Given a drive letter, how do I get the OSImage InstallTo Partition ID and Disk ID without using the registry?
相关问题
- the application was unable to start correctly 0xc0
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- Handle button click in another application
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- Why windows 64 still makes use of user32.dll etc?
- CosmosDB emulator can't start since port is al
- How to print to stdout from Python script with .py
Have you tried simply calling
QueryDosDevice
?The
WMI
classWin32_DiskPartition
is what I need. Now to figure out how to useWMI
to get this information from a drive letter.Win32_LogicalDisk
is also useful, MSDN Example, and this stackoverflow answer.Update: Hmm, this doesn't work! Not in the Windows Installer anyway (WMI is missing from Windows PE!!) so I am using the other answer
QueryDosDevice
(e.g.\\.\PhysicalDisk1\Partition0
) and hacking it together. This sucks Microsoft, accept a damn path in your installer.Answer:
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
works to get theDisk ID
. And DeviceIoControlIOCTL_DISK_GET_PARTITION_INFO_EX
(thanks TLama) gets me thePartition ID
.