InstallShield6.2中安装inf文件


为可以实现安装.inf文件,可以在安装脚本中通过调用LaunchAppAndWait函数启动一个命令行方式实现:

Windows 9x
Rundll.exe setupx.dll,InstallHinfSection DefaultInstall 132 %1

Windows NT/2000
Rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 132 %1

%1 是 .inf 文件名

下面给出例子:
Windows 9x

szProgram = "rundll.exe";
szCmdLine = "setupx.dll,InstallHinfSection DefaultInstall 132 " + SUPPORTDIR + "test.inf";
LaunchAppAndWait(szProgram, szCmdLine, WAIT);


Windows NT / 2000

szProgram = "rundll32.exe";
szCmdLine = "setupapi.dll,InstallHinfSection DefaultInstall 132? + SUPPORTDIR + "test.inf";
LaunchAppAndWait(szProgram, szCmdLine, WAIT); 

 

Right-Click Install
To execute the DefaultInstall and DefaultInstall.Services sections of your INF file, you should do the following:

In Windows Explorer, right-click on the INF file name. A shortcut menu will appear.
Click Install.
Note The shortcut menu appears only if the INF file contains a DefaultInstall section.

Command-Line or Batch File Install
To execute the DefaultInstall and DefaultInstall.Services sections of your INF file on the command line or by using a batch file installation, type the following command at the command prompt, or create and run a batch file that contains this command:

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 C:/WINDOWS/INF/SHELL.INF


"Rundll32" and "InstallHinfSection" are described in the Tools and Setup and System Administration sections, respectively, of the Platform SDK documentation.

Setup Application
InstallHinfSection can also be called from a setup application, as shown in the following code example:

InstallHinfSection(NULL,NULL,TEXT("DefaultInstall 132 path-to-inf/infname.inf"),0);


If you use a setup application to install your driver, observe the following guidelines:

To prepare for eventual uninstall, the setup application should copy the driver INF file to an uninstall directory.
If the setup application installs a user-mode application with the driver, this application should be listed in Add or Remove Programs in Control Panel so that the user can uninstall it if desired. Only one item should be listed, representing both the application and the driver.
For more information about how to list your application in Add or Remove Programs, see "Removing an Application" in the Setup and System Administration section of the Platform SDK documentation.

Setup applications should never copy driver INF files to the Windows INF file directory (%windir%/INF). SetupAPI does copies these files automatically as part of the InstallHinfSection call.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值