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.

1425 lines
36 KiB

  1. //+------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994.
  5. //
  6. // File: bmp_stg2.cxx
  7. //
  8. // Contents: Generic Storage parser based test file 2
  9. //
  10. // Classes: CStorageParser
  11. //
  12. // Functions: Parse and Execute functions for each instruction.
  13. //
  14. // History: 20-June-94 t-vadims Created
  15. //
  16. //--------------------------------------------------------------------------
  17. #include <headers.cxx>
  18. #pragma hdrstop
  19. #include <bmp_stg.hxx>
  20. #include <tchar.h>
  21. #define STGTY_ANY 0 // any storage element, stream or storage
  22. //
  23. // Static array of info for each instruction
  24. //
  25. SInstrInfo CStorageParser::m_aInstructions[] =
  26. { { TEXT("StgIsStorageFile"),
  27. TEXT("StgIsStorageFile "),
  28. Parse_StgIsStorageFile,
  29. Execute_StgIsStorageFile,
  30. NULL },
  31. { TEXT("StgCreateDocFile"),
  32. TEXT("StgCreateDocFile "),
  33. Parse_StgCreateDocFile,
  34. Execute_StgCreateDocFile,
  35. NULL },
  36. { TEXT("OpenStorage"),
  37. TEXT("StgOpenStorage "),
  38. Parse_StgOpenStorage,
  39. Execute_StgOpenStorage ,
  40. NULL },
  41. { TEXT("CExposedDocFile::AddRef"),
  42. TEXT("IStorage::AddRef "),
  43. Parse_IStorageAddRef,
  44. Execute_IStorageAddRef ,
  45. NULL },
  46. { TEXT("CExposedDocFile::Release"),
  47. TEXT("IStorage::Release "),
  48. Parse_IStorageRelease,
  49. Execute_IStorageRelease ,
  50. NULL },
  51. { TEXT("CExposedDocFile::Commit"),
  52. TEXT("IStorage::Commit "),
  53. Parse_IStorageCommit,
  54. Execute_IStorageCommit ,
  55. NULL },
  56. { TEXT("CExposedDocFile::Revert"),
  57. TEXT("IStorage::Revert "),
  58. Parse_IStorageRelease,
  59. Execute_IStorageRelease ,
  60. NULL },
  61. { TEXT("CExposedDocFile::CreateStream"),
  62. TEXT("IStorage::CreateStream"),
  63. Parse_IStorageCreateStream,
  64. Execute_IStorageCreateStream ,
  65. NULL },
  66. { TEXT("CExposedDocFile::OpenStream"),
  67. TEXT("IStorage::OpenStream "),
  68. Parse_IStorageOpenStream,
  69. Execute_IStorageOpenStream ,
  70. NULL },
  71. { TEXT("CExposedDocFile::CreateStorage"),
  72. TEXT("IStorage::CreateStorage"),
  73. Parse_IStorageCreateStorage,
  74. Execute_IStorageCreateStorage ,
  75. NULL },
  76. { TEXT("CExposedDocFile::OpenStorage"),
  77. TEXT("IStorage::OpenStorage"),
  78. Parse_IStorageOpenStorage,
  79. Execute_IStorageOpenStorage ,
  80. NULL },
  81. { TEXT("CExposedDocFile::DestroyElement"),
  82. TEXT("IStorage::DestroyElement"),
  83. Parse_IStorageDestroyElement,
  84. Execute_IStorageDestroyElement ,
  85. NULL },
  86. { TEXT("CExposedDocFile::RenameElement"),
  87. TEXT("IStorage::RenameElement"),
  88. Parse_IStorageRenameElement,
  89. Execute_IStorageRenameElement ,
  90. NULL },
  91. { TEXT("CExposedDocFile::SetStateBits"),
  92. TEXT("IStorage::SetStateBits"),
  93. Parse_IStorageSetStateBits,
  94. Execute_IStorageSetStateBits ,
  95. NULL },
  96. { TEXT("CExposedDocFile::SetElementTimes"),
  97. TEXT("IStorage::SetElementTimes"),
  98. Parse_IStorageSetElementTimes,
  99. Execute_IStorageSetElementTimes ,
  100. NULL },
  101. { TEXT("CExposedDocFile::SetClass"),
  102. TEXT("IStorage::SetClass "),
  103. Parse_IStorageSetClass,
  104. Execute_IStorageSetClass ,
  105. NULL },
  106. { TEXT("CExposedDocFile::Stat"),
  107. TEXT("IStorage::Stat "),
  108. Parse_IStorageStat,
  109. Execute_IStorageStat ,
  110. NULL },
  111. { TEXT("CExposedStream::AddRef"),
  112. TEXT("IStream::AddRef "),
  113. Parse_IStreamAddRef,
  114. Execute_IStreamAddRef ,
  115. NULL },
  116. { TEXT("CExposedStream::Release"),
  117. TEXT("IStream::Release "),
  118. Parse_IStreamRelease,
  119. Execute_IStreamRelease ,
  120. NULL },
  121. { TEXT("CExposedStream::Commit"),
  122. TEXT("IStream::Commit "),
  123. Parse_IStreamCommit,
  124. Execute_IStreamCommit ,
  125. NULL },
  126. { TEXT("CExposedStream::Clone"),
  127. TEXT("IStream::Clone "),
  128. Parse_IStreamClone,
  129. Execute_IStreamClone ,
  130. NULL },
  131. { TEXT("CExposedStream::Revert"),
  132. TEXT("IStream::Revert "),
  133. Parse_IStreamRevert,
  134. Execute_IStreamRevert ,
  135. NULL },
  136. { TEXT("CExposedStream::SetSize"),
  137. TEXT("IStream::SetSize "),
  138. Parse_IStreamSetSize,
  139. Execute_IStreamSetSize ,
  140. NULL },
  141. { TEXT("CExposedStream::Write"),
  142. TEXT("IStream::Write "),
  143. Parse_IStreamWrite,
  144. Execute_IStreamWrite ,
  145. GetName_IStreamWrite },
  146. { TEXT("CExposedStream::Read"),
  147. TEXT("IStream::Read "),
  148. Parse_IStreamRead,
  149. Execute_IStreamRead ,
  150. GetName_IStreamRead },
  151. { TEXT("CExposedStream::Seek"),
  152. TEXT("IStream::Seek "),
  153. Parse_IStreamSeek,
  154. Execute_IStreamSeek ,
  155. GetName_IStreamSeek },
  156. { TEXT("CExposedStream::Stat"),
  157. TEXT("IStream::Stat "),
  158. Parse_IStreamStat,
  159. Execute_IStreamStat ,
  160. NULL }
  161. };
  162. //
  163. // Number of instructions in the above array
  164. //
  165. ULONG CStorageParser::m_iMaxInstruction =
  166. sizeof(CStorageParser::m_aInstructions) /
  167. sizeof(CStorageParser::m_aInstructions[0]);
  168. //
  169. // Tries to find an "almost" matching name in the storage.
  170. // Used to get around bug of loging functions, that print a '.' instead of unprintable
  171. // characters.
  172. SCODE CStorageParser::CheckForElementName(LPINSTRDATA pInstrData, DWORD dwType)
  173. {
  174. HRESULT hr;
  175. LPENUMSTATSTG pEnum;
  176. STATSTG StatStg;
  177. BOOL bFound = FALSE;
  178. hr = m_apStorages[pInstrData->ThisID]->EnumElements(0, NULL, 0, &pEnum);
  179. while (!bFound && pEnum->Next(1, &StatStg, NULL) == S_OK)
  180. {
  181. if (StatStg.type == dwType || dwType == STGTY_ANY)
  182. {
  183. // if the names are the same except for the first letter, copy that letter.
  184. if (wcscmp(StatStg.pwcsName + 1, pInstrData->wszParam + 1) == 0)
  185. {
  186. pInstrData->wszParam[0] = StatStg.pwcsName[0];
  187. bFound = TRUE;
  188. }
  189. }
  190. m_piMalloc->Free(StatStg.pwcsName);
  191. }
  192. pEnum->Release();
  193. return bFound ? S_OK : E_FAIL;
  194. }
  195. /*
  196. --------::In StgIsStorageFile(stgtest.bm)
  197. --------::Out StgIsStorageFile(). ret == 1
  198. */
  199. SCODE CStorageParser::Parse_StgIsStorageFile(LPINSTRDATA pInstrData,
  200. LPTSTR pszPart1,
  201. LPTSTR pszPart2)
  202. {
  203. #ifdef UNICODE
  204. swscanf(pszPart1 + 31, L"%[^)]",pInstrData->wszParam);
  205. #else
  206. TCHAR szName[MAX_PATH];
  207. sscanf(pszPart1 + 31, "%[^)]", szName);
  208. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  209. #endif
  210. return S_OK;
  211. }
  212. ULONG CStorageParser::Execute_StgIsStorageFile(LPINSTRDATA pInstrData)
  213. {
  214. CStopWatch sw;
  215. ULONG ulTime;
  216. HRESULT hr;
  217. sw.Reset();
  218. hr = StgIsStorageFile(pInstrData->wszParam);
  219. ulTime = sw.Read();
  220. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  221. return ulTime;
  222. }
  223. /*
  224. --------::In OpenStorage(stgtest.bm, 00000000, 10, 00000000, 0, 0012F540, 0012F4F8)
  225. --------::Out OpenStorage(). *ppstgOpen == 00000000, ret == 80030050
  226. */
  227. SCODE CStorageParser::Parse_StgOpenStorage(LPINSTRDATA pInstrData,
  228. LPTSTR pszPart1,
  229. LPTSTR pszPart2)
  230. {
  231. ULONG ulStorageID;
  232. TCHAR szName[MAX_PATH];
  233. _stscanf(pszPart1 + 26, TEXT("%[^,], %*x, %lx"), szName, &pInstrData->dwParam1);
  234. #ifdef UNICODE
  235. wcscpy(pInstrData->wszParam, szName);
  236. #else
  237. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  238. #endif
  239. _stscanf(pszPart2 + 44, TEXT("%lx"), &ulStorageID);
  240. pInstrData->OutID = FindStorageID(ulStorageID);
  241. return S_OK;
  242. }
  243. ULONG CStorageParser::Execute_StgOpenStorage(LPINSTRDATA pInstrData)
  244. {
  245. CStopWatch sw;
  246. ULONG ulTime;
  247. HRESULT hr;
  248. sw.Reset();
  249. hr = StgOpenStorage(pInstrData->wszParam, NULL, pInstrData->dwParam1,
  250. NULL, 0, &m_apStorages[pInstrData->OutID]);
  251. ulTime = sw.Read();
  252. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  253. return ulTime;
  254. }
  255. /*
  256. --------::In StgCreateDocFile(stgtest.bm, 1011, 0, 0012F53C)
  257. --------::Out StgCreateDocFile(). *ppstgOpen == 50000A5C, ret == 0
  258. */
  259. SCODE CStorageParser::Parse_StgCreateDocFile(LPINSTRDATA pInstrData,
  260. LPTSTR pszPart1,
  261. LPTSTR pszPart2)
  262. {
  263. ULONG ulStorageID;
  264. TCHAR szName[MAX_PATH];
  265. _stscanf(pszPart1 + 31, TEXT("%[^,], %lx"),
  266. szName, &pInstrData->dwParam1);
  267. #ifdef UNICODE
  268. wcscpy(pInstrData->wszParam, szName);
  269. #else
  270. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  271. #endif
  272. _stscanf(pszPart2 + 49, TEXT("%lx"), &ulStorageID);
  273. pInstrData->OutID = FindStorageID(ulStorageID);
  274. return S_OK;
  275. }
  276. ULONG CStorageParser::Execute_StgCreateDocFile(LPINSTRDATA pInstrData)
  277. {
  278. CStopWatch sw;
  279. ULONG ulTime;
  280. HRESULT hr;
  281. OLECHAR *pwszName;
  282. pwszName = pInstrData->wszParam;
  283. if (wcscmp(pwszName, L"(null)") == 0)
  284. pwszName = NULL;
  285. sw.Reset();
  286. hr = StgCreateDocfile(pwszName, pInstrData->dwParam1,
  287. 0, &m_apStorages[pInstrData->OutID]);
  288. ulTime = sw.Read();
  289. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  290. return ulTime;
  291. }
  292. /*
  293. 50000A5C::In CExposedDocFile::AddRef()
  294. 50000A5C::Out CExposedDocFile::AddRef(). ret == 0
  295. */
  296. SCODE CStorageParser::Parse_IStorageAddRef(LPINSTRDATA pInstrData,
  297. LPTSTR pszPart1,
  298. LPTSTR pszPart2)
  299. {
  300. ULONG ulStorageID;
  301. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  302. pInstrData->ThisID = FindStorageID(ulStorageID);
  303. return S_OK;
  304. }
  305. ULONG CStorageParser::Execute_IStorageAddRef(LPINSTRDATA pInstrData)
  306. {
  307. CStopWatch sw;
  308. ULONG ulTime;
  309. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  310. return TEST_FAILED;
  311. sw.Reset();
  312. m_apStorages[pInstrData->ThisID]->AddRef();
  313. ulTime = sw.Read();
  314. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, S_OK);
  315. return ulTime;
  316. }
  317. /*
  318. 50000A5C::In CExposedDocFile::Release()
  319. 50000A5C::Out CExposedDocFile::Release(). ret == 0
  320. */
  321. SCODE CStorageParser::Parse_IStorageRelease(LPINSTRDATA pInstrData,
  322. LPTSTR pszPart1,
  323. LPTSTR pszPart2)
  324. {
  325. ULONG ulStorageID;
  326. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  327. pInstrData->ThisID = FindStorageID(ulStorageID);
  328. return S_OK;
  329. }
  330. ULONG CStorageParser::Execute_IStorageRelease(LPINSTRDATA pInstrData)
  331. {
  332. CStopWatch sw;
  333. ULONG ulTime;
  334. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  335. return TEST_FAILED;
  336. sw.Reset();
  337. m_apStorages[pInstrData->ThisID]->Release();
  338. ulTime = sw.Read();
  339. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, S_OK);
  340. return ulTime;
  341. }
  342. /*
  343. 50000A5C::In CExposedDocFile::Revert()
  344. 50000A5C::Out CExposedDocFile::Revert(). ret == 0
  345. */
  346. SCODE CStorageParser::Parse_IStorageRevert(LPINSTRDATA pInstrData,
  347. LPTSTR pszPart1,
  348. LPTSTR pszPart2)
  349. {
  350. ULONG ulStorageID;
  351. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  352. pInstrData->ThisID = FindStorageID(ulStorageID);
  353. return S_OK;
  354. }
  355. ULONG CStorageParser::Execute_IStorageRevert(LPINSTRDATA pInstrData)
  356. {
  357. CStopWatch sw;
  358. ULONG ulTime;
  359. HRESULT hr;
  360. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  361. return TEST_FAILED;
  362. sw.Reset();
  363. hr = m_apStorages[pInstrData->ThisID]->Revert();
  364. ulTime = sw.Read();
  365. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  366. return ulTime;
  367. }
  368. /*
  369. 50000A5C::In CExposedDocFile::Commit(0)
  370. 50000A5C::Out CExposedDocFile::Commit(). ret == 0
  371. */
  372. SCODE CStorageParser::Parse_IStorageCommit(LPINSTRDATA pInstrData,
  373. LPTSTR pszPart1,
  374. LPTSTR pszPart2)
  375. {
  376. ULONG ulStorageID;
  377. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  378. _stscanf(pszPart1 + 38, TEXT("%lx"), &pInstrData->dwParam1);
  379. pInstrData->ThisID = FindStorageID(ulStorageID);
  380. return S_OK;
  381. }
  382. ULONG CStorageParser::Execute_IStorageCommit(LPINSTRDATA pInstrData)
  383. {
  384. CStopWatch sw;
  385. ULONG ulTime;
  386. HRESULT hr;
  387. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  388. return TEST_FAILED;
  389. sw.Reset();
  390. hr = m_apStorages[pInstrData->ThisID]->Commit(pInstrData->dwParam1);
  391. ulTime = sw.Read();
  392. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  393. return ulTime;
  394. }
  395. /*
  396. 50000A5C::In CExposedDocFile::CreateStream(CONTENTS, 1011, 0, 0, 0012F54C)
  397. 50000A5C::Out CExposedDocFile::CreateStream(). *ppstm == 500008F4, ret == 0
  398. */
  399. SCODE CStorageParser::Parse_IStorageCreateStream(LPINSTRDATA pInstrData,
  400. LPTSTR pszPart1,
  401. LPTSTR pszPart2)
  402. {
  403. ULONG ulStreamID;
  404. ULONG ulStorageID;
  405. TCHAR szName[MAX_PATH];
  406. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  407. _stscanf(pszPart1 + 44, TEXT("%[^,], %lx"),
  408. szName, &pInstrData->dwParam1);
  409. #ifdef UNICODE
  410. wcscpy(pInstrData->wszParam, szName);
  411. #else
  412. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  413. #endif
  414. _stscanf(pszPart2 + 58, TEXT("%lx"), &ulStreamID);
  415. pInstrData->ThisID = FindStorageID(ulStorageID);
  416. pInstrData->OutID = FindStreamID(ulStreamID);
  417. return S_OK;
  418. }
  419. ULONG CStorageParser::Execute_IStorageCreateStream(LPINSTRDATA pInstrData)
  420. {
  421. CStopWatch sw;
  422. ULONG ulTime;
  423. HRESULT hr;
  424. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  425. return TEST_FAILED;
  426. sw.Reset();
  427. hr = m_apStorages[pInstrData->ThisID]->CreateStream(pInstrData->wszParam,
  428. pInstrData->dwParam1,
  429. 0, 0,
  430. &m_apStreams[pInstrData->OutID]);
  431. ulTime = sw.Read();
  432. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  433. return ulTime;
  434. }
  435. /*
  436. 50000A5C::In CExposedDocFile::OpenStream(CONTENTS, 0 12, 0, 0012F54C)
  437. 50000A5C::Out CExposedDocFile::OpenStream(). *ppstm == 500008F4, ret == 0
  438. */
  439. SCODE CStorageParser::Parse_IStorageOpenStream(LPINSTRDATA pInstrData,
  440. LPTSTR pszPart1,
  441. LPTSTR pszPart2)
  442. {
  443. ULONG ulStreamID;
  444. ULONG ulStorageID;
  445. TCHAR szName[MAX_PATH];
  446. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  447. _stscanf(pszPart1 + 42, TEXT("%[^,], %*x %lx"),
  448. szName, &pInstrData->dwParam1);
  449. #ifdef UNICODE
  450. wcscpy(pInstrData->wszParam, szName);
  451. #else
  452. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  453. #endif
  454. _stscanf(pszPart2 + 56, TEXT("%lx"), &ulStreamID);
  455. _stscanf(pszPart2 + 73, TEXT("%lx"), &pInstrData->dwParam2);
  456. pInstrData->ThisID = FindStorageID(ulStorageID);
  457. pInstrData->OutID = FindStreamID(ulStreamID);
  458. return S_OK;
  459. }
  460. ULONG CStorageParser::Execute_IStorageOpenStream(LPINSTRDATA pInstrData)
  461. {
  462. CStopWatch sw;
  463. ULONG ulTime;
  464. HRESULT hr;
  465. SCODE sc;
  466. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  467. return TEST_FAILED;
  468. sw.Reset();
  469. hr = m_apStorages[pInstrData->ThisID]->OpenStream(pInstrData->wszParam, 0,
  470. pInstrData->dwParam1, 0,
  471. &m_apStreams[pInstrData->OutID]);
  472. ulTime = sw.Read();
  473. // check if we failed but script indicated succes, which means that a name could be wrong
  474. if (FAILED(hr) && SUCCEEDED(pInstrData->dwParam2))
  475. {
  476. sc = CheckForElementName(pInstrData, STGTY_STREAM);
  477. if (SUCCEEDED(sc))
  478. {
  479. sw.Reset();
  480. hr = m_apStorages[pInstrData->ThisID]->OpenStream(pInstrData->wszParam, 0,
  481. pInstrData->dwParam1, 0,
  482. &m_apStreams[pInstrData->OutID]);
  483. ulTime = sw.Read();
  484. }
  485. }
  486. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  487. return ulTime;
  488. }
  489. /*
  490. 50000A5C::In CExposedDocFile::CreateStorage(STORAGE1, 1011, 0, 0, 0012F54C)
  491. 50000A5C::Out CExposedDocFile::CreateStorage(). *ppstm == 500008F4, ret == 0
  492. */
  493. SCODE CStorageParser::Parse_IStorageCreateStorage(LPINSTRDATA pInstrData,
  494. LPTSTR pszPart1,
  495. LPTSTR pszPart2)
  496. {
  497. ULONG ulStorageID1;
  498. ULONG ulStorageID2;
  499. TCHAR szName[MAX_PATH];
  500. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID1);
  501. _stscanf(pszPart1 + 45, TEXT("%[^,], %lx"),
  502. szName, &pInstrData->dwParam1);
  503. #ifdef UNICODE
  504. wcscpy(pInstrData->wszParam, szName);
  505. #else
  506. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  507. #endif
  508. _stscanf(pszPart2 + 59, TEXT("%lx"), &ulStorageID2);
  509. pInstrData->ThisID = FindStorageID(ulStorageID1);
  510. pInstrData->OutID = FindStorageID(ulStorageID2);
  511. return S_OK;
  512. }
  513. ULONG CStorageParser::Execute_IStorageCreateStorage(LPINSTRDATA pInstrData)
  514. {
  515. CStopWatch sw;
  516. ULONG ulTime;
  517. HRESULT hr;
  518. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  519. return TEST_FAILED;
  520. sw.Reset();
  521. hr = m_apStorages[pInstrData->ThisID]->CreateStorage(pInstrData->wszParam,
  522. pInstrData->dwParam1,
  523. 0, 0,
  524. &m_apStorages[pInstrData->OutID]);
  525. ulTime = sw.Read();
  526. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  527. return ulTime;
  528. }
  529. /*
  530. 50000A5C::In CExposedDocFile::OpenStorage(CONTENTS, 00000000, 1011, 00000000, 0, 0012F54C)
  531. 50000A5C::Out CExposedDocFile::OpenStorage(). *ppstm == 500008F4, ret == 0
  532. */
  533. SCODE CStorageParser::Parse_IStorageOpenStorage(LPINSTRDATA pInstrData,
  534. LPTSTR pszPart1,
  535. LPTSTR pszPart2)
  536. {
  537. ULONG ulStorageID1;
  538. ULONG ulStorageID2;
  539. TCHAR szName[MAX_PATH];
  540. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID1);
  541. _stscanf(pszPart1 + 43, TEXT("%[^,], %*lx, %lx"),
  542. szName, &pInstrData->dwParam1);
  543. #ifdef UNICODE
  544. wcscpy(pInstrData->wszParam, szName);
  545. #else
  546. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  547. #endif
  548. _stscanf(pszPart2 + 57, TEXT("%lx"), &ulStorageID2);
  549. _stscanf(pszPart2 + 74, TEXT("%lx"), &pInstrData->dwParam2);
  550. pInstrData->ThisID = FindStorageID(ulStorageID1);
  551. pInstrData->OutID = FindStorageID(ulStorageID2);
  552. return S_OK;
  553. }
  554. ULONG CStorageParser::Execute_IStorageOpenStorage(LPINSTRDATA pInstrData)
  555. {
  556. CStopWatch sw;
  557. ULONG ulTime;
  558. HRESULT hr;
  559. SCODE sc;
  560. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  561. return TEST_FAILED;
  562. sw.Reset();
  563. hr = m_apStorages[pInstrData->ThisID]->OpenStorage(pInstrData->wszParam,
  564. NULL,
  565. pInstrData->dwParam1,
  566. NULL, 0,
  567. &m_apStorages[pInstrData->OutID]);
  568. ulTime = sw.Read();
  569. // check if we failed but script indicated succes, which means that a name could be wrong
  570. if (FAILED(hr) && SUCCEEDED(pInstrData->dwParam2))
  571. {
  572. sc = CheckForElementName(pInstrData, STGTY_STORAGE);
  573. if (SUCCEEDED(sc))
  574. {
  575. sw.Reset();
  576. hr = m_apStorages[pInstrData->ThisID]->OpenStorage(pInstrData->wszParam, NULL,
  577. pInstrData->dwParam1, NULL, 0,
  578. &m_apStorages[pInstrData->OutID]);
  579. ulTime = sw.Read();
  580. }
  581. }
  582. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  583. return ulTime;
  584. }
  585. /*
  586. 50000A5C::In CExposedDocFile::DestroyElement(CONTENTS)
  587. 50000A5C::Out CExposedDocFile::DestroyElement(). ret == 0
  588. */
  589. SCODE CStorageParser::Parse_IStorageDestroyElement(LPINSTRDATA pInstrData,
  590. LPTSTR pszPart1,
  591. LPTSTR pszPart2)
  592. {
  593. ULONG ulStorageID;
  594. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  595. #ifdef UNICODE
  596. swscanf(pszPart1 + 46, L"%[^,]", pInstrData->wszParam);
  597. #else
  598. TCHAR szName[MAX_PATH];
  599. sscanf(pszPart1 + 46, "%[^,]", szName);
  600. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  601. #endif
  602. _stscanf(pszPart2 + 57, TEXT("%lx"), &pInstrData->dwParam1);
  603. pInstrData->ThisID = FindStorageID(ulStorageID);
  604. return S_OK;
  605. }
  606. ULONG CStorageParser::Execute_IStorageDestroyElement(LPINSTRDATA pInstrData)
  607. {
  608. CStopWatch sw;
  609. ULONG ulTime;
  610. HRESULT hr;
  611. SCODE sc;
  612. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  613. return TEST_FAILED;
  614. sw.Reset();
  615. hr = m_apStorages[pInstrData->ThisID]->DestroyElement(pInstrData->wszParam);
  616. ulTime = sw.Read();
  617. // check if we failed but script indicated succes, which means that a name could be wrong
  618. if (FAILED(hr) && SUCCEEDED(pInstrData->dwParam1))
  619. {
  620. sc = CheckForElementName(pInstrData, STGTY_ANY);
  621. if (SUCCEEDED(sc))
  622. {
  623. sw.Reset();
  624. hr = m_apStorages[pInstrData->ThisID]->DestroyElement(pInstrData->wszParam);
  625. ulTime = sw.Read();
  626. }
  627. }
  628. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  629. return ulTime;
  630. }
  631. /*
  632. 50000A5C::In CExposedDocFile::SetStateBits(%lu, %lu)
  633. 50000A5C::Out CExposedDocFile::SetStateBits(). ret == ??
  634. */
  635. SCODE CStorageParser::Parse_IStorageSetStateBits(LPINSTRDATA pInstrData,
  636. LPTSTR pszPart1,
  637. LPTSTR pszPart2)
  638. {
  639. ULONG ulStorageID;
  640. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  641. _stscanf(pszPart1 + 44, TEXT("%lu, %lu"),
  642. &pInstrData->dwParam1, &pInstrData->dwParam2);
  643. pInstrData->ThisID = FindStorageID(ulStorageID);
  644. return S_OK;
  645. }
  646. ULONG CStorageParser::Execute_IStorageSetStateBits(LPINSTRDATA pInstrData)
  647. {
  648. CStopWatch sw;
  649. ULONG ulTime;
  650. HRESULT hr;
  651. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  652. return TEST_FAILED;
  653. sw.Reset();
  654. hr = m_apStorages[pInstrData->ThisID]->SetStateBits(pInstrData->dwParam1, pInstrData->dwParam2);
  655. ulTime = sw.Read();
  656. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  657. return ulTime;
  658. }
  659. /*
  660. 50000A5C::In CExposedDocFile::SetClass(?)
  661. 50000A5C::Out CExposedDocFile::SetClass(). ret == ??
  662. */
  663. SCODE CStorageParser::Parse_IStorageSetClass(LPINSTRDATA pInstrData,
  664. LPTSTR pszPart1,
  665. LPTSTR pszPart2)
  666. {
  667. ULONG ulStorageID;
  668. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  669. pInstrData->ThisID = FindStorageID(ulStorageID);
  670. return S_OK;
  671. }
  672. ULONG CStorageParser::Execute_IStorageSetClass(LPINSTRDATA pInstrData)
  673. {
  674. CStopWatch sw;
  675. ULONG ulTime;
  676. HRESULT hr;
  677. static const CLSID ClsID =
  678. {0x0000013a,0x0001,0x0008,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
  679. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  680. return TEST_FAILED;
  681. sw.Reset();
  682. hr = m_apStorages[pInstrData->ThisID]->SetClass(ClsID);
  683. ulTime = sw.Read();
  684. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  685. return ulTime;
  686. }
  687. /*
  688. 5000A0FC::In CExposedDocFile::SetElementTimes(contents, 0012F518, 0012F518, 00000000)
  689. 5000A0FC::Out CExposedDocFile::SetElementTimes(). ret == 80030005
  690. */
  691. SCODE CStorageParser::Parse_IStorageSetElementTimes(LPINSTRDATA pInstrData,
  692. LPTSTR pszPart1,
  693. LPTSTR pszPart2)
  694. {
  695. ULONG ulStorageID;
  696. TCHAR szName[MAX_PATH];
  697. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  698. _stscanf(pszPart1 + 47, TEXT("%[^,], %lx, %lx, %lx"),
  699. szName, &pInstrData->dwParam1,
  700. &pInstrData->dwParam2, &pInstrData->dwParam3);
  701. #ifdef UNICODE
  702. wcscpy(pInstrData->wszParam, szName);
  703. #else
  704. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  705. #endif
  706. pInstrData->ThisID = FindStorageID(ulStorageID);
  707. return S_OK;
  708. }
  709. ULONG CStorageParser::Execute_IStorageSetElementTimes(LPINSTRDATA pInstrData)
  710. {
  711. CStopWatch sw;
  712. ULONG ulTime;
  713. HRESULT hr;
  714. FILETIME ft;
  715. SYSTEMTIME st;
  716. LPFILETIME pft1, pft2, pft3;
  717. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  718. return TEST_FAILED;
  719. // get current time
  720. GetSystemTime(&st);
  721. SystemTimeToFileTime(&st, &ft);
  722. pft1 = pInstrData->dwParam1 ? &ft : NULL;
  723. pft2 = pInstrData->dwParam2 ? &ft : NULL;
  724. pft3 = pInstrData->dwParam3 ? &ft : NULL;
  725. sw.Reset();
  726. hr = m_apStorages[pInstrData->ThisID]->SetElementTimes(pInstrData->wszParam,
  727. pft1, pft2, pft3);
  728. ulTime = sw.Read();
  729. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  730. return ulTime;
  731. }
  732. /*
  733. 50000A5C::In CExposedDocFile::RenameElement(Name1, Name2)
  734. 50000A5C::Out CExposedDocFile::RenameElement(). ret == ??
  735. */
  736. SCODE CStorageParser::Parse_IStorageRenameElement(LPINSTRDATA pInstrData,
  737. LPTSTR pszPart1,
  738. LPTSTR pszPart2)
  739. {
  740. ULONG ulStorageID;
  741. pInstrData->wszParam2 = (OLECHAR *)m_piMalloc->Alloc(MAX_PATH * sizeof(OLECHAR));
  742. if (pInstrData->wszParam2 == NULL)
  743. {
  744. Log(TEXT("Can't allocate memory in for RenameElement"), E_OUTOFMEMORY);
  745. return E_FAIL;
  746. }
  747. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  748. #ifdef UNICODE
  749. swscanf(pszPart1 + 45, L"%[^,], %[^)]",
  750. pInstrData->wszParam, pInstrData->wszParam2);
  751. #else
  752. TCHAR szName[MAX_PATH], szName2[MAX_PATH];
  753. _stscanf(pszPart1 + 45, "%[^,], %[^)]",
  754. szName, szName2);
  755. mbstowcs(pInstrData->wszParam, szName, strlen(szName)+1);
  756. mbstowcs(pInstrData->wszParam2, szName2, strlen(szName2)+1);
  757. #endif
  758. _stscanf(pszPart2 + 56, TEXT("%lx"), &pInstrData->dwParam1);
  759. pInstrData->ThisID = FindStorageID(ulStorageID);
  760. return S_OK;
  761. }
  762. ULONG CStorageParser::Execute_IStorageRenameElement(LPINSTRDATA pInstrData)
  763. {
  764. CStopWatch sw;
  765. ULONG ulTime;
  766. HRESULT hr;
  767. SCODE sc;
  768. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  769. return TEST_FAILED;
  770. sw.Reset();
  771. hr = m_apStorages[pInstrData->ThisID]->RenameElement(pInstrData->wszParam,
  772. pInstrData->wszParam2);
  773. ulTime = sw.Read();
  774. // check if we failed but script indicated succes,
  775. // which means that a name could be wrong
  776. if (FAILED(hr) && SUCCEEDED(pInstrData->dwParam1))
  777. {
  778. sc = CheckForElementName(pInstrData, STGTY_ANY);
  779. if (SUCCEEDED(sc))
  780. {
  781. sw.Reset();
  782. hr = m_apStorages[pInstrData->ThisID]->RenameElement(pInstrData->wszParam,
  783. pInstrData->wszParam2);
  784. ulTime = sw.Read();
  785. }
  786. }
  787. m_piMalloc->Free(pInstrData->wszParam2);
  788. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  789. return ulTime;
  790. }
  791. /*
  792. 50000A5C::In CExposedDocFile::Stat(xxxxxxxx)
  793. 50000A5C::Out CExposedDocFile::Stat(). ret == ??
  794. */
  795. SCODE CStorageParser::Parse_IStorageStat(LPINSTRDATA pInstrData,
  796. LPTSTR pszPart1,
  797. LPTSTR pszPart2)
  798. {
  799. ULONG ulStorageID;
  800. _stscanf(pszPart1, TEXT("%lx"), &ulStorageID);
  801. pInstrData->ThisID = FindStorageID(ulStorageID);
  802. return S_OK;
  803. }
  804. ULONG CStorageParser::Execute_IStorageStat(LPINSTRDATA pInstrData)
  805. {
  806. CStopWatch sw;
  807. ULONG ulTime;
  808. HRESULT hr;
  809. STATSTG StatStg;
  810. if (FAILED(CheckThisStorageID(pInstrData->ThisID)))
  811. return TEST_FAILED;
  812. sw.Reset();
  813. hr = m_apStorages[pInstrData->ThisID]->Stat(&StatStg, STATFLAG_NONAME);
  814. ulTime = sw.Read();
  815. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  816. return ulTime;
  817. }
  818. /*
  819. 50000A5C::In CExposedStream::AddRef()
  820. 50000A5C::Out CExposedStream::AddRef(). ret == 0
  821. */
  822. SCODE CStorageParser::Parse_IStreamAddRef(LPINSTRDATA pInstrData,
  823. LPTSTR pszPart1,
  824. LPTSTR pszPart2)
  825. {
  826. ULONG ulStreamID;
  827. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  828. pInstrData->ThisID = FindStreamID(ulStreamID);
  829. return S_OK;
  830. }
  831. ULONG CStorageParser::Execute_IStreamAddRef(LPINSTRDATA pInstrData)
  832. {
  833. CStopWatch sw;
  834. ULONG ulTime;
  835. ULONG ulRes;
  836. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  837. return TEST_FAILED;
  838. sw.Reset();
  839. ulRes = m_apStreams[pInstrData->ThisID]->AddRef();
  840. ulTime = sw.Read();
  841. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, S_OK);
  842. return ulTime;
  843. }
  844. /*
  845. 50000A5C::In CExposedStream::Release()
  846. 50000A5C::Out CExposedStream::Release(). ret == 0
  847. */
  848. SCODE CStorageParser::Parse_IStreamRelease(LPINSTRDATA pInstrData,
  849. LPTSTR pszPart1,
  850. LPTSTR pszPart2)
  851. {
  852. ULONG ulStreamID;
  853. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  854. pInstrData->ThisID = FindStreamID(ulStreamID);
  855. return S_OK;
  856. }
  857. ULONG CStorageParser::Execute_IStreamRelease(LPINSTRDATA pInstrData)
  858. {
  859. CStopWatch sw;
  860. ULONG ulTime;
  861. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  862. return TEST_FAILED;
  863. sw.Reset();
  864. m_apStreams[pInstrData->ThisID]->Release();
  865. ulTime = sw.Read();
  866. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, S_OK);
  867. return ulTime;
  868. }
  869. /*
  870. 50000A5C::In CExposedStream::Revert()
  871. 50000A5C::Out CExposedStream::Revert(). ret == 0
  872. */
  873. SCODE CStorageParser::Parse_IStreamRevert(LPINSTRDATA pInstrData,
  874. LPTSTR pszPart1,
  875. LPTSTR pszPart2)
  876. {
  877. ULONG ulStreamID;
  878. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  879. pInstrData->ThisID = FindStreamID(ulStreamID);
  880. return S_OK;
  881. }
  882. ULONG CStorageParser::Execute_IStreamRevert(LPINSTRDATA pInstrData)
  883. {
  884. CStopWatch sw;
  885. ULONG ulTime;
  886. HRESULT hr;
  887. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  888. return TEST_FAILED;
  889. sw.Reset();
  890. hr = m_apStreams[pInstrData->ThisID]->Revert();
  891. ulTime = sw.Read();
  892. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  893. return ulTime;
  894. }
  895. /*
  896. 50000A5C::In CExposedStream::Commit(0)
  897. 50000A5C::Out CExposedStream::Commit(). ret == 0
  898. */
  899. SCODE CStorageParser::Parse_IStreamCommit(LPINSTRDATA pInstrData,
  900. LPTSTR pszPart1,
  901. LPTSTR pszPart2)
  902. {
  903. ULONG ulStreamID;
  904. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  905. _stscanf(pszPart1 + 37, TEXT("%lx"), &pInstrData->dwParam1);
  906. pInstrData->ThisID = FindStreamID(ulStreamID);
  907. return S_OK;
  908. }
  909. ULONG CStorageParser::Execute_IStreamCommit(LPINSTRDATA pInstrData)
  910. {
  911. CStopWatch sw;
  912. ULONG ulTime;
  913. HRESULT hr;
  914. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  915. return TEST_FAILED;
  916. sw.Reset();
  917. hr = m_apStreams[pInstrData->ThisID]->Commit(pInstrData->dwParam1);
  918. ulTime = sw.Read();
  919. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  920. return ulTime;
  921. }
  922. /*
  923. 50000A5C::In CExposedStream::SetSize(10)
  924. 50000A5C::Out CExposedStream::SetSize(). ret == 0
  925. */
  926. SCODE CStorageParser::Parse_IStreamSetSize(LPINSTRDATA pInstrData,
  927. LPTSTR pszPart1,
  928. LPTSTR pszPart2)
  929. {
  930. ULONG ulStreamID;
  931. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  932. _stscanf(pszPart1 + 38, TEXT("%lu"), &pInstrData->dwParam1);
  933. pInstrData->ThisID = FindStreamID(ulStreamID);
  934. return S_OK;
  935. }
  936. ULONG CStorageParser::Execute_IStreamSetSize(LPINSTRDATA pInstrData)
  937. {
  938. CStopWatch sw;
  939. ULONG ulTime;
  940. HRESULT hr;
  941. ULARGE_INTEGER liSize;
  942. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  943. return TEST_FAILED;
  944. LISet32(liSize, pInstrData->dwParam1);
  945. sw.Reset();
  946. hr = m_apStreams[pInstrData->ThisID]->SetSize(liSize);
  947. ulTime = sw.Read();
  948. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  949. return ulTime;
  950. }
  951. /*
  952. 50000A5C::In CExposedStream::Write(xxxxxxxx, 1234, xxxxxxxx)
  953. 50000A5C::Out CExposedStream::Write(). ret == 0
  954. */
  955. SCODE CStorageParser::Parse_IStreamWrite(LPINSTRDATA pInstrData,
  956. LPTSTR pszPart1,
  957. LPTSTR pszPart2)
  958. {
  959. ULONG ulStreamID;
  960. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  961. _stscanf(pszPart1 + 46, TEXT("%lu"), &pInstrData->dwParam1);
  962. pInstrData->ThisID = FindStreamID(ulStreamID);
  963. return S_OK;
  964. }
  965. ULONG CStorageParser::Execute_IStreamWrite(LPINSTRDATA pInstrData)
  966. {
  967. CStopWatch sw;
  968. ULONG ulTime;
  969. HRESULT hr;
  970. BYTE *pData;
  971. pData = (BYTE *) m_piMalloc->Alloc(pInstrData->dwParam1);
  972. if (pData == NULL)
  973. {
  974. Log(TEXT("Can't allocate memory for write"), E_OUTOFMEMORY);
  975. return TEST_FAILED;
  976. }
  977. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  978. return TEST_FAILED;
  979. sw.Reset();
  980. hr = m_apStreams[pInstrData->ThisID]->Write(pData, pInstrData->dwParam1, NULL);
  981. ulTime = sw.Read();
  982. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  983. m_piMalloc->Free(pData);
  984. return ulTime;
  985. }
  986. TCHAR *CStorageParser::GetName_IStreamWrite(LPINSTRDATA pInstrData)
  987. {
  988. _stscanf(m_szBuffer, TEXT("IStream::Write %-8lu"), pInstrData->dwParam1);
  989. return m_szBuffer;
  990. }
  991. /*
  992. 50000A5C::In CExposedStream::Read(xxxxxxxx, 1234, xxxxxxxx)
  993. 50000A5C::Out CExposedStream::Read(). ret == 0
  994. */
  995. SCODE CStorageParser::Parse_IStreamRead(LPINSTRDATA pInstrData,
  996. LPTSTR pszPart1,
  997. LPTSTR pszPart2)
  998. {
  999. ULONG ulStreamID;
  1000. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  1001. _stscanf(pszPart1 + 45, TEXT("%lu"), &pInstrData->dwParam1);
  1002. pInstrData->ThisID = FindStreamID(ulStreamID);
  1003. return S_OK;
  1004. }
  1005. ULONG CStorageParser::Execute_IStreamRead(LPINSTRDATA pInstrData)
  1006. {
  1007. CStopWatch sw;
  1008. ULONG ulTime;
  1009. HRESULT hr;
  1010. BYTE *pData;
  1011. pData = (BYTE *) m_piMalloc->Alloc(pInstrData->dwParam1);
  1012. if (pData == NULL)
  1013. {
  1014. Log(TEXT("Can't allocate memory for read"), E_OUTOFMEMORY);
  1015. return TEST_FAILED;
  1016. }
  1017. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  1018. return TEST_FAILED;
  1019. sw.Reset();
  1020. hr = m_apStreams[pInstrData->ThisID]->Read(pData, pInstrData->dwParam1, NULL);
  1021. ulTime = sw.Read();
  1022. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  1023. m_piMalloc->Free(pData);
  1024. return ulTime;
  1025. }
  1026. TCHAR *CStorageParser::GetName_IStreamRead(LPINSTRDATA pInstrData)
  1027. {
  1028. _stscanf(m_szBuffer, TEXT("IStream::Read %-8lu"), pInstrData->dwParam1);
  1029. return m_szBuffer;
  1030. }
  1031. /*
  1032. 50000A5C::In CExposedStream::Seek(0, 1234, xxxxxxxx)
  1033. 50000A5C::Out CExposedStream::Seek(). ulPos == %lu, ret == 0
  1034. */
  1035. SCODE CStorageParser::Parse_IStreamSeek(LPINSTRDATA pInstrData,
  1036. LPTSTR pszPart1,
  1037. LPTSTR pszPart2)
  1038. {
  1039. ULONG ulStreamID;
  1040. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  1041. _stscanf(pszPart1 + 35, TEXT("%ld, %lu"),
  1042. &pInstrData->dwParam1, &pInstrData->dwParam2);
  1043. pInstrData->ThisID = FindStreamID(ulStreamID);
  1044. return S_OK;
  1045. }
  1046. ULONG CStorageParser::Execute_IStreamSeek(LPINSTRDATA pInstrData)
  1047. {
  1048. CStopWatch sw;
  1049. ULONG ulTime;
  1050. HRESULT hr;
  1051. LARGE_INTEGER liSize;
  1052. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  1053. return TEST_FAILED;
  1054. LISet32(liSize, pInstrData->dwParam1);
  1055. sw.Reset();
  1056. hr = m_apStreams[pInstrData->ThisID]->Seek(liSize,
  1057. pInstrData->dwParam2,
  1058. NULL);
  1059. ulTime = sw.Read();
  1060. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  1061. return ulTime;
  1062. }
  1063. TCHAR *CStorageParser::GetName_IStreamSeek(LPINSTRDATA pInstrData)
  1064. {
  1065. _stscanf(m_szBuffer, TEXT("IStream::Seek %lu %lu"),
  1066. pInstrData->dwParam1, pInstrData->dwParam2);
  1067. return m_szBuffer;
  1068. }
  1069. /*
  1070. 500074A4::In CExposedStream::Clone(0012DCE8)
  1071. 500074A4::Out CExposedStream::Clone(). *ppstm == 50007324, ret == 0
  1072. */
  1073. SCODE CStorageParser::Parse_IStreamClone(LPINSTRDATA pInstrData,
  1074. LPTSTR pszPart1,
  1075. LPTSTR pszPart2)
  1076. {
  1077. ULONG ulStreamID1;
  1078. ULONG ulStreamID2;
  1079. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID1);
  1080. _stscanf(pszPart2 + 50, TEXT("%lx"), &ulStreamID2);
  1081. pInstrData->ThisID = FindStreamID(ulStreamID1);
  1082. pInstrData->OutID = FindStreamID(ulStreamID2);
  1083. return S_OK;
  1084. }
  1085. ULONG CStorageParser::Execute_IStreamClone(LPINSTRDATA pInstrData)
  1086. {
  1087. CStopWatch sw;
  1088. ULONG ulTime;
  1089. HRESULT hr;
  1090. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  1091. return TEST_FAILED;
  1092. sw.Reset();
  1093. hr = m_apStreams[pInstrData->ThisID]->Clone(&m_apStreams[pInstrData->OutID]);
  1094. ulTime = sw.Read();
  1095. Log(m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  1096. return ulTime;
  1097. }
  1098. /*
  1099. 50000A5C::In CExposedStream::Stat(xxxxxxxx)
  1100. 50000A5C::Out CExposedStream::Stat). ret == 0
  1101. */
  1102. SCODE CStorageParser::Parse_IStreamStat(LPINSTRDATA pInstrData,
  1103. LPTSTR pszPart1,
  1104. LPTSTR pszPart2)
  1105. {
  1106. ULONG ulStreamID;
  1107. _stscanf(pszPart1, TEXT("%lx"), &ulStreamID);
  1108. pInstrData->ThisID = FindStreamID(ulStreamID);
  1109. return S_OK;
  1110. }
  1111. ULONG CStorageParser::Execute_IStreamStat(LPINSTRDATA pInstrData)
  1112. {
  1113. CStopWatch sw;
  1114. ULONG ulTime;
  1115. HRESULT hr;
  1116. STATSTG StatStg;
  1117. if (FAILED(CheckThisStreamID(pInstrData->ThisID)))
  1118. return TEST_FAILED;
  1119. sw.Reset();
  1120. hr = m_apStreams[pInstrData->ThisID]->Stat(&StatStg, STATFLAG_NONAME);
  1121. ulTime = sw.Read();
  1122. Log (m_aInstructions[pInstrData->ulInstrID].szPrintName, hr);
  1123. return ulTime;
  1124. }