⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 用is安装驱动程序.txt

📁 驱动开发过程中要注意的一些要点以及一些基本资料
💻 TXT
字号:
创建驱动程序包的步骤
一、用向导生成一个工程。

二、创建Files Groups
1、Inf Files
包含文件:StMp3Rec.inf, StUms.inf, 安装目录:<WINDIR>inf

2、Sys Files
包含文件:StMp3Rec.sys, StUms.sys, 安装目录:<WINDIR>System32Drivers

3、Pdr Files
包含文件:StUms.pdr, 安装目录:<WINSYSDIR>iosubsys

4、App Files
包含文件:无 

三、创建Componets
1. Inf Files 2、Sys Files 3、Pdr Files 4、App Files 并指定它们和Files Groups的组件一一对应。

四、创建卸载菜单
  新建Uninstall快捷方式,Target: <DISK1TARGET>setup.exe 
Install Conditions: App Files
五、写InstallScrip代码


////////////////////////////////////////////////////////////////////////////////
// 
// File Name: Setup.rul 
// 
// Description: InstallShield script 
// 
// Comments: This script was generated based on the selections you made in
// the Project Wizard. Refer to the help topic entitled "Modify 
// the script that the Project Wizard generates" for information
// on possible next steps.
//
////////////////////////////////////////////////////////////////////////////////


// Include header files

#include "ifx.h"

////////////////////// string defines ////////////////////////////

//////////////////// installation declarations ///////////////////

// ----- DLL function prototypes -----


// your DLL function prototypes


// ---- script function prototypes -----


// your script function prototypes

// your global variables

//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnBegin
//
// EVENT: Begin event is always sent as the first event during installation.
//
//////////////////////////////////////////////////////////////////////////////
function OnBegin()
begin
if (!(SYSINFO.WIN9X.bWin98)) then 
MessageBox("The installation only for Windows 98.",INFORMATION);
abort;
endif; 
//delete device infomation
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBDeleteKey("Enum\USB\VID_066F&PID_8000");
end;

//////////////////////////////////////////////////////////////////////////////
// 
// FUNCTION: OnFirstUIBefore 
// 
// EVENT: FirstUIBefore event is sent when installation is run for the first
// time on given machine. In the handler installation usually displays
// UI allowing end user to specify installation parameters. After this
// function returns, ComponentTransferData is called to perform file
// transfer.
// 
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()
number nResult,nSetupType;
string szTitle, szMsg;
LIST listStartCopy;
begin 
// TO DO: if you want to enable background, window title, and caption bar title 
// SetTitle( @TITLE_MAIN, 24, WHITE ); 
// SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); 
// Enable( FULLWINDOWMODE ); 
// Enable( BACKGROUND ); 
// SetColor(BACKGROUND,RGB (0, 128, 128)); 

TARGETDIR = PROGRAMFILES ^@COMPANY_NAME ^@PRODUCT_NAME; 

Dlg_Start:
// beginning of dialogs label

Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;

// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);

return 0;
end;

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnFirstUIAfter
//
// EVENT: FirstUIAfter event is sent after file transfer, when installation 
// is run for the first time on given machine. In this event handler 
// installation usually displays UI that will inform end user that
// installation has been completed successfully.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2;
NUMBER nReserved;
begin
Disable(STATUSEX);

ShowObjWizardPages(NEXT);

szMsg1 = SdLoadString(IFX_SDFINISH_MSG1); 
nReserved = 0; 
SdFinishReboot(szTitle, szMsg1, SYS_BOOTMACHINE,szMsg2,nReserved);
end; 
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMoving
//
// EVENT: Moving event is sent when file transfer is started as a result of
// ComponentTransferData call, before any file transfer operations 
// are performed.
//
///////////////////////////////////////////////////////////////////////////////
function OnMoving()
string szAppPath;
begin
// Set LOGO Compliance Application Path 
// TO DO : if your application .exe is in a subfolder of TARGETDIR then add subfolder 
szAppPath = TARGETDIR;
RegDBSetItem(REGDB_APPPATH, szAppPath);
RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);
end;

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMaintUIAfter
//
// EVENT: MaintUIAfter event is sent after file transfer, when end user runs 
// installation that has already been installed on the machine. Usually 
// this happens through Add/Remove Programs applet. 
// In the handler installation usually displays UI that will inform 
// end user that maintenance/uninstallation has been completed successfully.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIAfter()
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
begin
Disable(STATUSEX);
ShowObjWizardPages(NEXT); 

//Delete device information
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBDeleteKey("Enum\USB\VID_066F&PID_8000");

bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
end;
// --- include script file section ---
To xuquanyong:
如果你是Win2000,WinXP那么还要增加以下处理,内容是以前的一张贴子,在此引用。

首先说一下我的资源何我的目标:
我有两个文件,scap.sys和scap.inf,我的环境是InstallShield Developer 8 ,我希望最终可以制作出一个安装包,执行后可以自己实现驱动的安装。安装的平台为Windows 2000 或windows XP

下面是我找到的资料列出来:
1)这是InstallShield的官方网站上的一遍文档:

HOWTO: Launching an .inf File Via InstallScript 文档ID: Q102851

如何通过安装脚本来实现.inf的安装

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

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

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

where %1 is the .inf filename.

下面给出例子:
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);

文档内容我只保留需要的,如果需要详细的资料请根据文档ID到InstallShield上阅读。

2)还是一个例子,是InstallShield里一个老外问的
Q:How can i call an INF file during installation through installshield.
I need to do this inorder to install some PDF printers.

A:
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);

SUPPORTDIR is were your inf will be located.


3)网上的大虾都说在安装程序之外写一个执行安装功能的小程序,可以在DDKsrcsetup……找得到,我去看了,同时我也在MSDN上找到了一个文章,就是介绍这个小程序的的
http://support.microsoft.com/default.aspx?scid=http://support.microsoft..com:80/support/kb/articles/q311/2/72.asp&NoWebContent=1
有兴趣自己去看看,我就不罗嗦啦,我把这个程序Devcon下载了下来。


现在我手上有的资料可以使我有两种安装方式,一个是通过InstallShield在安装过程中通过脚本来调用Devcon来实现安装;还有一个是通过在脚本中调用rundll32来实现安装。

顺遍提一下,关于INF文件安装需要调用的函数说明,具体说明请参看Microsoft的MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/setupapi/setup/installing_from_an_inf_file.asp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -