=====================================================================
    INSTALLATION OF THE CRYPTO-BOX DEVICE DRIVERS FOR WINDOWS NT
 doc: inst4NT.txt 
date: Apr 17, 1996
      MJ July 18, 1996 register.bat replaces marxinst.bat
=====================================================================
This file contains the following chapters:
-> The evaluation kit contains the following files.
-> Installation of WINDOWS NT DEVICE DRIVER for CRYPTO-BOX 560 / VERSA
-> Driver installation via batch-file
-> Driver installation via your own setup program
-> Delivering the protected software to your customers
-> Removing the device drivers

-----------------------------------------------------------
-> The evaluation kit contains the following files.
-----------------------------------------------------------

Filename:		Description:
---------		------------
cbndll.dll		Contains 32-bit CRYPTO-BOX functions
cbn560win.dll           Contains 16-bit CRYPTO-BOX functions
cbnvdd.dll              Virtual device driver to run 16 bit application on NT
register.bat		CRYPTO-BOX-Registration via regini and ini-script
regini.exe              Registration utility (runs under Win-NT only)
marxdev#.ini            Script-file for regini to initialize a driver
marxdev1.sys		CRYPTO-BOX driver for port LPT1
marxdev2.sys		CRYPTO-BOX driver for port LPT2
marxdev3.sys		CRYPTO-BOX driver for port LPT3
   Why three drivers?
   ------------------
   Under the philosophy of Windows NT, the drivers should occupy the
   minimum system resources. For example, in one system there can be 3
   parallel ports, but not neccessarily three CRYPTO BOXES. The 
   "three driver approach" will provide maximum control over finding
   the BEST possible configuration which is suitable to your individual needs.
   There is no harm in keeping all three drivers active. No loss
   of performance will occur and printing can be done as usual.

---------------------------------------------------------------------
-> Installation of WINDOWS NT DEVICE DRIVER for CRYPTO-BOX 560 / VERSA
---------------------------------------------------------------------
For software on a Windows NT 3.x platform you have to copy and register
at least one of the CRYPTO-BOX device drivers MARXDEV1.SYS, MARXDEV2.SYS
or MARXDEV3.SYS. These drivers are essential for the communication
between your protected software and a CRYPTO-BOX attached to the parallel
printer port (LPT1, LPT2 or LPT3) of your computer system. After this 
registration process you can do CRYPTO-BOX function calls via a 16-bit or
32-bit DLL which contains all the security functions described in the
CRYPTO-BOX user's guide. There are two basic ways to register devices 
like the CRYPTO-BOX under Windows NT. 

  The first and easiest way is to use the utility "regini.exe" which is 
deliverd with the Microsoft SDK. You can run this registration and 
initialisation utility from a batch file like "register.bat" which is
provided in our evaluation kit. The batch file will execute all actions
needed to make the CRYPTO-BOX available under Windows NT. However, this is
not always the most elegant way to install the CRYPTO-BOX drivers. 

  The second, more elegant way is to use the installation and registration
functions of Windows-NT directly without passing by "regini.exe". Then you
can include the whole process in your own setup program. We provide basic 
instructions to show you how to do this quite complex task. For your customers,
however, this is a more transparent way to do the registration of a 
CRYPTO-BOX key. For further information refer to the Microsoft Windows NT SDK. 

    ************************** REMARK: *****************************
    * All CRYPTO-BOX drivers are KERNEL device drivers. To install *
    * kernel drivers (drivers which access hardware), you MUST be  *
    * logged on as a member of the ADMINISTRATOR group.            *
    ****************************************************************

-----------------------------------------------------------
-> Driver installation via batch-file
-----------------------------------------------------------

 First open an NT console (DOS-WINDOW under Windows NT)
 Change to the subdirectory \WIN-API\WIN-NT
 Then type "register [number of device]" to install the driver 
 on your system. 
 [number of device] = a for all drivers (recommended)
 [number of device] = 1 for marxdev1.sys
 [number of device] = 2 for marxdev2.sys
 [number of device] = 3 for marxdev3.sys

 After Windows NT is restarted, open the CONTROL PANEL from the MAIN
 window. Choose devices. A window comes up, listing all the devices
 available in WINDOWS NT. Find MARXDEV1, MARXDEV2 or MARXDEV3 in 
 the list (pressing the letter 'M' will take you there fast).

 The following setting should be present:
 --------------------------------------
 MarxDev1        Started         Automatic
 MarxDev2        Started         Automatic
 MarxDev3        Started         Automatic

 This confirms the device drivers are installed and activated.


The batch file "register.bat" has three basic tasks:
  1. Copy the device drivers to the Windows NT device directory.
     The line in the batch file is :
        copy marxdev%1.sys %SYSTEMROOT%\system32\drivers\marxdev%1.sys

  2. Register the CRYPTO-BOX key in the Windows NT registry.
     The line in the batch file is: 
        regini marxdev%1.ini
     ----------------------------------------------------------------
     Example:
     The following script is executed by "regini.exe marxdev1.ini":
       
     \Registry\Machine\System\CurrentControlSet\Services\MarxDev1
     Type = REG_DWORD 0x00000001
     Start = REG_DWORD 0x00000002
     Group = Extended Base
     ErrorControl = REG_DWORD 0x00000001
     Parameters
          IoPortAddress = REG_DWORD 0x000003bc
          IoPortCount = REG_DWORD 0x00000004 
     ----------------------------------------------------------------
     Explanation of the script which is executed by regini.exe:
  
     The CRYPTO-BOX device is registered under:
       \Registry\Machine\System\CurrentControlSet\Services\MarxDev1
  
     Values that are set to the registry:
       Type = REG_DWORD 0x00000001             
       Start = REG_DWORD 0x00000002
       Group = Extended Base                   // extended base device
       ErrorControl = REG_DWORD 0x00000001          
  
     Values that are device specific:
       Parameters
          IoPortAddress = REG_DWORD 0x000003bc        // resources used
          IoPortCount = REG_DWORD 0x00000004          // this many ports
  
       For marxdev2 these values would be:
       Parameters
          IoPortAddress = REG_DWORD 0x00000387         // resources used
          IoPortCount = REG_DWORD 0x00000004           // this many ports
       For marxdev3 these values would be:
       Parameters
          IoPortAddress = REG_DWORD 0x00000278         // resources used
          IoPortCount = REG_DWORD 0x00000004           // this many ports
     ----------------------------------------------------------------

  3. Prompt for the restart of Windows NT.
     The line in the batch file is: 
        echo To activate the CRYPTO-BOX, restart Windows NT 




-------------------------------------------------
-> Driver installation via your own setup program
-------------------------------------------------
Basically, the setup program must do the same job as the above described
batch file "register.bat". Since we cannot anticipate the exact nature of
your application and installation, only brief guidelines can be given to
assist developing  your own setup program.
  The above described steps 1 and 3 should not be a problem. The most
challanging part is to register new entries in the NT registry which is 
in step 2 above. The procedure must do the same job as "regini.exe" does 
together with the script file "marxdev#.ini". The Microsoft Win 32 SDK 
provides you with functions which replace "regini.exe". 
The most important function calls to the Microsoft Windows SDK are:
RegCreateKey(), RegAddValue(), and RegCloseKey()
The following steps are necessary for a complete CRYPTO-BOX reristration.
  
  a) CALL RegCreateKey() to do the registry entry of marxdev1.sys:
     \Registry\Machine\System\CurrentControlSet\Services\MarxDev1
  
  b) Set values with RegAddValue() to add the following:
      Type = REG_DWORD 0x00000001
      Start = REG_DWORD 0x00000002
      Group = Extended Base
      ErrorControl = REG_DWORD 0x00000001
  
     The following values are specific to I/O port and devices:
      IoPortAddress = REG_DWORD 0x000003bc
      IoPortCount = REG_DWORD 0x00000004
      Remark:
      The IoPortAddress for marxdev1 is 0x000003bc
      The IoPortAddress for marxdev2 is 0x00000387
      The IoPortAddress for marxdev3:is 0x00000278
       
  c) CALL RegCloseKey() to end the registration session.
  
For a detailed description of each function please look up the Win 32 SDK. We
understand the complexity of Windows NT registration process. Please
feel free to contact us concerning any suggestions you may have.
  

-----------------------------------------------------------
-> Delivering the protected software to your customers
-----------------------------------------------------------
When you deliver protected software to your customers, the following
files should be included in the delivery:
program:     yourapp.exe
drivers:     marxdev1.sys, marxdev2.sys, marxdev3.sys
    dll:     cbn560win.dll and cbnvdd.dll for 16-bit applications
             cbndll.dll for 32-bit applications
The DLL should be installed in your application directory or in the 
system directory of Windows NT.

If you register the CRYPTO-BOX via a batch file and "regini.exe",
the software package must include a batch file like "register.bat",
"regini.exe" and the "marxdev#.ini" files. If you have your own 
setup program you do not need to distribute these files.


-----------------------------------------------------------
-> Removing the CRYPTO-BOX device drivers
-----------------------------------------------------------
It is seldom necessary to remove the driver becuase the drivers
will do no harm, they remain quietly in NT, and start on demand. If
needed, a simple "disable" will do.  However, the drivers can 
be easily removed from the system.
Here is how:
 Start regedt32
 Find and select MARXDEV1 ... MARXDEV3
 Press the "DEL" key
DONE!

The CRYPTO-BOX device drivers are residing under:
             \Registry\Machine\System\CurrentControlSet\Services\MarxDev1
             \Registry\Machine\System\CurrentControlSet\Services\MarxDev2
             \Registry\Machine\System\CurrentControlSet\Services\MarxDev3

