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.

173 lines
2.8 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1998 - 1999
  3. Module Name:
  4. scEvents
  5. Abstract:
  6. This header file describes the services to access the Calais Resource
  7. Manager special events.
  8. Author:
  9. Doug Barlow (dbarlow) 7/1/1998
  10. Remarks:
  11. ?Remarks?
  12. Notes:
  13. ?Notes?
  14. --*/
  15. #ifndef _SCEVENTS_H_
  16. #define _SCEVENTS_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef HANDLE (*LPCALAISACCESSEVENT)(void);
  21. typedef void (*LPCALAISRELEASEEVENT)(void);
  22. #ifdef __cplusplus
  23. }
  24. #endif
  25. //
  26. // Special SCardGetStatusChange Reader Name definitions.
  27. //
  28. #define SCPNP_NOTIFICATION TEXT("\\\\?PnP?\\Notification")
  29. //
  30. // NOTE -- The following definitions intentionally use the ANSI versions
  31. // of the corresponding strings.
  32. //
  33. inline HANDLE
  34. CalaisAccessStartedEvent(
  35. void)
  36. {
  37. HANDLE hReturn = NULL;
  38. try
  39. {
  40. HMODULE hWinScard = GetModuleHandle(TEXT("WINSCARD.DLL"));
  41. if (NULL != hWinScard)
  42. {
  43. LPCALAISACCESSEVENT pfCalais =
  44. (LPCALAISACCESSEVENT)GetProcAddress(hWinScard,
  45. "SCardAccessStartedEvent");
  46. if (NULL != pfCalais)
  47. {
  48. hReturn = (*pfCalais)();
  49. }
  50. }
  51. }
  52. catch (...)
  53. {
  54. hReturn = NULL;
  55. }
  56. return hReturn;
  57. }
  58. inline HANDLE
  59. CalaisAccessNewReaderEvent(
  60. void)
  61. {
  62. HANDLE hReturn = NULL;
  63. try
  64. {
  65. HMODULE hWinScard = GetModuleHandle(TEXT("WINSCARD.DLL"));
  66. if (NULL != hWinScard)
  67. {
  68. LPCALAISACCESSEVENT pfCalais =
  69. (LPCALAISACCESSEVENT)GetProcAddress(hWinScard,
  70. "SCardAccessNewReaderEvent");
  71. if (NULL != pfCalais)
  72. {
  73. hReturn = (*pfCalais)();
  74. }
  75. }
  76. }
  77. catch (...)
  78. {
  79. hReturn = NULL;
  80. }
  81. return hReturn;
  82. }
  83. inline void
  84. CalaisReleaseStartedEvent(
  85. void)
  86. {
  87. try
  88. {
  89. HMODULE hWinScard = GetModuleHandle(TEXT("WINSCARD.DLL"));
  90. if (NULL != hWinScard)
  91. {
  92. LPCALAISRELEASEEVENT pfCalais =
  93. (LPCALAISRELEASEEVENT)GetProcAddress(hWinScard,
  94. "SCardReleaseStartedEvent");
  95. if (NULL != pfCalais)
  96. {
  97. (*pfCalais)();
  98. }
  99. }
  100. }
  101. catch (...) {}
  102. }
  103. inline void
  104. CalaisReleaseNewReaderEvent(
  105. void)
  106. {
  107. try
  108. {
  109. HMODULE hWinScard = GetModuleHandle(TEXT("WINSCARD.DLL"));
  110. if (NULL != hWinScard)
  111. {
  112. LPCALAISRELEASEEVENT pfCalais =
  113. (LPCALAISRELEASEEVENT)GetProcAddress(hWinScard,
  114. "SCardReleaseNewReaderEvent");
  115. if (NULL != pfCalais)
  116. {
  117. (*pfCalais)();
  118. }
  119. }
  120. }
  121. catch (...) {}
  122. }
  123. inline void
  124. CalaisReleaseAllEvents(
  125. void)
  126. {
  127. try
  128. {
  129. HMODULE hWinScard = GetModuleHandle(TEXT("WINSCARD.DLL"));
  130. if (NULL != hWinScard)
  131. {
  132. LPCALAISRELEASEEVENT pfCalais =
  133. (LPCALAISRELEASEEVENT)GetProcAddress(hWinScard,
  134. "SCardReleaseAllEvents");
  135. if (NULL != pfCalais)
  136. {
  137. (*pfCalais)();
  138. }
  139. }
  140. }
  141. catch (...) {}
  142. }
  143. #endif // _SCEVENTS_H_