DeviceType: DEVICE_TYPE // // The number of this device // DeviceNumber: DWORD // // If the device is partitionable, the partition number of the device. While oEnumDiskDrive.Next(1, objDiskDrive, iValue) = 0 doĭeviceID := StringReplace(VarStrNull(o bjDiskDriv e.DeviceID ),'\','\\' ,) //Escape the `\` chars in the DeviceID value because the '\' is a reserved character in WMI.ĬolPartitions := objWMIService.ExecQuery(Fo rmat('ASSO CIATORS OF uses SysUtils, Windows, JvSetupApi, PerlRegEx type DEVICE_TYPE = DWORD STORAGE_DEVICE_NUMBER = record // // The FILE_DEVICE_XXX type for this device. OEnumDiskDrive:= IUnknown(colDiskDrives._Ne wEnum) as IEnumVariant ObjWMIService := FSWbemLocator.ConnectServe r('.', 'root\CIMV2', '', '') ĬolDiskDrives := objWMIService.ExecQuery('S ELECT * FROM Win32_DiskDrive WHERE InterfaceType="USB"','WQL' ,0) see code below:įunction GetFlashDriveSerialNumber( const Drive:AnsiChar):string įSWbemLocator := CreateOleObject('WbemScrip ting.SWbem Locator') None of those solutions work for me and I have seen them a very long time ago.
0 Comments
Leave a Reply. |