/*************************************************************************
 *                                                                       *
 *     Definitions for INSTDRV.DLL                                       *
 *                                              (C) Aktiv Co. 1998-2001  *
 *************************************************************************/
#ifndef __INSTDRVS__H__
#define __INSTDRVS__H__


#pragma pack(4)
typedef struct _GD_DRIVER_INFO
{
 WORD   di_wSize;                   // Structure size
 WORD   di_wSign;                   // Signature
 DWORD  di_dwUpdateFlags;           // Flags for future use
 WORD   di_wVersion;                // Driver Version (example: 0x030B ==> 3.11)
 WORD   di_reserved_00;
 WORD   di_awBase[3];               // Used LPT ports base addresses
                                    // (== di_awAutoLPTAddr[3], if di_byLPTAuto=1)
 WORD   di_reserved_01;
 DWORD  di_adwHKey[3];              // Registry keys
 DWORD  di_adwMethod[3];            // LPT ports capture methods
 DWORD  di_dwTimeout;               // Timeout
 struct _TFlags                     // Flags of supported features:
 {
       unsigned  fConfigurable :1;  // Is driver configurable or not?
       // Features supported by driver:
       // 1. Methods
       unsigned  mSteal        :1;  // Capture LPT port    (95)
       unsigned  mAquire       :1;  // Capture I/O range   (95)
       unsigned  mCrSect       :1;  // Critical section    (95)
       unsigned  mMask         :1;  // Interrupts masking  (95)
       unsigned  mCli          :1;  // Interupts disabling (95)
       unsigned  mAlloc        :1;  // Capture LPT port    (NT)
       unsigned  mIrql         :1;  // Change IRQL         (NT)

       // 2. Configuration flags
       unsigned  cTimers       :1;  // Selectable timer and delay method

       unsigned  :23;               // reserved for future use
       unsigned reserved2[2];
 } di_Flags;
 BYTE   di_lpBuildTime[16];         // Driver Build time (string in DD-MM-YY HH:MM format)
 BYTE   di_abIrql[3];               // IRQL values for each LPT port
 BYTE   di_reserved_02;
 BYTE   di_bPort;                   // Mask of LPT ports to be used
 BYTE   di_reserved_03[3];
 DWORD  di_dwConfigFlags;           // Driver configuration
 DWORD  di_dwTimeLoop;              // Timer / delay supported methods
 BYTE   di_byCheckMode;             // Drivers Check mode (for different OS)
 BYTE   di_byUSBCheck;              // USB Check flag
 WORD  	di_awAutoLPTAddr[3];        // Autodetected LPT ports base addresses
 BYTE   di_byLPTAuto;               // LPT base addresses autodetect flag
 BYTE   di_byMultiProc;				// Multiprocessor mode flag (from registry)
 BYTE   di_reserved_4[162];         // Total size of structure is 256 bytes (170)//(172)

} GD_DRIVER_INFO, *PGD_DRIVER_INFO;;

// Error codes
#define   ge_NO_ERROR                     0x00
#define   ge_DRIVER_NOT_FOUND             0x01
#define   ge_DRIVER_ALREADY_INSTALLED     0x02
#define   ge_DRIVER_OLD_VERSION           0x03
#define   ge_DRIVER_NEWER_VERSION         0x04
#define   ge_DRIVER_NOT_REMOVED           0x05
#define   ge_DRIVER_CONFIG_NOT_SUPPORTED  0x06
#define   ge_DIOCTL_FAIL                  0x07
#define   ge_RETURNED_PART_ONLY           0x08
#define   ge_SOURCE_FILE_NOT_FOUND        0x09
#define   ge_CANNOT_COPY_FILE             0x0A
#define   ge_CANNOT_DELETE_FILE           0x0B
#define   ge_CANNOT_CREATE_REGKEY         0x0C
#define   ge_CANNOT_OPEN_REGKEY           0x0D
#define   ge_CANNOT_SET_REGKEY            0x0E
#define   ge_CANNOT_QUERY_REGKEY          0x0F
#define   ge_CANNOT_REMOVE_REGKEY         0x10
#define   ge_CANNOT_OPEN_DEVICE           0x11
#define   ge_CANNOT_CREATE_SERVICE        0x12
#define   ge_CANNOT_OPEN_SERVICE          0x13
#define   ge_CANNOT_DELETE_SERVICE        0x14
#define   ge_CANNOT_START_SERVICE         0x15
#define   ge_CANNOT_STOP_SERVICE          0x16
#define   ge_CANNOT_ADD_CONFIG            0x17
#define   ge_INCORRECT_WINDOWS_VERSION    0x18
#define   ge_ACCESS_DENIED                0x19
#define   ge_VALUE_OUT_OF_RANGE           0x1A
#define   ge_USER_BREAK                   0x1B
#define   ge_PORTS_NOT_USED               0x1C
#define   ge_DRIVER_BUSY                  0x1D
#define	  ge_SERVICE_MARKED_FOR_DELETE	  0x1E	//Not error! Will be delete after reboot. 
#define   ge_REBOOT_NEEDED                0x8000

// Methods for NT
#define   gd_METHOD_ALLOC      0x01
#define   gd_METHOD_IRQL       0x02
#define   gd_METHOD_AUTO       0x80

#define   gd_METHOD_AUTO_NT    ( gd_METHOD_ALLOC + gd_METHOD_IRQL )

#define   gd_IRQL_AUTO         0x03

// Methods for 95
#define   gd_METHOD_STEAL      0x01
#define   gd_METHOD_ACQUIRE    0x02
#define   gd_METHOD_CS         0x04
#define   gd_METHOD_MASK       0x08
#define   gd_METHOD_CLI        0x10
#define   gd_METHOD_AUTO       0x80

#define   gd_METHOD_AUTO_95     ( gd_METHOD_STEAL + gd_METHOD_CS )

#define   gd_PORT_LPT1         0x00
#define   gd_PORT_LPT2         0x01
#define   gd_PORT_LPT3         0x02

#define   gd_USE_PORT_LPT1     0x01
#define   gd_USE_PORT_LPT2     0x02
#define   gd_USE_PORT_LPT3     0x04

// Driver configuration
#define   gd_DEF_FLAGS_NT      0x8000   // Default set flags for windows NT
#define   gd_DEF_FLAGS_95      0x8000   // Default flags set for windows 95/98

// Timers
#define   gd_TIME_SYSTEM       0x0001
#define   gd_TIME_TRADITIONAL  0x0002
#define   gd_TIME_SECONDARY    0x0004

// Delay methods
#define   gd_LOOP_PENTIUM      0x0100
#define   gd_LOOP_BSF          0x0200
#define   gd_LOOP_TRADITIONAL  0x0400
#define   gd_LOOP_SECONDARY    0x0800

// Automatic Timer/Delay selection
#define   gd_TIMELOOP_AUTO     0x8000

// Automatic LPT ports base addresses detection
#define   gd_LPT_AUTO          0x01

// Guardant InstDrv Config - Options for Install API (use GD_SetInstdrvConfig())
#define   gic_SHOWMESSAGES     0x01
#define   gic_FULLINFO         0x02
#define   gic_PRINTLOG         0x04
#define	  gic_MANUALLANGUAGE   0x08
#define	  gic_ENGLANGUAGE	   0x10


#endif    // __INSTDRVS__H__

