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.

137 lines
3.0 KiB

  1. #ifndef __APPVERIFIER_DBSUPPORT_H_
  2. #define __APPVERIFIER_DBSUPPORT_H_
  3. typedef enum {
  4. TEST_SHIM,
  5. TEST_KERNEL
  6. } TestType;
  7. typedef vector<wstring> CWStringArray;
  8. class CTestInfo {
  9. public:
  10. //
  11. // valid for all tests
  12. //
  13. TestType eTestType;
  14. wstring strTestName;
  15. wstring strTestDescription;
  16. wstring strTestCommandLine;
  17. BOOL bDefault; // is this test turned on by default?
  18. //
  19. // if type is TEST_SHIM, the following are valid
  20. //
  21. wstring strDllName;
  22. CWStringArray astrIncludes;
  23. CWStringArray astrExcludes;
  24. //
  25. // if type is TEST_KERNEL, the following are valid
  26. //
  27. DWORD dwKernelFlag;
  28. CTestInfo(void) :
  29. eTestType(TEST_SHIM),
  30. dwKernelFlag(0),
  31. bDefault(TRUE) {}
  32. };
  33. typedef vector<CTestInfo> CTestInfoArray;
  34. class CAVAppInfo {
  35. public:
  36. wstring wstrExeName;
  37. wstring wstrExePath; // optional
  38. DWORD dwRegFlags;
  39. CWStringArray awstrShims;
  40. CAVAppInfo() : dwRegFlags(0) {}
  41. void
  42. AddTest(CTestInfo &Test) {
  43. if (Test.eTestType == TEST_KERNEL) {
  44. dwRegFlags |= Test.dwKernelFlag;
  45. } else {
  46. for (wstring *pStr = awstrShims.begin(); pStr != awstrShims.end(); ++pStr) {
  47. if (*pStr == Test.strTestName) {
  48. return;
  49. }
  50. }
  51. // not found, so add
  52. awstrShims.push_back(Test.strTestName);
  53. }
  54. }
  55. void
  56. RemoveTest(CTestInfo &Test) {
  57. if (Test.eTestType == TEST_KERNEL) {
  58. dwRegFlags &= ~(Test.dwKernelFlag);
  59. } else {
  60. for (wstring *pStr = awstrShims.begin(); pStr != awstrShims.end(); ++pStr) {
  61. if (*pStr == Test.strTestName) {
  62. awstrShims.erase(pStr);
  63. return;
  64. }
  65. }
  66. }
  67. }
  68. BOOL
  69. IsTestActive(CTestInfo &Test) {
  70. if (Test.eTestType == TEST_KERNEL) {
  71. return (dwRegFlags & Test.dwKernelFlag) == Test.dwKernelFlag;
  72. } else {
  73. for (wstring *pStr = awstrShims.begin(); pStr != awstrShims.end(); ++pStr) {
  74. if (*pStr == Test.strTestName) {
  75. return TRUE;
  76. }
  77. }
  78. return FALSE;
  79. }
  80. }
  81. };
  82. typedef vector<CAVAppInfo> CAVAppInfoArray;
  83. typedef struct _KERNEL_TEST_INFO
  84. {
  85. ULONG m_uNameStringId;
  86. ULONG m_uDescriptionStringId;
  87. DWORD m_dwBit;
  88. BOOL m_bDefault;
  89. LPWSTR m_szCommandLine;
  90. } KERNEL_TEST_INFO, *PKERNEL_TEST_INFO;
  91. extern CAVAppInfoArray g_aAppInfo;
  92. extern CTestInfoArray g_aTestInfo;
  93. void
  94. ResetVerifierLog(void);
  95. BOOL
  96. InitTestInfo(void);
  97. void
  98. GetCurrentAppSettings(void);
  99. void
  100. SetCurrentAppSettings(void);
  101. BOOL
  102. AppCompatWriteShimSettings(
  103. CAVAppInfoArray& arrAppInfo
  104. );
  105. BOOL
  106. AppCompatDeleteSettings(
  107. void
  108. );
  109. #endif // __APPVERIFIER_DBSUPPORT_H_