I'm in windows XP and Delphi
SetupDiGetDeviceInterfaceDetail is called twice
The first time it gives GetLastError = ERROR_INSUFFICIENT_BUFFER
and a string size 78 I beleave thats good as the DevData.guid is correct in the trace at this point
I make a memory block and size it correctly for DevIntfDetailData
call SetupDiGetDeviceInterfaceDetail a second Time
Error
Getlasterror = 1768
I've checked my structures through and through
I donot get my DevIntfDetailData.PathName
TSPDeviceInterfaceDetailData = record
Size: DWord;
DevicePath: Array [0..65535] of AnsiChar;
end;
TSPDevInfoData = packed record
Size: DWORD;
ClassGuid: TGUID;
DevInst: DWORD; // DEVINST handle
Reserved: DWord;
end;
PSPDevInfoData = ^TSPDevInfoData;
The rest are pointers or DWords
everything I've done in Ansi
PnPHandle := SetupDiGetClassDevsA(@FHidGuid, nil, 0,
DIGCF_PRESENT or DIGCF_DEVICEINTERFACE);
if PnPHandle = HDEVINFO(INVALID_HANDLE_VALUE) then
Exit;
DevNo := 0;
repeat
DevData.Size := SizeOf(TSPDevInfoData);
// Is there a HID device at this table entry?
Success := SetupDiEnumDeviceInterfaces(PnPHandle, nil, FHidGuid, DevNo, DevData);
if Success then
begin
DevData.Size := SizeOf(DevData);
BytesReturned := 0;
secondsuccess := SetupDiGetDeviceInterfaceDetail(PnPHandle, DevData, nil, 0,
BytesReturned, nil);
if (BytesReturned <> 0) and (GetLastError = ERROR_INSUFFICIENT_BUFFER) then
begin // good to this point I beleave
DevIntfDetailData := AllocMem(BytesReturned + 12);
DevIntfDetailData^.Size := sizeof(TSPDeviceInterfaceDetailData);
secondsuccess := SetupDiGetDeviceInterfaceDetail(PnPHandle, DevData,
DevIntfDetailData, BytesReturned, BytesReturned, nil) ;
Dose any one have an idea
I'm thinking to make c++ borland HID file as a *.DCU file and run it on pascal
becuse i've gone over this so often and still get the error.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment