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.

238 lines
7.5 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. pfrcfg.h
  5. Abstract:
  6. Client configuration class
  7. Revision History:
  8. created derekm 03/31/00
  9. ******************************************************************************/
  10. #ifndef PFRCFG_H
  11. #define PFRCFG_H
  12. const LPCWSTR c_wszRPCfg = L"Software\\Microsoft\\PCHealth\\ErrorReporting";
  13. const LPCWSTR c_wszRPCfgCPLExList = L"Software\\Microsoft\\PCHealth\\ErrorReporting\\ExclusionList";
  14. const LPCWSTR c_wszRPCfgPolicy = L"Software\\Policies\\Microsoft\\PCHealth\\ErrorReporting";
  15. const LPCWSTR c_wszRKDW = L"DW";
  16. const LPCWSTR c_wszRKIncList = L"InclusionList";
  17. const LPCWSTR c_wszRKExList = L"ExclusionList";
  18. const LPCWSTR c_wszRKWinCompList = L"WindowsAppsList";
  19. const LPCWSTR c_wszRVIncWinComp = L"IncludeWindowsApps";
  20. const LPCWSTR c_wszRVIncMS = L"IncludeMicrosoftApps";
  21. const LPCWSTR c_wszRVDumpPath = L"DWFileTreeRoot";
  22. const LPCWSTR c_wszRVShowUI = L"ShowUI";
  23. const LPCWSTR c_wszRVDoReport = L"DoReport";
  24. const LPCWSTR c_wszRVAllNone = L"AllOrNone";
  25. const LPCWSTR c_wszRVIncKernel = L"IncludeKernelFaults";
  26. const LPCWSTR c_wszRVInternalSrv = L"UseInternalServer";
  27. const LPCWSTR c_wszRVDefSrv = L"DefaultServer";
  28. const LPCWSTR c_wszRVDoTextLog = L"DoTextLog";
  29. const LPCWSTR c_wszRVMaxQueueSize = L"MaxUserQueueSize";
  30. const LPCWSTR c_wszRVNumHangPipe = L"NumberOfHangPipes";
  31. const LPCWSTR c_wszRVNumFaultPipe = L"NumberOfFaultPipes";
  32. const LPCWSTR c_wszRVForceQueue = L"ForceQueueMode";
  33. const LPCWSTR c_wszRVIncShutdown = L"IncludeShutdownErrs";
  34. // this value must NOT be raised such that the total # of pipes can be greater
  35. // MAXIMUM_WAIT_OBJECTS
  36. const DWORD c_cMaxPipes = 8;
  37. const DWORD c_cMinPipes = 1;
  38. const DWORD c_cMaxQueue = 128;
  39. #define FHCC_ALLNONE 0x0001
  40. #define FHCC_R0INCLUDE 0x0002
  41. #define FHCC_DUMPPATH 0x0004
  42. #define FHCC_SHOWUI 0x0008
  43. #define FHCC_WINCOMP 0x0010
  44. #define FHCC_DEFSRV 0x0080
  45. #define FHCC_INCMS 0x0200
  46. #define FHCC_DOREPORT 0x0400
  47. #define FHCC_QUEUESIZE 0x0800
  48. #define FHCC_NUMHANGPIPE 0x1000
  49. #define FHCC_NUMFAULTPIPE 0x2000
  50. #define FHCC_FORCEQUEUE 0x4000
  51. #define FHCC_INCSHUTDOWN 0x8000
  52. #define REPORT_POLICY 0x1
  53. #define SHOWUI_POLICY 0x2
  54. #define CPL_CORPPATH_SET 0x4
  55. #define eieIncMask 0x1
  56. #define eieDisableMask 0x2
  57. enum EIncEx
  58. {
  59. eieExclude = 0,
  60. eieInclude = eieIncMask,
  61. eieExDisabled = eieDisableMask,
  62. eieIncDisabled = eieIncMask | eieDisableMask,
  63. };
  64. #define eieEnableMask 0x1
  65. #define eieNoCheckMask 0x2
  66. enum EEnDis
  67. {
  68. eedDisabled = 0,
  69. eedEnabled = eieEnableMask,
  70. eedEnabledNoCheck = eieEnableMask | eieNoCheckMask,
  71. };
  72. enum EPFListType
  73. {
  74. epfltExclude = 0,
  75. epfltInclude,
  76. // this element must ALWAYS be the last item in the enum
  77. epfltListCount,
  78. };
  79. enum EPFAppAction
  80. {
  81. epfaaChecked = 0x1,
  82. epfaaUnchecked = 0x2,
  83. epfaaInitialized = 0x04,
  84. epfaaAdd = 0x100,
  85. epfaaDelete = 0x200,
  86. epfaaSetCheck = 0x400,
  87. epfaaRemCheck = 0x800
  88. };
  89. enum EReadOptions
  90. {
  91. eroPolicyRO,
  92. eroCPRO,
  93. eroCPRW,
  94. };
  95. #define ISCHECKED(x) ((x & epfaaSetCheck) != 0 || (x & (epfaaChecked | epfaaRemCheck)) == epfaaChecked)
  96. #define SETCHECK(x) x = ((x & ~epfaaRemCheck) | epfaaSetCheck);
  97. #define REMCHECK(x) x = ((x & ~epfaaSetCheck) | epfaaRemCheck);
  98. #define SETDEL(x) x = ((x & ~epfaaAdd) | epfaaDelete);
  99. #define SETADD(x) x = ((x & ~epfaaDelete) | epfaaAdd);
  100. struct SAppItem
  101. {
  102. DWORD dwState;
  103. WCHAR *wszApp;
  104. };
  105. struct SAppList
  106. {
  107. SAppItem *rgsai;
  108. DWORD cSlots;
  109. DWORD cSlotsUsed;
  110. DWORD cSlotsEmpty;
  111. DWORD dwState;
  112. DWORD cchMaxVal;
  113. DWORD cItemsInReg;
  114. HKEY hkey;
  115. };
  116. /////////////////////////////////////////////////////////////////////////////
  117. // CPFFaultClientCfg
  118. class CPFFaultClientCfg
  119. {
  120. private:
  121. CRITICAL_SECTION m_cs;
  122. SAppList m_rgLists[epfltListCount];
  123. EEnDis m_eedUI;
  124. EEnDis m_eedReport;
  125. EEnDis m_eedTextLog;
  126. EIncEx m_eieApps;
  127. EIncEx m_eieMS;
  128. EIncEx m_eieWin;
  129. EIncEx m_eieKernel;
  130. EIncEx m_eieShutdown;
  131. DWORD m_dwUseInternal;
  132. DWORD m_cFaultPipes;
  133. DWORD m_cHangPipes;
  134. DWORD m_cMaxQueueItems;
  135. WCHAR m_wszDump[MAX_PATH + 1];
  136. WCHAR m_wszSrv[1025];
  137. BOOL m_fForceQueue;
  138. DWORD m_dwStatus;
  139. DWORD m_dwDirty;
  140. PBYTE m_pbWinApps;
  141. BOOL m_fRead;
  142. BOOL m_fRO;
  143. BOOL m_fSrv;
  144. HRESULT IsRead(void) { return (m_fRead) ? NOERROR : this->Read(); }
  145. void Clear(void);
  146. public:
  147. CPFFaultClientCfg(void);
  148. ~CPFFaultClientCfg(void);
  149. HRESULT Read(EReadOptions ero = eroCPRW);
  150. BOOL ShouldCollect(LPWSTR wszAppPath = NULL, BOOL *pfIsMSApp = NULL);
  151. EEnDis get_ShowUI(void) { return m_eedUI; }
  152. EEnDis get_DoReport(void) { return m_eedReport; }
  153. EEnDis get_TextLog(void) { return m_eedTextLog; }
  154. EIncEx get_AllOrNone(void) { return m_eieApps; }
  155. EIncEx get_IncMSApps(void) { return m_eieMS; }
  156. EIncEx get_IncWinComp(void) { return m_eieWin; }
  157. EIncEx get_IncKernel(void) { return m_eieKernel; }
  158. EIncEx get_IncShutdown(void) { return m_eieShutdown; }
  159. DWORD get_UseInternal(void) { return m_dwUseInternal; }
  160. DWORD get_NumHangPipes(void) { return m_cHangPipes; }
  161. DWORD get_NumFaultPipes(void) { return m_cFaultPipes; }
  162. DWORD get_MaxUserQueueSize(void) { return m_cMaxQueueItems; }
  163. BOOL get_ForceQueueMode(void) { return m_fForceQueue; }
  164. LPCWSTR get_DumpPath(LPWSTR wsz, int cch);
  165. LPCWSTR get_DefaultServer(LPWSTR wsz, int cch);
  166. DWORD get_CfgStatus(void) { return m_dwStatus; }
  167. BOOL get_IsServer(void) { return m_fSrv; }
  168. #ifndef PFCLICFG_LITE
  169. BOOL HasWriteAccess(void);
  170. BOOL set_ShowUI(EEnDis ees);
  171. BOOL set_DoReport(EEnDis ees);
  172. BOOL set_AllOrNone(EIncEx eie);
  173. BOOL set_IncMSApps(EIncEx eie);
  174. BOOL set_IncWinComp(EIncEx eie);
  175. BOOL set_IncKernel(EIncEx eie);
  176. BOOL set_IncShutdown(EIncEx eie);
  177. BOOL set_NumHangPipes(DWORD cPipes);
  178. BOOL set_NumFaultPipes(DWORD cPipes);
  179. BOOL set_MaxUserQueueSize(DWORD cItems);
  180. BOOL set_DumpPath(LPCWSTR wsz);
  181. BOOL set_DefaultServer(LPCWSTR wsz);
  182. BOOL set_ForceQueueMode(BOOL fForceQueueMode);
  183. HRESULT Write(void);
  184. HRESULT InitList(EPFListType epflt);
  185. HRESULT get_ListRegInfo(EPFListType epflt, DWORD *pcchMaxName,
  186. DWORD *pcApps);
  187. HRESULT get_ListRegApp(EPFListType epflt, DWORD iApp, LPWSTR wszApp,
  188. DWORD cchApp, DWORD *pdwChecked);
  189. HRESULT add_ListApp(EPFListType epflt, LPCWSTR wszApp);
  190. HRESULT del_ListApp(EPFListType epflt, LPWSTR wszApp);
  191. HRESULT mod_ListApp(EPFListType epflt, LPWSTR wszApp, DWORD dwChecked);
  192. HRESULT ClearChanges(EPFListType epflt);
  193. HRESULT CommitChanges(EPFListType epflt);
  194. BOOL IsOnList(EPFListType epflt, LPCWSTR wszApp);
  195. #endif
  196. };
  197. #endif