#1
|
|||
|
|||
A drive letter is related to which physical disk?!
Hi all ,
I'm really interested if there's a way to find out that a specific drive letter is related to which physical disk? ( in XP and 98 ) . however in XP I found an IOCTL code ( IOCTL_DISK_GET_DRIVE_LETTERS ) , but it has not been even defined in windows! and i can't to compile my application! Any idea? Is there any way ? ( for example from kernel mode ). Tnx, Just4uriM |
#2
|
|||
|
|||
mountmgr.....
|
#3
|
|||
|
|||
you dont need r0 to get all these information
simply start wmic in cmd.exe and get all the information you need Code:
wmic:root\cli>path Win32_DiskPartition get Deviceid DeviceID Disk #0, Partition #0 Disk #0, Partition #1 Disk #0, Partition #2 Disk #2, Partition #0 wmic:root\cli>path Win32_logicaldisk get Deviceid DeviceID A: C: D: E: G: wmic:root\cli>path Win32_diskdrive get Deviceid DeviceID \\.\PHYSICALDRIVE0 \\.\PHYSICALDRIVE2 wmic:root\cli> Code:
path Win32_DiskPartition assoc or script oldstyle Code:
ComputerName = "." Set wmiServices = GetObject ( _ "winmgmts:{impersonationLevel=Impersonate}!//" _ & ComputerName) ' Get physical disk drive Set wmiDiskDrives = wmiServices.ExecQuery ( _ "SELECT Caption, DeviceID FROM Win32_DiskDrive") For Each wmiDiskDrive In wmiDiskDrives WScript.Echo "Disk drive Caption: " _ & wmiDiskDrive.Caption _ & VbNewLine & "DeviceID: " _ & " (" & wmiDiskDrive.DeviceID & ")" 'Use the disk drive device id to ' find associated partition query = "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" _ & wmiDiskDrive.DeviceID & "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition" Set wmiDiskPartitions = wmiServices.ExecQuery(query) For Each wmiDiskPartition In wmiDiskPartitions 'Use partition device id to find logical disk Set wmiLogicalDisks = wmiServices.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" _ & wmiDiskPartition.DeviceID & "'} WHERE AssocClass = Win32_LogicalDiskToPartition") For Each wmiLogicalDisk In wmiLogicalDisks WScript.Echo "Drive letter associated" _ & " with disk drive = " _ & wmiDiskDrive.Caption _ & wmiDiskDrive.DeviceID _ & VbNewLine & " Partition = " _ & wmiDiskPartition.DeviceID _ & VbNewLine & " is " _ & wmiLogicalDisk.DeviceID Next Next Next output as follows for above script wmic:/>cscript foo.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Disk drive Caption: ************ DeviceID: (\\.\PHYSICALDRIVE0) Drive letter associated with disk drive = ***********\\.\PHYSICALDRIVE0 Partition = Disk #0, Partition #0 is C: Drive letter associated with disk drive = **********\\.\PHYSICALDRIVE0 Partition = Disk #0, Partition #1 is E: Drive letter associated with disk drive = **********\\.\PHYSICALDRIVE0 Partition = Disk #0, Partition #2 is D: Disk drive Caption: *********** USB Device DeviceID: (\\.\PHYSICALDRIVE2) Drive letter associated with disk drive = *********** USB Device\\.\PHYSI CALDRIVE2 Partition = Disk #2, Partition #0 is G: wmic:/> http://msdn2.microsoft.com/en-us/library/aa394592.aspx Quote:
Last edited by JuneMouse; 10-25-2007 at 01:19. |
#4
|
|||
|
|||
Thanks for your guidance,
Quote:
Regards, Just4UriM |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating boot WinPE ISO from USB drive with min. disk space+factory reset prtn. info | chants | General Discussion | 2 | 02-29-2020 21:49 |
About cracking related IRC channels | Hero | General Discussion | 1 | 07-11-2005 04:32 |