.NET Framework - Installing a driver (.INF file) from code

Asked By MySelf on 13-Apr-11 09:05 AM
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.




Peter Duniho replied to MySelf on 13-Apr-11 10:19 AM
If you cannot get the install to work from the GUI, why do you expect it
to work from code?


Which is probably the same reason it does not work from the GUI.


It seems to me that your question really has nothing to do with C#.
Most likely, you need an answer from the manufacturer to explain how
they expect you to use the files they gave you to install the driver.
Once you know how the installation is supposed to work generally, then
you can work on how to accomplish it programmatically.

Pete
Peter Duniho replied to MySelf on 13-Apr-11 10:37 AM
(sorry if this is a duplicate???my newsgroup burped and it appears to me
that the first attempt to send failed)


If you cannot get the install to work from the GUI, why do you expect it
to work from code?


Which is probably the same reason it does not work from the GUI.


It seems to me that your question really has nothing to do with C#. Most
likely, you need an answer from the manufacturer to explain how they
expect you to use the files they gave you to install the driver. Once
you know how the installation is supposed to work generally, then you
can work on how to accomplish it programmatically.

Pete
MySelf replied to Peter Duniho on 13-Apr-11 11:22 AM
Peter Duniho avait pr?tendu :


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.