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.

794 lines
20 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. hsmacrsc.cpp
  5. Abstract:
  6. This component represents the actions that can be performed by a job
  7. on a resource either before or after the scan.
  8. Author:
  9. Ronald G. White [ronw] 14-Aug-1997
  10. Revision History:
  11. --*/
  12. #include "stdafx.h"
  13. #include "stdio.h"
  14. #include "wsb.h"
  15. #include "job.h"
  16. #include "HsmConn.h"
  17. #include "hsmacrsc.h"
  18. #include "fsaprv.h"
  19. #include "fsa.h"
  20. #define WSB_TRACE_IS WSB_TRACE_BIT_JOB
  21. HRESULT
  22. CHsmActionOnResource::GetName(
  23. OUT OLECHAR** pName,
  24. IN ULONG bufferSize
  25. )
  26. /*++
  27. Implements:
  28. IHsmActionOnResource::GetName().
  29. --*/
  30. {
  31. HRESULT hr = S_OK;
  32. CWsbStringPtr tmpString;
  33. try {
  34. WsbAssert(0 != pName, E_POINTER);
  35. WsbAffirmHr(tmpString.LoadFromRsc(_Module.m_hInst, m_nameId));
  36. WsbAffirmHr(tmpString.CopyTo(pName, bufferSize));
  37. } WsbCatch(hr);
  38. return(hr);
  39. }
  40. HRESULT
  41. CHsmActionOnResource::Load(
  42. IN IStream* pStream
  43. )
  44. /*++
  45. Implements:
  46. IPersistStream::Load().
  47. --*/
  48. {
  49. HRESULT hr = S_OK;
  50. WsbTraceIn(OLESTR("CHsmActionOnResource::Load"), OLESTR(""));
  51. try {
  52. WsbAssert(0 != pStream, E_POINTER);
  53. WsbAffirmHr(WsbLoadFromStream(pStream, &m_nameId));
  54. } WsbCatch(hr);
  55. WsbTraceOut(OLESTR("CHsmActionOnResource::Load"), OLESTR("hr = <%ls>, nameId = <%lu>"), WsbHrAsString(hr), m_nameId);
  56. return(hr);
  57. }
  58. HRESULT
  59. CHsmActionOnResource::Save(
  60. IN IStream* pStream,
  61. IN BOOL clearDirty
  62. )
  63. /*++
  64. Implements:
  65. IPersistStream::Save().
  66. --*/
  67. {
  68. HRESULT hr = S_OK;
  69. WsbTraceIn(OLESTR("CHsmActionOnResource::Save"), OLESTR("clearDirty = <%ls>"), WsbBoolAsString(clearDirty));
  70. try {
  71. WsbAssert(0 != pStream, E_POINTER);
  72. WsbAffirmHr(WsbSaveToStream(pStream, m_nameId));
  73. // If we got it saved and we were asked to clear the dirty bit, then
  74. // do so now.
  75. if (clearDirty) {
  76. m_isDirty = FALSE;
  77. }
  78. } WsbCatch(hr);
  79. WsbTraceOut(OLESTR("CHsmActionOnResource::Save"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  80. return(hr);
  81. }
  82. HRESULT
  83. CHsmActionOnResourcePostValidate::Do(
  84. IHsmJobWorkItem* pWorkItem,
  85. HSM_JOB_STATE state
  86. )
  87. /*++
  88. Implements:
  89. IHsmActionOnResource::Do().
  90. --*/
  91. {
  92. HRESULT hr = S_OK;
  93. WsbTraceIn(OLESTR("CHsmActionOnResourcePostValidate::Do"),
  94. OLESTR("pWorkItem = %p, state = %ld"), pWorkItem,
  95. (LONG)state);
  96. try {
  97. GUID id;
  98. CComPtr<IFsaResource> pResource;
  99. WsbAssertPointer(pWorkItem);
  100. // Get resource associated with this work item
  101. WsbAffirmHr(pWorkItem->GetResourceId(&id));
  102. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_RESOURCE, id, IID_IFsaResource, (void**) &pResource));
  103. // Tell the resource what's happening
  104. WsbAffirmHr(pResource->EndValidate(state));
  105. } WsbCatch(hr);
  106. WsbTraceOut(OLESTR("CHsmActionOnResourcePostValidate::Do"),
  107. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  108. return(hr);
  109. }
  110. HRESULT
  111. CHsmActionOnResourcePostValidate::GetClassID(
  112. OUT CLSID* pClsid
  113. )
  114. /*++
  115. Implements:
  116. IPersist::GetClassID().
  117. --*/
  118. {
  119. HRESULT hr = S_OK;
  120. WsbTraceIn(OLESTR("CHsmActionOnResourcePostValidate::GetClassID"), OLESTR(""));
  121. try {
  122. WsbAssert(0 != pClsid, E_POINTER);
  123. *pClsid = CLSID_CHsmActionOnResourcePostValidate;
  124. } WsbCatch(hr);
  125. WsbTraceOut(OLESTR("CHsmActionOnResourcePostValidate::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  126. return(hr);
  127. }
  128. HRESULT
  129. CHsmActionOnResourcePostValidate::FinalConstruct(
  130. void
  131. )
  132. /*++
  133. Implements:
  134. CComObjectRoot::FinalConstruct().
  135. --*/
  136. {
  137. HRESULT hr = S_OK;
  138. WsbTraceIn(OLESTR("CHsmActionOnResourcePostValidate::FinalConstruct"), OLESTR(""));
  139. try {
  140. WsbAffirmHr(CHsmActionOnResource::FinalConstruct());
  141. m_nameId = IDS_HSMACTIONONRESOURCEPOSTVALIDATE_ID;
  142. } WsbCatch(hr);
  143. WsbTraceOut(OLESTR("CHsmActionOnResourcePostValidate::FinalConstruct"),
  144. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  145. return(hr);
  146. }
  147. HRESULT
  148. CHsmActionOnResourcePreValidate::Do(
  149. IHsmJobWorkItem* pWorkItem,
  150. IHsmJobDef* pJobDef
  151. )
  152. /*++
  153. Implements:
  154. IHsmActionOnResource::Do().
  155. --*/
  156. {
  157. HRESULT hr = S_OK;
  158. WsbTraceIn(OLESTR("CHsmActionOnResourcePreValidate::Do"),
  159. OLESTR("pWorkItem = %p, pJobDef=%p"), pWorkItem, pJobDef);
  160. try {
  161. GUID id;
  162. CComPtr<IFsaResource> pResource;
  163. WsbAssertPointer(pWorkItem);
  164. // Get resource associated with this work item
  165. WsbAffirmHr(pWorkItem->GetResourceId(&id));
  166. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_RESOURCE, id, IID_IFsaResource, (void**) &pResource));
  167. // Tell the resource what's happening
  168. WsbAffirmHr(pResource->BeginValidate());
  169. } WsbCatch(hr);
  170. WsbTraceOut(OLESTR("CHsmActionOnResourcePreValidate::Do"),
  171. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  172. return(hr);
  173. }
  174. HRESULT
  175. CHsmActionOnResourcePreValidate::GetClassID(
  176. OUT CLSID* pClsid
  177. )
  178. /*++
  179. Implements:
  180. IPersist::GetClassID().
  181. --*/
  182. {
  183. HRESULT hr = S_OK;
  184. WsbTraceIn(OLESTR("CHsmActionOnResourcePreValidate::GetClassID"), OLESTR(""));
  185. try {
  186. WsbAssert(0 != pClsid, E_POINTER);
  187. *pClsid = CLSID_CHsmActionOnResourcePreValidate;
  188. } WsbCatch(hr);
  189. WsbTraceOut(OLESTR("CHsmActionOnResourcePreValidate::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  190. return(hr);
  191. }
  192. HRESULT
  193. CHsmActionOnResourcePreValidate::FinalConstruct(
  194. void
  195. )
  196. /*++
  197. Implements:
  198. CComObjectRoot::FinalConstruct().
  199. --*/
  200. {
  201. HRESULT hr = S_OK;
  202. WsbTraceIn(OLESTR("CHsmActionOnResourcePreValidate::FinalConstruct"),
  203. OLESTR(""));
  204. try {
  205. WsbAffirmHr(CHsmActionOnResource::FinalConstruct());
  206. m_nameId = IDS_HSMACTIONONRESOURCEPREVALIDATE_ID;
  207. } WsbCatch(hr);
  208. WsbTraceOut(OLESTR("CHsmActionOnResourcePreValidate::FinalConstruct"),
  209. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  210. return(hr);
  211. }
  212. HRESULT
  213. CHsmActionOnResourcePostUnmanage::Do(
  214. IHsmJobWorkItem* pWorkItem,
  215. HSM_JOB_STATE state
  216. )
  217. /*++
  218. Implements:
  219. IHsmActionOnResource::Do().
  220. --*/
  221. {
  222. HRESULT hr = S_OK;
  223. WsbTraceIn(OLESTR("CHsmActionOnResourcePostUnmanage::Do"),
  224. OLESTR("pWorkItem = %p, state = %ld"), pWorkItem,
  225. (LONG)state);
  226. try {
  227. GUID id, hsmId;
  228. CComPtr<IFsaResource> pResource;
  229. CComPtr<IFsaResourcePriv> pResourcePriv;
  230. CComPtr<IHsmServer> pHsm;
  231. WsbAssertPointer(pWorkItem);
  232. // Get resource associated with this work item
  233. WsbAffirmHr(pWorkItem->GetResourceId(&id));
  234. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_RESOURCE, id, IID_IFsaResource, (void**) &pResource));
  235. // Delete the temporary Unmanage database that we use for scanning in the right order (ignore errors)
  236. hr = pResource->QueryInterface(IID_IFsaResourcePriv, (void**) &pResourcePriv);
  237. if (SUCCEEDED(hr)) {
  238. // ignore errors
  239. (void)pResourcePriv->TerminateUnmanageDb();
  240. }
  241. // Get back to the HSM system so we can remove it
  242. WsbAffirmHr(pResource->GetManagingHsm(&hsmId));
  243. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_HSM, hsmId, IID_IHsmServer, (void**) &pHsm));
  244. // Get the collection and find the coresponding object
  245. CComPtr<IWsbIndexedCollection> pCollection;
  246. WsbAffirmHr(pHsm->GetManagedResources(&pCollection));
  247. CComPtr<IWsbCreateLocalObject> pCreate;
  248. WsbAffirmHr(pHsm->QueryInterface(IID_IWsbCreateLocalObject, (void**) &pCreate));
  249. CComPtr<IHsmManagedResource> pHsmResourceKey, pHsmResource;
  250. WsbAffirmHr(pCreate->CreateInstance(CLSID_CHsmManagedResource, IID_IHsmManagedResource, (void**) &pHsmResourceKey));
  251. WsbAffirmHr(pHsmResourceKey->SetResourceId(id));
  252. WsbAffirmHr(pCollection->Find(pHsmResourceKey, IID_IHsmManagedResource, (void**) &pHsmResource));
  253. // Remove the volume from management
  254. WsbAffirmHr(pCollection->RemoveAndRelease(pHsmResource));
  255. } WsbCatch(hr);
  256. WsbTraceOut(OLESTR("CHsmActionOnResourcePostUnmanage::Do"),
  257. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  258. return(hr);
  259. }
  260. HRESULT
  261. CHsmActionOnResourcePostUnmanage::GetClassID(
  262. OUT CLSID* pClsid
  263. )
  264. /*++
  265. Implements:
  266. IPersist::GetClassID().
  267. --*/
  268. {
  269. HRESULT hr = S_OK;
  270. WsbTraceIn(OLESTR("CHsmActionOnResourcePostUnmanage::GetClassID"), OLESTR(""));
  271. try {
  272. WsbAssert(0 != pClsid, E_POINTER);
  273. *pClsid = CLSID_CHsmActionOnResourcePostUnmanage;
  274. } WsbCatch(hr);
  275. WsbTraceOut(OLESTR("CHsmActionOnResourcePostUnmanage::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  276. return(hr);
  277. }
  278. HRESULT
  279. CHsmActionOnResourcePostUnmanage::FinalConstruct(
  280. void
  281. )
  282. /*++
  283. Implements:
  284. CComObjectRoot::FinalConstruct().
  285. --*/
  286. {
  287. HRESULT hr = S_OK;
  288. WsbTraceIn(OLESTR("CHsmActionOnResourcePostUnmanage::FinalConstruct"), OLESTR(""));
  289. try {
  290. WsbAffirmHr(CHsmActionOnResource::FinalConstruct());
  291. m_nameId = IDS_HSMACTIONONRESOURCEPOSTUNMANAGE_ID;
  292. } WsbCatch(hr);
  293. WsbTraceOut(OLESTR("CHsmActionOnResourcePostUnmanage::FinalConstruct"),
  294. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  295. return(hr);
  296. }
  297. HRESULT
  298. CHsmActionOnResourcePreUnmanage::Do(
  299. IHsmJobWorkItem* pWorkItem,
  300. IHsmJobDef* pJobDef
  301. )
  302. /*++
  303. Implements:
  304. IHsmActionOnResource::Do().
  305. --*/
  306. {
  307. HRESULT hr = S_OK;
  308. WsbTraceIn(OLESTR("CHsmActionOnResourcePreUnmanage::Do"),
  309. OLESTR("pWorkItem = %p, pJobDef=%p"), pWorkItem, pJobDef);
  310. try {
  311. GUID id;
  312. CComPtr<IFsaResource> pResource;
  313. CComPtr<IHsmServer> pHsm;
  314. CComPtr<IWsbCreateLocalObject> pCreateObj;
  315. CComPtr<IHsmActionOnResourcePreScan> pActionResourcePreScan;
  316. GUID hsmId = GUID_NULL;
  317. WsbAssertPointer(pWorkItem);
  318. WsbAssertPointer(pJobDef);
  319. // Create a pre-scan action and assign to the job definition
  320. // Note: Naturally, creating the pre-scan action would have been done in CHsmJobDef::InitAs
  321. // However, since we cannot add new persistent members to JobDef (.col files mismatch on upgrade...),
  322. // we let the pre-action to create a pre-scan-action if necessary
  323. WsbAffirmHr(pJobDef->SetUseDbIndex(TRUE));
  324. // hsm-id is not used today in HsmConnectFromId for HSMCONN_TYPE_HSM
  325. // When it does - use IFsaResource::GetManagingHsm to get the hsm-id
  326. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_HSM, hsmId, IID_IHsmServer, (void**) &pHsm));
  327. WsbAffirmHr(pHsm->QueryInterface(IID_IWsbCreateLocalObject, (void**) &pCreateObj));
  328. WsbAffirmHr(pCreateObj->CreateInstance(CLSID_CHsmActionOnResourcePreScanUnmanage,
  329. IID_IHsmActionOnResourcePreScan, (void**) &pActionResourcePreScan));
  330. WsbAffirmHr(pJobDef->SetPreScanActionOnResource(pActionResourcePreScan));
  331. // Get resource associated with this work item
  332. WsbAffirmHr(pWorkItem->GetResourceId(&id));
  333. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_RESOURCE, id, IID_IFsaResource, (void**) &pResource));
  334. // Tell the resource what's happening
  335. WsbAffirmHr(pResource->SetIsDeletePending( TRUE ));
  336. } WsbCatch(hr);
  337. WsbTraceOut(OLESTR("CHsmActionOnResourcePreUnmanage::Do"),
  338. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  339. return(hr);
  340. }
  341. HRESULT
  342. CHsmActionOnResourcePreUnmanage::GetClassID(
  343. OUT CLSID* pClsid
  344. )
  345. /*++
  346. Implements:
  347. IPersist::GetClassID().
  348. --*/
  349. {
  350. HRESULT hr = S_OK;
  351. WsbTraceIn(OLESTR("CHsmActionOnResourcePreUnmanage::GetClassID"), OLESTR(""));
  352. try {
  353. WsbAssert(0 != pClsid, E_POINTER);
  354. *pClsid = CLSID_CHsmActionOnResourcePreUnmanage;
  355. } WsbCatch(hr);
  356. WsbTraceOut(OLESTR("CHsmActionOnResourcePreUnmanage::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  357. return(hr);
  358. }
  359. HRESULT
  360. CHsmActionOnResourcePreUnmanage::FinalConstruct(
  361. void
  362. )
  363. /*++
  364. Implements:
  365. CComObjectRoot::FinalConstruct().
  366. --*/
  367. {
  368. HRESULT hr = S_OK;
  369. WsbTraceIn(OLESTR("CHsmActionOnResourcePreUnmanage::FinalConstruct"),
  370. OLESTR(""));
  371. try {
  372. WsbAffirmHr(CHsmActionOnResource::FinalConstruct());
  373. m_nameId = IDS_HSMACTIONONRESOURCEPREUNMANAGE_ID;
  374. } WsbCatch(hr);
  375. WsbTraceOut(OLESTR("CHsmActionOnResourcePreUnmanage::FinalConstruct"),
  376. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  377. return(hr);
  378. }
  379. HRESULT
  380. CHsmActionOnResourcePreScanUnmanage::Do(
  381. IFsaResource* pFsaResource,
  382. IHsmSession* pSession
  383. )
  384. /*++
  385. Implements:
  386. IHsmActionOnResource::Do().
  387. --*/
  388. {
  389. HRESULT hr = S_OK;
  390. CComPtr<IFsaUnmanageDb> pUnmanageDb;
  391. CComPtr<IWsbDbSession> pDbSession;
  392. CComPtr<IFsaUnmanageRec> pUnmanageRec;
  393. BOOL bDbOpen = FALSE;
  394. WsbTraceIn(OLESTR("CHsmActionOnResourcePreScanUnmanage::Do"), OLESTR(""));
  395. try {
  396. CComPtr<IFsaResourcePriv> pResourcePriv;
  397. CComPtr<IFsaScanItem> pScanItem;
  398. CComPtr<IHsmServer> pHsmServer;
  399. GUID hsmId = GUID_NULL;
  400. // Scan according to RP index and fill the Db
  401. // Don't need recursive scanning since we scan the RP index of the volume
  402. hr = pFsaResource->FindFirstInRPIndex(pSession, &pScanItem);
  403. if (SUCCEEDED(hr)) {
  404. // At least one managed file is found...
  405. // Initialize the Unmanaged Db for this resource
  406. WsbAffirmHr(pFsaResource->QueryInterface(IID_IFsaResourcePriv, (void**) &pResourcePriv));
  407. WsbAffirmHr(pResourcePriv->InitializeUnmanageDb());
  408. // Get and open the database
  409. WsbAffirmHr(pResourcePriv->GetUnmanageDb(IID_IFsaUnmanageDb, (void**) &pUnmanageDb));
  410. WsbAffirmHr(pUnmanageDb->Open(&pDbSession));
  411. bDbOpen = TRUE;
  412. // Get a record to work with
  413. WsbAffirmHr(pUnmanageDb->GetEntity(pDbSession, UNMANAGE_REC_TYPE, IID_IFsaUnmanageRec, (void**) &pUnmanageRec));
  414. // Get HSM Server
  415. // Note: hsm-id is not used today in HsmConnectFromId for HSMCONN_TYPE_HSM
  416. // When it does - use IFsaResource::GetManagingHsm to get the hsm-id
  417. WsbAffirmHr(HsmConnectFromId(HSMCONN_TYPE_HSM, hsmId, IID_IHsmServer, (void**) &pHsmServer));
  418. }
  419. while (SUCCEEDED(hr)) {
  420. LONGLONG offset = 0;
  421. LONGLONG size = 0;
  422. FSA_PLACEHOLDER placeholder;
  423. GUID mediaId;
  424. LONGLONG fileOffset;
  425. LONGLONG fileId;
  426. LONGLONG segOffset;
  427. hr = pScanItem->GetPlaceholder(offset, size, &placeholder);
  428. if (S_OK == hr) {
  429. // File must be managed by HSM
  430. // If the file is truncated, then we need to add to the Db
  431. if (pScanItem->IsTruncated(offset, size) == S_OK) {
  432. // Get segment details from the Engine and calculate absolute offset
  433. WsbAffirmHr(pHsmServer->GetSegmentPosition(placeholder.bagId, placeholder.fileStart,
  434. placeholder.fileSize, &mediaId, &segOffset));
  435. fileOffset = segOffset + placeholder.fileStart + placeholder.dataStart;
  436. // Add to the Unmanage database
  437. WsbAffirmHr(pScanItem->GetFileId(&fileId));
  438. WsbAffirmHr(pUnmanageRec->SetMediaId(mediaId));
  439. WsbAffirmHr(pUnmanageRec->SetFileOffset(fileOffset));
  440. WsbAffirmHr(pUnmanageRec->SetFileId(fileId));
  441. WsbAffirmHr(pUnmanageRec->MarkAsNew());
  442. WsbAffirmHr(pUnmanageRec->Write());
  443. } else {
  444. // Note: We will continue here even if we fail to cleanup non-truncated files, because
  445. // the auto-truncator is suspended (so no premigrated files will become truncated while
  446. // the job is running) and this piece of code will be tried again in CFsaScanItem::Unmanage
  447. try {
  448. // For disaster recovery, it would be better to delete the placeholder
  449. // and THEN remove this file from the premigration list. Unfortunately,
  450. // after deleting the placeholder, the RemovePremigrated call fails
  451. // because it needs to get some information from the placeholder (which
  452. // is gone). So we do it in this order.
  453. hr = pFsaResource->RemovePremigrated(pScanItem, offset, size);
  454. if (WSB_E_NOTFOUND == hr) {
  455. // It's no tragedy if this file wasn't in the list since we were
  456. // going to delete it anyway (although it shouldn't happen) so
  457. // let's continue anyway
  458. hr = S_OK;
  459. }
  460. WsbAffirmHr(hr);
  461. WsbAffirmHr(pScanItem->DeletePlaceholder(offset, size));
  462. } WsbCatchAndDo(hr,
  463. WsbTraceAlways(OLESTR("...PreScanUnmanage::Do: failed to handle premigrated file, hr = <%ls>\n"),
  464. WsbHrAsString(hr));
  465. hr = S_OK;
  466. );
  467. }
  468. }
  469. // Get next file
  470. hr = pFsaResource->FindNextInRPIndex(pScanItem);
  471. }
  472. if (hr == WSB_E_NOTFOUND) {
  473. hr = S_OK;
  474. }
  475. } WsbCatch(hr);
  476. if (bDbOpen) {
  477. pUnmanageRec = 0;
  478. (void)pUnmanageDb->Close(pDbSession);
  479. }
  480. if (! SUCCEEDED(hr)) {
  481. // Log an error message
  482. CWsbStringPtr tmpString;
  483. hr = pFsaResource->GetPath(&tmpString, 0);
  484. if (hr != S_OK) {
  485. tmpString = OLESTR("");
  486. }
  487. WsbLogEvent(JOB_MESSAGE_UNMANAGE_PRESCAN_FAILED, 0, NULL, (WCHAR *)tmpString, WsbHrAsString(hr), NULL);
  488. }
  489. WsbTraceOut(OLESTR("CHsmActionOnResourcePreScanUnmanage::Do"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  490. return(hr);
  491. }
  492. HRESULT
  493. CHsmActionOnResourcePreScanUnmanage::GetClassID(
  494. OUT CLSID* pClsid
  495. )
  496. /*++
  497. Implements:
  498. IPersist::GetClassID().
  499. --*/
  500. {
  501. HRESULT hr = S_OK;
  502. WsbTraceIn(OLESTR("CHsmActionOnResourcePreScanUnmanage::GetClassID"), OLESTR(""));
  503. try {
  504. WsbAssert(0 != pClsid, E_POINTER);
  505. *pClsid = CLSID_CHsmActionOnResourcePreScanUnmanage;
  506. } WsbCatch(hr);
  507. WsbTraceOut(OLESTR("CHsmActionOnResourcePreScanUnmanage::GetClassID"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  508. return(hr);
  509. }
  510. HRESULT
  511. CHsmActionOnResourcePreScanUnmanage::FinalConstruct(
  512. void
  513. )
  514. /*++
  515. Implements:
  516. CComObjectRoot::FinalConstruct().
  517. --*/
  518. {
  519. HRESULT hr = S_OK;
  520. WsbTraceIn(OLESTR("CHsmActionOnResourcePreScanUnmanage::FinalConstruct"), OLESTR(""));
  521. try {
  522. WsbAffirmHr(CHsmActionOnResource::FinalConstruct());
  523. m_nameId = IDS_HSMACTIONONRESOURCEPRESCANUNMANAGE_ID;
  524. } WsbCatch(hr);
  525. WsbTraceOut(OLESTR("CHsmActionOnResourcePreScanUnmanage::FinalConstruct"),
  526. OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  527. return(hr);
  528. }