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.

799 lines
21 KiB

  1. //-------------------------------------------------------------------------
  2. //
  3. // Microsoft OLE
  4. // Copyright (C) Microsoft Corporation, 1994 - 1995.
  5. //
  6. // File: ivcptsts.cxx
  7. //
  8. // Contents: storage base tests basically pertaining to IStorage/IStream copy
  9. // ops
  10. //
  11. // Functions:
  12. //
  13. // History: 21-July-1996 NarindK Created.
  14. // 27-Mar-97 SCousens conversionified
  15. //
  16. //--------------------------------------------------------------------------
  17. #include <dfheader.hxx>
  18. #pragma hdrstop
  19. #include "init.hxx"
  20. //----------------------------------------------------------------------------
  21. //
  22. // Test: IVCPYTEST_100
  23. //
  24. // Synopsis:Create a root docfile with a child IStorage and a child IStream
  25. // within the child IStorage. Commit the root docfile. Create a
  26. // new root docfile with a different name.
  27. // Revert the child IStorage. CopyTo() the child IStorage to the
  28. // second root docfile. Now revert the original root docfile and
  29. // attempt the same CopyTo() operation we just tried. This should
  30. // fail with STG_E_REVERTED since the child IStorage should be
  31. // marked invalid from the root revert.
  32. //
  33. // Arguments:[argc]
  34. // [argv]
  35. //
  36. // Returns: HRESULT
  37. //
  38. // History: 21-July-1996 NarindK Created.
  39. //
  40. // Notes: This test runs in transacted, and transacted deny write modes
  41. //
  42. // New Test Notes:
  43. // 1. Old File: ICPARINV.CXX
  44. // 2. Old name of test : IllegitCopyParentInvalid Test
  45. // New Name of test : IVCPYTEST_100
  46. // 3. To run the test, do the following at command prompt.
  47. // a. stgbase /seed:2 /dfdepth:0-0 /dfstg:0-0 /dfstm:0-0 /t:IVCPYTEST-100
  48. // /dfRootMode:xactReadWriteShEx /dfStgMode:xactReadWriteShEx
  49. // b. stgbase /seed:2 /dfdepth:0-0 /dfstg:0-0 /dfstm:0-0 /t:VCPYTEST-100
  50. // /dfRootMode:xactReadWriteShDenyW /dfStgMode:xactReadWriteShEx
  51. //
  52. // BUGNOTE: Conversion: IVCPYTEST-100
  53. //
  54. // Note: In this test, we are not adjusting the VirtualDF tree as
  55. // result of copyto opeartions as this test checks only the return
  56. // error codes as result of copyto operations
  57. //-----------------------------------------------------------------------------
  58. HRESULT IVCPYTEST_100(int argc, char *argv[])
  59. {
  60. HRESULT hr = S_OK;
  61. HRESULT hr2 = S_OK;
  62. ChanceDF *pTestChanceDF = NULL;
  63. VirtualDF *pTestVirtualDF = NULL;
  64. VirtualCtrNode *pVirtualDFRoot = NULL;
  65. VirtualCtrNode *pvcnRootNewChildStorage= NULL;
  66. VirtualStmNode *pvsnChildStgNewChildStm= NULL;
  67. LPTSTR pRootNewChildStgName = NULL;
  68. LPTSTR pChildStgNewChildStmName= NULL;
  69. ChanceDF *pNewTestChanceDF = NULL;
  70. VirtualDF *pNewTestVirtualDF = NULL;
  71. VirtualCtrNode *pNewVirtualDFRoot = NULL;
  72. LPTSTR pNewRootDocFileName = NULL;
  73. DG_STRING *pdgu = NULL;
  74. USHORT usErr = 0;
  75. DWORD dwRootMode = 0;
  76. DWORD dwStgMode = 0;
  77. BOOL fPass = TRUE;
  78. CDFD cdfd;
  79. DH_FUNCENTRY(NULL, DH_LVL_DFLIB, _TEXT("IVCPYTEST_100"));
  80. DH_TRACE((DH_LVL_TRACE1, TEXT("--------------------------------------------")) );
  81. DH_TRACE((DH_LVL_TRACE1, TEXT("Test variation IVCPYTEST_100 started.")) );
  82. DH_TRACE((DH_LVL_TRACE1,TEXT("Attempt invalid copyto fm child IStg to root")));
  83. // Create our ChanceDF and VirtualDF
  84. hr = CreateTestDocfile (argc,
  85. argv,
  86. &pVirtualDFRoot,
  87. &pTestVirtualDF,
  88. &pTestChanceDF);
  89. // if creating the docfile - bail here
  90. if (NULL != pTestChanceDF && DoingCreate ())
  91. {
  92. UINT ulSeed = pTestChanceDF->GetSeed ();
  93. CleanupTestDocfile (&pVirtualDFRoot,
  94. &pTestVirtualDF,
  95. &pTestChanceDF,
  96. FALSE);
  97. return (HRESULT)ulSeed;
  98. }
  99. if (S_OK == hr)
  100. {
  101. dwRootMode = pTestChanceDF->GetRootMode();
  102. dwStgMode = pTestChanceDF->GetStgMode();
  103. DH_TRACE((
  104. DH_LVL_TRACE1,
  105. TEXT("Run Mode for IVCPYTEST_100, Access mode: %lx"),
  106. dwRootMode));
  107. }
  108. // Add a child storage to root.
  109. // Get DG_STRING object pointer
  110. if (S_OK == hr)
  111. {
  112. pdgu = pTestVirtualDF->GetDataGenUnicode();
  113. DH_ASSERT(NULL != pdgu);
  114. }
  115. // Generate a random name for child IStorage
  116. if(S_OK == hr)
  117. {
  118. hr = GenerateRandomName(pdgu,MINLENGTH,MAXLENGTH,&pRootNewChildStgName);
  119. DH_HRCHECK(hr, TEXT("GenerateRandomName")) ;
  120. }
  121. // Adds a new storage to the root storage.
  122. if(S_OK == hr)
  123. {
  124. hr = AddStorage(
  125. pTestVirtualDF,
  126. pVirtualDFRoot,
  127. pRootNewChildStgName,
  128. dwStgMode | STGM_CREATE,
  129. &pvcnRootNewChildStorage);
  130. DH_HRCHECK(hr, TEXT("AddStorage")) ;
  131. }
  132. if(S_OK == hr)
  133. {
  134. DH_TRACE((
  135. DH_LVL_TRACE1,
  136. TEXT("VirtualCtrNode::AddStorage completed successfully.")));
  137. }
  138. else
  139. {
  140. DH_TRACE((
  141. DH_LVL_TRACE1,
  142. TEXT("VirtualCtrNode::AddStorage not successful, hr = 0x%lx."),
  143. hr));
  144. }
  145. // Adds a new stream to this child storage.
  146. if(S_OK == hr)
  147. {
  148. // Generate random name for stream
  149. hr = GenerateRandomName(
  150. pdgu,
  151. MINLENGTH,
  152. MAXLENGTH,
  153. &pChildStgNewChildStmName);
  154. DH_HRCHECK(hr, TEXT("GenerateRandomName")) ;
  155. }
  156. if(S_OK == hr)
  157. {
  158. hr = AddStream(
  159. pTestVirtualDF,
  160. pvcnRootNewChildStorage,
  161. pChildStgNewChildStmName,
  162. 0,
  163. STGM_READWRITE |
  164. STGM_SHARE_EXCLUSIVE,
  165. &pvsnChildStgNewChildStm);
  166. DH_HRCHECK(hr, TEXT("AddStream")) ;
  167. }
  168. if(S_OK == hr)
  169. {
  170. DH_TRACE((
  171. DH_LVL_TRACE1,
  172. TEXT("VirtualStmNode::AddStream completed successfully.")));
  173. }
  174. else
  175. {
  176. DH_TRACE((
  177. DH_LVL_TRACE1,
  178. TEXT("VirtualStmNode::AddStream not successful, hr = 0x%lx."),
  179. hr));
  180. }
  181. // Commit the root storage.
  182. if(S_OK == hr)
  183. {
  184. hr = pVirtualDFRoot->Commit(STGC_DEFAULT);
  185. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Commit")) ;
  186. }
  187. if (S_OK == hr)
  188. {
  189. DH_TRACE((
  190. DH_LVL_TRACE1,
  191. TEXT("VirtualCtrNode::Commit completed successfully.")));
  192. }
  193. else
  194. {
  195. DH_TRACE((
  196. DH_LVL_TRACE1,
  197. TEXT("VirtualCtrNode::Commit unsuccessful, hr=0x%lx."),
  198. hr));
  199. }
  200. // Revert the child storage
  201. if(S_OK == hr)
  202. {
  203. hr = pvcnRootNewChildStorage->Revert();
  204. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Revert")) ;
  205. }
  206. if (S_OK == hr)
  207. {
  208. DH_TRACE((
  209. DH_LVL_TRACE1,
  210. TEXT("VirtualCtrNode::Revert completed successfully.")));
  211. }
  212. else
  213. {
  214. DH_TRACE((
  215. DH_LVL_TRACE1,
  216. TEXT("VirtualCtrNode::Revert unsuccessful, hr=0x%lx."),
  217. hr));
  218. }
  219. // Create a new destination docfile with a random name
  220. if(S_OK == hr)
  221. {
  222. // Generate random name for new docfile
  223. hr = GenerateRandomName(
  224. pdgu,
  225. MINLENGTH,
  226. MAXLENGTH,
  227. &pNewRootDocFileName);
  228. DH_HRCHECK(hr, TEXT("GenerateRandomName")) ;
  229. }
  230. // Create the new ChanceDocFile tree that would consist of chance nodes.
  231. if (S_OK == hr)
  232. {
  233. pNewTestChanceDF = new ChanceDF();
  234. if(NULL == pNewTestChanceDF)
  235. {
  236. hr = E_OUTOFMEMORY;
  237. }
  238. }
  239. if(S_OK == hr)
  240. {
  241. cdfd.cDepthMin = 0;
  242. cdfd.cDepthMax = 0;
  243. cdfd.cStgMin = 0;
  244. cdfd.cStgMax = 0;
  245. cdfd.cStmMin = 0;
  246. cdfd.cStmMax = 0;
  247. cdfd.cbStmMin = 0;
  248. cdfd.cbStmMax = 0;
  249. cdfd.ulSeed = pTestChanceDF->GetSeed();
  250. cdfd.dwRootMode = dwRootMode;
  251. hr = pNewTestChanceDF->Create(&cdfd, pNewRootDocFileName);
  252. DH_HRCHECK(hr, TEXT("pNewTestChanceDF->Create"));
  253. }
  254. if (S_OK == hr)
  255. {
  256. pNewTestVirtualDF = new VirtualDF();
  257. if(NULL == pNewTestVirtualDF)
  258. {
  259. hr = E_OUTOFMEMORY;
  260. }
  261. }
  262. if (S_OK == hr)
  263. {
  264. hr = pNewTestVirtualDF->GenerateVirtualDF(
  265. pNewTestChanceDF,
  266. &pNewVirtualDFRoot);
  267. DH_HRCHECK(hr, TEXT("pNewTestVirtualDF->GenerateVirtualDF")) ;
  268. }
  269. if (S_OK == hr)
  270. {
  271. DH_TRACE((
  272. DH_LVL_TRACE1,
  273. TEXT("DocFile - CreateFromParams - successfully created.")));
  274. }
  275. else
  276. {
  277. DH_TRACE((
  278. DH_LVL_TRACE1,
  279. TEXT("DocFile - CreateFromParams - failed, hr=0x%lx."),
  280. hr));
  281. }
  282. // Copy source docfile child storage to destination root docfile
  283. if(S_OK == hr)
  284. {
  285. hr = pvcnRootNewChildStorage->CopyTo(0, NULL, NULL, pNewVirtualDFRoot);
  286. DH_HRCHECK(hr, TEXT("VirtualCtrNode::CopyTo")) ;
  287. }
  288. if (S_OK == hr)
  289. {
  290. DH_TRACE((
  291. DH_LVL_TRACE1,
  292. TEXT("VirtualCtrNode::CopyTo completed successfully.")));
  293. }
  294. else
  295. {
  296. DH_TRACE((
  297. DH_LVL_TRACE1,
  298. TEXT("VirtualCtrNode::CopyTo unsuccessful, hr=0x%lx."),
  299. hr));
  300. }
  301. // Revert the root source docfile
  302. if(S_OK == hr)
  303. {
  304. hr = pVirtualDFRoot->Revert();
  305. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Revert")) ;
  306. }
  307. if (S_OK == hr)
  308. {
  309. DH_TRACE((
  310. DH_LVL_TRACE1,
  311. TEXT("VirtualCtrNode::Revert completed successfully.")));
  312. }
  313. else
  314. {
  315. DH_TRACE((
  316. DH_LVL_TRACE1,
  317. TEXT("VirtualCtrNode::Revert unsuccessful, hr=0x%lx."),
  318. hr));
  319. }
  320. // Attempt Copy source docfile child storage to destination root docfile
  321. if(S_OK == hr)
  322. {
  323. hr = pvcnRootNewChildStorage->CopyTo(0, NULL, NULL, pNewVirtualDFRoot);
  324. DH_HRCHECK(hr, TEXT("VirtualCtrNode::CopyTo")) ;
  325. }
  326. if (STG_E_REVERTED == hr)
  327. {
  328. DH_TRACE((
  329. DH_LVL_TRACE1,
  330. TEXT("VirtualCtrNode::CopyTo failed as exp, hr = 0x%lx"),
  331. hr));
  332. hr = S_OK;
  333. }
  334. else
  335. {
  336. fPass = FALSE;
  337. DH_TRACE((
  338. DH_LVL_TRACE1,
  339. TEXT("VirtualCtrNode::CopyTo not as exp, hr=0x%lx."),
  340. hr));
  341. }
  342. // Copy source root docfile to dest root docfile.
  343. if(S_OK == hr)
  344. {
  345. hr = pVirtualDFRoot->CopyTo(0, NULL, NULL, pNewVirtualDFRoot);
  346. DH_HRCHECK(hr, TEXT("VirtualCtrNode::CopyTo")) ;
  347. }
  348. if (S_OK == hr)
  349. {
  350. DH_TRACE((
  351. DH_LVL_TRACE1,
  352. TEXT("VirtualCtrNode::CopyTo completed successfully.")));
  353. }
  354. else
  355. {
  356. DH_TRACE((
  357. DH_LVL_TRACE1,
  358. TEXT("VirtualCtrNode::CopyTo unsuccessful, hr=0x%lx."),
  359. hr));
  360. }
  361. // Close the source Root Docfile.
  362. if (S_OK == hr)
  363. {
  364. hr = pVirtualDFRoot->Close();
  365. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Close")) ;
  366. }
  367. if (S_OK == hr)
  368. {
  369. DH_TRACE((
  370. DH_LVL_TRACE1,
  371. TEXT("VirtualCtrNode::Close completed successfully.")));
  372. }
  373. else
  374. {
  375. DH_TRACE((
  376. DH_LVL_TRACE1,
  377. TEXT("VirtualCtrNode::Close unsuccessful, hr=0x%lx."),
  378. hr));
  379. }
  380. // Close the dest Root Docfile.
  381. if (S_OK == hr)
  382. {
  383. hr = pNewVirtualDFRoot->Close();
  384. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Close")) ;
  385. }
  386. if (S_OK == hr)
  387. {
  388. DH_TRACE((
  389. DH_LVL_TRACE1,
  390. TEXT("VirtualCtrNode::Close completed successfully.")));
  391. }
  392. else
  393. {
  394. DH_TRACE((
  395. DH_LVL_TRACE1,
  396. TEXT("VirtualCtrNode::Close unsuccessful, hr=0x%lx."),
  397. hr));
  398. }
  399. // if everything goes well, log test as passed else failed.
  400. if ((S_OK == hr) && (TRUE == fPass))
  401. {
  402. DH_LOG((LOG_PASS, TEXT("Test variation IVCPYTEST_100 passed.")) );
  403. }
  404. else
  405. {
  406. DH_LOG((LOG_FAIL,
  407. TEXT("Test variation IVCPYTEST_100 failed, hr=0x%lx."),
  408. hr) );
  409. // test failed. make it look like it failed.
  410. hr = FirstError (hr, E_FAIL);
  411. }
  412. // Cleanup
  413. CleanupTestDocfile (&pVirtualDFRoot,
  414. &pTestVirtualDF,
  415. &pTestChanceDF,
  416. S_OK == hr);
  417. // Delete new Chance docfile tree
  418. if(NULL != pNewTestChanceDF)
  419. {
  420. hr2 = pNewTestChanceDF->DeleteChanceDocFileTree(
  421. pNewTestChanceDF->GetChanceDFRoot());
  422. DH_HRCHECK(hr2, TEXT("pNewTestChanceDF->DeleteChanceFileDocTree")) ;
  423. delete pNewTestChanceDF;
  424. pNewTestChanceDF = NULL;
  425. }
  426. // Delete new Virtual docfile tree
  427. if(NULL != pNewTestVirtualDF)
  428. {
  429. hr2 = pNewTestVirtualDF->DeleteVirtualDocFileTree(pNewVirtualDFRoot);
  430. DH_HRCHECK(hr2, TEXT("pNewTestVirtualDF->DeleteVirtualFileDocTree")) ;
  431. delete pNewTestVirtualDF;
  432. pNewTestVirtualDF = NULL;
  433. }
  434. if((S_OK == hr) && (NULL != pNewRootDocFileName))
  435. {
  436. if(FALSE == DeleteFile(pNewRootDocFileName))
  437. {
  438. hr2 = HRESULT_FROM_WIN32(GetLastError()) ;
  439. DH_HRCHECK(hr2, TEXT("DeleteFile")) ;
  440. }
  441. }
  442. // Delete strings
  443. if(NULL != pNewRootDocFileName)
  444. {
  445. delete pNewRootDocFileName;
  446. pNewRootDocFileName = NULL;
  447. }
  448. if(NULL != pRootNewChildStgName)
  449. {
  450. delete pRootNewChildStgName;
  451. pRootNewChildStgName = NULL;
  452. }
  453. if(NULL != pChildStgNewChildStmName)
  454. {
  455. delete pChildStgNewChildStmName;
  456. pChildStgNewChildStmName = NULL;
  457. }
  458. // Stop logging the test
  459. DH_TRACE((DH_LVL_TRACE1, TEXT("Test variation IVCPYTEST_100 finished")) );
  460. DH_TRACE((DH_LVL_TRACE1, TEXT("--------------------------------------------")) );
  461. return hr;
  462. }
  463. //----------------------------------------------------------------------------
  464. //
  465. // Test: IVCPYTEST_101
  466. //
  467. // Synopsis:Create a root docfile with a child IStorage. Make an attempt
  468. // attempt to copy the root docfile into the child. This should
  469. // result in an error.
  470. //
  471. // Arguments:[argc]
  472. // [argv]
  473. //
  474. // Returns: HRESULT
  475. //
  476. // History: 21-July-1996 NarindK Created.
  477. //
  478. // Notes: This test runs in direct, transacted, transacted deny write modes
  479. //
  480. // New Test Notes:
  481. // 1. Old File: ICPARTOC.CXX
  482. // 2. Old name of test : IllegitCopyParentToChild Test
  483. // New Name of test : IVCPYTEST_101
  484. // 3. To run the test, do the following at command prompt.
  485. // a. stgbase /seed:2 /dfdepth:0-0 /dfstg:0-0 /dfstm:0-0 /t:IVCPYTEST-101
  486. // /dfRootMode:dirReadWriteShEx /dfStgMode:dirReadWriteShEx
  487. // b. stgbase /seed:2 /dfdepth:0-0 /dfstg:0-0 /dfstm:0-0 /t:IVCPYTEST-101
  488. // /dfRootMode:xactReadWriteShEx /dfStgMode:xactReadWriteShEx
  489. // c. stgbase /seed:2 /dfdepth:0-0 /dfstg:0-0 /dfstm:0-0 /t:IVCPYTEST-101
  490. // /dfRootMode:xactReadWriteShDenyW /dfStgMode:xactReadWriteShEx
  491. //
  492. // BUGNOTE: Conversion: IVCPYTEST-101
  493. //
  494. //-----------------------------------------------------------------------------
  495. HRESULT IVCPYTEST_101(int argc, char *argv[])
  496. {
  497. HRESULT hr = S_OK;
  498. ChanceDF *pTestChanceDF = NULL;
  499. VirtualDF *pTestVirtualDF = NULL;
  500. VirtualCtrNode *pVirtualDFRoot = NULL;
  501. VirtualCtrNode *pvcnRootNewChildStorage= NULL;
  502. LPTSTR pRootNewChildStgName = NULL;
  503. DWORD dwRootMode = 0;
  504. DWORD dwStgMode = 0;
  505. DG_STRING *pdgu = NULL;
  506. USHORT usErr = 0;
  507. BOOL fPass = TRUE;
  508. DH_FUNCENTRY(NULL, DH_LVL_DFLIB, _TEXT("IVCPYTEST_101"));
  509. DH_TRACE((DH_LVL_TRACE1, TEXT("--------------------------------------------")) );
  510. DH_TRACE((DH_LVL_TRACE1, TEXT("Test variation IVCPYTEST_101 started.")) );
  511. DH_TRACE((DH_LVL_TRACE1,TEXT("Attempt invalid copyto fm Parent stg to child")));
  512. // Create our ChanceDF and VirtualDF
  513. hr = CreateTestDocfile (argc,
  514. argv,
  515. &pVirtualDFRoot,
  516. &pTestVirtualDF,
  517. &pTestChanceDF);
  518. // if creating the docfile - bail here
  519. if (NULL != pTestChanceDF && DoingCreate ())
  520. {
  521. UINT ulSeed = pTestChanceDF->GetSeed ();
  522. CleanupTestDocfile (&pVirtualDFRoot,
  523. &pTestVirtualDF,
  524. &pTestChanceDF,
  525. FALSE);
  526. return (HRESULT)ulSeed;
  527. }
  528. if (S_OK == hr)
  529. {
  530. dwRootMode = pTestChanceDF->GetRootMode();
  531. dwStgMode = pTestChanceDF->GetStgMode();
  532. DH_TRACE((
  533. DH_LVL_TRACE1,
  534. TEXT("Run Mode for IVCPYTEST_101, Access mode: %lx"),
  535. dwRootMode));
  536. }
  537. // Get DG_STRING object pointer
  538. if (S_OK == hr)
  539. {
  540. pdgu = pTestVirtualDF->GetDataGenUnicode();
  541. DH_ASSERT(NULL != pdgu);
  542. }
  543. // Add a child storage to root.
  544. // Generate a random name for child IStorage
  545. if(S_OK == hr)
  546. {
  547. hr = GenerateRandomName(pdgu,MINLENGTH,MAXLENGTH,&pRootNewChildStgName);
  548. DH_HRCHECK(hr, TEXT("GenerateRandomName")) ;
  549. }
  550. // Adds a new storage to the root storage.
  551. if(S_OK == hr)
  552. {
  553. hr = AddStorage(
  554. pTestVirtualDF,
  555. pVirtualDFRoot,
  556. pRootNewChildStgName,
  557. dwStgMode | STGM_CREATE,
  558. &pvcnRootNewChildStorage);
  559. DH_HRCHECK(hr, TEXT("AddStorage")) ;
  560. }
  561. if(S_OK == hr)
  562. {
  563. DH_TRACE((
  564. DH_LVL_TRACE1,
  565. TEXT("VirtualCtrNode::AddStorage completed successfully.")));
  566. }
  567. else
  568. {
  569. DH_TRACE((
  570. DH_LVL_TRACE1,
  571. TEXT("VirtualCtrNode::AddStorage not successful, hr = 0x%lx."),
  572. hr));
  573. }
  574. // Copy source root docfile to child storage.
  575. if(S_OK == hr)
  576. {
  577. hr = pVirtualDFRoot->CopyTo(0, NULL, NULL, pvcnRootNewChildStorage);
  578. DH_HRCHECK(hr, TEXT("VirtualCtrNode::CopyTo")) ;
  579. }
  580. if (STG_E_ACCESSDENIED == hr)
  581. {
  582. DH_TRACE((
  583. DH_LVL_TRACE1,
  584. TEXT("VirtualCtrNode::CopyTo failed as exp, hr=0x%lx."),
  585. hr));
  586. hr = S_OK;
  587. }
  588. else
  589. {
  590. fPass = FALSE;
  591. DH_TRACE((
  592. DH_LVL_TRACE1,
  593. TEXT("VirtualCtrNode::CopyTo passed unexp, hr=0x%lx."),
  594. hr));
  595. }
  596. // Close child storage
  597. if (S_OK == hr)
  598. {
  599. hr = pvcnRootNewChildStorage->Close();
  600. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Close")) ;
  601. }
  602. if (S_OK == hr)
  603. {
  604. DH_TRACE((
  605. DH_LVL_TRACE1,
  606. TEXT("VirtualCtrNode::Close completed successfully.")));
  607. }
  608. else
  609. {
  610. DH_TRACE((
  611. DH_LVL_TRACE1,
  612. TEXT("VirtualCtrNode::Close unsuccessful, hr=0x%lx."),
  613. hr));
  614. }
  615. // Close Root Storage
  616. if (S_OK == hr)
  617. {
  618. hr = pVirtualDFRoot->Close();
  619. DH_HRCHECK(hr, TEXT("VirtualCtrNode::Close")) ;
  620. }
  621. if (S_OK == hr)
  622. {
  623. DH_TRACE((
  624. DH_LVL_TRACE1,
  625. TEXT("VirtualCtrNode::Close completed successfully.")));
  626. }
  627. else
  628. {
  629. DH_TRACE((
  630. DH_LVL_TRACE1,
  631. TEXT("VirtualCtrNode::Close unsuccessful, hr=0x%lx."),
  632. hr));
  633. }
  634. // if everything goes well, log test as passed else failed.
  635. if ((S_OK == hr) && (TRUE == fPass))
  636. {
  637. DH_LOG((LOG_PASS, TEXT("Test variation IVCPYTEST_101 passed.")) );
  638. }
  639. else
  640. {
  641. DH_LOG((LOG_FAIL,
  642. TEXT("Test variation IVCPYTEST_101 failed, hr=0x%lx."),
  643. hr) );
  644. // test failed. make it look like it failed.
  645. hr = FirstError (hr, E_FAIL);
  646. }
  647. // Cleanup
  648. CleanupTestDocfile (&pVirtualDFRoot,
  649. &pTestVirtualDF,
  650. &pTestChanceDF,
  651. S_OK == hr);
  652. // Delete temp string
  653. if(NULL != pRootNewChildStgName)
  654. {
  655. delete pRootNewChildStgName;
  656. pRootNewChildStgName = NULL;
  657. }
  658. // Stop logging the test
  659. DH_TRACE((DH_LVL_TRACE1, TEXT("Test variation IVCPYTEST_101 finished")) );
  660. DH_TRACE((DH_LVL_TRACE1, TEXT("--------------------------------------------")) );
  661. return hr;
  662. }