需要实现USB驱动程序的自动打包安装。
我有驱动文件(包括sys和inf)文件,现在请教:
这种情况下如何制作驱动安装程序包:
1。如果采用安装制作工具的话(比如InstallShield,Wise,inno setup等)应该如何做,那位能够提供一些例子?
2。如果采用编程开发工具的话(比如VC等等),请问该如何做呢?或者还有什么其它的方法,多谢!!!

解决方案 »

  1.   

    如果采用安装制作工具的话(比如InstallShield,Wise,inno setup等)应该如何做,那位能够提供一些例子?
    可以参考驱动开发网,上面很多这中例子
    用InstallShield开发驱动安装程序的方法这是一个MP3 Player在win98下的驱动程序安装包的例子,开发工具是InstallShield6.2。 
    其功能是实现Driver的自动安装,原始文件是StMp3Rec.inf,StUms.inf,StMp3Rec.sys, 
    StUms.sys,StUmsPdr.pdr。供大家参考,以便快速掌握InstallShield开发98驱动安装程序的方法。              创建驱动程序包的步骤 
    一、用向导生成一个工程。 二、创建Files Groups 
    1、Inf Files 
    包含文件:StMp3Rec.inf, StUms.inf, 安装目录:\inf 2、Sys Files 
    包含文件:StMp3Rec.sys, StUms.sys, 安装目录:\System32\Drivers 3、Pdr Files 
    包含文件:StUms.pdr, 安装目录:\iosubsys 4、App Files 
    包含文件:无 三、创建Componets 
    1. Inf Files 2、Sys Files 3、Pdr Files 4、App Files 并指定它们和Files Groups的组件一一对应。 四、创建卸载菜单 
      新建Uninstall快捷方式,Target: \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 --- 如果采用编程开发工具的话(比如VC等等),请问该如何做呢?
    可以采用ddk开发包,使用里面一套安装api
    ,参考一个szdriverinstaller的程序,ds好象有带了最大问题莫过于自己的驱动没有经过ms签名,安装起来界面不友好