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.

756 lines
20 KiB

  1. //
  2. // dmstrm.cpp
  3. //
  4. // Copyright (c) 1995-2001 Microsoft Corporation
  5. //
  6. #include "debug.h"
  7. #include "dmusicc.h"
  8. #include "..\shared\dmstrm.h"
  9. #include "..\shared\validate.h"
  10. /////////////////////////////////////////////////////////////////////////////
  11. // AllocDIrectMusicStream
  12. STDAPI AllocDirectMusicStream(IStream* pIStream, IDMStream** ppIDMStream)
  13. {
  14. if(pIStream == NULL || ppIDMStream == NULL)
  15. {
  16. return E_INVALIDARG;
  17. }
  18. if((*ppIDMStream = (IDMStream*) new CDirectMusicStream()) == NULL)
  19. {
  20. return E_OUTOFMEMORY;
  21. }
  22. ((CDirectMusicStream*)*ppIDMStream)->Init(pIStream);
  23. return S_OK;
  24. }
  25. //////////////////////////////////////////////////////////////////////
  26. // CDirectMusicStream::CDirectMusicStream
  27. CDirectMusicStream::CDirectMusicStream() :
  28. m_cRef(1),
  29. m_pStream(NULL)
  30. {
  31. }
  32. //////////////////////////////////////////////////////////////////////
  33. // CDirectMusicStream::~CDirectMusicStream
  34. CDirectMusicStream::~CDirectMusicStream()
  35. {
  36. if(m_pStream != NULL)
  37. {
  38. m_pStream->Release();
  39. }
  40. }
  41. //////////////////////////////////////////////////////////////////////
  42. // CDirectMusicStream::Init
  43. STDMETHODIMP CDirectMusicStream::Init(IStream* pStream)
  44. {
  45. SetStream(pStream);
  46. return S_OK;
  47. }
  48. //////////////////////////////////////////////////////////////////////
  49. // IUnknown
  50. //////////////////////////////////////////////////////////////////////
  51. // CDirectMusicStream::QueryInterface
  52. STDMETHODIMP CDirectMusicStream::QueryInterface(const IID &iid, void **ppv)
  53. {
  54. V_INAME(CDirectMusicStream::QueryInterface);
  55. V_PTRPTR_WRITE(ppv);
  56. V_REFGUID(iid);
  57. if(iid == IID_IUnknown || iid == IID_IDMStream)
  58. {
  59. *ppv = static_cast<IDMStream*>(this);
  60. }
  61. else
  62. {
  63. *ppv = NULL;
  64. return E_NOINTERFACE;
  65. }
  66. reinterpret_cast<IUnknown*>(this)->AddRef();
  67. return S_OK;
  68. }
  69. //////////////////////////////////////////////////////////////////////
  70. // CDirectMusicStream::AddRef
  71. STDMETHODIMP_(ULONG) CDirectMusicStream::AddRef()
  72. {
  73. return InterlockedIncrement(&m_cRef);
  74. }
  75. //////////////////////////////////////////////////////////////////////
  76. // CDirectMusicStream::Release
  77. STDMETHODIMP_(ULONG) CDirectMusicStream::Release()
  78. {
  79. if(!InterlockedDecrement(&m_cRef))
  80. {
  81. delete this;
  82. return 0;
  83. }
  84. return m_cRef;
  85. }
  86. //////////////////////////////////////////////////////////////////////
  87. // CDirectMusicStream::SetStream
  88. STDMETHODIMP CDirectMusicStream::SetStream(IStream* pStream)
  89. {
  90. if(m_pStream != NULL)
  91. {
  92. m_pStream->Release();
  93. }
  94. m_pStream = pStream;
  95. if(m_pStream != NULL)
  96. {
  97. m_pStream->AddRef();
  98. }
  99. return S_OK;
  100. }
  101. //////////////////////////////////////////////////////////////////////
  102. // CDirectMusicStream::GetStream
  103. STDMETHODIMP_(IStream*) CDirectMusicStream::GetStream()
  104. {
  105. if(m_pStream != NULL)
  106. {
  107. m_pStream->AddRef();
  108. }
  109. return m_pStream;
  110. }
  111. //////////////////////////////////////////////////////////////////////
  112. // IDMStream
  113. //////////////////////////////////////////////////////////////////////
  114. // CDirectMusicStream::Descend
  115. STDMETHODIMP CDirectMusicStream::Descend(LPMMCKINFO lpck, LPMMCKINFO lpckParent, UINT wFlags)
  116. {
  117. assert(lpck);
  118. FOURCC ckidFind; // Chunk ID to find (or NULL)
  119. FOURCC fccTypeFind; // Form/list type to find (or NULL)
  120. // Figure out what chunk id and form/list type for which to search
  121. if(wFlags & MMIO_FINDCHUNK)
  122. {
  123. ckidFind = lpck->ckid;
  124. fccTypeFind = NULL;
  125. }
  126. else if(wFlags & MMIO_FINDRIFF)
  127. {
  128. ckidFind = FOURCC_RIFF;
  129. fccTypeFind = lpck->fccType;
  130. }
  131. else if(wFlags & MMIO_FINDLIST)
  132. {
  133. ckidFind = FOURCC_LIST;
  134. fccTypeFind = lpck->fccType;
  135. }
  136. else
  137. {
  138. ckidFind = fccTypeFind = NULL;
  139. }
  140. lpck->dwFlags = 0L;
  141. for(;;)
  142. {
  143. HRESULT hr;
  144. LARGE_INTEGER li;
  145. ULARGE_INTEGER uli;
  146. ULONG cbRead;
  147. // Read the chunk header
  148. hr = m_pStream->Read(lpck, 2 * sizeof(DWORD), &cbRead);
  149. if (FAILED(hr) || (cbRead != 2 * sizeof(DWORD)))
  150. {
  151. Trace(1,"Error: Unable to read file.\n");
  152. return DMUS_E_DESCEND_CHUNK_FAIL;
  153. }
  154. // Store the offset of the data part of the chunk
  155. li.QuadPart = 0;
  156. hr = m_pStream->Seek(li, STREAM_SEEK_CUR, &uli);
  157. if(FAILED(hr))
  158. {
  159. Trace(1,"Error: Unable to read file.\n");
  160. return DMUS_E_CANNOTSEEK;
  161. }
  162. else
  163. {
  164. lpck->dwDataOffset = uli.LowPart;
  165. }
  166. // See if the chunk is within the parent chunk (if given)
  167. if((lpckParent != NULL) &&
  168. (lpck->dwDataOffset - 8L >=
  169. lpckParent->dwDataOffset + lpckParent->cksize))
  170. {
  171. Trace(1,"Error: Unable to read file.\n");
  172. return DMUS_E_DESCEND_CHUNK_FAIL;
  173. }
  174. // If the chunk is a 'RIFF' or 'LIST' chunk, read the
  175. // form type or list type
  176. if((lpck->ckid == FOURCC_RIFF) || (lpck->ckid == FOURCC_LIST))
  177. {
  178. hr = m_pStream->Read(&lpck->fccType, sizeof(DWORD), &cbRead);
  179. if(FAILED(hr) || (cbRead != sizeof(DWORD)))
  180. {
  181. Trace(1,"Error: Unable to read file.\n");
  182. return DMUS_E_DESCEND_CHUNK_FAIL;
  183. }
  184. }
  185. else
  186. {
  187. lpck->fccType = NULL;
  188. }
  189. // If this is the chunk we're looking for, stop looking
  190. if(((ckidFind == NULL) || (ckidFind == lpck->ckid)) &&
  191. ((fccTypeFind == NULL) || (fccTypeFind == lpck->fccType)))
  192. {
  193. break;
  194. }
  195. // Ascend out of the chunk and try again
  196. HRESULT w = Ascend(lpck, 0);
  197. if(FAILED(w))
  198. {
  199. return w;
  200. }
  201. }
  202. return S_OK;
  203. }
  204. //////////////////////////////////////////////////////////////////////
  205. // CDirectMusicStream::Ascend
  206. STDMETHODIMP CDirectMusicStream::Ascend(LPMMCKINFO lpck, UINT /*wFlags*/)
  207. {
  208. assert(lpck);
  209. HRESULT hr;
  210. LARGE_INTEGER li;
  211. ULARGE_INTEGER uli;
  212. if (lpck->dwFlags & MMIO_DIRTY)
  213. {
  214. // <lpck> refers to a chunk created by CreateChunk();
  215. // check that the chunk size that was written when
  216. // CreateChunk() was called is the real chunk size;
  217. // if not, fix it
  218. LONG lOffset; // current offset in file
  219. LONG lActualSize; // actual size of chunk data
  220. li.QuadPart = 0;
  221. hr = m_pStream->Seek(li, STREAM_SEEK_CUR, &uli);
  222. if(FAILED(hr))
  223. {
  224. Trace(1,"Error: Unable to write file.\n");
  225. return DMUS_E_CANNOTSEEK;
  226. }
  227. else
  228. {
  229. lOffset = uli.LowPart;
  230. }
  231. if((lActualSize = lOffset - lpck->dwDataOffset) < 0)
  232. {
  233. Trace(1,"Error: Unable to write file.\n");
  234. return DMUS_E_CANNOTWRITE;
  235. }
  236. if(LOWORD(lActualSize) & 1)
  237. {
  238. ULONG cbWritten;
  239. // Chunk size is odd -- write a null pad byte
  240. hr = m_pStream->Write("\0", 1, &cbWritten);
  241. if(FAILED(hr) || cbWritten != 1)
  242. {
  243. Trace(1,"Error: Unable to write file.\n");
  244. return DMUS_E_CANNOTWRITE;
  245. }
  246. }
  247. if(lpck->cksize == (DWORD)lActualSize)
  248. {
  249. return S_OK;
  250. }
  251. // Fix the chunk header
  252. lpck->cksize = lActualSize;
  253. li.QuadPart = lpck->dwDataOffset - sizeof(DWORD);
  254. hr = m_pStream->Seek(li, STREAM_SEEK_SET, &uli);
  255. if(FAILED(hr))
  256. {
  257. Trace(1,"Error: Unable to write file.\n");
  258. return DMUS_E_CANNOTSEEK;
  259. }
  260. ULONG cbWritten;
  261. hr = m_pStream->Write(&lpck->cksize, sizeof(DWORD), &cbWritten);
  262. if(FAILED(hr) || cbWritten != sizeof(DWORD))
  263. {
  264. Trace(1,"Error: Unable to write file.\n");
  265. return DMUS_E_CANNOTWRITE;
  266. }
  267. }
  268. // Seek to the end of the chunk, past the null pad byte
  269. // (which is only there if chunk size is odd)
  270. li.QuadPart = lpck->dwDataOffset + lpck->cksize + (lpck->cksize & 1L);
  271. hr = m_pStream->Seek(li, STREAM_SEEK_SET, &uli);
  272. if(FAILED(hr))
  273. {
  274. Trace(1,"Error: Unable to write file.\n");
  275. return DMUS_E_CANNOTSEEK;
  276. }
  277. return S_OK;
  278. }
  279. //////////////////////////////////////////////////////////////////////
  280. // CDirectMusicStream::CreateChunk
  281. STDMETHODIMP CDirectMusicStream::CreateChunk(LPMMCKINFO lpck, UINT wFlags)
  282. {
  283. assert(lpck);
  284. UINT iBytes; // Bytes to write
  285. LONG lOffset; // Current offset in file
  286. // Store the offset of the data part of the chunk
  287. LARGE_INTEGER li;
  288. ULARGE_INTEGER uli;
  289. li.QuadPart = 0;
  290. HRESULT hr = m_pStream->Seek(li, STREAM_SEEK_CUR, &uli);
  291. if(FAILED(hr))
  292. {
  293. Trace(1,"Error: Unable to write file.\n");
  294. return DMUS_E_CANNOTSEEK;
  295. }
  296. else
  297. {
  298. lOffset = uli.LowPart;
  299. }
  300. lpck->dwDataOffset = lOffset + 2 * sizeof(DWORD);
  301. // figure out if a form/list type needs to be written
  302. if(wFlags & MMIO_CREATERIFF)
  303. {
  304. lpck->ckid = FOURCC_RIFF, iBytes = 3 * sizeof(DWORD);
  305. }
  306. else if(wFlags & MMIO_CREATELIST)
  307. {
  308. lpck->ckid = FOURCC_LIST, iBytes = 3 * sizeof(DWORD);
  309. }
  310. else
  311. {
  312. iBytes = 2 * sizeof(DWORD);
  313. }
  314. // Write the chunk header
  315. ULONG cbWritten;
  316. hr = m_pStream->Write(lpck, iBytes, &cbWritten);
  317. if(FAILED(hr) || cbWritten != iBytes)
  318. {
  319. Trace(1,"Error: Unable to write file.\n");
  320. return DMUS_E_CANNOTWRITE;
  321. }
  322. lpck->dwFlags = MMIO_DIRTY;
  323. return S_OK;
  324. }
  325. CRiffParser::CRiffParser(IStream *pStream)
  326. {
  327. assert(pStream);
  328. m_fDebugOn = FALSE;
  329. m_pStream = pStream;
  330. m_pParent = NULL;
  331. m_pChunk = NULL;
  332. m_lRead = 0;
  333. m_fFirstPass = TRUE;
  334. m_fComponentFailed = FALSE;
  335. m_fInComponent = FALSE;
  336. }
  337. void CRiffParser::EnterList(RIFFIO *pChunk)
  338. {
  339. assert (pChunk);
  340. pChunk->lRead = 0;
  341. pChunk->pParent = m_pChunk; // Previous chunk (could be NULL.)
  342. m_pParent = m_pChunk;
  343. m_pChunk = pChunk;
  344. m_fFirstPass = TRUE;
  345. }
  346. void CRiffParser::LeaveList()
  347. {
  348. assert (m_pChunk);
  349. if (m_pChunk)
  350. {
  351. m_pChunk = m_pChunk->pParent;
  352. if (m_pChunk)
  353. {
  354. m_pParent = m_pChunk->pParent;
  355. }
  356. }
  357. }
  358. BOOL CRiffParser::NextChunk(HRESULT * pHr)
  359. {
  360. BOOL fMore = FALSE;
  361. if (SUCCEEDED(*pHr))
  362. {
  363. // If this is the first time we've entered this list, there is no previous chunk.
  364. if (m_fFirstPass)
  365. {
  366. // Clear the flag.
  367. m_fFirstPass = FALSE;
  368. }
  369. else
  370. {
  371. // Clean up the previous pass.
  372. *pHr = LeaveChunk();
  373. }
  374. // Find out if there are more chunks to read.
  375. fMore = MoreChunks();
  376. // If so, and we don't have any failure, go ahead and read the next chunk header.
  377. if (fMore && SUCCEEDED(*pHr))
  378. {
  379. *pHr = EnterChunk();
  380. }
  381. }
  382. else
  383. {
  384. #ifdef DBG
  385. char szName[5];
  386. if (m_fDebugOn)
  387. {
  388. szName[4] = 0;
  389. strncpy(szName,(char *)&m_pChunk->ckid,4);
  390. Trace(0,"Error parsing %s, Read %ld of %ld\n",szName,m_pChunk->lRead,RIFF_ALIGN(m_pChunk->cksize));
  391. }
  392. #endif
  393. // If we were in a component, it's okay to fail. Mark that fact by setting
  394. // m_fComponentFailed then properly pull out of the chunk so we can
  395. // continue reading.
  396. if (m_fInComponent)
  397. {
  398. m_fComponentFailed = TRUE;
  399. // We don't need to check for first pass, because we must have gotten
  400. // that far. Instead, we just clean up from the failed chunk.
  401. // Note that this sets the hresult to S_OK, which is what we want.
  402. // Later, the caller needs to call ComponentFailed() to find out if
  403. // this error occured.
  404. *pHr = LeaveChunk();
  405. }
  406. else
  407. {
  408. // Clean up but leave the error code.
  409. LeaveChunk();
  410. }
  411. }
  412. return fMore && SUCCEEDED(*pHr);
  413. }
  414. BOOL CRiffParser::MoreChunks()
  415. {
  416. assert(m_pChunk);
  417. if (m_pChunk)
  418. {
  419. if (m_pParent)
  420. {
  421. // Return TRUE if there's enough room for another chunk.
  422. return (m_pParent->lRead < (m_pParent->cksize - 8));
  423. }
  424. else
  425. {
  426. // This must be a top level chunk, in which case there would only be one to read.
  427. return (m_pChunk->lRead == 0);
  428. }
  429. }
  430. // This should never happen unless CRiffParser is used incorrectly, in which
  431. // case the assert will help debug. But, in the interest of making Prefix happy...
  432. return false;
  433. }
  434. HRESULT CRiffParser::EnterChunk()
  435. {
  436. assert(m_pChunk);
  437. if (m_pChunk)
  438. {
  439. // Read the chunk header
  440. HRESULT hr = m_pStream->Read(m_pChunk, 2 * sizeof(DWORD), NULL);
  441. if (SUCCEEDED(hr))
  442. {
  443. #ifdef DBG
  444. char szName[5];
  445. if (m_fDebugOn)
  446. {
  447. szName[4] = 0;
  448. strncpy(szName,(char *)&m_pChunk->ckid,4);
  449. ULARGE_INTEGER ul;
  450. LARGE_INTEGER li;
  451. li.QuadPart = 0;
  452. m_pStream->Seek(li, STREAM_SEEK_CUR, &ul);
  453. Trace(0,"Entering %s, Length %ld, File position is %ld",szName,m_pChunk->cksize,(long)ul.QuadPart);
  454. }
  455. #endif
  456. // Clear bytes read field.
  457. m_pChunk->lRead = 0;
  458. // Check to see if this is a container (LIST or RIFF.)
  459. if((m_pChunk->ckid == FOURCC_RIFF) || (m_pChunk->ckid == FOURCC_LIST))
  460. {
  461. hr = m_pStream->Read(&m_pChunk->fccType, sizeof(DWORD), NULL);
  462. if (SUCCEEDED(hr))
  463. {
  464. m_pChunk->lRead += sizeof(DWORD);
  465. #ifdef DBG
  466. if (m_fDebugOn)
  467. {
  468. strncpy(szName,(char *)&m_pChunk->fccType,4);
  469. Trace(0," Type %s",szName);
  470. }
  471. #endif
  472. }
  473. else
  474. {
  475. Trace(1,"Error: Unable to read file.\n");
  476. }
  477. }
  478. #ifdef DBG
  479. if (m_fDebugOn) Trace(0,"\n");
  480. #endif
  481. }
  482. else
  483. {
  484. Trace(1,"Error: Unable to read file.\n");
  485. }
  486. return hr;
  487. }
  488. // This should never happen unless CRiffParser is used incorrectly, in which
  489. // case the assert will help debug. But, in the interest of making Prefix happy...
  490. return E_FAIL;
  491. }
  492. HRESULT CRiffParser::LeaveChunk()
  493. {
  494. HRESULT hr = S_OK;
  495. assert(m_pChunk);
  496. if (m_pChunk)
  497. {
  498. m_fInComponent = false;
  499. // Get the rounded up size of the chunk.
  500. long lSize = RIFF_ALIGN(m_pChunk->cksize);
  501. // Increment the parent's count of bytes read so far.
  502. if (m_pParent)
  503. {
  504. m_pParent->lRead += lSize + (2 * sizeof(DWORD));
  505. if (m_pParent->lRead > RIFF_ALIGN(m_pParent->cksize))
  506. {
  507. Trace(1,"Error: Unable to read file.\n");
  508. hr = DMUS_E_DESCEND_CHUNK_FAIL; // Goofy error name, but need to be consistent with previous versions.
  509. }
  510. }
  511. #ifdef DBG
  512. char szName[5];
  513. if (m_fDebugOn)
  514. {
  515. szName[4] = 0;
  516. strncpy(szName,(char *)&m_pChunk->ckid,4);
  517. ULARGE_INTEGER ul;
  518. LARGE_INTEGER li;
  519. li.QuadPart = 0;
  520. m_pStream->Seek(li, STREAM_SEEK_CUR, &ul);
  521. Trace(0,"Leaving %s, Read %ld of %ld, File Position is %ld\n",szName,m_pChunk->lRead,lSize,(long)ul.QuadPart);
  522. }
  523. #endif
  524. // If we haven't actually read this entire chunk, seek to the end of it.
  525. if (m_pChunk->lRead < lSize)
  526. {
  527. LARGE_INTEGER li;
  528. li.QuadPart = lSize - m_pChunk->lRead;
  529. hr = m_pStream->Seek(li,STREAM_SEEK_CUR,NULL);
  530. // There's a chance it could fail because we are at the end of file with an odd length chunk.
  531. if (FAILED(hr))
  532. {
  533. // If there's a parent, see if this is the last chunk.
  534. if (m_pParent)
  535. {
  536. if (m_pParent->cksize >= (m_pParent->lRead - 1))
  537. {
  538. hr = S_OK;
  539. }
  540. }
  541. // Else, see if we are an odd length.
  542. else if (m_pChunk->cksize & 1)
  543. {
  544. hr = S_OK;
  545. }
  546. }
  547. }
  548. return hr;
  549. }
  550. // This should never happen unless CRiffParser is used incorrectly, in which
  551. // case the assert will help debug. But, in the interest of making Prefix happy...
  552. return E_FAIL;
  553. }
  554. HRESULT CRiffParser::Read(void *pv,ULONG cb)
  555. {
  556. assert(m_pChunk);
  557. if (m_pChunk)
  558. {
  559. // Make sure we don't read beyond the end of the chunk.
  560. if (((long)cb + m_pChunk->lRead) > m_pChunk->cksize)
  561. {
  562. cb -= (cb - (m_pChunk->cksize - m_pChunk->lRead));
  563. }
  564. HRESULT hr = m_pStream->Read(pv,cb,NULL);
  565. if (SUCCEEDED(hr))
  566. {
  567. m_pChunk->lRead += cb;
  568. }
  569. else
  570. {
  571. Trace(1,"Error: Unable to read %ld bytes from file.\n",cb);
  572. }
  573. return hr;
  574. }
  575. // This should never happen unless CRiffParser is used incorrectly, in which
  576. // case the assert will help debug. But, in the interest of making Prefix happy...
  577. return E_FAIL;
  578. }
  579. HRESULT CRiffParser::Skip(ULONG ulBytes)
  580. {
  581. assert(m_pChunk);
  582. if (m_pChunk)
  583. {
  584. // Make sure we don't scan beyond the end of the chunk.
  585. if (((long)ulBytes + m_pChunk->lRead) > m_pChunk->cksize)
  586. {
  587. ulBytes -= (ulBytes - (m_pChunk->cksize - m_pChunk->lRead));
  588. }
  589. LARGE_INTEGER li;
  590. li.HighPart = 0;
  591. li.LowPart = ulBytes;
  592. HRESULT hr = m_pStream->Seek( li, STREAM_SEEK_CUR, NULL );
  593. if (SUCCEEDED(hr))
  594. {
  595. m_pChunk->lRead += ulBytes;
  596. }
  597. return hr;
  598. }
  599. // This should never happen unless CRiffParser is used incorrectly, in which
  600. // case the assert will help debug. But, in the interest of making Prefix happy...
  601. return E_FAIL;
  602. }
  603. void CRiffParser::MarkPosition()
  604. {
  605. assert(m_pChunk);
  606. if (m_pChunk)
  607. {
  608. LARGE_INTEGER li;
  609. ULARGE_INTEGER ul;
  610. li.HighPart = 0;
  611. li.LowPart = 0;
  612. m_pStream->Seek(li, STREAM_SEEK_CUR, &ul);
  613. m_pChunk->liPosition.QuadPart = (LONGLONG) ul.QuadPart;
  614. }
  615. }
  616. HRESULT CRiffParser::SeekBack()
  617. {
  618. assert(m_pChunk);
  619. if (m_pChunk)
  620. {
  621. // Move back to the start of the current chunk. Also, store the
  622. // absolute position because that will be useful later when we need to seek to the
  623. // end of this chunk.
  624. ULARGE_INTEGER ul;
  625. LARGE_INTEGER li;
  626. li.QuadPart = 0;
  627. li.QuadPart -= (m_pChunk->lRead + (2 * sizeof(DWORD)));
  628. HRESULT hr = m_pStream->Seek(li, STREAM_SEEK_CUR, &ul);
  629. // Now, save the absolute position for the end of this chunk.
  630. m_pChunk->liPosition.QuadPart = ul.QuadPart +
  631. RIFF_ALIGN(m_pChunk->cksize) + (2 * sizeof(DWORD));
  632. m_pChunk->lRead = 0;
  633. return hr;
  634. }
  635. return E_FAIL;
  636. }
  637. HRESULT CRiffParser::SeekForward()
  638. {
  639. assert(m_pChunk);
  640. if (m_pChunk)
  641. {
  642. m_pChunk->lRead = RIFF_ALIGN(m_pChunk->cksize);
  643. return m_pStream->Seek(m_pChunk->liPosition, STREAM_SEEK_SET, NULL);
  644. }
  645. return E_FAIL;
  646. }