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.

118 lines
3.2 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. Common
  5. Abstract:
  6. This file contains common includes, data structures, defines, etc. used
  7. throughtout the common dialog
  8. Author:
  9. Chris Dudley 3/15/1997
  10. Environment:
  11. Win32, C++ w/Exceptions, MFC
  12. Revision History:
  13. Chris Dudley 5/13/1997
  14. Notes:
  15. --*/
  16. #ifndef __COMMON_H__
  17. #define __COMMON_H__
  18. /////////////////////////////////////////////////////////////////////////////
  19. //
  20. // Includes
  21. //
  22. #include <winscard.h>
  23. #include <SCardLib.h>
  24. #include <scarderr.h> //Smartcard errors
  25. //////////////////////////////////////////////////////////////////////////////
  26. //
  27. // Defines
  28. //
  29. // Status of reader
  30. #define SC_STATUS_NO_CARD 0 // SCARD_STATE_EMPTY
  31. #define SC_STATUS_UNKNOWN 1 // SCARD_STATE_PRESENT | SCARD_STATE_MUTE
  32. #define SC_SATATUS_AVAILABLE 2 // SCARD_STATE_PRESENT (| SCARD_STATE_UNPOWERED)
  33. #define SC_STATUS_SHARED 3 // SCARD_SATATE_PRESENT | SCARD_STATE_INUSE
  34. #define SC_STATUS_EXCLUSIVE 4 // "" | SCARD_STATE_EXCLUSIVE
  35. #define SC_STATUS_ERROR 5 // SCARD_STATE_UNAVAILABLE (reader or card error)
  36. /*
  37. #define SC_STATUS_NO_CARD 0
  38. #define SC_STATUS_NOT_IN_USE 1
  39. #define SC_STATUS_ERROR 2
  40. #define SC_STATUS_IN_USE 3
  41. */
  42. /////////////////////////////////////////////////////////////////////////////
  43. //
  44. // Structures
  45. //
  46. #ifndef __READERINFO__
  47. #define __READERINFO__
  48. typedef struct _READERINFO {
  49. CTextString sReaderName; // Reader name
  50. CTextString sCardName; // Card name if inserted
  51. BOOL fCardInserted; // Flag indicating card in reader
  52. BOOL fCardLookup; // Flag indicating inserted card is being looked for
  53. BOOL fChecked; // Flag indicating inserted card has been checked by callers code
  54. DWORD dwState; // State of reader
  55. DWORD dwInternalIndex;// Indicates this readerinfo's position in a ReaderStateArray
  56. BYTE rgbAtr[36]; // RFU!!
  57. DWORD dwAtrLength; // RFU!!
  58. } SCARD_READERINFO;
  59. typedef SCARD_READERINFO* LPSCARD_READERINFO;
  60. #endif
  61. // Structure used for thread-to-thread communication.
  62. // Note: "Might" want to encapsulate these in class!!
  63. #ifndef __STATUS__
  64. #define __STATUS__
  65. typedef struct _STATUS {
  66. HWND hwnd;
  67. // Event handles
  68. HANDLE hEventKillStatus;
  69. // Smartcard Info
  70. SCARDCONTEXT hContext;
  71. LPSCARD_READERSTATE rgReaderState;
  72. DWORD dwNumReaders;
  73. } SCSTATUS, *LPSCSTATUS;
  74. #endif //STATUS
  75. ////////////////////////////////////////////////////////////////////////////////
  76. //
  77. // Constants
  78. //
  79. #define SCARD_NO_MORE_READERS -1
  80. const char SCARD_DEFAULT_A[] = "SCard$DefaultReaders\0\0";
  81. const WCHAR SCARD_DEFAULT_W[] = L"SCard$DefaultReaders\0\0";
  82. //////////////////////////////////////////////////////////////////////////
  83. //
  84. // Macros
  85. //
  86. #ifndef SCARDFAILED
  87. #define SCARDFAILED(r) ((r != SCARD_S_SUCCESS) ? TRUE : FALSE)
  88. #endif
  89. #ifndef SCARDSUCCESS
  90. #define SCARDSUCCESS(r) ((r == SCARD_S_SUCCESS) ? TRUE : FALSE)
  91. #endif
  92. //////////////////////////////////////////////////////////////////////////////
  93. #endif //__SCDLGCMN_H__