Anyone with experience using the Setup API in C# ?

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi all,

Anybody w/ experience using this unmanaged API ?
I'm trying to figure out how to correctly enable/disable devices in C#.
This is to automate one of our manual tests in our lab.
I've been trying to give it a go but have been tripping all over myself.

Thanks,
MH
 
Hello, Michael!

M> Anybody w/ experience using this unmanaged API ?
M> I'm trying to figure out how to correctly enable/disable devices in C#.
M> This is to automate one of our manual tests in our lab.
M> I've been trying to give it a go but have been tripping all over myself.

What devices do you mean?

Devices usually are presented with drivers, drivers have names. AFAIK you cannot
disable (unload) driver from memory, however you can stop it.
As hint you can try "net stop [driverName]" this cmd uses SCM manager to do the job.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Hi Vadym,

You can enable/disable devices programmatically in C++ using Microsoft's
setupapi.dll and my ordeal has involved trying to consume this API in C#.

-MH
 
* Hello, Michael!
*
* M> You can enable/disable devices programmatically in C++ using
Microsoft's
* M> setupapi.dll and my ordeal has involved trying to consume this API in
* M> C#.
*
* This can be a good start to utilize Setup API in .NET
* ( http://www.codeproject.com/csharp/divingsysprog1.asp )
* --
* Regards, Vadym Stetsyak
* www: http://vadmyst.blogspot.com

Vadym,

Thanks for the link. I looked at that a bit. Some helpful stuff on
codeproject from its author.

I've managed to get to the point where I'm trying to match my C# signature
for
SetupDiGetDeviceInstanceId with its WINAPI counterpart. This has been a pain
so far !

-MH
 

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

Back
Top