Source code of Windows XP (NT5)
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.

136 lines
2.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) SCM Microsystems, 1998 - 1999
  6. //
  7. // File: drivernt.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #if !defined( __DRIVER_NT_H__ )
  11. #define __DRIVER_NT_H__
  12. #include <NTDDK.H>
  13. #include "STCLog.h"
  14. #include "SMCLIB.h"
  15. #include "WINSMCRD.h"
  16. #include "SerialNT.h"
  17. #define SMARTCARD_POOL_TAG '3BCS'
  18. #if !defined( STATUS_DEVICE_REMOVED )
  19. #define STATUS_DEVICE_REMOVED STATUS_UNSUCCESSFUL
  20. #endif
  21. void SystemTime( void );
  22. void DataOut( PUCHAR p, ULONG l );
  23. #define LOBYTE( any ) ((UCHAR)( any & 0xFF ) )
  24. #define HIBYTE( any ) ((UCHAR)( ( any >> 8) & 0xFF ))
  25. #define SysCompareMemory( p1, p2, Len ) ( RtlCompareMemory( p1,p2, Len ) != Len )
  26. #define SysCopyMemory( pDest, pSrc, Len ) RtlCopyMemory( pDest, pSrc, Len )
  27. #define SysFillMemory( pDest, Value, Len ) RtlFillMemory( pDest, Len, Value )
  28. typedef struct _DEVICE_EXTENSION
  29. {
  30. SMARTCARD_EXTENSION SmartcardExtension;
  31. #if defined( __NT4__ )
  32. BOOLEAN OpenFlag;
  33. UNICODE_STRING LinkID;
  34. #else
  35. KEVENT ReaderStarted; // Used to signal that the reader is able to process reqeusts
  36. LONG ReaderOpen; // Used to signal the the reader has been closed
  37. KSPIN_LOCK SpinLock;
  38. UNICODE_STRING PnPDeviceName; // The pnp device name of our smart card reader
  39. PVOID RemoveLock;
  40. ULONG DeviceInstance;
  41. LONG PowerState; // Used to keep track of the current power state the reader is in
  42. LONG IoCount; // The current number of io-requests
  43. #endif
  44. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  45. #define IOCTL_SR_COMMAND SCARD_CTL_CODE( 0x800 )
  46. #define IOCTL_GET_VERSIONS SCARD_CTL_CODE( 0x801 )
  47. typedef struct _VERSION_CONTROL
  48. {
  49. ULONG SmclibVersion;
  50. UCHAR DriverMajor,
  51. DriverMinor,
  52. FirmwareMajor,
  53. FirmwareMinor;
  54. } VERSION_CONTROL, *PVERSION_CONTROL;
  55. #define MAX_READERS 4
  56. NTSTATUS
  57. DriverEntry(
  58. PDRIVER_OBJECT DriverObject,
  59. PUNICODE_STRING RegistryPath
  60. );
  61. NTSTATUS
  62. DrvGetConfiguration(
  63. PDRIVER_OBJECT DriverObject,
  64. PUNICODE_STRING RegistryPath,
  65. PULONG pComPort
  66. );
  67. NTSTATUS
  68. DrvInitDeviceObject(
  69. PDRIVER_OBJECT DriverObject,
  70. ULONG ComPort
  71. );
  72. VOID
  73. DrvUnloadDevice(
  74. PDEVICE_OBJECT DeviceObject
  75. );
  76. VOID
  77. DrvUnloadDriver(
  78. PDRIVER_OBJECT DriverObject
  79. );
  80. NTSTATUS
  81. DrvOpenClose(
  82. PDEVICE_OBJECT DeviceObject,
  83. PIRP Irp
  84. );
  85. NTSTATUS
  86. DrvDeviceIoControl(
  87. PDEVICE_OBJECT DeviceObject,
  88. PIRP Irp
  89. );
  90. NTSTATUS
  91. DrvGenericIOCTL(
  92. PSMARTCARD_EXTENSION SmartcardExtension
  93. );
  94. void
  95. DrvSetupSmartcardExtension(
  96. PSMARTCARD_EXTENSION SmartcardExtension
  97. );
  98. NTSTATUS
  99. DrvCancel(
  100. PDEVICE_OBJECT DeviceObject,
  101. PIRP Irp
  102. );
  103. void
  104. SysDelay(
  105. ULONG Timeout
  106. );
  107. #endif // !__DRIVER_NT_H__