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.

360 lines
8.1 KiB

  1. /*++
  2. Module Name:
  3. struct.h
  4. Abstract:
  5. Contains all the valid definition constants, structures used
  6. by client.c and testdrvr.c
  7. Author:
  8. Sanjeev Katariya
  9. Environment:
  10. User mode
  11. Revision History:
  12. Serial # Author Date Changes
  13. -------- ------ ---- -------
  14. 1. SanjeevK 10/28/92 Original
  15. 2. RickTu 1/25/93 Changed for new system watchdog mess.
  16. 3. RajNath 2/??/93
  17. --*/
  18. //
  19. // DEFINES: General
  20. //
  21. //#define SRVTOCLIENT_MSLOT "\\\\.\\mailslot\\SRVTOCLNT"
  22. #define CONNECT_MSLOT "\\\\*\\mailslot\\CONNECT"
  23. #define SRVEND_PIPE_BASE "PIPE\\NODAL"
  24. #define SRVEND_PIPE_NAME "STRESS7"
  25. #define MAX_RETRY_COUNT 3
  26. #define MAX_EMAILNAME_LENGTH 8
  27. #define MAX_LOCATION_LENGTH 10
  28. #define MAX_COMMENT_LENGTH 15
  29. #define MAX_GENERAL_LENGTH 80
  30. #define MAX_TESTS 256
  31. #define MAX_TEST_IDS 64
  32. #define SEND_PERIOD 10UL*60UL*1000UL //Interval 10 minutes at which Alive Message Sent
  33. //#define NUM_MACHINE_TYPES 2
  34. //#define MACHINE_TYPE_X86 (TCHAR)0x1
  35. //#define MACHINE_TYPE_MIPS (TCHAR)0x2
  36. #define STRESS_ENV_VAR "STRESSROOT"
  37. //#define NUM_DEFAULT_SRVADMINS 4
  38. //#define NUM_POPUP_SERVERS 4
  39. //#define NUM_DEFAULT_SRVADMINS (sizeof(ppc_SrvAdmins)/sizeof(ppc_SrvAdmins[0]))
  40. //#define NUM_POPUP_SERVERS (sizeof(ppc_PopUpSrvrs)/sizeof(ppc_PopUpSrvrs[0]))
  41. //
  42. // DEFINES: Message Identifiers
  43. //
  44. #define MSG_REGISTER_INFORMATION (DWORD)0x1
  45. #define MSG_REGISTER_ADD_INFORMATION (DWORD)0x2
  46. #define MSG_CLIENT_ALIVE (DWORD)0x3
  47. #define MSG_CLIENT_SHUTDOWN (DWORD)0x4
  48. #define MSG_CLIENT_WATCHDOG (DWORD)0x5
  49. #define MSG_ERROR_POPUP (DWORD)0x6
  50. //
  51. // DEFINES: Popups (upper WORD bit fields)
  52. //
  53. #define VDM_WINDOWS_POPUP 0x10000000
  54. #define VDM_MSDOS_POPUP 0x20000000
  55. #define APP_POPUP 0x40000000
  56. //
  57. // DEFINES: Special error codes
  58. //
  59. #define ERROR_SHARENAME_RETRIEVAL (DWORD)2000
  60. //
  61. // DEFINES: Connection States
  62. //
  63. // This is the state transition diagram for the client
  64. //
  65. // Reg/Fail KeepAlive/Success
  66. // ----------- ----
  67. // | Count:3 | | |
  68. // v | | v
  69. // ------ ------ Reg/Success ------
  70. // | DISC |--->| CONN |------------>| REG |
  71. // ------ ------ ------
  72. // ^ |
  73. // | |
  74. // --------------------------------
  75. // KeepAlive/Fail Count:3
  76. //
  77. #define STATE_DISCONNECTED (DWORD)0x0
  78. #define STATE_CONNECTED (DWORD)0x1
  79. #define STATE_REGISTERED (DWORD)0x2
  80. //
  81. // TYPEDEFS: SERVER, CONNECTION_INFORMATION, REG_INFORMATION
  82. // REG_ADD_INFORMATION, CLIENT_ALIVE, CLIENT_SHUTDOWN,
  83. // DATA, INFORMATION, THREAD_KEEPALIVE_PARMS
  84. //
  85. //typedef TCHAR SERVER, *PSERVER;
  86. //typedef struct _STRESS_SHARE {
  87. //
  88. // TCHAR c_MachineType;
  89. // TCHAR pc_SrvShareName[NNLEN+MAX_COMPUTERNAME_LENGTH+6];
  90. //
  91. //} STRESS_SHARE, *PSTRESS_SHARE;
  92. //typedef struct _CONNECTION_INFORMATION {
  93. //
  94. // TCHAR pc_ComputerName[MAX_COMPUTERNAME_LENGTH+1] ;
  95. // TCHAR pc_ServerName[MAX_COMPUTERNAME_LENGTH+1] ;
  96. // STRESS_SHARE pstruct_SrvShareName[NUM_MACHINE_TYPES] ;
  97. //
  98. //} CONNECTION_INFORMATION, *PCONNECTION_INFORMATION;
  99. typedef struct _TEST_FLAGS {
  100. DWORD ul_TestFl[2];
  101. } TEST_FLAGS;
  102. typedef struct _INFO_FLAGS {
  103. TCHAR FreeChk;
  104. TCHAR UniMultiProc;
  105. WORD CsdVersion;
  106. WORD RCMajor;
  107. WORD RCMinor;
  108. } INFO_FLAGS;
  109. typedef union _STRESS_FLAGS {
  110. TEST_FLAGS TF;
  111. INFO_FLAGS IF;
  112. } STRESS_FLAGS;
  113. typedef struct _OLDCAIROBUILD {
  114. TCHAR CairoBld[16];
  115. } OLDCAIROBUILD;
  116. typedef struct _FILESYSTEMINFO {
  117. TCHAR FileSystemName[12];
  118. DWORD FileSystemFlags;
  119. } FILESYSTEMINFO;
  120. typedef union _FILESYSTEMUNION {
  121. OLDCAIROBUILD oldcairo;
  122. FILESYSTEMINFO fsi;
  123. } FILESYSTEMUNION;
  124. typedef struct _REG_INFORMATION {
  125. DWORD ul_PhysMem;
  126. DWORD ul_Version;
  127. DWORD ul_FreeDisk;
  128. STRESS_FLAGS Fl;
  129. //DWORD ul_TestFl[2]; // out of date
  130. DWORD ul_BuildVersionNumber;
  131. TCHAR pc_EmailName[MAX_EMAILNAME_LENGTH+1] ;
  132. TCHAR pc_MachineName[MAX_COMPUTERNAME_LENGTH+1];
  133. TCHAR pc_Location[MAX_LOCATION_LENGTH+1] ;
  134. TCHAR pc_Debugger[MAX_COMPUTERNAME_LENGTH+1] ;
  135. TCHAR Filler;
  136. SYSTEMTIME st_StartTime;
  137. union {
  138. DWORD Cpu;
  139. struct {
  140. WORD CpuLevel;
  141. WORD CpuType;
  142. };
  143. };
  144. TCHAR Run_Type[128];
  145. int OtherBuild;
  146. FILESYSTEMUNION fsu;
  147. WORD TestIds[MAX_TEST_IDS];
  148. } REG_INFORMATION, *PREG_INFORMATION;
  149. //
  150. // Defines current registration packet "version" number. Need
  151. // to incremenent the low word by "1" every time a change is made
  152. // to the REG_INFORMATION structure
  153. //
  154. #define CURRENT_REG_VERSION 0xFFFF0003
  155. typedef struct _REG_ADD_INFORMATION {
  156. WORD TestIds[MAX_TEST_IDS];
  157. } REG_ADD_INFORMATION, *PREG_ADD_INFORMATION;
  158. typedef struct _CLIENT_ALIVE {
  159. DWORD ul_ClientSendCount;
  160. DWORD CpuUtil;
  161. DWORD DiskUtil;
  162. DWORD Interrupts;
  163. } CLIENT_ALIVE, *PCLIENT_ALIVE;
  164. typedef struct _CLIENT_SHUTDOWN {
  165. TCHAR pc_SmartMessage;
  166. } CLIENT_SHUTDOWN, *PCLIENT_SHUTDOWN;
  167. typedef struct
  168. {
  169. TCHAR Popup[1];
  170. }ERROR_POPUP;
  171. typedef union _DATA {
  172. REG_INFORMATION RI ;
  173. REG_ADD_INFORMATION RAI;
  174. CLIENT_ALIVE CA ;
  175. CLIENT_SHUTDOWN CS ;
  176. } DATA, *PDATA;
  177. typedef struct _INFORMATION {
  178. DWORD Type;
  179. char Data[1];
  180. } INFORMATION, *PINFORMATION;
  181. typedef struct _WATCHDOG {
  182. DWORD CsrssCommitedPages;
  183. DWORD PercentCpuUsage;
  184. DWORD InterruptsPerSec;
  185. DWORD ReadWritePerSec;
  186. } WATCHDOG, *PWATCHDOG;
  187. typedef struct _ERRORS {
  188. DWORD ErrCode;
  189. CHAR Server[100];
  190. } ERRORS, *PERRORS;
  191. #define MAX_ERROR_ENTRIES 20
  192. //
  193. // Structure for parameters passed to the client alive thread
  194. //
  195. typedef struct _THREAD_KEEPALIVE_PARMS {
  196. PHANDLE ppv_Handle ;
  197. DWORD ul_DelayTimer;
  198. DWORD ul_ConnectionState;
  199. REG_INFORMATION struct_RegInf;
  200. TCHAR pc_ServerName[MAX_COMPUTERNAME_LENGTH+1];
  201. } THREAD_KEEPALIVE_PARMS, *PTHREAD_KEEPALIVE_PARMS;
  202. //
  203. // Exported functions: EstablishConnection(), SendInformation(),
  204. // ReceiveInformation(), CloseConnection()
  205. //
  206. //DWORD
  207. //EstablishConnection(
  208. // IN PSERVER lpsz_ServerName OPTIONAL,
  209. // OUT PHANDLE ppv_Handle,
  210. // OUT PCONNECTION_INFORMATION pstruct_ConnectionInformation
  211. // );
  212. BOOL
  213. SendInformation(
  214. DWORD MsgType,
  215. PVOID Msg,
  216. DWORD MsgSize
  217. );
  218. //DWORD
  219. //ReceiveInformation(
  220. // IN HANDLE pv_PipeHandle,
  221. // IN OUT PINFORMATION pstruct_Information
  222. // );
  223. //
  224. // MACROS
  225. //
  226. //#define CloseConnection( Handle ) CloseHandle( Handle ) ? ERROR_SUCCESS : GetLastError()
  227. //
  228. // SOME ADDITIONAL STUFF FOR NEWCLIENT.C
  229. //
  230. #define MAX_SERVERS 10
  231. #define MAXPIPENAME MAX_COMPUTERNAME_LENGTH+1+128
  232. typedef struct {
  233. TCHAR RegSrvs[MAX_SERVERS][MAX_COMPUTERNAME_LENGTH+1];
  234. DWORD NumRegSrvs;
  235. } SERVERLIST;
  236. //
  237. //Incase the .INI File has missing section on this....
  238. //
  239. //static CHAR ppc_SrvAdmins[][MAX_COMPUTERNAME_LENGTH+1] = { "NTSTRESS", "LAPILE","DRAINO","RICKTUMIPS","RAJNATH" };
  240. //static CHAR ppc_PopUpSrvrs[][MAX_COMPUTERNAME_LENGTH+1] = { "STRESS", "RICKTU", "A-LARSO", "RAJNATH" };
  241. //static STRESS_SHARE pstruct_DefaultStressSrvrs[] = { { MACHINE_TYPE_X86, "\\\\PEANUT\\X86STRS" },
  242. // { MACHINE_TYPE_MIPS, "\\\\PEANUT\\MIPSSTRS" } };
  243. extern BOOL SendAdditionalInfo;
  244. extern REG_ADD_INFORMATION RAI;
  245. extern REG_INFORMATION RI;
  246. extern SERVERLIST ServerList;
  247. extern int ActiveServer;
  248. #define SAFECLOSEHANDLE(hX) {if (hX!=INVALID_HANDLE_VALUE) {CloseHandle(hX);hX=INVALID_HANDLE_VALUE;}}