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.

211 lines
3.4 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1999
  3. Module Name:
  4. event.hxx
  5. Abstract:
  6. Header file for firing Events using LCE.
  7. Author:
  8. Gopal Parupudi <GopalP>
  9. [Notes:]
  10. optional-notes
  11. Revision History:
  12. GopalP 10/31/1997 Start.
  13. --*/
  14. //
  15. // Enumerated types
  16. //
  17. enum SENS_EVENT_TYPE
  18. {
  19. SENS_EVENT_NETALIVE = 0,
  20. SENS_EVENT_REACH,
  21. SENS_EVENT_LOGON,
  22. SENS_EVENT_LOGOFF,
  23. SENS_EVENT_STARTUP,
  24. SENS_EVENT_STARTSHELL,
  25. SENS_EVENT_POSTSHELL,
  26. SENS_EVENT_SESSION_DISCONNECT,
  27. SENS_EVENT_SESSION_RECONNECT,
  28. SENS_EVENT_SHUTDOWN,
  29. SENS_EVENT_LOCK,
  30. SENS_EVENT_UNLOCK,
  31. SENS_EVENT_STARTSCREENSAVER,
  32. SENS_EVENT_STOPSCREENSAVER,
  33. SENS_EVENT_POWER_ON_ACPOWER,
  34. SENS_EVENT_POWER_ON_BATTERYPOWER,
  35. SENS_EVENT_POWER_BATTERY_LOW,
  36. SENS_EVENT_POWER_STATUS_CHANGE,
  37. SENS_EVENT_PNP_DEVICE_ARRIVED,
  38. SENS_EVENT_PNP_DEVICE_REMOVED,
  39. SENS_EVENT_RAS_STARTED,
  40. SENS_EVENT_RAS_STOPPED,
  41. SENS_EVENT_RAS_CONNECT,
  42. SENS_EVENT_RAS_DISCONNECT,
  43. SENS_EVENT_RAS_DISCONNECT_PENDING,
  44. SENS_EVENT_LAN_CONNECT,
  45. SENS_EVENT_LAN_DISCONNECT
  46. };
  47. enum CONNECTIVITY_TYPE
  48. {
  49. TYPE_LAN = 1,
  50. TYPE_WAN,
  51. TYPE_LAN_AND_WAN,
  52. TYPE_DELAY_LAN
  53. };
  54. //
  55. // Typedefs
  56. //
  57. #if !defined(SENS_CHICAGO)
  58. typedef struct _LOGON_INFO {
  59. ULONG Size;
  60. ULONG Flags;
  61. PWSTR UserName;
  62. PWSTR Domain;
  63. PWSTR WindowStation;
  64. HANDLE hToken;
  65. HDESK hDesktop;
  66. DWORD dwSessionId;
  67. } SENS_LOGON_INFO;
  68. #else
  69. typedef struct _LOGON_INFO
  70. {
  71. ULONG Size;
  72. ULONG Flags;
  73. PWSTR UserName;
  74. PWSTR Domain;
  75. PWSTR WindowStation;
  76. HANDLE hToken;
  77. HDESK hDesktop;
  78. } SENS_LOGON_INFO;
  79. #endif // SENS_CHICAGO
  80. typedef struct _SENSEVENT_NETALIVE
  81. {
  82. SENS_EVENT_TYPE eType;
  83. BOOL bAlive;
  84. QOCINFO QocInfo;
  85. LPWSTR strConnection;
  86. } SENSEVENT_NETALIVE, *PSENSEVENT_NETALIVE;
  87. typedef struct _SENSEVENT_REACH
  88. {
  89. SENS_EVENT_TYPE eType;
  90. BOOL bReachable;
  91. PWCHAR Destination;
  92. QOCINFO QocInfo;
  93. LPWSTR strConnection;
  94. } SENSEVENT_REACH, *PSENSEVENT_REACH;
  95. typedef struct _SENSEVENT_WINLOGON
  96. {
  97. SENS_EVENT_TYPE eType;
  98. SENS_LOGON_INFO Info;
  99. } SENSEVENT_WINLOGON, *PSENSEVENT_WINLOGON;
  100. typedef struct _SENSEVENT_POWER
  101. {
  102. SENS_EVENT_TYPE eType;
  103. SYSTEM_POWER_STATUS PowerStatus;
  104. } SENSEVENT_POWER, *PSENSEVENT_POWER;
  105. typedef struct _SENSEVENT_PNP
  106. {
  107. SENS_EVENT_TYPE eType;
  108. DWORD Size;
  109. DWORD DevType;
  110. DWORD Resource;
  111. DWORD Flags;
  112. } SENSEVENT_PNP, *PSENSEVENT_PNP;
  113. typedef struct _SENSEVENT_RAS
  114. {
  115. SENS_EVENT_TYPE eType;
  116. DWORD hConnection;
  117. } SENSEVENT_RAS, *PSENSEVENT_RAS;
  118. typedef struct _SENSEVENT_LAN
  119. {
  120. SENS_EVENT_TYPE eType;
  121. LPWSTR Name;
  122. NETCON_STATUS Status;
  123. NETCON_MEDIATYPE Type;
  124. } SENSEVENT_LAN, *PSENSEVENT_LAN;
  125. //
  126. // Functions
  127. //
  128. void
  129. EvaluateConnectivity(
  130. IN CONNECTIVITY_TYPE Type
  131. );
  132. PVOID
  133. AllocateEventData(
  134. PVOID EventData
  135. );
  136. void
  137. FreeEventData(
  138. PVOID EventData
  139. );
  140. void
  141. SensFireEvent(
  142. IN PVOID EventData
  143. );
  144. DWORD WINAPI
  145. SensFireEventHelper(
  146. IN PVOID EventData
  147. );
  148. HRESULT
  149. SensFireNetEventHelper(
  150. PSENSEVENT_NETALIVE pData
  151. );
  152. HRESULT
  153. SensFireWinlogonEventHelper(
  154. LPWSTR strArg,
  155. DWORD dwSessionId,
  156. SENS_EVENT_TYPE eType
  157. );
  158. HRESULT
  159. SensFireReachabilityEventHelper(
  160. PSENSEVENT_REACH pData
  161. );
  162. HRESULT
  163. SensFirePowerEventHelper(
  164. SYSTEM_POWER_STATUS PowerStatus,
  165. SENS_EVENT_TYPE eType
  166. );