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.

82 lines
2.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: G P N L A . H
  7. //
  8. // Contents: Class for Handling NLA Changes that affect Group Policies
  9. //
  10. // Notes:
  11. //
  12. // Author: sjkhan 20 Feb 2001
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "nmbase.h"
  17. #include <winsock2.h>
  18. #include "ncstl.h"
  19. #include "ncstlstr.h"
  20. #include "netcon.h"
  21. #include "gpbase.h"
  22. #include "cmevent.h"
  23. typedef struct tagGPNLAINFORMATION
  24. {
  25. tstring strNetworkName;
  26. NETCON_STATUS ncsStatus;
  27. } GPNLAINFORMATION;
  28. typedef pair<GUID, GPNLAINFORMATION> GPNLAPAIR;
  29. typedef list<GPNLAPAIR> GPNLALIST;
  30. typedef GPNLALIST::iterator GPNLAITER;
  31. class CGroupPolicyNetworkLocationAwareness : public CGroupPolicyBase
  32. {
  33. public:
  34. CGroupPolicyNetworkLocationAwareness();
  35. ~CGroupPolicyNetworkLocationAwareness();
  36. HRESULT Initialize();
  37. HRESULT Uninitialize();
  38. virtual BOOL IsSameNetworkAsGroupPolicies();
  39. static VOID NTAPI EventHandler(IN LPVOID pContext, IN BOOLEAN TimerOrWaitFired);
  40. static VOID NTAPI GroupPolicyChange(IN LPVOID pContext, IN BOOLEAN TimerOrWaitFired);
  41. static DWORD WINAPI ShutdownNlaHandler(PVOID pThis);
  42. protected:
  43. HRESULT LookupServiceBegin(DWORD dwControlFlags);
  44. HRESULT LookupServiceNext(DWORD dwControlFlags, LPDWORD lpdwBufferLength, LPWSAQUERYSET lpqsResults);
  45. HRESULT LookupServiceEnd();
  46. HRESULT QueueEvent(CONMAN_EVENTTYPE cmEventType, LPGUID pguidAdapter, NETCON_STATUS ncsStatus);
  47. HRESULT RegisterWait();
  48. HRESULT DeregisterWait();
  49. HRESULT EnumChanges();
  50. LONG Reference();
  51. LONG Unreference();
  52. BOOL IsJoinedToDomain();
  53. static HRESULT ReconfigureHomeNet(IN BOOL fWaitUntilRunningOrStopped = FALSE);
  54. protected:
  55. WSADATA m_wsaData;
  56. WSACOMPLETION m_wsaCompletion;
  57. WSAOVERLAPPED m_wsaOverlapped;
  58. HANDLE m_hQuery;
  59. WSAQUERYSET m_wqsRestrictions;
  60. BOOL m_fSameNetwork;
  61. HANDLE m_hEventNLA;
  62. HANDLE m_hNLAWait;
  63. HANDLE m_hEventGP;
  64. HANDLE m_hGPWait;
  65. GPNLALIST m_listAdapters;
  66. CRITICAL_SECTION m_csList;
  67. LONG m_lRefCount;
  68. HANDLE m_hEventExit;
  69. BOOL m_fShutdown;
  70. BOOL m_fErrorShutdown;
  71. static LONG m_lBusyWithReconfigure;
  72. };