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.

62 lines
1.4 KiB

  1. #include "priv.h"
  2. #include "ipstg.h"
  3. HRESULT CImpIPersistStorage::InitNew(IStorage *pStg)
  4. {
  5. return InitNew();
  6. }
  7. HRESULT CImpIPersistStorage::Load(IStorage *pStg)
  8. {
  9. HRESULT hres = E_INVALIDARG;
  10. if (EVAL(pStg))
  11. {
  12. IStream* pstm = NULL;
  13. hres = pStg->OpenStream(L"CONTENTS",0,STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &pstm);
  14. if (EVAL(SUCCEEDED(hres)))
  15. {
  16. hres = pstm->Seek(c_li0, STREAM_SEEK_SET, NULL);
  17. if (SUCCEEDED(hres))
  18. {
  19. hres = Load(pstm);
  20. }
  21. pstm->Release();
  22. }
  23. }
  24. return hres;
  25. }
  26. HRESULT CImpIPersistStorage::Save(IStorage *pStgSave, BOOL fSameAsLoad)
  27. {
  28. HRESULT hres = E_INVALIDARG;
  29. if (EVAL(pStgSave))
  30. {
  31. IStream* pstm = NULL;
  32. hres = pStgSave->CreateStream(L"CONTENTS",STGM_CREATE|STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &pstm);
  33. if (EVAL(SUCCEEDED(hres)))
  34. {
  35. hres = pstm->Seek(c_li0, STREAM_SEEK_SET, NULL);
  36. if (SUCCEEDED(hres))
  37. {
  38. hres = Save(pstm, TRUE);
  39. }
  40. pstm->Release();
  41. }
  42. }
  43. return hres;
  44. }
  45. HRESULT CImpIPersistStorage::SaveCompleted(IStorage *pStgNew)
  46. {
  47. return S_OK;
  48. }
  49. HRESULT CImpIPersistStorage::HandsOffStorage(void)
  50. {
  51. return S_OK;
  52. }