SetupDiGetDriverInfoDetail fails whatever i do,...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

i am working mainly in C# the last projects. Well, i faced
a Situation, i am not really able to solve myself. I want to
translate the devcon's "devcon driverfiles" command to
a C# function that returns a array of strings, holding all
the driverfiles. Well, just fir the record, what i am doing.

The point is, that SetupDiGetDriverInfoDetail fails whatever
i do with 1784. All calls before return true and are verified
before they will be used. Calls are (Top to Bottom):

SetupDiGetDeviceInstallParams
SetupDiBuildDriverInfoList
SetupDiEnumDriverInfo
SetupDiGetDriverInfoDetail<-Fails!

I first call SetupDiGetDriverInfoDetail to get the memory size
i need, it returns 122 as expected and fails with false, then i call
it again with allocated memory of size-n it needed, and even then
it fails with return false and 1784 or sometimes even with Zero
for GetLastError but returns false. I am not really sure what i should
understand from that results and Error Codes, since the second call
fails with strange results. I dumped the Buffers content to a file and
view it with a hexeditor, it is filled with zeros (i zeroed the buffer
before and placed its size in the beginning).

Since i allocate raw memory, and the structure is sequential in its
layout and the functions expects the memory size in the first
part of the structure, i do write the required buffers size to the
allocated buffers first 4-bytes (DWORD) and it still fails,...

Do i have to take care about something with SetupDiGetDriverInfoDetail?
This is really strange, because a second call returns false, but GetLastError
says Zero (0), so whats the Problem here. I cant enclose all that stuff
inside a external dll and pinvoke it. I have to do all from C# vie Pinvoke
directly over the .NET Marshalling Layer to the setupapi.dll.

Any Ideas why i fails.? All Data aquired before is just fine and valid. This
is really strange to me,...


Regards

Kerem

--
--
----------------------- Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
----------------------- "This reply is provided as is, without warranty express or implied."

.



Relevant Pages

  • Re: SetupDiGetDriverInfoDetail fails whatever i do,...
    ... The point is, that SetupDiGetDriverInfoDetail fails whatever ... I first call SetupDiGetDriverInfoDetail to get the memory size ... i do write the required buffers size to the ...
    (microsoft.public.development.device.drivers)
  • Re: SetupDiGetDriverInfoDetail fails whatever i do,...
    ... Beste Grüsse / Best regards / Votre bien devoue ... The point is, that SetupDiGetDriverInfoDetail fails whatever ... I first call SetupDiGetDriverInfoDetail to get the memory size ... i do write the required buffers size to the ...
    (microsoft.public.development.device.drivers)
  • Re: SetupDiGetDriverInfoDetail fails whatever i do,...
    ... Both setupapi and PInvoke are known to work well, ... The point is, that SetupDiGetDriverInfoDetail fails whatever ... I first call SetupDiGetDriverInfoDetail to get the memory size ... i do write the required buffers size to the ...
    (microsoft.public.development.device.drivers)