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.

357 lines
10 KiB

  1. /******************************************************************************
  2. stivar.h
  3. Copyright (C) Microsoft Corporation, 1997 - 1998
  4. All rights reserved
  5. Notes:
  6. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  7. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  8. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  9. PURPOSE.
  10. ******************************************************************************/
  11. #include "resource.h"
  12. //
  13. // reset listbox window display after this many iterations
  14. //
  15. #define MAX_LOOP 16383
  16. //
  17. // INF defines
  18. //
  19. #define INFBUFSIZ 0x8000 // assume 32k for largest INF
  20. //
  21. // available test suites
  22. //
  23. #define NONE 500 // no test suite selected
  24. #define HELP 501 // display help
  25. #define COMPLIANCE 502 // external compliance suite
  26. #define SHIPCRIT 503 // internal compliance suite
  27. #define ERRORLOG 504 // big error log test
  28. #define TEST 505 // test test
  29. //
  30. // Sti service tests
  31. //
  32. enum TimedTests {
  33. // open iStillImage interface
  34. tCreateInstance,
  35. // IStillImage interface
  36. tGetDeviceList,
  37. tCreateDevice,
  38. tGetDeviceInfo,
  39. tGetDeviceValue,
  40. tSetDeviceValue,
  41. tRegisterLaunchApplication,
  42. tUnRegisterLaunchApplication,
  43. tEnableHwNotifications,
  44. tGetHwNotificationState,
  45. tWriteToErrorLog,
  46. // variation
  47. tWriteToErrorLogBig,
  48. tReleaseSti,
  49. // IStillDevice interface
  50. tGetStatusA,
  51. tGetStatusB,
  52. tGetStatusC,
  53. tGetCapabilities,
  54. tDeviceReset,
  55. tDiagnostic,
  56. tGetLastInfoError,
  57. tSubscribe,
  58. tUnSubscribe,
  59. tEscapeA,
  60. tEscapeB,
  61. tRawReadDataA,
  62. tRawReadDataB,
  63. tRawWriteDataA,
  64. tRawWriteDataB,
  65. tRawReadCommandA,
  66. tRawReadCommandB,
  67. tRawWriteCommandA,
  68. tRawWriteCommandB,
  69. tReleaseDevice,
  70. // select a device name
  71. tSelectDeviceName,
  72. // Scan (if HP SCL device)
  73. tAcquire,
  74. // help request
  75. tHelp,
  76. // Beginning of test pass initialization
  77. tBeginningOfTest,
  78. // output test
  79. tTest,
  80. // End of test pass summary
  81. tEndOfTest
  82. } tLabTests;
  83. //
  84. // display help
  85. //
  86. int nHelpSuite[] = {
  87. HELP,
  88. tBeginningOfTest,
  89. tHelp,
  90. tEndOfTest,
  91. -1
  92. };
  93. //
  94. // external Sti Compliance tests
  95. //
  96. int nComplianceSuite[] = {
  97. COMPLIANCE,
  98. tBeginningOfTest,
  99. tCreateInstance,
  100. tGetDeviceList,
  101. tCreateDevice,
  102. tGetStatusA,
  103. tGetStatusB,
  104. tGetStatusC,
  105. tDiagnostic,
  106. tGetDeviceValue,
  107. tGetCapabilities,
  108. tGetLastInfoError,
  109. // tSubscribe,
  110. // tUnSubscribe,
  111. tDeviceReset,
  112. tEscapeA,
  113. tRawReadDataA,
  114. tRawWriteDataA,
  115. tRawReadCommandA,
  116. tRawWriteCommandA,
  117. tReleaseDevice,
  118. tReleaseSti,
  119. tEndOfTest,
  120. -1
  121. };
  122. //
  123. // internal Sti Compliance tests
  124. //
  125. int nShipcritSuite[] = {
  126. SHIPCRIT,
  127. tBeginningOfTest,
  128. tCreateInstance,
  129. tGetDeviceList,
  130. tSelectDeviceName,
  131. tGetDeviceInfo,
  132. tGetDeviceValue,
  133. tSetDeviceValue,
  134. tRegisterLaunchApplication,
  135. tUnRegisterLaunchApplication,
  136. tEnableHwNotifications,
  137. tGetHwNotificationState,
  138. tWriteToErrorLog,
  139. tCreateDevice,
  140. tGetStatusA,
  141. tGetStatusB,
  142. tGetStatusC,
  143. tDiagnostic,
  144. tDeviceReset,
  145. tGetDeviceInfo,
  146. tGetDeviceValue,
  147. tSetDeviceValue,
  148. tRegisterLaunchApplication,
  149. tUnRegisterLaunchApplication,
  150. tEnableHwNotifications,
  151. tGetHwNotificationState,
  152. tWriteToErrorLog,
  153. tGetCapabilities,
  154. tGetLastInfoError,
  155. // tSubscribe,
  156. // tUnSubscribe,
  157. tEscapeA,
  158. tRawReadDataA,
  159. tRawWriteDataA,
  160. tRawReadCommandA,
  161. tRawWriteCommandA,
  162. tAcquire,
  163. tReleaseDevice,
  164. tReleaseSti,
  165. tEndOfTest,
  166. -1
  167. };
  168. //
  169. // big Error log tests
  170. //
  171. int nErrorlogSuite[] = {
  172. ERRORLOG,
  173. tBeginningOfTest,
  174. tCreateInstance,
  175. tGetDeviceList,
  176. tSelectDeviceName,
  177. tWriteToErrorLogBig,
  178. tReleaseSti,
  179. tEndOfTest,
  180. -1
  181. };
  182. //
  183. // test tests
  184. //
  185. int nOutputSuite[] = {
  186. TEST,
  187. tBeginningOfTest,
  188. tTest,
  189. tEndOfTest,
  190. -1
  191. };
  192. //
  193. // Test Suite test strings
  194. //
  195. STRINGTABLE StSuiteStrings[] =
  196. {
  197. tCreateInstance, "Create Instance",0,
  198. tGetDeviceList, "Get Device List",0,
  199. tCreateDevice, "Create Device",0,
  200. tGetDeviceInfo, "Get Device Info",0,
  201. tGetDeviceValue, "Get Device Value",0,
  202. tSetDeviceValue, "Set Device Value",0,
  203. tRegisterLaunchApplication, "Register Launch Application",0,
  204. tUnRegisterLaunchApplication, "UnRegister Launch Application",0,
  205. tEnableHwNotifications, "Enable Hardware Notifications",0,
  206. tGetHwNotificationState, "Get Hardware Notification State",0,
  207. tWriteToErrorLog, "Write To Error Log (variation A)",0,
  208. tWriteToErrorLogBig, "Write to Error Log (variation B)",0,
  209. tReleaseSti, "Release Sti subsystem",0,
  210. tGetStatusA, "Get Status (Online)",0,
  211. tGetStatusB, "Get Status (Event)",0,
  212. tGetStatusC, "Get Status (All)",0,
  213. tGetCapabilities, "Get Capabilities",0,
  214. tDeviceReset, "Device Reset",0,
  215. tDiagnostic, "Diagnostic",0,
  216. tGetLastInfoError, "Get Last Error Information",0,
  217. tSubscribe, "Subscribe",0,
  218. tUnSubscribe, "Unsubscribe",0,
  219. tEscapeA, "Escape (variation A)",0,
  220. tEscapeB, "Escape (variation B)",0,
  221. tRawReadDataA, "Raw Read Data (variation A)",0,
  222. tRawReadDataB, "Raw Read Data (variation B)",0,
  223. tRawWriteDataA, "Raw Write Data (variation A)",0,
  224. tRawWriteDataB, "Raw Write Data (variation B)",0,
  225. tRawReadCommandA, "Raw Read Command (variation A)",0,
  226. tRawReadCommandB, "Raw Read Command (variation B)",0,
  227. tRawWriteCommandA, "Raw Write Command (variation A)",0,
  228. tRawWriteCommandB, "Raw Write Command (variation B)",0,
  229. tReleaseDevice, "Release Device",0,
  230. tSelectDeviceName, "Select Device Name",0,
  231. tAcquire, "Acquire",0,
  232. tHelp, "Help",0,
  233. tBeginningOfTest, "Beginning of Test",0,
  234. tTest, "Test",0,
  235. tEndOfTest, "End of testing",0,
  236. 0, "Unknown Test",-1
  237. };
  238. //
  239. // timers
  240. //
  241. #define TIMER_ONE 3001
  242. #define TIMER_TWO 3002
  243. //
  244. // GLOBAL VARIABLES
  245. //
  246. //
  247. // global window handles
  248. //
  249. HINSTANCE hThisInstance; // current instance
  250. HWND hThisWindow; // current window
  251. HMENU hMenu; // current menu
  252. //
  253. // general purpose strings
  254. //
  255. HGLOBAL hLHand[5]; // utility string handles
  256. LPSTR lpzString; // utility FAR string
  257. PSTR pszOut, // TextOut string
  258. pszStr1, // utility NEAR strings
  259. pszStr2,
  260. pszStr3,
  261. pszStr4;
  262. //
  263. // global test settings
  264. //
  265. BOOL bAuto = FALSE, // TRUE = running an Automated test
  266. bCompDiag = TRUE, // TRUE = show COMPLIANCE test dialog
  267. bExit = FALSE; // TRUE = exit when test has completed
  268. int nError = 0, // number of errors
  269. nEvent = 0, // 1 = StiEvent, 2 = StiDevice
  270. nFatal = 0, // can't continue after this...
  271. nGo = 0, // 1 = nonstop timed test
  272. nHWState = 0, // current HWEnable state
  273. nICanScan = 0, // Stillvue can / can't scan this device
  274. nInATestSemaphore = 0, // 1 = a test is running
  275. nInTimerSemaphore = 0, // 1 = don't reenter TimerParse
  276. nLastLine = 1, // last line number in script
  277. nMaxCount = 1, // run test Suite this many times
  278. nNameOnly = 0, // 1 = select device name, not device
  279. nNextLine = 1, // next line of inf to run
  280. nNextTest = 0, // pointer to next test to run
  281. nPause = 0, // toggle for run (0) pause test (! 0)
  282. nRunInf = 0, // 0 = no INF, 1 = INF is loaded
  283. nRadix = 10, // base is decimal (or hex)
  284. nSaveLog = 0, // always write out log
  285. nScanCount = 0, // number of scans run so far
  286. nScriptLine = 1, // next script line to parse
  287. nTestCount = 1, // number of tests run so far
  288. nTestID = 0, // the current test ID
  289. nTimeMultiplier = 1000, // multiply nTimeNext for seconds
  290. nTimeNext = 5, // wait time between timer in seconds
  291. nTimeState = 0, // 0 timer is off, 1 timer is on
  292. nTimeScan = 60, // wait nTimeNext units before next scan
  293. nTTMax = 0, // temp var
  294. nTTNext = 0, // temp var
  295. nTTScan = 0, // temp var
  296. nUnSubscribe = 0, // 0 = UnSubscribe'd, 1 = Subscribed
  297. nUnSubscribeSemaphore = 0; // semaphore for UnSubscribe
  298. int *pSuite = nHelpSuite; // pointer to test Suite to run
  299. DWORD dwLastError = 0; // last GetLastError found
  300. //
  301. // text display
  302. //
  303. HWND hLogWindow;
  304. ULONG ulCount1,ulCount2;
  305. int cxChar,cxCaps,cyChar,cxClient,cyClient,iMaxWidth,
  306. iHscrollPos,iHscrollMax,
  307. iVscrollPos,iVscrollMax;
  308. //
  309. // inf, logfile, NT logging
  310. //
  311. HANDLE hLog = NULL, // output log file handle
  312. hDLog = NULL, // display output log handle
  313. hNTLog = NULL; // NT log handle
  314. char szInfName[LONGSTRING] = "", // input script file name
  315. szDLogName[LONGSTRING] = "",// display output log file name
  316. szWLogName[LONGSTRING] = "";// WHQL NTLOG output log file name
  317. LPSTR lpInf = NULL, // buffer for INF commands
  318. lpLine;
  319. DWORD dwNTStyle; // NTLog style
  320. //
  321. // device logging
  322. //
  323. PDEVLOG pdevPtr = NULL, // pointer to current device log device
  324. pdevRoot = NULL; // base of the device log table
  325. PVOID pInfoPrivate = NULL; // private list of devices under test
  326. PSTI_DEVICE_INFORMATION
  327. pInfoPrivatePtr = NULL; // pointer to device in pStiBuffer