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.

1523 lines
24 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. hsmactn.cpp
  5. Abstract:
  6. This component represents the actions that can be performed by a policy.
  7. Author:
  8. Chuck Bardeen [cbardeen] 29-Oct-1996
  9. Revision History:
  10. --*/
  11. #include "stdafx.h"
  12. #include "stdio.h"
  13. #include "wsb.h"
  14. #include "job.h"
  15. #include "hsmactn.h"
  16. #define WSB_TRACE_IS WSB_TRACE_BIT_JOB
  17. HRESULT
  18. CHsmAction::GetName(
  19. OUT OLECHAR** pName,
  20. IN ULONG bufferSize
  21. )
  22. /*++
  23. Implements:
  24. IHsmAction::GetName().
  25. --*/
  26. {
  27. HRESULT hr = S_OK;
  28. CWsbStringPtr tmpString;
  29. try {
  30. WsbAssert(0 != pName, E_POINTER);
  31. WsbAffirmHr(tmpString.LoadFromRsc(_Module.m_hInst, m_nameId));
  32. WsbAffirmHr(tmpString.CopyTo(pName, bufferSize));
  33. } WsbCatch(hr);
  34. return(hr);
  35. }
  36. HRESULT
  37. CHsmAction::GetSizeMax(
  38. OUT ULARGE_INTEGER* pSize
  39. )
  40. /*++
  41. Implements:
  42. IPersistStream::GetSizeMax().
  43. --*/
  44. {
  45. HRESULT hr = S_OK;
  46. WsbTraceIn(OLESTR("CHsmAction::GetSizeMax"), OLESTR(""));
  47. try {
  48. WsbAssert(0 != pSize, E_POINTER);
  49. pSize->QuadPart = WsbPersistSizeOf(ULONG);
  50. } WsbCatch(hr);
  51. WsbTraceOut(OLESTR("CHsmAction::GetSizeMax"), OLESTR("hr = <%ls>, Size = <%ls>"), WsbHrAsString(hr), WsbPtrToUliAsString(pSize));
  52. return(hr);
  53. }
  54. HRESULT
  55. CHsmAction::Load(
  56. IN IStream* pStream
  57. )
  58. /*++
  59. Implements:
  60. IPersistStream::Load().
  61. --*/
  62. {
  63. HRESULT hr = S_OK;
  64. WsbTraceIn(OLESTR("CHsmAction::Load"), OLESTR(""));
  65. try {
  66. WsbAssert(0 != pStream, E_POINTER);
  67. WsbAffirmHr(WsbLoadFromStream(pStream, &m_nameId));
  68. } WsbCatch(hr);
  69. WsbTraceOut(OLESTR("CHsmAction::Load"), OLESTR("hr = <%ls>, nameId = <%lu>"), WsbHrAsString(hr), m_nameId);
  70. return(hr);
  71. }
  72. HRESULT
  73. CHsmAction::Save(
  74. IN IStream* pStream,
  75. IN BOOL clearDirty
  76. )
  77. /*++
  78. Implements:
  79. IPersistStream::Save().
  80. --*/
  81. {
  82. HRESULT hr = S_OK;
  83. WsbTraceIn(OLESTR("CHsmAction::Save"), OLESTR("clearDirty = <%ls>"), WsbBoolAsString(clearDirty));
  84. try {
  85. WsbAssert(0 != pStream, E_POINTER);
  86. WsbAffirmHr(WsbSaveToStream(pStream, m_nameId));
  87. // If we got it saved and we were asked to clear the dirty bit, then
  88. // do so now.
  89. if (clearDirty) {
  90. m_isDirty = FALSE;
  91. }
  92. } WsbCatch(hr);
  93. WsbTraceOut(OLESTR("CHsmAction::Save"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  94. return(hr);
  95. }
  96. HRESULT
  97. CHsmAction::Test(
  98. USHORT* passed,
  99. USHORT* failed
  100. )
  101. /*++
  102. Implements:
  103. IWsbTestable::Test().
  104. --*/
  105. {
  106. HRESULT hr = S_OK;
  107. try {
  108. WsbAssert(0 != passed, E_POINTER);
  109. WsbAssert(0 != failed, E_POINTER);
  110. *passed = 0;
  111. *failed = 0;
  112. } WsbCatch(hr);
  113. return(hr);
  114. }
  115. HRESULT
  116. CHsmDirectedAction::FinalConstruct(
  117. void
  118. )
  119. /*++
  120. Implements:
  121. CComObjectRoot::FinalConstruct().
  122. --*/
  123. {
  124. HRESULT hr = S_OK;
  125. try {
  126. WsbAffirmHr(CWsbObject::FinalConstruct());
  127. m_storagePoolId = GUID_NULL;
  128. } WsbCatch(hr);
  129. return(hr);
  130. }
  131. HRESULT
  132. CHsmDirectedAction::GetStoragePoolId(
  133. OUT GUID* pId
  134. )
  135. /*++
  136. Implements:
  137. IHsmDirectedAction::GetStoragePoolId().
  138. --*/
  139. {
  140. HRESULT hr = S_OK;
  141. try {
  142. WsbAssert(0 != pId, E_POINTER);
  143. *pId = m_storagePoolId;
  144. } WsbCatch(hr);
  145. return(hr);
  146. }
  147. HRESULT
  148. CHsmDirectedAction::GetSizeMax(
  149. OUT ULARGE_INTEGER* pSize
  150. )
  151. /*++
  152. Implements:
  153. IPersistStream::GetSizeMax().
  154. --*/
  155. {
  156. HRESULT hr = S_OK;
  157. WsbTraceIn(OLESTR("CHsmDirectedAction::GetSizeMax"), OLESTR(""));
  158. try {
  159. WsbAssert(0 != pSize, E_POINTER);
  160. pSize->QuadPart = WsbPersistSizeOf(ULONG) + WsbPersistSizeOf(GUID);
  161. } WsbCatch(hr);
  162. WsbTraceOut(OLESTR("CHsmDirectedAction::GetSizeMax"), OLESTR("hr = <%ls>, Size = <%ls>"), WsbHrAsString(hr), WsbPtrToUliAsString(pSize));
  163. return(hr);
  164. }
  165. HRESULT
  166. CHsmDirectedAction::Load(
  167. IN IStream* pStream
  168. )
  169. /*++
  170. Implements:
  171. IPersistStream::Load().
  172. --*/
  173. {
  174. HRESULT hr = S_OK;
  175. WsbTraceIn(OLESTR("CHsmDirectedAction::Load"), OLESTR(""));
  176. try {
  177. WsbAssert(0 != pStream, E_POINTER);
  178. WsbAffirmHr(WsbLoadFromStream(pStream, &m_nameId));
  179. WsbAffirmHr(WsbLoadFromStream(pStream, &m_storagePoolId));
  180. } WsbCatch(hr);
  181. WsbTraceOut(OLESTR("CHsmDirectedAction::Load"), OLESTR("hr = <%ls>, nameId = <%lu>, storagePoolId = <%ls>"), WsbHrAsString(hr), m_nameId, WsbGuidAsString(m_storagePoolId));
  182. return(hr);
  183. }
  184. HRESULT
  185. CHsmDirectedAction::Save(
  186. IN IStream* pStream,
  187. IN BOOL clearDirty
  188. )
  189. /*++
  190. Implements:
  191. IPersistStream::Save().
  192. --*/
  193. {
  194. HRESULT hr = S_OK;
  195. WsbTraceIn(OLESTR("CHsmDirectedAction::Save"), OLESTR("clearDirty = <%ls>"), WsbBoolAsString(clearDirty));
  196. try {
  197. WsbAssert(0 != pStream, E_POINTER);
  198. WsbAffirmHr(WsbSaveToStream(pStream, m_nameId));
  199. WsbAffirmHr(WsbSaveToStream(pStream, m_storagePoolId));
  200. // If we got it saved and we were asked to clear the dirty bit, then
  201. // do so now.
  202. if (clearDirty) {
  203. m_isDirty = FALSE;
  204. }
  205. } WsbCatch(hr);
  206. WsbTraceOut(OLESTR("CHsmDirectedAction::Save"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  207. return(hr);
  208. }
  209. HRESULT
  210. CHsmDirectedAction::SetStoragePoolId(
  211. IN GUID id
  212. )
  213. /*++
  214. Implements:
  215. IHsmDirectedAction::SetStoragePoolId().
  216. --*/
  217. {
  218. HRESULT hr = S_OK;
  219. try {
  220. m_storagePoolId = id;
  221. m_isDirty = TRUE;
  222. } WsbCatch(hr);
  223. return(S_OK);
  224. }
  225. HRESULT
  226. CHsmRelocateAction::ExpandPlaceholders(
  227. void
  228. )
  229. /*++
  230. Implements:
  231. IHsmRelocateAction::ExpandPlaceholders().
  232. --*/
  233. {
  234. return(m_expandPlaceholders ? S_OK : S_FALSE);
  235. }
  236. HRESULT
  237. CHsmRelocateAction::FinalConstruct(
  238. void
  239. )
  240. /*++
  241. Implements:
  242. CComObjectRoot::FinalConstruct().
  243. --*/
  244. {
  245. HRESULT hr = S_OK;
  246. try {
  247. WsbAffirmHr(CWsbObject::FinalConstruct());
  248. m_retainHierarchy = FALSE;;
  249. m_expandPlaceholders = FALSE;;
  250. } WsbCatch(hr);
  251. return(hr);
  252. }
  253. HRESULT
  254. CHsmRelocateAction::GetDestination(
  255. OUT OLECHAR** pDest,
  256. IN ULONG bufferSize
  257. )
  258. /*++
  259. Implements:
  260. IHsmRelocateAction::GetDestination().
  261. --*/
  262. {
  263. HRESULT hr = S_OK;
  264. try {
  265. WsbAssert(0 != pDest, E_POINTER);
  266. WsbAffirmHr(m_dest.CopyTo(pDest, bufferSize));
  267. } WsbCatch(hr);
  268. return(hr);
  269. }
  270. HRESULT
  271. CHsmRelocateAction::GetSizeMax(
  272. OUT ULARGE_INTEGER* pSize
  273. )
  274. /*++
  275. Implements:
  276. IPersistStream::GetSizeMax().
  277. --*/
  278. {
  279. HRESULT hr = S_OK;
  280. WsbTraceIn(OLESTR("CHsmRelocateAction::GetSizeMax"), OLESTR(""));
  281. try {
  282. WsbAssert(0 != pSize, E_POINTER);
  283. pSize->QuadPart = WsbPersistSizeOf(ULONG) + WsbPersistSizeOf(BOOL) + WsbPersistSizeOf(BOOL) + WsbPersistSize((wcslen(m_dest) + 1) * sizeof(OLECHAR));
  284. } WsbCatch(hr);
  285. WsbTraceOut(OLESTR("CHsmRelocateAction::GetSizeMax"), OLESTR("hr = <%ls>, Size = <%ls>"), WsbHrAsString(hr), WsbPtrToUliAsString(pSize));
  286. return(hr);
  287. }
  288. HRESULT
  289. CHsmRelocateAction::Load(
  290. IN IStream* pStream
  291. )
  292. /*++
  293. Implements:
  294. IPersistStream::Load().
  295. --*/
  296. {
  297. HRESULT hr = S_OK;
  298. WsbTraceIn(OLESTR("CHsmRelocateAction::Load"), OLESTR(""));
  299. try {
  300. WsbAssert(0 != pStream, E_POINTER);
  301. WsbAffirmHr(WsbLoadFromStream(pStream, &m_nameId));
  302. WsbAffirmHr(WsbLoadFromStream(pStream, &m_expandPlaceholders));
  303. WsbAffirmHr(WsbLoadFromStream(pStream, &m_retainHierarchy));
  304. WsbAffirmHr(WsbLoadFromStream(pStream, &m_dest, 0));
  305. } WsbCatch(hr);
  306. WsbTraceOut(OLESTR("CHsmRelocateAction::Load"), OLESTR("hr = <%ls>, expandPlaceholders = <%ls>, retainHierarchy = <%ls>, destination = <%ls>"), WsbHrAsString(hr), m_nameId, WsbBoolAsString(m_expandPlaceholders), WsbBoolAsString(m_retainHierarchy), m_dest);
  307. return(hr);
  308. }
  309. HRESULT
  310. CHsmRelocateAction::RetainHierarchy(
  311. void
  312. )
  313. /*++
  314. Implements:
  315. IHsmRelocateAction::RetainHierarchy().
  316. --*/
  317. {
  318. return(m_retainHierarchy ? S_OK : S_FALSE);
  319. }
  320. HRESULT
  321. CHsmRelocateAction::Save(
  322. IN IStream* pStream,
  323. IN BOOL clearDirty
  324. )
  325. /*++
  326. Implements:
  327. IPersistStream::Save().
  328. --*/
  329. {
  330. HRESULT hr = S_OK;
  331. WsbTraceIn(OLESTR("CHsmRelocateAction::Save"), OLESTR("clearDirty = <%ls>"), WsbBoolAsString(clearDirty));
  332. try {
  333. WsbAssert(0 != pStream, E_POINTER);
  334. WsbAffirmHr(WsbSaveToStream(pStream, m_nameId));
  335. WsbAffirmHr(WsbSaveToStream(pStream, m_expandPlaceholders));
  336. WsbAffirmHr(WsbSaveToStream(pStream, m_retainHierarchy));
  337. WsbAffirmHr(WsbSaveToStream(pStream, m_dest));
  338. // If we got it saved and we were asked to clear the dirty bit, then
  339. // do so now.
  340. if (clearDirty) {
  341. m_isDirty = FALSE;
  342. }
  343. } WsbCatch(hr);
  344. WsbTraceOut(OLESTR("CHsmRelocateAction::Save"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  345. return(hr);
  346. }
  347. HRESULT
  348. CHsmRelocateAction::SetDestination(
  349. IN OLECHAR* dest
  350. )
  351. /*++
  352. Implements:
  353. IHsmRelocateAction::SetDestination().
  354. --*/
  355. {
  356. HRESULT hr = S_OK;
  357. try {
  358. m_dest = dest;
  359. m_isDirty = TRUE;
  360. } WsbCatch(hr);
  361. return(hr);
  362. }
  363. HRESULT
  364. CHsmRelocateAction::SetExpandPlaceholders(
  365. IN BOOL expandPlaceholders
  366. )
  367. /*++
  368. Implements:
  369. IHsmRelocateAction::SetExpandPlaceholders().
  370. --*/
  371. {
  372. HRESULT hr = S_OK;
  373. try {
  374. m_expandPlaceholders = expandPlaceholders;
  375. m_isDirty = TRUE;
  376. } WsbCatch(hr);
  377. return(hr);
  378. }
  379. HRESULT
  380. CHsmRelocateAction::SetRetainHierarchy(
  381. IN BOOL retainHierarchy
  382. )
  383. /*++
  384. Implements:
  385. IHsmRelocateAction::SetRetainHierarchy().
  386. --*/
  387. {
  388. HRESULT hr = S_OK;
  389. try {
  390. m_retainHierarchy = retainHierarchy;
  391. m_isDirty = TRUE;
  392. } WsbCatch(hr);
  393. return(hr);
  394. }
  395. HRESULT
  396. CHsmActionDelete::Do(
  397. IFsaScanItem* pScanItem
  398. )
  399. /*++
  400. Implements:
  401. IHsmAction::Do().
  402. --*/
  403. {
  404. HRESULT hr = S_OK;
  405. try {
  406. WsbAssert(0 != pScanItem, E_POINTER);
  407. WsbAffirmHr(pScanItem->Delete());
  408. } WsbCatch(hr);
  409. return(hr);
  410. }
  411. HRESULT
  412. CHsmActionDelete::FinalConstruct(
  413. void
  414. )
  415. /*++
  416. Implements:
  417. CComObjectRoot::FinalConstruct().
  418. --*/
  419. {
  420. HRESULT hr = S_OK;
  421. try {
  422. WsbAffirmHr(CWsbObject::FinalConstruct());
  423. m_nameId = IDS_HSMACTIONDELETE_ID;
  424. } WsbCatch(hr);
  425. return(hr);
  426. }
  427. HRESULT
  428. CHsmActionDelete::GetClassID(
  429. OUT CLSID* pClsid
  430. )
  431. /*++
  432. Implements:
  433. IPersist::GetClassID().
  434. --*/
  435. {
  436. HRESULT hr = S_OK;
  437. WsbTraceIn(OLESTR("CHsmActionDelete::GetClassID"), OLESTR(""));
  438. try {
  439. WsbAssert(0 != pClsid, E_POINTER);
  440. *pClsid = CLSID_CHsmActionDelete;
  441. } WsbCatch(hr);
  442. WsbTraceOut(OLESTR("CHsmActionDelete::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  443. return(hr);
  444. }
  445. HRESULT
  446. CHsmActionRecall::Do(
  447. IFsaScanItem* pScanItem
  448. )
  449. /*++
  450. Implements:
  451. IHsmAction::Do().
  452. --*/
  453. {
  454. HRESULT hr = S_OK;
  455. LONGLONG offset = 0;
  456. LONGLONG size = 0;
  457. FSA_PLACEHOLDER placeholder;
  458. try {
  459. WsbAssert(0 != pScanItem, E_POINTER);
  460. // Iterate overall the reparsed areas.
  461. for (hr = pScanItem->FindFirstPlaceholder(&offset, &size, &placeholder);
  462. SUCCEEDED(hr);
  463. hr = pScanItem->FindNextPlaceholder(&offset, &size, &placeholder)) {
  464. WsbAffirmHr(pScanItem->Recall(offset, size, FALSE));
  465. }
  466. if (WSB_E_NOTFOUND == hr) {
  467. hr = S_OK;
  468. }
  469. } WsbCatch(hr);
  470. return(hr);
  471. }
  472. HRESULT
  473. CHsmActionRecall::FinalConstruct(
  474. void
  475. )
  476. /*++
  477. Implements:
  478. CComObjectRoot::FinalConstruct().
  479. --*/
  480. {
  481. HRESULT hr = S_OK;
  482. try {
  483. WsbAffirmHr(CWsbObject::FinalConstruct());
  484. m_nameId = IDS_HSMACTIONRECALL_ID;
  485. } WsbCatch(hr);
  486. return(hr);
  487. }
  488. HRESULT
  489. CHsmActionRecall::GetClassID(
  490. OUT CLSID* pClsid
  491. )
  492. /*++
  493. Implements:
  494. IPersist::GetClassID().
  495. --*/
  496. {
  497. HRESULT hr = S_OK;
  498. WsbTraceIn(OLESTR("CHsmActionRecall::GetClassID"), OLESTR(""));
  499. try {
  500. WsbAssert(0 != pClsid, E_POINTER);
  501. *pClsid = CLSID_CHsmActionRecall;
  502. } WsbCatch(hr);
  503. WsbTraceOut(OLESTR("CHsmActionRecall::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  504. return(hr);
  505. }
  506. HRESULT
  507. CHsmActionRecycle::Do(
  508. IFsaScanItem* pScanItem
  509. )
  510. /*++
  511. Implements:
  512. IHsmAction::Do().
  513. --*/
  514. {
  515. HRESULT hr = S_OK;
  516. try {
  517. WsbAssert(0 != pScanItem, E_POINTER);
  518. WsbAffirmHr(pScanItem->Recycle());
  519. } WsbCatch(hr);
  520. return(hr);
  521. }
  522. HRESULT
  523. CHsmActionRecycle::FinalConstruct(
  524. void
  525. )
  526. /*++
  527. Implements:
  528. CComObjectRoot::FinalConstruct().
  529. --*/
  530. {
  531. HRESULT hr = S_OK;
  532. try {
  533. WsbAffirmHr(CWsbObject::FinalConstruct());
  534. m_nameId = IDS_HSMACTIONRECYCLE_ID;
  535. } WsbCatch(hr);
  536. return(hr);
  537. }
  538. HRESULT
  539. CHsmActionRecycle::GetClassID(
  540. OUT CLSID* pClsid
  541. )
  542. /*++
  543. Implements:
  544. IPersist::GetClassID().
  545. --*/
  546. {
  547. HRESULT hr = S_OK;
  548. WsbTraceIn(OLESTR("CHsmActionRecycle::GetClassID"), OLESTR(""));
  549. try {
  550. WsbAssert(0 != pClsid, E_POINTER);
  551. *pClsid = CLSID_CHsmActionRecycle;
  552. } WsbCatch(hr);
  553. WsbTraceOut(OLESTR("CHsmActionRecycle::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  554. return(hr);
  555. }
  556. HRESULT
  557. CHsmActionTruncate::Do(
  558. IFsaScanItem* pScanItem
  559. )
  560. /*++
  561. Implements:
  562. IHsmAction::Do().
  563. --*/
  564. {
  565. HRESULT hr = S_OK;
  566. LONGLONG size;
  567. try {
  568. WsbAssert(0 != pScanItem, E_POINTER);
  569. WsbAffirmHr(pScanItem->GetLogicalSize(&size));
  570. WsbAffirmHr(pScanItem->Truncate(0, size));
  571. } WsbCatch(hr);
  572. return(hr);
  573. }
  574. HRESULT
  575. CHsmActionTruncate::FinalConstruct(
  576. void
  577. )
  578. /*++
  579. Implements:
  580. CComObjectRoot::FinalConstruct().
  581. --*/
  582. {
  583. HRESULT hr = S_OK;
  584. try {
  585. WsbAffirmHr(CWsbObject::FinalConstruct());
  586. m_nameId = IDS_HSMACTIONTRUNCATE_ID;
  587. } WsbCatch(hr);
  588. return(hr);
  589. }
  590. HRESULT
  591. CHsmActionTruncate::GetClassID(
  592. OUT CLSID* pClsid
  593. )
  594. /*++
  595. Implements:
  596. IPersist::GetClassID().
  597. --*/
  598. {
  599. HRESULT hr = S_OK;
  600. WsbTraceIn(OLESTR("CHsmActionTruncate::GetClassID"), OLESTR(""));
  601. try {
  602. WsbAssert(0 != pClsid, E_POINTER);
  603. *pClsid = CLSID_CHsmActionTruncate;
  604. } WsbCatch(hr);
  605. WsbTraceOut(OLESTR("CHsmActionTruncate::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  606. return(hr);
  607. }
  608. HRESULT
  609. CHsmActionUnmanage::Do(
  610. IFsaScanItem* pScanItem
  611. )
  612. /*++
  613. Implements:
  614. IHsmAction::Do().
  615. --*/
  616. {
  617. HRESULT hr = S_OK;
  618. LONGLONG offset;
  619. LONGLONG size;
  620. FSA_PLACEHOLDER placeholder;
  621. try {
  622. WsbAssert(0 != pScanItem, E_POINTER);
  623. // Iterate overall the reparsed areas.
  624. for (hr = pScanItem->FindFirstPlaceholder(&offset, &size, &placeholder);
  625. SUCCEEDED(hr);
  626. hr = pScanItem->FindNextPlaceholder(&offset, &size, &placeholder)) {
  627. WsbAffirmHr(pScanItem->Unmanage(offset, size));
  628. }
  629. if (WSB_E_NOTFOUND == hr) {
  630. hr = S_OK;
  631. }
  632. } WsbCatch(hr);
  633. return(hr);
  634. }
  635. HRESULT
  636. CHsmActionUnmanage::FinalConstruct(
  637. void
  638. )
  639. /*++
  640. Implements:
  641. CComObjectRoot::FinalConstruct().
  642. --*/
  643. {
  644. HRESULT hr = S_OK;
  645. try {
  646. WsbAffirmHr(CWsbObject::FinalConstruct());
  647. m_nameId = IDS_HSMACTIONUNMANAGE_ID;
  648. } WsbCatch(hr);
  649. return(hr);
  650. }
  651. HRESULT
  652. CHsmActionUnmanage::GetClassID(
  653. OUT CLSID* pClsid
  654. )
  655. /*++
  656. Implements:
  657. IPersist::GetClassID().
  658. --*/
  659. {
  660. HRESULT hr = S_OK;
  661. WsbTraceIn(OLESTR("CHsmActionUnmanage::GetClassID"), OLESTR(""));
  662. try {
  663. WsbAssert(0 != pClsid, E_POINTER);
  664. *pClsid = CLSID_CHsmActionUnmanage;
  665. } WsbCatch(hr);
  666. WsbTraceOut(OLESTR("CHsmActionUnmanage::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  667. return(hr);
  668. }
  669. HRESULT
  670. CHsmActionValidate::Do(
  671. IFsaScanItem* pScanItem
  672. )
  673. /*++
  674. Implements:
  675. IHsmAction::Do().
  676. --*/
  677. {
  678. HRESULT hr = S_OK;
  679. LONGLONG offset;
  680. LONGLONG size;
  681. FSA_PLACEHOLDER placeholder;
  682. try {
  683. WsbAssert(0 != pScanItem, E_POINTER);
  684. // Iterate overall the reparsed areas.
  685. for (hr = pScanItem->FindFirstPlaceholder(&offset, &size, &placeholder);
  686. SUCCEEDED(hr);
  687. hr = pScanItem->FindNextPlaceholder(&offset, &size, &placeholder)) {
  688. WsbAffirmHr(pScanItem->Validate(offset, size));
  689. }
  690. if (WSB_E_NOTFOUND == hr) {
  691. hr = S_OK;
  692. }
  693. } WsbCatch(hr);
  694. return(hr);
  695. }
  696. HRESULT
  697. CHsmActionValidate::FinalConstruct(
  698. void
  699. )
  700. /*++
  701. Implements:
  702. CComObjectRoot::FinalConstruct().
  703. --*/
  704. {
  705. HRESULT hr = S_OK;
  706. try {
  707. WsbAffirmHr(CWsbObject::FinalConstruct());
  708. m_nameId = IDS_HSMACTIONVALIDATE_ID;
  709. } WsbCatch(hr);
  710. return(hr);
  711. }
  712. HRESULT
  713. CHsmActionValidate::GetClassID(
  714. OUT CLSID* pClsid
  715. )
  716. /*++
  717. Implements:
  718. IPersist::GetClassID().
  719. --*/
  720. {
  721. HRESULT hr = S_OK;
  722. WsbTraceIn(OLESTR("CHsmActionValidate::GetClassID"), OLESTR(""));
  723. try {
  724. WsbAssert(0 != pClsid, E_POINTER);
  725. *pClsid = CLSID_CHsmActionValidate;
  726. } WsbCatch(hr);
  727. WsbTraceOut(OLESTR("CHsmActionValidate::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  728. return(hr);
  729. }
  730. HRESULT
  731. CHsmActionManage::Do(
  732. IFsaScanItem* pScanItem
  733. )
  734. /*++
  735. Implements:
  736. IHsmAction::Do().
  737. --*/
  738. {
  739. HRESULT hr = S_OK;
  740. LONGLONG size;
  741. WsbTraceIn(OLESTR("CHsmActionManage::Do"), OLESTR(""));
  742. try {
  743. WsbAssert(0 != pScanItem, E_POINTER);
  744. WsbAffirmHr(pScanItem->GetLogicalSize(&size));
  745. WsbAffirmHr(pScanItem->Manage(0, size, m_storagePoolId, FALSE));
  746. } WsbCatch(hr);
  747. WsbTraceOut(OLESTR("CHsmActionManage::Do"), OLESTR("hr = <%ls>"), WsbHrAsString(hr));
  748. return(hr);
  749. }
  750. HRESULT
  751. CHsmActionManage::FinalConstruct(
  752. void
  753. )
  754. /*++
  755. Implements:
  756. CComObjectRoot::FinalConstruct().
  757. --*/
  758. {
  759. HRESULT hr = S_OK;
  760. try {
  761. WsbAffirmHr(CHsmDirectedAction::FinalConstruct());
  762. m_nameId = IDS_HSMACTIONMANAGE_ID;
  763. } WsbCatch(hr);
  764. return(hr);
  765. }
  766. HRESULT
  767. CHsmActionManage::GetClassID(
  768. OUT CLSID* pClsid
  769. )
  770. /*++
  771. Implements:
  772. IPersist::GetClassID().
  773. --*/
  774. {
  775. HRESULT hr = S_OK;
  776. WsbTraceIn(OLESTR("CHsmActionManage::GetClassID"), OLESTR(""));
  777. try {
  778. WsbAssert(0 != pClsid, E_POINTER);
  779. *pClsid = CLSID_CHsmActionManage;
  780. } WsbCatch(hr);
  781. WsbTraceOut(OLESTR("CHsmActionManage::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  782. return(hr);
  783. }
  784. HRESULT
  785. CHsmActionMigrate::Do(
  786. IFsaScanItem* pScanItem
  787. )
  788. /*++
  789. Implements:
  790. IHsmAction::Do().
  791. --*/
  792. {
  793. HRESULT hr = S_OK;
  794. LONGLONG size;
  795. try {
  796. WsbAssert(0 != pScanItem, E_POINTER);
  797. WsbAffirmHr(pScanItem->GetLogicalSize(&size));
  798. WsbAffirmHr(pScanItem->Manage(0, size, m_storagePoolId, TRUE));
  799. } WsbCatch(hr);
  800. return(hr);
  801. }
  802. HRESULT
  803. CHsmActionMigrate::FinalConstruct(
  804. void
  805. )
  806. /*++
  807. Implements:
  808. CComObjectRoot::FinalConstruct().
  809. --*/
  810. {
  811. HRESULT hr = S_OK;
  812. try {
  813. WsbAffirmHr(CHsmDirectedAction::FinalConstruct());
  814. m_nameId = IDS_HSMACTIONMIGRATE_ID;
  815. } WsbCatch(hr);
  816. return(hr);
  817. }
  818. HRESULT
  819. CHsmActionMigrate::GetClassID(
  820. OUT CLSID* pClsid
  821. )
  822. /*++
  823. Implements:
  824. IPersist::GetClassID().
  825. --*/
  826. {
  827. HRESULT hr = S_OK;
  828. WsbTraceIn(OLESTR("CHsmActionMigrate::GetClassID"), OLESTR(""));
  829. try {
  830. WsbAssert(0 != pClsid, E_POINTER);
  831. *pClsid = CLSID_CHsmActionMigrate;
  832. } WsbCatch(hr);
  833. WsbTraceOut(OLESTR("CHsmActionMigrate::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  834. return(hr);
  835. }
  836. HRESULT
  837. CHsmActionCopy::Do(
  838. IFsaScanItem* pScanItem
  839. )
  840. /*++
  841. Implements:
  842. IHsmAction::Do().
  843. --*/
  844. {
  845. HRESULT hr = S_OK;
  846. try {
  847. WsbAssert(0 != pScanItem, E_POINTER);
  848. WsbAffirmHr(pScanItem->Copy(m_dest, m_retainHierarchy, m_expandPlaceholders, TRUE));
  849. } WsbCatch(hr);
  850. return(hr);
  851. }
  852. HRESULT
  853. CHsmActionCopy::FinalConstruct(
  854. void
  855. )
  856. /*++
  857. Implements:
  858. CComObjectRoot::FinalConstruct().
  859. --*/
  860. {
  861. HRESULT hr = S_OK;
  862. try {
  863. WsbAffirmHr(CHsmRelocateAction::FinalConstruct());
  864. m_nameId = IDS_HSMACTIONCOPY_ID;
  865. } WsbCatch(hr);
  866. return(hr);
  867. }
  868. HRESULT
  869. CHsmActionCopy::GetClassID(
  870. OUT CLSID* pClsid
  871. )
  872. /*++
  873. Implements:
  874. IPersist::GetClassID().
  875. --*/
  876. {
  877. HRESULT hr = S_OK;
  878. WsbTraceIn(OLESTR("CHsmActionCopy::GetClassID"), OLESTR(""));
  879. try {
  880. WsbAssert(0 != pClsid, E_POINTER);
  881. *pClsid = CLSID_CHsmActionCopy;
  882. } WsbCatch(hr);
  883. WsbTraceOut(OLESTR("CHsmActionCopy::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  884. return(hr);
  885. }
  886. HRESULT
  887. CHsmActionMove::Do(
  888. IFsaScanItem* pScanItem
  889. )
  890. /*++
  891. Implements:
  892. IHsmAction::Do().
  893. --*/
  894. {
  895. HRESULT hr = S_OK;
  896. try {
  897. WsbAssert(0 != pScanItem, E_POINTER);
  898. WsbAffirmHr(pScanItem->Move(m_dest, m_retainHierarchy, m_expandPlaceholders, TRUE));
  899. } WsbCatch(hr);
  900. return(hr);
  901. }
  902. HRESULT
  903. CHsmActionMove::FinalConstruct(
  904. void
  905. )
  906. /*++
  907. Implements:
  908. CComObjectRoot::FinalConstruct().
  909. --*/
  910. {
  911. HRESULT hr = S_OK;
  912. try {
  913. WsbAffirmHr(CHsmRelocateAction::FinalConstruct());
  914. m_nameId = IDS_HSMACTIONMOVE_ID;
  915. } WsbCatch(hr);
  916. return(hr);
  917. }
  918. HRESULT
  919. CHsmActionMove::GetClassID(
  920. OUT CLSID* pClsid
  921. )
  922. /*++
  923. Implements:
  924. IPersist::GetClassID().
  925. --*/
  926. {
  927. HRESULT hr = S_OK;
  928. WsbTraceIn(OLESTR("CHsmActionMove::GetClassID"), OLESTR(""));
  929. try {
  930. WsbAssert(0 != pClsid, E_POINTER);
  931. *pClsid = CLSID_CHsmActionMove;
  932. } WsbCatch(hr);
  933. WsbTraceOut(OLESTR("CHsmActionMove::GetClassID"), OLESTR("hr = <%ls>, CLSID = <%ls>"), WsbHrAsString(hr), WsbGuidAsString(*pClsid));
  934. return(hr);
  935. }