?? 用is安裝驅動程序.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 + -