Help with using Win32 API setupapi.dll in C#

M

Michael

Hi all,

I'm trying to figure out how to use setupapi.dll in C#, specifically the
SetupDiCallClassInstaller function.
I'm trying to develop a test suite which tests drivers and part of this
suite is checking whether devices can be successfully disabled and enabled.
I haven't found anything to support this in the .NET framework yet and seem
to be stuck interopping this Win32 API stuff.

Anybody w/ experience or know-how (C# source code examples) on how to
consume this part of the API?

Thanks,
-MH
 
M

Michael

Adam,

Yes, I stopped by there the other day. It was a little helpful but of
limited use :(.

-MH
 
M

Michael

* Hi all,
*
* I'm trying to figure out how to use setupapi.dll in C#, specifically the
* SetupDiCallClassInstaller function.
* I'm trying to develop a test suite which tests drivers and part of this
* suite is checking whether devices can be successfully disabled and
enabled.
* I haven't found anything to support this in the .NET framework yet and
seem
* to be stuck interopping this Win32 API stuff.
*
* Anybody w/ experience or know-how (C# source code examples) on how to
* consume this part of the API?
*
* Thanks,
* -MH
*
*

Also,

Does anybody know the proper way to populate the arguments that are passed
to the function call "SetupDiCallClassInstaller" ?

Where do I get the IntPtr for the second parameter and the SP_DEVINFO_DATA
info for the third?






WINSETUPAPI BOOL WINAPI
SetupDiCallClassInstaller(
IN DI_FUNCTION InstallFunction,
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
);

Parameters
InstallFunction - Specifies the device installation request (DIF request) to
pass to the co-installers and class installer. DIF codes have the format
DIF_XXX and are defined in setupapi.h. See Device Installation Function
Codes for more information. Note that for certain DIF requests, the caller
must be a member of the Administrators group. For such DIF requests, this
requirement is listed on the reference page
for the associated default handler.

DeviceInfoSet - Supplies a handle to a device information set for the local
machine.

DeviceInfoData - Supplies a pointer to an SP_DEVINFO_DATA structure that
specifies a device in the DeviceInfoSet. If DeviceInfoData is NULL, this
function calls the installers for the setup class associated with the device
information set.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top