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.

67 lines
1.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1995.
  5. //
  6. // File: pfolder.cxx
  7. //
  8. // Contents: Implementation of IPersistFolder
  9. //
  10. // History: 13-Dec-95 BruceFo Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "headers.hxx"
  14. #pragma hdrstop
  15. #include "guids.h"
  16. #include "pfolder.hxx"
  17. #include "shares.hxx"
  18. #include "util.hxx"
  19. //////////////////////////////////////////////////////////////////////////////
  20. STDMETHODIMP
  21. CSharesPF::GetClassID(
  22. LPCLSID lpClassID
  23. )
  24. {
  25. CShares* This = IMPL(CShares,m_PersistFolder,this);
  26. *lpClassID = CLSID_CShares;
  27. return S_OK;
  28. }
  29. STDMETHODIMP
  30. CSharesPF::Initialize(
  31. LPCITEMIDLIST pidl
  32. )
  33. {
  34. CShares* This = IMPL(CShares,m_PersistFolder,this);
  35. This->m_pidl = ILClone(pidl);
  36. if (NULL == This->m_pidl)
  37. {
  38. return E_OUTOFMEMORY;
  39. }
  40. // Determine what share info level to use, based on which level succeeds.
  41. // NOTE: if this is being invoked remotely, we assume that IRemoteComputer
  42. // is invoked *before* IPersistFolder.
  43. // Try 2, then 1.
  44. if (IsLevelOk(This->m_pszMachine, 2))
  45. {
  46. This->m_level = 2;
  47. }
  48. else if (IsLevelOk(This->m_pszMachine, 1))
  49. {
  50. This->m_level = 1;
  51. }
  52. else
  53. {
  54. // error: can't enumerate
  55. return HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED);
  56. }
  57. return S_OK;
  58. }