Installing a driver (.INF file) from code

M

MySelf

Hello,

I need to install a driver for a smart card reader directly from the C#
code of my application, but all I got from the manufacturer of the
reader is a driver made of two files : a .INF file and a .CAT file.

I tried to install the driver by right-clicking on the .INF file, but I
got a message error saying that this .INF file does not support this
way of installing.

On the web, I found this command line :

C:\WINDOWS\System32\rundll32.exe setupapi,InstallHinfSection
DefaultInstall 132 yourfile.inf

but when trying it, I got a message saying that InstallInfSection was
not provided.

So my question is How can I install such a .INF file from C# code,
without asking the user for an action ?

Thank you for your help.
 
M

MySelf

Peter Duniho avait prétendu :
If you can't get the install to work from the GUI, why do you expect it to
work from code?

The error message said "INF file does not support THIS way of
installing". I supposed there it exist were some other ways to install
this kind of files.
 
N

NumbLock

Hello MySelf,
It sounds like you are trying to install just an INF. The right-click INF
install feature only works for windows features, not devices. Since you
only have the INF, there is no GUI setup to fail. A Device Driver INF is
installed through Device Manager. You need to find a way to interact with
device manager from code. Probably a rundll command or something. Here
is a link to an article about what you are trying to do. It is not specific
to C#.

http://www.techtalkz.com/microsoft-device-drivers/245175-installing-driver-using-rundll32.html

Best of luck.
 
M

MySelf

NumbLock vient de nous annoncer :
Hello MySelf,
It sounds like you are trying to install just an INF. The right-click INF
install feature only works for windows features, not devices. Since you only
have the INF, there is no GUI setup to fail. A Device Driver INF is
installed through Device Manager. You need to find a way to interact with
device manager from code. Probably a rundll command or something. Here is a
link to an article about what you are trying to do. It is not specific to
C#.

http://www.techtalkz.com/microsoft-device-drivers/245175-installing-driver-using-rundll32.html

Best of luck.


Thank you for your help. In fact, I already tried to use RunDLL as said
in my previous post, but with no success.

We finally found a way to solve the problem by using a DPInst.exe
program available from Microsoft, that was able to install the driver.

I agree it is not a C# specific problem, sorry for posting in the wrong
channel.
 
N

NumbLock

Hello MySelf,
No Prob. I wasn't complaining I was just noting that the link I referred
you to was not C# specific...
 

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