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.

79 lines
2.1 KiB

  1. #pragma once
  2. #include "hnetbcon.h"
  3. #include "nmbase.h"
  4. #include "nmres.h"
  5. #include "HNetCfg.h"
  6. extern LONG g_CountSharedAccessConnectionObjects;
  7. HRESULT InvokeVoidAction(IUPnPService * pService, LPTSTR pszCommand, VARIANT* pOutParams);
  8. class ATL_NO_VTABLE CSharedAccessConnection :
  9. public CComObjectRootEx <CComMultiThreadModel>,
  10. public CComCoClass <CSharedAccessConnection, &CLSID_SharedAccessConnection>,
  11. public INetConnection,
  12. public INetSharedAccessConnection,
  13. public IPersistNetConnection
  14. {
  15. public:
  16. DECLARE_REGISTRY_RESOURCEID(IDR_SA_CONNECTION)
  17. BEGIN_COM_MAP(CSharedAccessConnection)
  18. COM_INTERFACE_ENTRY(INetConnection)
  19. COM_INTERFACE_ENTRY(INetSharedAccessConnection)
  20. COM_INTERFACE_ENTRY(IPersistNetConnection)
  21. END_COM_MAP()
  22. CSharedAccessConnection();
  23. HRESULT GetStatus(NETCON_STATUS* pStatus);
  24. HRESULT GetCharacteristics(DWORD* pdwFlags);
  25. //
  26. // INetConnection
  27. //
  28. STDMETHOD(Connect)();
  29. STDMETHOD(Disconnect)();
  30. STDMETHOD(Delete)();
  31. STDMETHOD(Duplicate) (PCWSTR pszwDuplicateName, INetConnection** ppCon);
  32. STDMETHOD(GetProperties) (NETCON_PROPERTIES** ppProps);
  33. STDMETHOD(GetUiObjectClassId)(CLSID *pclsid);
  34. STDMETHOD(Rename)(PCWSTR pszwNewName);
  35. //
  36. // INetSharedAccessConnection
  37. //
  38. STDMETHOD(GetInfo)(DWORD dwMask, SHAREDACCESSCON_INFO* pConInfo);
  39. STDMETHOD(SetInfo)(DWORD dwMask, const SHAREDACCESSCON_INFO* pConInfo);
  40. STDMETHODIMP GetLocalAdapterGUID(GUID* pGuid);
  41. STDMETHODIMP GetService(SAHOST_SERVICES ulService, IUPnPService** ppService);
  42. //
  43. // IPersistNetConnection
  44. //
  45. STDMETHOD(GetClassID)(CLSID *pclsid);
  46. STDMETHOD(GetSizeMax)(ULONG *pcbSize);
  47. STDMETHOD(Load)(const BYTE *pbBuf, ULONG cbSize);
  48. STDMETHOD(Save)(BYTE *pbBuf, ULONG cbSize);
  49. //
  50. // Overrides
  51. //
  52. HRESULT FinalConstruct(void);
  53. HRESULT FinalRelease(void);
  54. private:
  55. HRESULT GetConnectionName(LPWSTR* pName);
  56. HRESULT GetStringStateVariable(IUPnPService* pService, LPWSTR pszVariableName, BSTR* pString);
  57. ISharedAccessBeacon* m_pSharedAccessBeacon;
  58. IUPnPService* m_pWANConnectionService;
  59. };