-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetworkAdapter.h
50 lines (42 loc) · 946 Bytes
/
NetworkAdapter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright(C) Nishant Sivakumar, 2005. All rights reserved.
http://blog.voidnish.com
*/
#pragma once
#include <windows.h>
#include <string>
#include <tchar.h>
#pragma comment(lib,"Iphlpapi.lib")
#include <Iphlpapi.h>
#pragma comment(lib,"Rpcrt4.lib")
#include <netcon.h>
namespace CodeProjectUtils
{
struct ADAPTERINFO
{
ADAPTERINFO()
{
InstanceId = Description = MAC = _T("");
}
std::wstring InstanceId;
std::wstring Description;
std::wstring MAC;
};
class CNetworkAdapterList
{
public:
CNetworkAdapterList(void);
~CNetworkAdapterList(void);
private:
PIP_ADAPTER_INFO pAdapterInfo;
int m_count;
public:
bool IsValid(void);
int GetCount(void);
int GetAdapters(ADAPTERINFO* pADAPTERINFO);
};
bool EnableConnection(GUID guidId, bool bEnable);
bool UpdateRegistry(std::wstring strNetCfgInstanceId, LPCTSTR lpszMacID = NULL);
bool Reset(ADAPTERINFO* pAdInfo);
DWORD ErrorCOMToWin32(HRESULT hr);
}