Source code of Windows XP (NT5)
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.

132 lines
3.3 KiB

  1. // FSStg.cpp -- Implementation for the FileSystemStorage class
  2. #include "stdafx.h"
  3. HRESULT STDMETHODCALLTYPE CFileSystemStorage::Create
  4. (IUnknown *punkOuter, REFIID riid, PPVOID ppv)
  5. {
  6. if (punkOuter && riid != IID_IUnknown)
  7. return CLASS_E_NOAGGREGATION;
  8. CFileSystemStorage *pFSStg = New CFileSystemStorage(punkOuter);
  9. if (!pFSStg)
  10. return STG_E_INSUFFICIENTMEMORY;
  11. HRESULT hr = pFSStg->m_ImpIFileSystemStorage.Init();
  12. if (hr == S_OK)
  13. hr = pFSStg->QueryInterface(riid, ppv);
  14. if (hr != S_OK)
  15. delete pFSStg;
  16. return hr;
  17. }
  18. // Initialing routines:
  19. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::Init()
  20. {
  21. return NO_ERROR;
  22. }
  23. // IFSStorage methods
  24. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSCreateStorage
  25. (const WCHAR * pwcsName, DWORD grfMode, IStorage ** ppstgOpen)
  26. {
  27. return CFSStorage::CreateStorage(NULL, pwcsName, grfMode, ppstgOpen);
  28. }
  29. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSOpenStorage
  30. (const WCHAR * pwcsName, DWORD grfMode, IStorage ** ppstgOpen)
  31. {
  32. return CFSStorage:: OpenStorage(NULL, pwcsName, grfMode, ppstgOpen);
  33. }
  34. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSCreateStream
  35. (const WCHAR *pwcsName, DWORD grfMode, IStream **ppStrm)
  36. {
  37. ILockBytes *pLKB = NULL;
  38. HRESULT hr = CFSLockBytes::Create(NULL, pwcsName, grfMode, &pLKB);
  39. if (hr == S_OK)
  40. {
  41. hr = CStream::OpenStream(NULL, pLKB, grfMode, (IStreamITEx **) ppStrm);
  42. if (hr != S_OK)
  43. pLKB->Release();
  44. }
  45. return hr;
  46. }
  47. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage
  48. ::FSCreateTemporaryStream(IStream **ppStrm)
  49. {
  50. ILockBytes *pLKB = NULL;
  51. HRESULT hr = CFSLockBytes::CreateTemp(NULL, &pLKB);
  52. if (hr == S_OK)
  53. {
  54. hr = CStream::OpenStream(NULL, pLKB, STGM_READWRITE, (IStreamITEx **) ppStrm);
  55. if (hr != S_OK)
  56. pLKB->Release();
  57. }
  58. return hr;
  59. }
  60. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSOpenStream
  61. (const WCHAR *pwcsName, DWORD grfMode, IStream **ppStrm)
  62. {
  63. ILockBytes *pLKB = NULL;
  64. HRESULT hr = CFSLockBytes::Open(NULL, pwcsName, grfMode, &pLKB);
  65. if (hr == S_OK)
  66. {
  67. hr = CStream::OpenStream(NULL, pLKB, grfMode, (IStreamITEx **) ppStrm);
  68. if (hr != S_OK)
  69. pLKB->Release();
  70. }
  71. return hr;
  72. }
  73. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSCreateLockBytes
  74. (const WCHAR *pwcsName, DWORD grfMode, ILockBytes **ppLkb)
  75. {
  76. return CFSLockBytes::Create(NULL, pwcsName, grfMode, ppLkb);
  77. }
  78. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage
  79. ::FSCreateTemporaryLockBytes(ILockBytes **ppLkb)
  80. {
  81. return CFSLockBytes::CreateTemp(NULL, ppLkb);
  82. }
  83. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSOpenLockBytes
  84. (const WCHAR *pwcsName, DWORD grfMode, ILockBytes **ppLkb)
  85. {
  86. return CFSLockBytes::Open(NULL, pwcsName, grfMode, ppLkb);
  87. }
  88. HRESULT STDMETHODCALLTYPE CFileSystemStorage::CImpIFileSystemStorage::FSStgSetTimes
  89. (WCHAR const * lpszName, FILETIME const * pctime,
  90. FILETIME const * patime, FILETIME const * pmtime
  91. )
  92. {
  93. RonM_ASSERT(FALSE);
  94. return E_NOTIMPL;
  95. }