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.

147 lines
4.4 KiB

  1. // Warehse.cpp -- Implementation for the class CWarehouse
  2. #include "stdafx.h"
  3. CWarehouse::CImpIWarehouse::CImpIWarehouse(CWarehouse *pBackObj, IUnknown *punkOuter)
  4. : IITITStorageEx(pBackObj, punkOuter)
  5. {
  6. m_pITSCD = NULL;
  7. }
  8. CWarehouse::CImpIWarehouse::~CImpIWarehouse(void)
  9. {
  10. if (m_pITSCD)
  11. delete [] (DWORD *) m_pITSCD;
  12. }
  13. HRESULT STDMETHODCALLTYPE CWarehouse::Create
  14. (IUnknown *punkOuter, REFIID riid, PPVOID ppv)
  15. {
  16. if (punkOuter && riid != IID_IUnknown)
  17. return CLASS_E_NOAGGREGATION;
  18. CWarehouse *pWarehouse = New CWarehouse(punkOuter);
  19. if (!pWarehouse)
  20. return STG_E_INSUFFICIENTMEMORY;
  21. HRESULT hr = pWarehouse->m_ImpIWarehouse.Init();
  22. if (hr == S_OK)
  23. hr = pWarehouse->QueryInterface(riid, ppv);
  24. if (hr != S_OK)
  25. delete pWarehouse;
  26. return hr;
  27. }
  28. STDMETHODIMP CWarehouse::CImpIWarehouse::StgCreateDocfile
  29. (const WCHAR * pwcsName, DWORD grfMode,
  30. DWORD reserved, IStorage ** ppstgOpen
  31. )
  32. {
  33. return CITFileSystem::CreateITFileSystem
  34. (NULL, pwcsName, grfMode, m_pITSCD, GetUserDefaultLCID(), ppstgOpen);
  35. }
  36. STDMETHODIMP CWarehouse::CImpIWarehouse::StgCreateDocfileOnILockBytes
  37. (ILockBytes * plkbyt, DWORD grfMode,
  38. DWORD reserved, IStorage ** ppstgOpen
  39. )
  40. {
  41. return CITFileSystem::CreateITFSOnLockBytes
  42. (NULL, plkbyt, grfMode, m_pITSCD, GetUserDefaultLCID(), ppstgOpen);
  43. }
  44. STDMETHODIMP CWarehouse::CImpIWarehouse::StgCreateDocfileForLocale
  45. (const WCHAR * pwcsName, DWORD grfMode, DWORD reserved, LCID lcid, IStorage ** ppstgOpen)
  46. {
  47. return CITFileSystem::CreateITFileSystem
  48. (NULL, pwcsName, grfMode, m_pITSCD, lcid, ppstgOpen);
  49. }
  50. STDMETHODIMP CWarehouse::CImpIWarehouse::StgCreateDocfileForLocaleOnILockBytes
  51. (ILockBytes * plkbyt, DWORD grfMode, DWORD reserved, LCID lcid, IStorage ** ppstgOpen)
  52. {
  53. return CITFileSystem::CreateITFSOnLockBytes
  54. (NULL, plkbyt, grfMode, m_pITSCD, lcid, ppstgOpen);
  55. }
  56. STDMETHODIMP CWarehouse::CImpIWarehouse::QueryFileStampAndLocale
  57. (const WCHAR *pwcsName, DWORD *pFileStamp, DWORD *pFileLocale)
  58. {
  59. return CITFileSystem::QueryFileStampAndLocale(pwcsName, pFileStamp, pFileLocale);
  60. }
  61. STDMETHODIMP CWarehouse::CImpIWarehouse::QueryLockByteStampAndLocale
  62. (ILockBytes * plkbyt, DWORD *pFileStamp, DWORD *pFileLocale)
  63. {
  64. return CITFileSystem::QueryLockByteStampAndLocale(plkbyt, pFileStamp, pFileLocale);
  65. }
  66. STDMETHODIMP CWarehouse::CImpIWarehouse::StgIsStorageFile(const WCHAR * pwcsName)
  67. {
  68. return CITFileSystem::IsITFile(pwcsName);
  69. }
  70. STDMETHODIMP CWarehouse::CImpIWarehouse::StgIsStorageILockBytes(ILockBytes * plkbyt)
  71. {
  72. return CITFileSystem::IsITLockBytes(plkbyt);
  73. }
  74. STDMETHODIMP CWarehouse::CImpIWarehouse::StgOpenStorage
  75. (const WCHAR * pwcsName, IStorage * pstgPriority,
  76. DWORD grfMode, SNB snbExclude, DWORD reserved,
  77. IStorage ** ppstgOpen
  78. )
  79. {
  80. return CITFileSystem::OpenITFileSystem(NULL, pwcsName, grfMode, (IStorageITEx **)ppstgOpen);
  81. }
  82. STDMETHODIMP CWarehouse::CImpIWarehouse::StgOpenStorageOnILockBytes
  83. (ILockBytes * plkbyt, IStorage * pStgPriority,
  84. DWORD grfMode, SNB snbExclude, DWORD reserved,
  85. IStorage ** ppstgOpen
  86. )
  87. {
  88. return CITFileSystem::OpenITFSOnLockBytes(NULL, plkbyt, grfMode, (IStorageITEx **)ppstgOpen);
  89. }
  90. STDMETHODIMP CWarehouse::CImpIWarehouse::StgSetTimes
  91. (WCHAR const * lpszName, FILETIME const * pctime,
  92. FILETIME const * patime, FILETIME const * pmtime
  93. )
  94. {
  95. return CITFileSystem::SetITFSTimes(lpszName, pctime, patime, pmtime);
  96. }
  97. STDMETHODIMP CWarehouse::CImpIWarehouse::SetControlData(PITS_Control_Data pControlData)
  98. {
  99. UINT cdw = pControlData->cdwControlData + 1;
  100. ITS_Control_Data *pITSCD = (ITS_Control_Data *) New DWORD[cdw];
  101. if (!pITSCD)
  102. return STG_E_INSUFFICIENTMEMORY;
  103. CopyMemory(pITSCD, pControlData, cdw * sizeof(DWORD));
  104. if (m_pITSCD)
  105. delete [] (DWORD *) m_pITSCD;
  106. m_pITSCD = pITSCD;
  107. return NO_ERROR;
  108. }
  109. STDMETHODIMP CWarehouse::CImpIWarehouse::DefaultControlData(PITS_Control_Data *ppControlData)
  110. {
  111. return CITFileSystem::DefaultControlData(ppControlData);
  112. }
  113. STDMETHODIMP CWarehouse::CImpIWarehouse::Compact(const WCHAR * pwcsName, ECompactionLev iLev)
  114. {
  115. return CITFileSystem::Compact(pwcsName, iLev);
  116. }