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.

61 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001.
  5. //
  6. // File: E V E N T Q . C P P
  7. //
  8. // Contents: Event Queue for managing synchonization of external events.
  9. //
  10. // Notes:
  11. //
  12. // Author: ckotze 29 Nov 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "nmpolicy.h"
  18. #include "ncperms.h"
  19. extern CGroupPolicyNetworkLocationAwareness* g_pGPNLA;
  20. CNetMachinePolicies::CNetMachinePolicies() : m_pGroupPolicyNLA(0)
  21. {
  22. HRESULT hr;
  23. hr = HrEnsureRegisteredWithNla();
  24. if (SUCCEEDED(hr))
  25. {
  26. m_pGroupPolicyNLA = g_pGPNLA;
  27. }
  28. TraceHr(ttidGPNLA, FAL, hr, (S_FALSE==hr), "CNetMachinePolicies::CNetMachinePolicies()");
  29. }
  30. CNetMachinePolicies::~CNetMachinePolicies()
  31. {
  32. }
  33. HRESULT CNetMachinePolicies::VerifyPermission(IN DWORD ulPerm, OUT BOOL* pfPermission)
  34. {
  35. Assert(ulPerm == NCPERM_ShowSharedAccessUi || ulPerm == NCPERM_PersonalFirewallConfig ||
  36. ulPerm == NCPERM_ICSClientApp || ulPerm == NCPERM_AllowNetBridge_NLA);
  37. if (ulPerm != NCPERM_ShowSharedAccessUi && ulPerm != NCPERM_PersonalFirewallConfig &&
  38. ulPerm != NCPERM_ICSClientApp && ulPerm != NCPERM_AllowNetBridge_NLA)
  39. {
  40. return E_INVALIDARG;
  41. }
  42. if (!pfPermission)
  43. {
  44. return E_POINTER;
  45. }
  46. // If for some reason m_pGroupPolicyNLA is NULL, then FHasPermission will return TRUE,
  47. // We assume that we're on a different network from which the policy came, rather than
  48. // enforce the policies and cause the firewall not to start when connected to a public
  49. // network.
  50. *pfPermission = FHasPermission(ulPerm, dynamic_cast<CGroupPolicyBase*>(m_pGroupPolicyNLA));
  51. return S_OK;
  52. }