mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
b2d56cf364
For simplicity and short typing. JIRA issue: CORE-19469 - Replace "virtual HRESULT STDMETHODCALLTYPE m" with "STDMETHOD(m)" (m is a method name). - Replace "virtual t STDMETHODCALLTYPE m" with "STDMETHOD_(t, m)" (t is a type. m is a method name). - Use override keyword as possible.
75 lines
2.5 KiB
C++
75 lines
2.5 KiB
C++
|
|
typedef struct tagINetConnectionItem
|
|
{
|
|
struct tagINetConnectionItem * Next;
|
|
DWORD dwAdapterIndex;
|
|
NETCON_PROPERTIES Props;
|
|
} INetConnectionItem, *PINetConnectionItem;
|
|
|
|
class CNetConnectionManager:
|
|
public CComCoClass<CNetConnectionManager, &CLSID_ConnectionManager>,
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
|
public INetConnectionManager,
|
|
public IEnumNetConnection
|
|
{
|
|
public:
|
|
CNetConnectionManager();
|
|
HRESULT Initialize();
|
|
HRESULT EnumerateINetConnections();
|
|
|
|
// INetConnectionManager
|
|
STDMETHOD(EnumConnections)(NETCONMGR_ENUM_FLAGS Flags, IEnumNetConnection **ppEnum) override;
|
|
|
|
// IEnumNetConnection
|
|
STDMETHOD(Next)(ULONG celt, INetConnection **rgelt, ULONG *pceltFetched) override;
|
|
STDMETHOD(Skip)(ULONG celt) override;
|
|
STDMETHOD(Reset)() override;
|
|
STDMETHOD(Clone)(IEnumNetConnection **ppenum) override;
|
|
|
|
private:
|
|
PINetConnectionItem m_pHead;
|
|
PINetConnectionItem m_pCurrent;
|
|
|
|
public:
|
|
DECLARE_NO_REGISTRY()
|
|
DECLARE_NOT_AGGREGATABLE(CNetConnectionManager)
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
BEGIN_COM_MAP(CNetConnectionManager)
|
|
COM_INTERFACE_ENTRY_IID(IID_INetConnectionManager, INetConnectionManager)
|
|
COM_INTERFACE_ENTRY_IID(IID_IEnumNetConnection, IEnumNetConnection)
|
|
END_COM_MAP()
|
|
};
|
|
|
|
class CNetConnection:
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
|
public INetConnection
|
|
{
|
|
private:
|
|
NETCON_PROPERTIES m_Props;
|
|
DWORD m_dwAdapterIndex;
|
|
|
|
public:
|
|
~CNetConnection();
|
|
HRESULT WINAPI Initialize(PINetConnectionItem pItem);
|
|
|
|
// INetConnection
|
|
STDMETHOD(Connect)() override;
|
|
STDMETHOD(Disconnect)() override;
|
|
STDMETHOD(Delete)() override;
|
|
STDMETHOD(Duplicate)(LPCWSTR pszwDuplicateName, INetConnection **ppCon) override;
|
|
STDMETHOD(GetProperties)(NETCON_PROPERTIES **ppProps) override;
|
|
STDMETHOD(GetUiObjectClassId)(CLSID *pclsid) override;
|
|
STDMETHOD(Rename)(LPCWSTR pszwDuplicateName) override;
|
|
|
|
DECLARE_NOT_AGGREGATABLE(CNetConnection)
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
BEGIN_COM_MAP(CNetConnection)
|
|
COM_INTERFACE_ENTRY_IID(IID_INetConnection, INetConnection)
|
|
END_COM_MAP()
|
|
};
|
|
|
|
BOOL GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetCfg, PDWORD pIndex);
|
|
HRESULT WINAPI CNetConnectionManager_CreateInstance(REFIID riid, LPVOID * ppv);
|
|
|