Driver Problems? Questions? Issues?
Put OSR's experience to work for you! Contact us for assistance with:
  • Creating the right design for your requirements
  • Reviewing your existing driver code
  • Analyzing driver reliability/performance issues
  • Custom training mixed with consulting and focused directly on your specific areas of interest/concern.
Check us out. OSR, the Windows driver experts.

Monthly Seminars at OSR Headquarters

East Coast USA
Windows Internals and SW Drivers, Dulles (Sterling) VA, 13 November 2017

Kernel Debugging & Crash Analysis for Windows, Nashua (Amherst) NH, 4 December 2017

Writing WDF Drivers I: Core Concepts, Nashua (Amherst) NH, 8 January 2018

WDF Drivers II: Advanced Implementation Techniques, Nashua (Amherst) NH, 15 January 2018


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 4  
27 Dec 17 10:52
Deepak Mahale
xxxxxx@gmail.com
Join Date: 23 Dec 2015
Posts To This List: 11
Enumerating disks attached to the system

Hi Guys, I'am currently writing a kernel mode driver and i need to enumerate the disks attached to the system (eg : I have 2 physical disks attached to my system \\.\\PhysicalDrive1 and \\.\\PhysicalDrive2). Is there some way in which i could get this information? I have tried using the IOGetDeviceInterface API with DISK GUID, but it give me symbolic link such as \\??\\SCSI... which when checked in Winobj maps to \Device\00..21.
  Message 2 of 4  
27 Dec 17 11:53
Doron Holan
xxxxxx@microsoft.com
Join Date: 08 Sep 2005
Posts To This List: 10129
Enumerating disks attached to the system

Device interface enumeration is the way to go. What underlying device objects do the \\.\phsyicaldriveX symbolic links point to? Remember that there can be many symbolic link names to the same underlying device object name, so both a device interface (which is a symbolic link) and legacy symbolic link name can point to the same device. Bent from my phone ________________________________ From: xxxxx@lists.osr.com <xxxxx@lists.osr.com> on behalf of xxxxx@gmail.com <xxxxx@lists.osr.com> Sent: Wednesday, December 27, 2017 7:52:17 AM To: Windows System Software Devs Interest List Subject: [ntdev] Enumerating disks attached to the system Hi Guys, I'am currently writing a kernel mode driver and i need to enumerate the disks attached to the system (eg : I have 2 physical disks attached to my system \\.\\PhysicalDrive1 and \\.\\PhysicalDrive2). Is there some way in which i could get this information? I have tried using the IOGetDeviceInterface API with DISK GUID, but it give me symbolic link such as \\??\\SCSI... which when checked in Winobj maps to \Device\00..21. --- NTDEV is sponsored by OSR Visit the list online at: <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osronline.co m%2Fshowlists.cfm%3Flist%3Dntdev&data=02%7C01%7CDoron.Holan%40microsoft.com%7Ccc3 fa385b9bc439b2b9708d54d41c62c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636499 867445187570&sdata=KTp9sb58C3fYY%2BMnknSEC%2FETAxLrHxhSNVcjocdYQ6w%3D&reserved=0> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osr.com%2Fse minars&data=02%7C01%7CDoron.Holan%40microsoft.com%7Ccc3fa385b9bc439b2b9708d54d41c 62c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636499867445187570&sdata=qxvzGlf HAVSogVQX5VFMo0YWcc09yP%2BovoHSbjxsktE%3D&reserved=0> To unsubscribe, visit the List Server section of OSR Online at <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osronline.co m%2Fpage.cfm%3Fname%3DListServer&data=02%7C01%7CDoron.Holan%40microsoft.com%7Ccc3 fa385b9bc439b2b9708d54d41c62c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636499 867445187570&sdata=aEnkz3r2iedgskry804ySlrpdzCSkyvu7EA9kM5SjZo%3D&reserved=0> --
  Message 3 of 4  
27 Dec 17 23:41
Deepak Mahale
xxxxxx@gmail.com
Join Date: 23 Dec 2015
Posts To This List: 11
Enumerating disks attached to the system

Hi Doron, "What underlying device objects do the \\.\phsyicaldriveX symbolic links point to?" PhysicalDrive0 points to \Device\Harddisk0\DR0 PhysicalDrive1 points to \Device\Harddisk1\DR1 I'am using IOGetDeviceInterface as follows ntStatus = IoGetDeviceInterfaces(&GUID_DEVINTERFACE_DISK, NULL, 0, &SymbolicLinkList ); It returns me following Symbolic Links SCSI#Disk&Ven_VBOX&Prod_HARDDISK#4&... points to \Device\00000021 SCSI#Disk&Ven_VBOX&Prod_HARDDISK#4&... points to \Device\00000022
  Message 4 of 4  
28 Dec 17 12:31
Mark Roddy
xxxxxx@gmail.com
Join Date: 25 Feb 2000
Posts To This List: 4048
Enumerating disks attached to the system

The SCSI name is for the disk device pdo. See the routines DiskGenerateDeviceName <https://github.com/Microsoft/Windows-driver-samples/blob/aa6e0b36eb932099fa4eb95 0a6f5e289a23b6d6e/storage/class/disk/src/pnp.c>and DiskCreateFdo <https://github.com/Microsoft/Windows-driver-samples/blob/master/storage/class/di sk/src/disk.c> on github for how this works. The FDO created by the disk class driver is attached to the scsi pdo device. and has a name like \Device\Harddisk0\DR0. Note that pre-pnp style (NT4 or earlier) enumeration of disk devices still works :-) Mark Roddy On Wed, Dec 27, 2017 at 11:40 PM, xxxxx@gmail.com <xxxxx@lists.osr.com> wrote: > Hi Doron, > > "What underlying device objects do > the \\.\phsyicaldriveX symbolic links point to?" > > PhysicalDrive0 points to \Device\Harddisk0\DR0 > PhysicalDrive1 points to \Device\Harddisk1\DR1 > > I'am using IOGetDeviceInterface as follows > <...excess quoted lines suppressed...> --
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 11:41.


Copyright ©2015, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license