Technical Document #54

Technical Document #54        [Product Version: 5.2.2 and below]
Sample InstallShield procedure for installing the driver on a Windows machine

NOTE: In the following sample, "WinNT" relates to Windows NT 4.0, Windows 2000 and Windows XP; "Win98" relates to Windows 98, Windows 98 Second Edition and Windows Me; And "Win95" relates to Windows 95.

Sample InstallShield procedure —

  number nvResult, nMajor, nMinor;
  STRING svResult;
  BOOL  bWinNT;
  BOOL  bWin98;
  BOOL  bWin95;
  
  bWinNT = FALSE;
  bWin98 = FALSE;
  bWin95 = FALSE;

  GetSystemInfo(OS, nvResult, svResult);
  if (nvResult  = IS_WINDOWSNT) then
      bWinNT = TRUE;
  else
      if (nvResult = IS_WINDOWS95) then
          GetSystemInfo(OSMAJOR, nMajor, svResult);
          GetSystemInfo(OSMINOR, nMinor, svResult);
          if (((nMajor > 4) || ((nMajor = 4) && (nMinor > 0)))) then
             BWin98 = TRUE;
          else
             bWin95 = TRUE;
          endif;
      endif;
  endif;

  if ((bWinNT = TRUE) || (bWin98 = TRUE)) then
      if (bWinNT = TRUE) then
          TARGETDIR = WINSYSDIR^"drivers";
      else
          TARGETDIR = WINSYSDIR^"..\\system32\\drivers";
      endif;
    
      CompressGet(COMPRESSED_FILE, "windrvr.sys",COMP_NORMAL);
  
  endif;
 
  if (bWin95) then   
       TARGETDIR = WINSYSDIR^"vmm32";
       CompressGet(COMPRESSED_FILE, "windrvr.vxd",COMP_NORMAL);
  endif;

To load WinDriver's kernel and add it to the Registry:

For WinDriver version 5.2 and above:
  LaunchAppAndWait("wdreg_gui",
    "-inf <full path to wd_virtual.inf> reload", WAIT);
  LaunchAppAndWait("wdreg_gui",
    "-inf <full path to your INF file> loadinf", WAIT);


For example:
  LaunchAppAndWait("wdreg_gui",
    "-inf c:\tmp\wd_virtual.inf reload", WAIT);
  LaunchAppAndWait("wdreg_gui",
    "-inf %windir%\inf\my_device.inf loadinf", WAIT);


For WinDriver version 5.0.5b and below:
  LaunchAppAndWait("wdreg", "install", WAIT);

wdreg_gui.exe and wdreg.exe are found in the WinDriver\util directory.
In version 5.0.5b and earlier you can find the source code of the wdreg.exe utility in the WinDriver\samples\wdreg directory.

Note that wdreg install/wdreg_gui install adds WinDriver to the Registry, therefore WinDriver will be loaded on the next boot, and it also loads WinDriver immediately, so you can run your application without rebooting (except for *.sys drivers on Win98/Me).