DECLARE INTEGER SetupDiEnumDeviceInterfaces IN setupapi; INTEGER DeviceInfoSet,; STRING @ DeviceInfoData,; STRING @ ByRefterfaceClassGuid,; INTEGER MemberIndex,; STRING @ DeviceInterfaceDataand the parameters are:
*--The GUID_DEVCLASS_DISKDRIVE is correct it works with other setupapi calls #Define GUID_DEVCLASS_DISKDRIVE ; Chr(0x67) + Chr(0xE9) + Chr(0x36) + Chr(0x4D) + ; Chr(0x25) + Chr(0xE3) + ; Chr(0xCE) + Chr(0x11) + ; Chr(0xBF) + Chr(0xC1) + Chr(0x08) + Chr(0x00) + Chr(0x2B) + Chr(0xE1) + Chr(0x03) + Chr(0x18) m.lcClassGuid = GUID_DEVCLASS_DISKDRIVE *--The below value is correct - it is returned from SetupDiGetClassDevs m.lnDeviceInfoSet = 432974329 && this value actually returned from SetupDiGetClassDevs and is valid *--The below should be correct - it works with SetupDiEnumDeviceInfo and returns correctly m.lcDeviceInfoData = Padr(BinToC(28, [4RS]), 4, Chr(0)) + Replicate(Chr(0), 24) *--Start with 1st device - I know it works too using SetupDiEnumDeviceInfo m.lnx = 0 *--Given the the definition I included above for SP_DEVICE_INTERFACE_DATA below should be ok m.lcDeviceInterfaceData = long2str(32)+Replicate(CHR(0),28) *--Assuming the line above may be wrong, I also tried: *m.lcDeviceInterfaceData = CHR(32)+CHR(0)+CHR(0)+CHR(0) &&dword only *--to no avail as well as: *m.lcDeviceInterfaceData = num2dword(32)+num2dword(0)+num2dword(0)+; *num2dword(0)+num2dword(0)However the below code returns data type mismatch:
IF SetupDiEnumDeviceInterfaces( ;
m.lnDeviceInfoSet, ;
@m.lcDeviceInfoData, ;
@m.lcClassGuid, ;
m.lnx,;
@m.lcDeviceInterfaceData)
Any ideas anyone?************************************************************* FUNCTION long2str ************************************************************* * passed : 32-bit non-negative numeric value (m.longval) * returns : ascii character representation of passed * value in low-high format (m.retstr) * example : * m.long = 999999 * m.longstr = long2str(m.long) PARAMETERS m.longval PRIVATE i, m.retstr m.retstr = "" FOR i = 24 TO 0 STEP -8 m.retstr = CHR(INT(m.longval/(2^i))) + m.retstr m.longval = MOD(m.longval, (2^i)) NEXT RETURN m.retstr ************************************************************* FUNCTION str2long ************************************************************* * passed: 4-byte character string (m.longstr) in low-high ASCII format * returns: long integer value * example: * m.longstr = "1111" * m.longval = str2long(m.longstr) PARAMETERS m.longstr PRIVATE i, m.retval m.retval = 0 FOR i = 0 TO 24 STEP 8 m.retval = m.retval + (ASC(m.longstr) * (2^i)) m.longstr = RIGHT(m.longstr, LEN(m.longstr) - 1) NEXT RETURN m.retval ************************************************************* FUNCTION num2dword (lnValue) ************************************************************* #DEFINE m0 256 #DEFINE m1 65536 #DEFINE m2 16777216 LOCAL b0, b1, b2, b3 b3 = Int(lnValue/m2) b2 = Int((lnValue - b3 * m2)/m1) b1 = Int((lnValue - b3*m2 - b2*m1)/m0) b0 = Mod(lnValue, m0) RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3) ************************************************************* FUNCTION num2word (lnValue) ************************************************************* RETURN Chr(Mod(m.lnValue,256)) + Chr(Int(m.lnValue/256))