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.

187 lines
5.0 KiB

  1. #ifndef __APPVERIFIER_DBSUPPORT_H_
  2. #define __APPVERIFIER_DBSUPPORT_H_
  3. typedef enum {
  4. TEST_SHIM,
  5. TEST_KERNEL
  6. } TestType;
  7. class CIncludeInfo {
  8. public:
  9. wstring strModule;
  10. BOOL bInclude;
  11. CIncludeInfo(void) :
  12. bInclude(TRUE) {}
  13. };
  14. typedef vector<CIncludeInfo> CIncludeArray;
  15. typedef vector<wstring> CWStringArray;
  16. class CTestInfo {
  17. public:
  18. //
  19. // valid for all tests
  20. //
  21. TestType eTestType;
  22. wstring strTestName;
  23. wstring strTestDescription;
  24. wstring strTestFriendlyName;
  25. BOOL bDefault; // is this test turned on by default?
  26. BOOL bWin2KCompatible; // can this test be run on Win2K?
  27. BOOL bRunAlone; // should this test be run alone?
  28. BOOL bSetupOK; // can this test be run on a setup app?
  29. BOOL bNonSetupOK; // can this test be run on a non-setup app?
  30. BOOL bPseudoShim; // this test is not a shim, and shouldn't be applied to apps
  31. BOOL bNonTest; // this is not a test at all, and is only in the list to provide an options page
  32. BOOL bInternal; // this test is appropriate for internal MS NTDEV use
  33. BOOL bExternal; // this test is appropriate for external (non MS or non NTDEV) use
  34. //
  35. // if type is TEST_SHIM, the following are valid
  36. //
  37. wstring strDllName;
  38. CIncludeArray aIncludes;
  39. WORD wVersionHigh;
  40. WORD wVersionLow;
  41. PROPSHEETPAGE PropSheetPage;
  42. //
  43. // if type is TEST_KERNEL, the following are valid
  44. //
  45. DWORD dwKernelFlag;
  46. CTestInfo(void) :
  47. eTestType(TEST_SHIM),
  48. dwKernelFlag(0),
  49. bDefault(TRUE),
  50. wVersionHigh(0),
  51. wVersionLow(0),
  52. bWin2KCompatible(TRUE),
  53. bRunAlone(FALSE),
  54. bSetupOK(TRUE),
  55. bNonSetupOK(TRUE),
  56. bPseudoShim(FALSE),
  57. bNonTest(FALSE),
  58. bInternal(TRUE),
  59. bExternal(TRUE) {
  60. ZeroMemory(&PropSheetPage, sizeof(PROPSHEETPAGE));
  61. PropSheetPage.dwSize = sizeof(PROPSHEETPAGE);
  62. }
  63. };
  64. typedef vector<CTestInfo> CTestInfoArray;
  65. class CAVAppInfo {
  66. public:
  67. wstring wstrExeName;
  68. wstring wstrExePath; // optional
  69. DWORD dwRegFlags;
  70. CWStringArray awstrShims;
  71. //BOOL bClearSessionLogBeforeRun;
  72. BOOL bBreakOnLog;
  73. BOOL bFullPageHeap;
  74. BOOL bUseAVDebugger;
  75. BOOL bPropagateTests;
  76. wstring wstrDebugger;
  77. CAVAppInfo() :
  78. dwRegFlags(0),
  79. bBreakOnLog(FALSE),
  80. bFullPageHeap(FALSE),
  81. bUseAVDebugger(FALSE),
  82. bPropagateTests(FALSE) {}
  83. void
  84. AddTest(CTestInfo &Test) {
  85. if (Test.eTestType == TEST_KERNEL) {
  86. dwRegFlags |= Test.dwKernelFlag;
  87. } else {
  88. for (wstring *pStr = awstrShims.begin(); pStr != awstrShims.end(); ++pStr) {
  89. if (*pStr == Test.strTestName) {
  90. return;
  91. }
  92. }
  93. // not found, so add
  94. awstrShims.push_back(Test.strTestName);
  95. }
  96. }
  97. void
  98. RemoveTest(CTestInfo &Test) {
  99. if (Test.eTestType == TEST_KERNEL) {
  100. dwRegFlags &= ~(Test.dwKernelFlag);
  101. } else {
  102. for (wstring *pStr = awstrShims.begin(); pStr != awstrShims.end(); ++pStr) {
  103. if (*pStr == Test.strTestName) {
  104. awstrShims.erase(pStr);
  105. return;
  106. }
  107. }
  108. }
  109. }
  110. BOOL
  111. IsTestActive(CTestInfo &Test) {
  112. if (Test.eTestType == TEST_KERNEL) {
  113. return (dwRegFlags & Test.dwKernelFlag) == Test.dwKernelFlag;
  114. } else {
  115. for (wstring *pStr = awstrShims.begin(); pStr != awstrShims.end(); ++pStr) {
  116. if (*pStr == Test.strTestName) {
  117. return TRUE;
  118. }
  119. }
  120. return FALSE;
  121. }
  122. }
  123. };
  124. typedef vector<CAVAppInfo> CAVAppInfoArray;
  125. typedef struct _KERNEL_TEST_INFO
  126. {
  127. ULONG m_uFriendlyNameStringId;
  128. ULONG m_uDescriptionStringId;
  129. DWORD m_dwBit;
  130. BOOL m_bDefault;
  131. LPWSTR m_szCommandLine;
  132. BOOL m_bWin2KCompatible;
  133. } KERNEL_TEST_INFO, *PKERNEL_TEST_INFO;
  134. extern CAVAppInfoArray g_aAppInfo;
  135. extern CTestInfoArray g_aTestInfo;
  136. void
  137. ResetVerifierLog(void);
  138. BOOL
  139. InitTestInfo(void);
  140. void
  141. GetCurrentAppSettings(void);
  142. void
  143. SetCurrentAppSettings(void);
  144. BOOL
  145. AppCompatWriteShimSettings(
  146. CAVAppInfoArray& arrAppInfo,
  147. BOOL b32bitOnly
  148. );
  149. BOOL
  150. AppCompatDeleteSettings(
  151. void
  152. );
  153. #endif // __APPVERIFIER_DBSUPPORT_H_