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.

1387 lines
38 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. logger.cpp (cgenericlogger.h derivation)
  5. Abstract:
  6. This file contains derived class definitions for logging RSOP security extension data to WMI.
  7. There is one class defined for each schema RSOP security extension class (see .mof file).
  8. Author:
  9. Vishnu Patankar (VishnuP) 7-April-2000
  10. Environment:
  11. User Mode - Win32
  12. Revision History:
  13. --*/
  14. ///////////////////////////////////////////////////////////////////////////////
  15. // //
  16. // Includes //
  17. // //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #include "logger.h"
  20. #include "kerberos.h"
  21. #ifndef Thread
  22. #define Thread __declspec( thread )
  23. #endif
  24. //extern void Thread *tg_pWbemServices;
  25. /////////////////////////////////////////////////////////////////////
  26. // Log class definition for
  27. // RSOP_SecuritySettingNumeric schema class
  28. //////////////////////////////////////////////////////////////////////
  29. RSOP_SecuritySettingNumericLogger::RSOP_SecuritySettingNumericLogger(IWbemServices *pNamespace,
  30. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  31. {
  32. m_pHr = WBEM_S_NO_ERROR;
  33. m_xbstrClassName = L"RSOP_SecuritySettingNumeric";
  34. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  35. m_xbstrKeyName = L"KeyName";
  36. if (!m_xbstrKeyName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  37. m_xbstrSetting = L"Setting";
  38. if (!m_xbstrSetting) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  39. m_bInitialized = TRUE;
  40. done:
  41. return;
  42. }
  43. RSOP_SecuritySettingNumericLogger::~RSOP_SecuritySettingNumericLogger()
  44. {
  45. }
  46. HRESULT
  47. RSOP_SecuritySettingNumericLogger::Log( WCHAR *wcKeyName, DWORD dwValue, DWORD dwPrecedence){
  48. m_pHr = WBEM_S_NO_ERROR;
  49. m_pHr = SpawnAnInstance(&m_pObj);
  50. if (FAILED(m_pHr)) goto done;
  51. m_pHr = PutGenericProperties();
  52. if (FAILED(m_pHr)) goto done;
  53. m_pHr = PutProperty(m_pObj, m_xbstrKeyName, wcKeyName);
  54. if (FAILED(m_pHr)) goto done;
  55. m_pHr = PutProperty(m_pObj, m_xbstrSetting, (int)dwValue);
  56. if (FAILED(m_pHr)) goto done;
  57. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  58. if (FAILED(m_pHr)) goto done;
  59. m_pHr = PutInstAndFreeObj();
  60. if (FAILED(m_pHr)) goto done;
  61. done:
  62. return m_pHr;
  63. }
  64. /////////////////////////////////////////////////////////////////////
  65. // Log class definition for
  66. // RSOP_SecuritySettingBoolean schema class
  67. //////////////////////////////////////////////////////////////////////
  68. RSOP_SecuritySettingBooleanLogger::RSOP_SecuritySettingBooleanLogger(IWbemServices *pNamespace,
  69. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  70. {
  71. m_pHr = WBEM_S_NO_ERROR;
  72. m_xbstrClassName = L"RSOP_SecuritySettingBoolean";
  73. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  74. m_xbstrKeyName = L"KeyName";
  75. if (!m_xbstrKeyName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  76. m_xbstrSetting = L"Setting";
  77. if (!m_xbstrSetting) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  78. m_bInitialized = TRUE;
  79. done:
  80. return;
  81. }
  82. RSOP_SecuritySettingBooleanLogger::~RSOP_SecuritySettingBooleanLogger()
  83. {
  84. }
  85. HRESULT
  86. RSOP_SecuritySettingBooleanLogger::Log( WCHAR *wcKeyName, DWORD dwValue, DWORD dwPrecedence){
  87. m_pHr = WBEM_S_NO_ERROR;
  88. m_pHr = SpawnAnInstance(&m_pObj);
  89. if (FAILED(m_pHr)) goto done;
  90. m_pHr = PutGenericProperties();
  91. if (FAILED(m_pHr)) goto done;
  92. m_pHr = PutProperty(m_pObj, m_xbstrKeyName, wcKeyName);
  93. if (FAILED(m_pHr)) goto done;
  94. m_pHr = PutProperty(m_pObj, m_xbstrSetting, (BOOL)(dwValue ? TRUE : FALSE));
  95. if (FAILED(m_pHr)) goto done;
  96. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  97. if (FAILED(m_pHr)) goto done;
  98. m_pHr = PutInstAndFreeObj();
  99. if (FAILED(m_pHr)) goto done;
  100. done:
  101. return m_pHr;
  102. }
  103. /////////////////////////////////////////////////////////////////////
  104. // Log class definition for
  105. // RSOP_SecuritySettingString schema class
  106. //////////////////////////////////////////////////////////////////////
  107. RSOP_SecuritySettingStringLogger::RSOP_SecuritySettingStringLogger(IWbemServices *pNamespace,
  108. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  109. {
  110. m_pHr = WBEM_S_NO_ERROR;
  111. m_xbstrClassName = L"RSOP_SecuritySettingString";
  112. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  113. m_xbstrKeyName = L"KeyName";
  114. if (!m_xbstrKeyName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  115. m_xbstrSetting = L"Setting";
  116. if (!m_xbstrSetting) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  117. m_bInitialized = TRUE;
  118. done:
  119. return;
  120. }
  121. RSOP_SecuritySettingStringLogger::~RSOP_SecuritySettingStringLogger()
  122. {
  123. }
  124. HRESULT
  125. RSOP_SecuritySettingStringLogger::Log( WCHAR *wcKeyName, PWSTR pwszValue, DWORD dwPrecedence){
  126. m_pHr = WBEM_S_NO_ERROR;
  127. m_pHr = SpawnAnInstance(&m_pObj);
  128. if (FAILED(m_pHr)) goto done;
  129. m_pHr = PutGenericProperties();
  130. if (FAILED(m_pHr)) goto done;
  131. m_pHr = PutProperty(m_pObj, m_xbstrKeyName, wcKeyName);
  132. if (FAILED(m_pHr)) goto done;
  133. m_pHr = PutProperty(m_pObj, m_xbstrSetting, pwszValue);
  134. if (FAILED(m_pHr)) goto done;
  135. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  136. if (FAILED(m_pHr)) goto done;
  137. m_pHr = PutInstAndFreeObj();
  138. if (FAILED(m_pHr)) goto done;
  139. done:
  140. return m_pHr;
  141. }
  142. /////////////////////////////////////////////////////////////////////
  143. // Log class definition for
  144. // RSOP_AuditPolicy schema class
  145. //////////////////////////////////////////////////////////////////////
  146. RSOP_AuditPolicyLogger::RSOP_AuditPolicyLogger(IWbemServices *pNamespace,
  147. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  148. {
  149. m_pHr = WBEM_S_NO_ERROR;
  150. m_xbstrClassName = L"RSOP_AuditPolicy";
  151. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  152. m_xbstrCategory = L"Category";
  153. if (!m_xbstrCategory) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  154. m_xbstrSuccess = L"Success";
  155. if (!m_xbstrSuccess) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  156. m_xbstrFailure = L"Failure";
  157. if (!m_xbstrFailure) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  158. m_bInitialized = TRUE;
  159. done:
  160. return;
  161. }
  162. RSOP_AuditPolicyLogger::~RSOP_AuditPolicyLogger()
  163. {
  164. }
  165. HRESULT
  166. RSOP_AuditPolicyLogger::Log( WCHAR *wcCategory, DWORD dwValue, DWORD dwPrecedence){
  167. m_pHr = WBEM_S_NO_ERROR;
  168. m_pHr = SpawnAnInstance(&m_pObj);
  169. if (FAILED(m_pHr)) goto done;
  170. m_pHr = PutGenericProperties();
  171. if (FAILED(m_pHr)) goto done;
  172. m_pHr = PutProperty(m_pObj, m_xbstrCategory, wcCategory);
  173. if (FAILED(m_pHr)) goto done;
  174. m_pHr = PutProperty(m_pObj, m_xbstrSuccess, (BOOL)(dwValue & POLICY_AUDIT_EVENT_SUCCESS ? TRUE : FALSE));
  175. if (FAILED(m_pHr)) goto done;
  176. m_pHr = PutProperty(m_pObj, m_xbstrFailure, (BOOL)(dwValue & POLICY_AUDIT_EVENT_FAILURE ? TRUE : FALSE));
  177. if (FAILED(m_pHr)) goto done;
  178. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  179. if (FAILED(m_pHr)) goto done;
  180. m_pHr = PutInstAndFreeObj();
  181. if (FAILED(m_pHr)) goto done;
  182. done:
  183. return m_pHr;
  184. }
  185. /////////////////////////////////////////////////////////////////////
  186. // Log class definition for
  187. // RSOP_SecurityEventLogSettingNumeric schema class
  188. //////////////////////////////////////////////////////////////////////
  189. RSOP_SecurityEventLogSettingNumericLogger::RSOP_SecurityEventLogSettingNumericLogger(IWbemServices *pNamespace,
  190. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  191. {
  192. m_pHr = WBEM_S_NO_ERROR;
  193. m_xbstrClassName = L"RSOP_SecurityEventLogSettingNumeric";
  194. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  195. m_xbstrType = L"Type";
  196. if (!m_xbstrType) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  197. m_xbstrKeyName = L"KeyName";
  198. if (!m_xbstrKeyName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  199. m_xbstrSetting = L"Setting";
  200. if (!m_xbstrSetting) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  201. m_bInitialized = TRUE;
  202. done:
  203. return;
  204. }
  205. RSOP_SecurityEventLogSettingNumericLogger::~RSOP_SecurityEventLogSettingNumericLogger()
  206. {
  207. }
  208. HRESULT
  209. RSOP_SecurityEventLogSettingNumericLogger::Log( WCHAR *wcKeyName, PWSTR pwszType, DWORD dwValue, DWORD dwPrecedence){
  210. m_pHr = WBEM_S_NO_ERROR;
  211. m_pHr = SpawnAnInstance(&m_pObj);
  212. if (FAILED(m_pHr)) goto done;
  213. m_pHr = PutGenericProperties();
  214. if (FAILED(m_pHr)) goto done;
  215. m_pHr = PutProperty(m_pObj, m_xbstrKeyName, wcKeyName);
  216. if (FAILED(m_pHr)) goto done;
  217. m_pHr = PutProperty(m_pObj, m_xbstrType, pwszType);
  218. if (FAILED(m_pHr)) goto done;
  219. m_pHr = PutProperty(m_pObj, m_xbstrSetting, (int)dwValue);
  220. if (FAILED(m_pHr)) goto done;
  221. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  222. if (FAILED(m_pHr)) goto done;
  223. m_pHr = PutInstAndFreeObj();
  224. if (FAILED(m_pHr)) goto done;
  225. done:
  226. return m_pHr;
  227. }
  228. /////////////////////////////////////////////////////////////////////
  229. // Log class definition for
  230. // RSOP_SecurityEventLogSettingBoolean schema class
  231. //////////////////////////////////////////////////////////////////////
  232. RSOP_SecurityEventLogSettingBooleanLogger::RSOP_SecurityEventLogSettingBooleanLogger(IWbemServices *pNamespace,
  233. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  234. {
  235. m_pHr = WBEM_S_NO_ERROR;
  236. m_xbstrClassName = L"RSOP_SecurityEventLogSettingBoolean";
  237. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  238. m_xbstrType = L"Type";
  239. if (!m_xbstrType) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  240. m_xbstrKeyName = L"KeyName";
  241. if (!m_xbstrKeyName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  242. m_xbstrSetting = L"Setting";
  243. if (!m_xbstrSetting) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  244. m_bInitialized = TRUE;
  245. done:
  246. return;
  247. }
  248. RSOP_SecurityEventLogSettingBooleanLogger::~RSOP_SecurityEventLogSettingBooleanLogger()
  249. {
  250. }
  251. HRESULT
  252. RSOP_SecurityEventLogSettingBooleanLogger::Log( WCHAR *wcKeyName, PWSTR pwszType, DWORD dwValue, DWORD dwPrecedence){
  253. m_pHr = WBEM_S_NO_ERROR;
  254. m_pHr = SpawnAnInstance(&m_pObj);
  255. if (FAILED(m_pHr)) goto done;
  256. m_pHr = PutGenericProperties();
  257. if (FAILED(m_pHr)) goto done;
  258. m_pHr = PutProperty(m_pObj, m_xbstrKeyName, wcKeyName);
  259. if (FAILED(m_pHr)) goto done;
  260. m_pHr = PutProperty(m_pObj, m_xbstrType, pwszType);
  261. if (FAILED(m_pHr)) goto done;
  262. m_pHr = PutProperty(m_pObj, m_xbstrSetting, (BOOL)(dwValue ? TRUE : FALSE));
  263. if (FAILED(m_pHr)) goto done;
  264. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  265. if (FAILED(m_pHr)) goto done;
  266. m_pHr = PutInstAndFreeObj();
  267. if (FAILED(m_pHr)) goto done;
  268. done:
  269. return m_pHr;
  270. }
  271. /////////////////////////////////////////////////////////////////////
  272. // Log class definition for
  273. // RSOP_RegistryValue schema class
  274. //////////////////////////////////////////////////////////////////////
  275. RSOP_RegistryValueLogger::RSOP_RegistryValueLogger(IWbemServices *pNamespace,
  276. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  277. {
  278. m_pHr = WBEM_S_NO_ERROR;
  279. m_xbstrClassName = L"RSOP_RegistryValue";
  280. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  281. m_xbstrType = L"Type";
  282. if (!m_xbstrType) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  283. m_xbstrPath = L"Path";
  284. if (!m_xbstrPath) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  285. m_xbstrData = L"Data";
  286. if (!m_xbstrData) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  287. m_bInitialized = TRUE;
  288. done:
  289. return;
  290. }
  291. RSOP_RegistryValueLogger::~RSOP_RegistryValueLogger()
  292. {
  293. }
  294. HRESULT
  295. RSOP_RegistryValueLogger::Log( WCHAR *wcPath, DWORD dwType, PWSTR pwszData, DWORD dwPrecedence){
  296. m_pHr = WBEM_S_NO_ERROR;
  297. m_pHr = SpawnAnInstance(&m_pObj);
  298. if (FAILED(m_pHr)) goto done;
  299. m_pHr = PutGenericProperties();
  300. if (FAILED(m_pHr)) goto done;
  301. m_pHr = PutProperty(m_pObj, m_xbstrPath, wcPath);
  302. if (FAILED(m_pHr)) goto done;
  303. m_pHr = PutProperty(m_pObj, m_xbstrType, (int)dwType);
  304. if (FAILED(m_pHr)) goto done;
  305. m_pHr = PutProperty(m_pObj, m_xbstrData, pwszData);
  306. if (FAILED(m_pHr)) goto done;
  307. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  308. if (FAILED(m_pHr)) goto done;
  309. m_pHr = PutInstAndFreeObj();
  310. if (FAILED(m_pHr)) goto done;
  311. done:
  312. return m_pHr;
  313. }
  314. /////////////////////////////////////////////////////////////////////
  315. // Log class definition for
  316. // RSOP_UserPrivilegeRight schema class
  317. //////////////////////////////////////////////////////////////////////
  318. RSOP_UserPrivilegeRightLogger::RSOP_UserPrivilegeRightLogger(IWbemServices *pNamespace,
  319. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  320. {
  321. m_pHr = WBEM_S_NO_ERROR;
  322. m_xbstrClassName = L"RSOP_UserPrivilegeRight";
  323. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  324. m_xbstrUserRight = L"UserRight";
  325. if (!m_xbstrUserRight) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  326. m_xbstrAccountList = L"AccountList";
  327. if (!m_xbstrAccountList) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  328. m_bInitialized = TRUE;
  329. done:
  330. return;
  331. }
  332. RSOP_UserPrivilegeRightLogger::~RSOP_UserPrivilegeRightLogger()
  333. {
  334. }
  335. HRESULT
  336. RSOP_UserPrivilegeRightLogger::Log( WCHAR *wcUserRight, PSCE_NAME_LIST pList, DWORD dwPrecedence){
  337. m_pHr = WBEM_S_NO_ERROR;
  338. m_pHr = SpawnAnInstance(&m_pObj);
  339. if (FAILED(m_pHr)) goto done;
  340. m_pHr = PutGenericProperties();
  341. if (FAILED(m_pHr)) goto done;
  342. m_pHr = PutProperty(m_pObj, m_xbstrUserRight, wcUserRight);
  343. if (FAILED(m_pHr)) goto done;
  344. m_pHr = PutProperty(m_pObj, m_xbstrAccountList, pList);
  345. if (FAILED(m_pHr)) goto done;
  346. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  347. if (FAILED(m_pHr)) goto done;
  348. m_pHr = PutInstAndFreeObj();
  349. if (FAILED(m_pHr)) goto done;
  350. done:
  351. return m_pHr;
  352. }
  353. /////////////////////////////////////////////////////////////////////
  354. // Log class definition for
  355. // RSOP_RestrictedGroup schema class
  356. //////////////////////////////////////////////////////////////////////
  357. RSOP_RestrictedGroupLogger::RSOP_RestrictedGroupLogger(IWbemServices *pNamespace,
  358. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  359. {
  360. m_pHr = WBEM_S_NO_ERROR;
  361. m_xbstrClassName = L"RSOP_RestrictedGroup";
  362. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  363. m_xbstrGroupName = L"GroupName";
  364. if (!m_xbstrGroupName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  365. m_xbstrMembers = L"Members";
  366. if (!m_xbstrMembers) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  367. m_bInitialized = TRUE;
  368. done:
  369. return;
  370. }
  371. RSOP_RestrictedGroupLogger::~RSOP_RestrictedGroupLogger()
  372. {
  373. }
  374. HRESULT
  375. RSOP_RestrictedGroupLogger::Log( WCHAR *wcGroupName, PSCE_NAME_LIST pList, DWORD dwPrecedence){
  376. m_pHr = WBEM_S_NO_ERROR;
  377. m_pHr = SpawnAnInstance(&m_pObj);
  378. if (FAILED(m_pHr)) goto done;
  379. m_pHr = PutGenericProperties();
  380. if (FAILED(m_pHr)) goto done;
  381. m_pHr = PutProperty(m_pObj, m_xbstrGroupName, wcGroupName);
  382. if (FAILED(m_pHr)) goto done;
  383. m_pHr = PutProperty(m_pObj, m_xbstrMembers, pList);
  384. if (FAILED(m_pHr)) goto done;
  385. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  386. if (FAILED(m_pHr)) goto done;
  387. m_pHr = PutInstAndFreeObj();
  388. if (FAILED(m_pHr)) goto done;
  389. done:
  390. return m_pHr;
  391. }
  392. /////////////////////////////////////////////////////////////////////
  393. // Log class definition for
  394. // RSOP_SystemService schema class
  395. //////////////////////////////////////////////////////////////////////
  396. RSOP_SystemServiceLogger::RSOP_SystemServiceLogger(IWbemServices *pNamespace,
  397. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  398. {
  399. m_pHr = WBEM_S_NO_ERROR;
  400. m_xbstrClassName = L"RSOP_SystemService";
  401. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  402. m_xbstrService = L"Service";
  403. if (!m_xbstrService) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  404. m_xbstrStartupMode = L"StartupMode";
  405. if (!m_xbstrStartupMode) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  406. m_xbstrSDDLString = L"SDDLString";
  407. if (!m_xbstrSDDLString) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  408. m_bInitialized = TRUE;
  409. done:
  410. return;
  411. }
  412. RSOP_SystemServiceLogger::~RSOP_SystemServiceLogger()
  413. {
  414. }
  415. HRESULT
  416. RSOP_SystemServiceLogger::Log( WCHAR *wcService, BYTE m_byStartupMode, PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_INFORMATION SeInfo, DWORD dwPrecedence){
  417. DWORD rc;
  418. PWSTR SDspec=NULL;
  419. DWORD SDsize=0;
  420. m_pHr = WBEM_S_NO_ERROR;
  421. rc = ConvertSecurityDescriptorToText(
  422. pSecurityDescriptor,
  423. SeInfo,
  424. &SDspec,
  425. &SDsize
  426. );
  427. if (rc!= ERROR_SUCCESS) {m_pHr = ScepDosErrorToWbemError(rc); goto done;}
  428. if (m_pHr != WBEM_S_NO_ERROR) goto done;
  429. m_pHr = SpawnAnInstance(&m_pObj);
  430. if (FAILED(m_pHr)) goto done;
  431. m_pHr = PutGenericProperties();
  432. if (FAILED(m_pHr)) goto done;
  433. m_pHr = PutProperty(m_pObj, m_xbstrService, wcService);
  434. if (FAILED(m_pHr)) goto done;
  435. m_pHr = PutProperty(m_pObj, m_xbstrStartupMode, (int)m_byStartupMode);
  436. if (FAILED(m_pHr)) goto done;
  437. m_pHr = PutProperty(m_pObj, m_xbstrSDDLString, SDspec);
  438. if (FAILED(m_pHr)) goto done;
  439. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  440. if (FAILED(m_pHr)) goto done;
  441. m_pHr = PutInstAndFreeObj();
  442. if (FAILED(m_pHr)) goto done;
  443. done:
  444. LocalFree(SDspec);
  445. SDspec = NULL;
  446. return m_pHr;
  447. }
  448. /////////////////////////////////////////////////////////////////////
  449. // Log class definition for
  450. // RSOP_File schema class
  451. //////////////////////////////////////////////////////////////////////
  452. RSOP_FileLogger::RSOP_FileLogger(IWbemServices *pNamespace,
  453. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  454. {
  455. m_pHr = WBEM_S_NO_ERROR;
  456. m_xbstrClassName = L"RSOP_File";
  457. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  458. m_xbstrPath = L"Path";
  459. if (!m_xbstrPath) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  460. m_xbstrOriginalPath = L"OriginalPath";
  461. if (!m_xbstrOriginalPath) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  462. m_xbstrMode = L"Mode";
  463. if (!m_xbstrMode) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  464. m_xbstrSDDLString = L"SDDLString";
  465. if (!m_xbstrSDDLString) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  466. m_bInitialized = TRUE;
  467. done:
  468. return;
  469. }
  470. RSOP_FileLogger::~RSOP_FileLogger()
  471. {
  472. }
  473. HRESULT
  474. RSOP_FileLogger::Log( WCHAR *wcPath, WCHAR *wcOriginalPath, BYTE m_byMode, PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_INFORMATION SeInfo, DWORD dwPrecedence){
  475. DWORD rc;
  476. PWSTR SDspec=NULL;
  477. DWORD SDsize=0;
  478. m_pHr = WBEM_S_NO_ERROR;
  479. rc = ConvertSecurityDescriptorToText(
  480. pSecurityDescriptor,
  481. SeInfo,
  482. &SDspec,
  483. &SDsize
  484. );
  485. if (rc!= ERROR_SUCCESS) {m_pHr = ScepDosErrorToWbemError(rc); goto done;}
  486. if (m_pHr != WBEM_S_NO_ERROR) goto done;
  487. m_pHr = SpawnAnInstance(&m_pObj);
  488. if (FAILED(m_pHr)) goto done;
  489. m_pHr = PutGenericProperties();
  490. if (FAILED(m_pHr)) goto done;
  491. m_pHr = PutProperty(m_pObj, m_xbstrPath, wcPath);
  492. if (FAILED(m_pHr)) goto done;
  493. if (wcOriginalPath != NULL) {
  494. m_pHr = PutProperty(m_pObj, m_xbstrOriginalPath, wcOriginalPath);
  495. if (FAILED(m_pHr)) goto done;
  496. }
  497. m_pHr = PutProperty(m_pObj, m_xbstrMode, (int)m_byMode);
  498. if (FAILED(m_pHr)) goto done;
  499. m_pHr = PutProperty(m_pObj, m_xbstrSDDLString, SDspec);
  500. if (FAILED(m_pHr)) goto done;
  501. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  502. if (FAILED(m_pHr)) goto done;
  503. m_pHr = PutInstAndFreeObj();
  504. if (FAILED(m_pHr)) goto done;
  505. done:
  506. LocalFree(SDspec);
  507. SDspec = NULL;
  508. return m_pHr;
  509. }
  510. /////////////////////////////////////////////////////////////////////
  511. // Log class definition for
  512. // RSOP_RegistryKey schema class
  513. //////////////////////////////////////////////////////////////////////
  514. RSOP_RegistryKeyLogger::RSOP_RegistryKeyLogger(IWbemServices *pNamespace,
  515. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  516. {
  517. m_pHr = WBEM_S_NO_ERROR;
  518. m_xbstrClassName = L"RSOP_RegistryKey";
  519. if (!m_xbstrClassName) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  520. m_xbstrPath = L"Path";
  521. if (!m_xbstrPath) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  522. m_xbstrMode = L"Mode";
  523. if (!m_xbstrMode) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  524. m_xbstrSDDLString = L"SDDLString";
  525. if (!m_xbstrSDDLString) {m_pHr = WBEM_E_OUT_OF_MEMORY; goto done;}
  526. m_bInitialized = TRUE;
  527. done:
  528. return;
  529. }
  530. RSOP_RegistryKeyLogger::~RSOP_RegistryKeyLogger()
  531. {
  532. }
  533. HRESULT
  534. RSOP_RegistryKeyLogger::Log( WCHAR *wcPath, BYTE m_byMode, PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_INFORMATION SeInfo, DWORD dwPrecedence){
  535. DWORD rc;
  536. PWSTR SDspec=NULL;
  537. DWORD SDsize=0;
  538. m_pHr = WBEM_S_NO_ERROR;
  539. rc = ConvertSecurityDescriptorToText(
  540. pSecurityDescriptor,
  541. SeInfo,
  542. &SDspec,
  543. &SDsize
  544. );
  545. if (rc!= ERROR_SUCCESS) {m_pHr = ScepDosErrorToWbemError(rc); goto done;}
  546. if (m_pHr != WBEM_S_NO_ERROR) goto done;
  547. m_pHr = SpawnAnInstance(&m_pObj);
  548. if (FAILED(m_pHr)) goto done;
  549. m_pHr = PutGenericProperties();
  550. if (FAILED(m_pHr)) goto done;
  551. m_pHr = PutProperty(m_pObj, m_xbstrPath, wcPath);
  552. if (FAILED(m_pHr)) goto done;
  553. m_pHr = PutProperty(m_pObj, m_xbstrMode, (int)m_byMode);
  554. if (FAILED(m_pHr)) goto done;
  555. m_pHr = PutProperty(m_pObj, m_xbstrSDDLString, SDspec);
  556. if (FAILED(m_pHr)) goto done;
  557. m_pHr = PutProperty(m_pObj, m_xbstrPrecedence, (int)dwPrecedence);
  558. if (FAILED(m_pHr)) goto done;
  559. m_pHr = PutInstAndFreeObj();
  560. if (FAILED(m_pHr)) goto done;
  561. done:
  562. LocalFree(SDspec);
  563. SDspec = NULL;
  564. return m_pHr;
  565. }
  566. DiagnosisStatusLogger::DiagnosisStatusLogger(IWbemServices *pNamespace,
  567. PWSTR pwszGPOName, const PWSTR pwszSOMID):CGenericLogger(pNamespace, pwszGPOName, pwszSOMID)
  568. {
  569. return;
  570. }
  571. HRESULT DiagnosisStatusLogger::LogChild( PWSTR pwszClassName,
  572. PWSTR pwszPropertyName,
  573. PWSTR pwszPropertyValueName,
  574. DWORD dwError,
  575. int iChildStatus)
  576. /////////////////////////////////////////////////////////////////////////////////////////////
  577. // Logger method for 1-property-type child search-and-log (files/registry objects //
  578. /////////////////////////////////////////////////////////////////////////////////////////////
  579. {
  580. if ( m_pNamespace == NULL )
  581. return WBEM_E_CRITICAL_ERROR;
  582. if ( pwszClassName == NULL ||
  583. pwszPropertyName == NULL ||
  584. pwszPropertyValueName == NULL)
  585. return WBEM_E_INVALID_PARAMETER;
  586. DWORD Len = wcslen(pwszClassName) +
  587. wcslen(pwszPropertyName) +
  588. wcslen(pwszPropertyValueName) +
  589. 50;
  590. PWSTR tmp=(PWSTR)LocalAlloc(LPTR, (Len)*sizeof(WCHAR));
  591. if ( tmp == NULL )
  592. return WBEM_E_OUT_OF_MEMORY;
  593. swprintf(tmp, L"%s.precedence=1,%s=\"%s\"",
  594. pwszClassName,
  595. pwszPropertyName,
  596. pwszPropertyValueName);
  597. // XBStr m_xbstrQuery = tmp;
  598. BSTR m_xbstrQuery = SysAllocString(tmp);
  599. LocalFree(tmp);
  600. // XBStr m_xbstrWQL = L"WQL";
  601. BSTR m_xbstrWQL = SysAllocString(L"WQL");
  602. m_pHr = WBEM_NO_ERROR;
  603. m_pEnum = NULL;
  604. m_pObj = NULL;
  605. ULONG n = 0;
  606. m_pHr = m_pNamespace->GetObject(
  607. m_xbstrQuery,
  608. WBEM_FLAG_RETURN_WBEM_COMPLETE,
  609. NULL,
  610. &m_pObj,
  611. NULL);
  612. //
  613. // should only get one instance for this query (since precedence = 1)
  614. //
  615. if (SUCCEEDED(m_pHr) && m_pObj) {
  616. m_pHr = PutProperty(m_pObj, m_xbstrStatus, iChildStatus);
  617. if (FAILED(m_pHr)) goto done;
  618. if (dwError != ERROR_SUCCESS) {
  619. m_pHr = PutProperty(m_pObj, m_xbstrErrorCode, (int)dwError);
  620. if (FAILED(m_pHr)) goto done;
  621. }
  622. m_pHr = PutInstAndFreeObj();
  623. if (FAILED(m_pHr)) goto done;
  624. } else {
  625. m_pHr = WBEM_E_NOT_FOUND;
  626. }
  627. done:
  628. SysFreeString(m_xbstrQuery);
  629. SysFreeString(m_xbstrWQL);
  630. if (m_pObj){
  631. m_pObj->Release();
  632. m_pObj = NULL;
  633. }
  634. return m_pHr;
  635. }
  636. HRESULT DiagnosisStatusLogger::Log( PWSTR pwszClassName,
  637. PWSTR pwszPropertyName1,
  638. PWSTR pwszPropertyValueName1,
  639. PWSTR pwszPropertyName2,
  640. PWSTR pwszPropertyValueName2,
  641. DWORD dwError)
  642. ///////////////////////////////////////////////////////////////
  643. // Logger method for 2-property-type search-and-log //
  644. ///////////////////////////////////////////////////////////////
  645. {
  646. if ( m_pNamespace == NULL )
  647. return WBEM_E_CRITICAL_ERROR;
  648. if ( pwszClassName == NULL ||
  649. pwszPropertyName1 == NULL ||
  650. pwszPropertyValueName1 == NULL ||
  651. pwszPropertyName2 == NULL ||
  652. pwszPropertyValueName2 == NULL )
  653. return WBEM_E_INVALID_PARAMETER;
  654. DWORD Len = wcslen(pwszClassName) +
  655. wcslen(pwszPropertyName1) +
  656. wcslen(pwszPropertyValueName1) +
  657. wcslen(pwszPropertyName2) +
  658. wcslen(pwszPropertyValueName2) +
  659. 50;
  660. PWSTR tmp=(PWSTR)LocalAlloc(LPTR, (Len)*sizeof(WCHAR));
  661. if ( tmp == NULL )
  662. return WBEM_E_OUT_OF_MEMORY;
  663. swprintf(tmp, L"%s.precedence=1,%s=\"%s\",%s=\"%s\"",
  664. pwszClassName,
  665. pwszPropertyName1,
  666. pwszPropertyValueName1,
  667. pwszPropertyName2,
  668. pwszPropertyValueName2);
  669. // XBStr m_xbstrQuery = tmp;
  670. BSTR m_xbstrQuery = SysAllocString(tmp);
  671. LocalFree(tmp);
  672. // XBStr m_xbstrWQL = L"WQL";
  673. BSTR m_xbstrWQL = SysAllocString(L"WQL");
  674. m_pHr = WBEM_NO_ERROR;
  675. m_pEnum = NULL;
  676. m_pObj = NULL;
  677. ULONG n = 0;
  678. m_pHr = m_pNamespace->GetObject(
  679. m_xbstrQuery,
  680. WBEM_FLAG_RETURN_WBEM_COMPLETE,
  681. NULL,
  682. &m_pObj,
  683. NULL);
  684. //
  685. // should only get one instance for this query (since precedence = 1)
  686. //
  687. if (SUCCEEDED(m_pHr) && m_pObj) {
  688. m_pHr = PutProperty(m_pObj, m_xbstrStatus, (dwError == ERROR_SUCCESS ? (int)1 : (int)3));
  689. if (FAILED(m_pHr)) goto done;
  690. if (dwError != ERROR_SUCCESS) {
  691. m_pHr = PutProperty(m_pObj, m_xbstrErrorCode, (int)dwError);
  692. if (FAILED(m_pHr)) goto done;
  693. }
  694. m_pHr = PutInstAndFreeObj();
  695. if (FAILED(m_pHr)) goto done;
  696. } else {
  697. m_pHr = WBEM_E_NOT_FOUND;
  698. }
  699. done:
  700. SysFreeString(m_xbstrQuery);
  701. SysFreeString(m_xbstrWQL);
  702. if (m_pObj){
  703. m_pObj->Release();
  704. m_pObj = NULL;
  705. }
  706. return m_pHr;
  707. }
  708. HRESULT DiagnosisStatusLogger::Log( PWSTR pwszClassName,
  709. PWSTR pwszPropertyName,
  710. PWSTR pwszPropertyValueName,
  711. DWORD dwError,
  712. BOOL Merge)
  713. //////////////////////////////////////////////////////////////////////////////////////////////////
  714. // Logger method for 1-property-type if-not-already-error search-and-log w or w/o merge //
  715. //////////////////////////////////////////////////////////////////////////////////////////////////
  716. {
  717. if ( m_pNamespace == NULL )
  718. return WBEM_E_CRITICAL_ERROR;
  719. if ( pwszClassName == NULL ||
  720. pwszPropertyName == NULL ||
  721. pwszPropertyValueName == NULL)
  722. return WBEM_E_INVALID_PARAMETER;
  723. DWORD Len = wcslen(pwszClassName) +
  724. wcslen(pwszPropertyName) +
  725. wcslen(pwszPropertyValueName) +
  726. 50;
  727. PWSTR tmp=(PWSTR)LocalAlloc(LPTR, (Len)*sizeof(WCHAR));
  728. if ( tmp == NULL )
  729. return WBEM_E_OUT_OF_MEMORY;
  730. swprintf(tmp, L"%s.precedence=1,%s=\"%s\"",
  731. pwszClassName,
  732. pwszPropertyName,
  733. pwszPropertyValueName);
  734. // XBStr m_xbstrQuery = tmp;
  735. BSTR m_xbstrQuery = SysAllocString(tmp);
  736. LocalFree(tmp);
  737. // XBStr m_xbstrWQL = L"WQL";
  738. BSTR m_xbstrWQL = SysAllocString(L"WQL");
  739. m_pHr = WBEM_NO_ERROR;
  740. m_pEnum = NULL;
  741. m_pObj = NULL;
  742. ULONG n = 0;
  743. m_pHr = m_pNamespace->GetObject(
  744. m_xbstrQuery,
  745. WBEM_FLAG_RETURN_WBEM_COMPLETE,
  746. NULL,
  747. &m_pObj,
  748. NULL);
  749. //
  750. // should only get one instance for this query (since precedence = 1)
  751. //
  752. if (SUCCEEDED(m_pHr) && m_pObj ) {
  753. if (Merge) {
  754. int iValue;
  755. m_pHr = GetProperty(m_pObj, m_xbstrStatus, &iValue);
  756. if (FAILED(m_pHr)) goto done;
  757. //
  758. // only put if (status = 0) or (status = 1 and dwError != ERROR_SUCCESS)
  759. //
  760. if ((DWORD)iValue == 0 ||
  761. ((DWORD)iValue == 1 && dwError != ERROR_SUCCESS)) {
  762. m_pHr = PutProperty(m_pObj, m_xbstrStatus, (dwError == ERROR_SUCCESS ? (int)1 : (int)3));
  763. if (FAILED(m_pHr)) goto done;
  764. if (dwError != ERROR_SUCCESS) {
  765. m_pHr = PutProperty(m_pObj, m_xbstrErrorCode, (int)dwError);
  766. if (FAILED(m_pHr)) goto done;
  767. }
  768. m_pHr = PutInstAndFreeObj();
  769. if (FAILED(m_pHr)) goto done;
  770. }
  771. } else {
  772. m_pHr = PutProperty(m_pObj, m_xbstrStatus, (dwError == ERROR_SUCCESS ? (int)1 : (int)3));
  773. if (FAILED(m_pHr)) goto done;
  774. if (dwError != ERROR_SUCCESS) {
  775. m_pHr = PutProperty(m_pObj, m_xbstrErrorCode, (int)dwError);
  776. if (FAILED(m_pHr)) goto done;
  777. }
  778. m_pHr = PutInstAndFreeObj();
  779. if (FAILED(m_pHr)) goto done;
  780. }
  781. } else {
  782. m_pHr = WBEM_E_NOT_FOUND;
  783. }
  784. done:
  785. SysFreeString(m_xbstrQuery);
  786. SysFreeString(m_xbstrWQL);
  787. if (m_pObj){
  788. m_pObj->Release();
  789. m_pObj = NULL;
  790. }
  791. return m_pHr;
  792. }
  793. #ifdef _WIN64
  794. HRESULT DiagnosisStatusLogger::LogRegistryKey( PWSTR pwszClassName,
  795. PWSTR pwszPropertyName,
  796. PWSTR pwszPropertyValueName,
  797. DWORD dwError,
  798. BOOL bIsChild)
  799. //////////////////////////////////////////////////////////////////////////////////////////////////
  800. // Logger method for 1-property-type if-not-already-error search-and-log w or w/o merge //
  801. // Purpose is the same as regular ::Log() method, except that merge logic is different due to //
  802. // 64-bit and 32-bit issues //
  803. //////////////////////////////////////////////////////////////////////////////////////////////////
  804. {
  805. if ( m_pNamespace == NULL )
  806. return WBEM_E_CRITICAL_ERROR;
  807. if ( pwszClassName == NULL ||
  808. pwszPropertyName == NULL ||
  809. pwszPropertyValueName == NULL)
  810. return WBEM_E_INVALID_PARAMETER;
  811. DWORD Len = wcslen(pwszClassName) +
  812. wcslen(pwszPropertyName) +
  813. wcslen(pwszPropertyValueName) +
  814. 50;
  815. PWSTR tmp=(PWSTR)LocalAlloc(LPTR, (Len)*sizeof(WCHAR));
  816. if ( tmp == NULL )
  817. return WBEM_E_OUT_OF_MEMORY;
  818. swprintf(tmp, L"%s.precedence=1,%s=\"%s\"",
  819. pwszClassName,
  820. pwszPropertyName,
  821. pwszPropertyValueName);
  822. // XBStr m_xbstrQuery = tmp;
  823. BSTR m_xbstrQuery = SysAllocString(tmp);
  824. LocalFree(tmp);
  825. // XBStr m_xbstrWQL = L"WQL";
  826. BSTR m_xbstrWQL = SysAllocString(L"WQL");
  827. m_pHr = WBEM_NO_ERROR;
  828. m_pEnum = NULL;
  829. m_pObj = NULL;
  830. ULONG n = 0;
  831. m_pHr = m_pNamespace->GetObject(
  832. m_xbstrQuery,
  833. WBEM_FLAG_RETURN_WBEM_COMPLETE,
  834. NULL,
  835. &m_pObj,
  836. NULL);
  837. //
  838. // should only get one instance for this query (since precedence = 1)
  839. //
  840. //
  841. // on a 64-bit platform, the following merging logic holds for registry keys only
  842. // get status
  843. // if status == 0 put 1 or 3 depending on dwError, also put dwError if not success
  844. // else if status == 3 or 4 (64-bit key or child failed for the same key before)
  845. // get error code
  846. // if error code == FILE_NOT_FOUND
  847. // if dwError == SUCCESS
  848. // set status = 1 and error code = SUCCESS
  849. // else if dwError != FILE_NOT_FOUND
  850. // set status = 3 and error code = dwError
  851. // else if dwError == FILE_NOT_FOUND
  852. // do nothing (leave status = 3 or 4 and error code = FILE_NOT_FOUND)
  853. // else
  854. // if dwError == FILE_NOT_FOUND or SUCCESS
  855. // leave as is
  856. // else
  857. // error code = dwError, status = 3
  858. // else if status == 1
  859. // if dwError == FILE_NOT_FOUND
  860. // do nothing (leave status = 1)
  861. // else if dwError != SUCCESS
  862. // set status = 3 and error code = dwError
  863. //
  864. if (SUCCEEDED(m_pHr) && m_pObj) {
  865. int iValue;
  866. int iUpdateStatus = 0;
  867. BOOL bUpdateErrorCode = FALSE;
  868. m_pHr = GetProperty(m_pObj, m_xbstrStatus, &iValue);
  869. if (FAILED(m_pHr)) goto done;
  870. if ((DWORD)iValue == 0) {
  871. iUpdateStatus = (dwError == ERROR_SUCCESS ? (int)1 : (int)3);
  872. bUpdateErrorCode = (dwError != ERROR_SUCCESS ? TRUE : FALSE);
  873. } else if ((DWORD)iValue == 3 || (DWORD)iValue == 4) {
  874. //
  875. // in this case, further decisions are based on the ErrorCode, so retrieve it
  876. //
  877. m_pHr = GetProperty(m_pObj, m_xbstrErrorCode, &iValue);
  878. if (FAILED(m_pHr)) goto done;
  879. if ((DWORD)iValue == ERROR_FILE_NOT_FOUND) {
  880. if (dwError == ERROR_SUCCESS) {
  881. iUpdateStatus = 1;
  882. bUpdateErrorCode = TRUE;
  883. } else if (dwError != ERROR_FILE_NOT_FOUND) {
  884. iUpdateStatus = 3;
  885. bUpdateErrorCode = TRUE;
  886. }
  887. } else {
  888. if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND ) {
  889. iUpdateStatus = 3;
  890. bUpdateErrorCode = TRUE;
  891. }
  892. }
  893. } else if ((DWORD)iValue == 1) {
  894. if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND) {
  895. iUpdateStatus = 3;
  896. bUpdateErrorCode = TRUE;
  897. }
  898. }
  899. if (iUpdateStatus) {
  900. iUpdateStatus = ((bIsChild && iUpdateStatus == 3) ? 4: 3);
  901. m_pHr = PutProperty(m_pObj, m_xbstrStatus, (int)iUpdateStatus);
  902. if (FAILED(m_pHr)) goto done;
  903. }
  904. if (bUpdateErrorCode) {
  905. m_pHr = PutProperty(m_pObj, m_xbstrErrorCode, (int)dwError);
  906. if (FAILED(m_pHr)) goto done;
  907. }
  908. m_pHr = PutInstAndFreeObj();
  909. if (FAILED(m_pHr)) goto done;
  910. } else {
  911. m_pHr = WBEM_E_NOT_FOUND;
  912. }
  913. done:
  914. SysFreeString(m_xbstrQuery);
  915. SysFreeString(m_xbstrWQL);
  916. if (m_pObj){
  917. m_pObj->Release();
  918. m_pObj = NULL;
  919. }
  920. return m_pHr;
  921. }
  922. #endif
  923. DiagnosisStatusLogger::~DiagnosisStatusLogger(){
  924. }