Guidance:
Use setupapi. DLL to automatically install driver in Win2k and XP
See54. CNDRAlthough I have always used InstallShield in this article, I think this is also a good idea, so it is excerpted here.
Use setupapi. DLL to install driver
Applicable OS: Win2k, WINXP
Installshiled code:
Szprogram = "rundll32.exe ";
Szcmdline = "setupapi. dll, installhinfsection defaultinstall 132" + suppdir dir + "netsf. inf ";
Launchappandwait (szprogram, szw.line, wait );
Note:
1. defaultinstll refers to the installation section in the INF file and must be replaced with the install section name in the INF file. For example, if the section name is usbcamera. Dev, the code should be changed:
Szcmdline = "setupapi. dll, installhinfsection usbcamera. Dev 132" + supportdir + "netsf. inf ";
2. supportdir refers to the path where all driver files, such as INF and SYS, are located. You must copy all driver files to the hard disk first. For example, if your file is in C: yourdriver,
Supportdir should be replaced with "C: // yourdriver //" in the program ////". in the command doscommand environment, run the command to debug the program. This is easy to troubleshoot. Pay attention to the driver directory and spaces. You can also use rundll32.exe.
For Debugging commands, see:
Rundll32.exe setupapi. dll, installhinfsection modem2.nt 132 C: // yourdriver // netsf. inf
This article is transferred from
Http://www.52rd.com/Blog/Detail_RD.Blog_xjl20008_8591.html