Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.7 KiB

  1. // Gemplus (C) 1999
  2. // This module keeps system interface for the driver.
  3. // Version 1.0
  4. // Author: Sergey Ivanov
  5. // Date of creation - 18.05.1999
  6. // Change log:
  7. //
  8. #ifndef GEN_INT
  9. #define GEN_INT
  10. #define PAGEDCODE code_seg("page")
  11. #define LOCKEDCODE code_seg()
  12. #define INITCODE code_seg("init")
  13. #define PAGEDDATA data_seg("page")
  14. #define LOCKEDDATA data_seg()
  15. #define INITDATA data_seg("init")
  16. #define SMARTCARD_POOL_TAG 'bGCS'
  17. // Include files for different system objects
  18. #ifdef WDM_KERNEL
  19. #include "syswdm.h"
  20. #else
  21. #ifdef NT4_KERNEL
  22. #include "sysnt4.h"
  23. #else
  24. #ifdef WIN9X_KERNEL
  25. #include "syswin9x.h"
  26. #else
  27. #include "syswdm.h"
  28. #endif
  29. #endif
  30. #endif
  31. #include <smclib.h>
  32. #include "gemlog.h"
  33. // Miscellaneous useful declarations
  34. #ifndef arraysize
  35. #define arraysize(p) (sizeof(p)/sizeof((p)[0]))
  36. #endif
  37. #ifndef CTL_CODE
  38. #pragma message("CTL_CODE undefined. Include winioctl.h or devioctl.h before this file")
  39. #endif
  40. #define IOCTL_GRCLASS_GETVER CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
  41. typedef VOID (*PDEFERRED_FUNCTION)(IN struct _KDPC *Dpc, IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp, IN PVOID SystemArgument2);
  42. int __cdecl _purecall(VOID);
  43. #define SAFE_DESTRUCTORS()\
  44. VOID self_delete(VOID){delete this;}
  45. #ifdef __cplusplus
  46. #define GENERICAPI extern "C"
  47. #else
  48. #define GENERICAPI
  49. #endif
  50. #define GENERIC_EXPORT __declspec(dllexport) __stdcall
  51. typedef VOID (__stdcall *PQNOTIFYFUNC)(PVOID);
  52. BOOLEAN GENERIC_EXPORT isWin98();
  53. #define DRIVERNAME "GRClass.sys"
  54. #define NT_OBJECT_NAME L"\\Device\\GRClass"
  55. #if DEBUG
  56. extern "C" VOID __cdecl _chkesp();
  57. #endif
  58. extern BOOLEAN SystemWin98;
  59. // Power management constants
  60. #define GUR_IDLE_CONSERVATION 60 // sleep after 60 seconds on battery power
  61. #define GUR_IDLE_PERFORMANCE 600 // sleep after 10 minutes on AC power
  62. EXTERN_C const GUID FAR GUID_CLASS_GRCLASS;
  63. EXTERN_C const GUID FAR GUID_CLASS_SMARTCARD;
  64. // Supported by driver different type of devices
  65. #define GRCLASS_DEVICE 0
  66. #define USB_DEVICE 1
  67. #define USBREADER_DEVICE 2
  68. #define BUS_DEVICE 3
  69. #define CHILD_DEVICE 4
  70. inline VOID _cdecl DBG_PRINT(PCH Format,...)
  71. {
  72. va_list argpoint;
  73. CHAR strTempo[1024];
  74. va_start(argpoint,Format);
  75. vsprintf(strTempo,Format,argpoint);
  76. va_end(argpoint);
  77. SmartcardDebug (DEBUG_DRIVER,("GemPC430: "));
  78. SmartcardDebug (DEBUG_DRIVER, (strTempo));
  79. };
  80. inline VOID _cdecl DBG_PRINT_NO_PREFIX(PCH Format,...)
  81. {
  82. va_list argpoint;
  83. CHAR strTempo[1024];
  84. va_start(argpoint,Format);
  85. vsprintf(strTempo,Format,argpoint);
  86. va_end(argpoint);
  87. SmartcardDebug (DEBUG_DRIVER, (strTempo));
  88. };
  89. // already included
  90. #endif