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.

58 lines
1.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1995.
  5. //
  6. // File: rcomp.cxx
  7. //
  8. // Contents: Implementation of IRemoteComputer
  9. //
  10. // History: 13-Dec-95 BruceFo Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "headers.hxx"
  14. #pragma hdrstop
  15. #include "guids.h"
  16. #include "rcomp.hxx"
  17. #include "shares.hxx"
  18. #include "util.hxx"
  19. //////////////////////////////////////////////////////////////////////////////
  20. STDMETHODIMP
  21. CSharesRC::Initialize(
  22. LPCWSTR pszMachine,
  23. BOOL bEnumerating
  24. )
  25. {
  26. CShares* This = IMPL(CShares,m_RemoteComputer,this);
  27. if (NULL == pszMachine)
  28. {
  29. return E_INVALIDARG;
  30. }
  31. //
  32. // We only want to show the remote shares folder if it is an NT
  33. // server and the user has administrative access. That means that
  34. // NetShareEnum must pass at least level 2.
  35. //
  36. if (bEnumerating)
  37. {
  38. if (!IsLevelOk(const_cast<LPWSTR>(pszMachine), 2))
  39. {
  40. return E_FAIL;
  41. }
  42. }
  43. This->m_pszMachine = NewDup(pszMachine);
  44. if (NULL == This->m_pszMachine)
  45. {
  46. return E_OUTOFMEMORY;
  47. }
  48. return S_OK;
  49. }