ReactOS  0.4.14-dev-337-gf981a68
CNetConnection Class Reference

#include <connectmanager.h>

Inheritance diagram for CNetConnection:
Collaboration diagram for CNetConnection:

Public Member Functions

 ~CNetConnection ()
 
HRESULT WINAPI Initialize (PINetConnectionItem pItem)
 
HRESULT WINAPI Connect ()
 
HRESULT WINAPI Disconnect ()
 
HRESULT WINAPI Delete ()
 
HRESULT WINAPI Duplicate (LPCWSTR pszwDuplicateName, INetConnection **ppCon)
 
HRESULT WINAPI GetProperties (NETCON_PROPERTIES **ppProps)
 
HRESULT WINAPI GetUiObjectClassId (CLSID *pclsid)
 
HRESULT WINAPI Rename (LPCWSTR pszwDuplicateName)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Attributes

NETCON_PROPERTIES m_Props
 
DWORD m_dwAdapterIndex
 

Additional Inherited Members

- Public Types inherited from INetConnection
enum  tagNETCON_CHARACTERISTIC_FLAGS {
  NCCF_NONE = 0x0000, NCCF_ALL_USERS = 0x0001, NCCF_ALLOW_DUPLICATION = 0x0002, NCCF_ALLOW_REMOVAL = 0x0004,
  NCCF_ALLOW_RENAME = 0x0008, NCCF_INCOMING_ONLY = 0x0020, NCCF_OUTGOING_ONLY = 0x0040, NCCF_BRANDED = 0x0080,
  NCCF_SHARED = 0x0100, NCCF_BRIDGED = 0x0200, NCCF_FIREWALLED = 0x0400, NCCF_DEFAULT = 0x0800,
  NCCF_HOMENET_CAPABLE = 0x1000, NCCF_SHARED_PRIVATE = 0x2000, NCCF_QUARANTINED = 0x4000, NCCF_RESERVED = 0x8000,
  NCCF_BLUETOOTH_MASK = 0x000F0000, NCCF_LAN_MASK = 0x00F00000
}
 
enum  tagNETCON_STATUS {
  NCS_DISCONNECTED, NCS_CONNECTING, NCS_CONNECTED, NCS_DISCONNECTING,
  NCS_HARDWARE_NOT_PRESENT, NCS_HARDWARE_DISABLED, NCS_HARDWARE_MALFUNCTION, NCS_MEDIA_DISCONNECTED,
  NCS_AUTHENTICATING, NCS_AUTHENTICATION_SUCCEEDED, NCS_AUTHENTICATION_FAILED, NCS_INVALID_ADDRESS,
  NCS_CREDENTIALS_REQUIRED
}
 
enum  tagNETCON_TYPE {
  NCT_DIRECT_CONNECT, NCT_INBOUND, NCT_INTERNET, NCT_LAN,
  NCT_PHONE, NCT_TUNNEL, NCT_BRIDGE
}
 
enum  tagNETCON_MEDIATYPE {
  NCM_NONE, NCM_DIRECT, NCM_ISDN, NCM_LAN,
  NCM_PHONE, NCM_TUNNEL, NCM_PPPOE, NCM_BRIDGE,
  NCM_SHAREDACCESSHOST_LAN, NCM_SHAREDACCESSHOST_RAS
}
 
typedef enum INetConnection::tagNETCON_CHARACTERISTIC_FLAGS NETCON_CHARACTERISTIC_FLAGS
 
typedef enum INetConnection::tagNETCON_STATUS NETCON_STATUS
 
typedef enum INetConnection::tagNETCON_TYPE NETCON_TYPE
 
typedef enum INetConnection::tagNETCON_MEDIATYPE NETCON_MEDIATYPE
 
typedef struct INetConnection::tagNETCON_PROPERTIES NETCON_PROPERTIES
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 44 of file connectmanager.h.

Constructor & Destructor Documentation

◆ ~CNetConnection()

CNetConnection::~CNetConnection ( )

Definition at line 40 of file connectmanager.cpp.

41 {
44 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
NETCON_PROPERTIES m_Props

Member Function Documentation

◆ Connect()

HRESULT WINAPI CNetConnection::Connect ( )

Implements INetConnection.

Definition at line 48 of file connectmanager.cpp.

49 {
50  return E_NOTIMPL;
51 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Delete()

HRESULT WINAPI CNetConnection::Delete ( )

Implements INetConnection.

Definition at line 188 of file connectmanager.cpp.

189 {
190  return E_NOTIMPL;
191 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Disconnect()

HRESULT WINAPI CNetConnection::Disconnect ( void  )

Implements INetConnection.

Definition at line 98 of file connectmanager.cpp.

99 {
100  HKEY hKey;
101  NETCON_PROPERTIES * pProperties;
102  LPOLESTR pDisplayName;
103  WCHAR szPath[200];
104  DWORD dwSize, dwType;
105  LPWSTR pPnp;
106  HDEVINFO hInfo;
107  SP_DEVINFO_DATA DevInfo;
108  SP_PROPCHANGE_PARAMS PropChangeParams;
109  HRESULT hr;
110 
111  hr = GetProperties(&pProperties);
112  if (FAILED_UNEXPECTEDLY(hr))
113  return hr;
114 
115  hInfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_NET, NULL, NULL, DIGCF_PRESENT );
116  if (!hInfo)
117  {
118  NcFreeNetconProperties(pProperties);
119  return E_FAIL;
120  }
121 
122  if (FAILED(StringFromCLSID((CLSID)pProperties->guidId, &pDisplayName)))
123  {
124  NcFreeNetconProperties(pProperties);
126  return E_FAIL;
127  }
128  NcFreeNetconProperties(pProperties);
129 
130  if (FindNetworkAdapter(hInfo, &DevInfo, pDisplayName))
131  {
132  PropChangeParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
134  PropChangeParams.StateChange = DICS_DISABLE;
135  PropChangeParams.Scope = DICS_FLAG_CONFIGSPECIFIC;
136  PropChangeParams.HwProfile = 0;
137 
138  if (SetupDiSetClassInstallParams(hInfo, &DevInfo, &PropChangeParams.ClassInstallHeader, sizeof(SP_PROPCHANGE_PARAMS)))
139  {
141  }
142  }
144 
145  swprintf(szPath, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pDisplayName);
146  CoTaskMemFree(pDisplayName);
147 
149  return E_FAIL;
150 
151  dwSize = 0;
152  if (RegQueryValueExW(hKey, L"PnpInstanceID", NULL, &dwType, NULL, &dwSize) != ERROR_SUCCESS || dwType != REG_SZ)
153  {
154  RegCloseKey(hKey);
155  return E_FAIL;
156  }
157 
158  pPnp = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
159  if (!pPnp)
160  {
161  RegCloseKey(hKey);
162  return E_FAIL;
163  }
164 
165  if (RegQueryValueExW(hKey, L"PnpInstanceID", NULL, &dwType, (LPBYTE)pPnp, &dwSize) != ERROR_SUCCESS)
166  {
167  CoTaskMemFree(pPnp);
168  RegCloseKey(hKey);
169  return E_FAIL;
170  }
171  RegCloseKey(hKey);
172 
173  swprintf(szPath, L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Enum\\%s", pPnp);
174  CoTaskMemFree(pPnp);
175 
177  return E_FAIL;
178 
179  dwSize = 1; /* enable = 0, disable = 1 */
180  RegSetValueExW(hKey, L"CSConfigFlags", 0, REG_DWORD, (LPBYTE)&dwSize, sizeof(DWORD));
181  RegCloseKey(hKey);
182 
183  return S_OK;
184 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
BOOL FindNetworkAdapter(HDEVINFO hInfo, SP_DEVINFO_DATA *pDevInfo, LPWSTR pGuid)
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2297
#define KEY_READ
Definition: nt_native.h:1023
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4029
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define DICS_DISABLE
Definition: setupapi.h:114
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:911
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
LPCWSTR szPath
Definition: env.c:35
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2612
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HRESULT WINAPI GetProperties(NETCON_PROPERTIES **ppProps)
#define REG_DWORD
Definition: sdbapi.c:596
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
DI_FUNCTION InstallFunction
Definition: setupapi.h:899
#define DIGCF_PRESENT
Definition: setupapi.h:171
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define REG_SZ
Definition: layer.c:22

◆ Duplicate()

HRESULT WINAPI CNetConnection::Duplicate ( LPCWSTR  pszwDuplicateName,
INetConnection **  ppCon 
)

Implements INetConnection.

Definition at line 195 of file connectmanager.cpp.

198 {
199  return E_NOTIMPL;
200 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetProperties()

HRESULT WINAPI CNetConnection::GetProperties ( NETCON_PROPERTIES **  ppProps)

Implements INetConnection.

Definition at line 204 of file connectmanager.cpp.

205 {
206  MIB_IFROW IfEntry;
207  HKEY hKey;
208  LPOLESTR pStr;
209  WCHAR szName[140];
210  DWORD dwShowIcon, dwNotifyDisconnect, dwType, dwSize;
211  NETCON_PROPERTIES * pProperties;
212  HRESULT hr;
213 
214  if (!ppProps)
215  return E_POINTER;
216 
217  pProperties = static_cast<NETCON_PROPERTIES*>(CoTaskMemAlloc(sizeof(NETCON_PROPERTIES)));
218  if (!pProperties)
219  return E_OUTOFMEMORY;
220 
221  CopyMemory(pProperties, &m_Props, sizeof(NETCON_PROPERTIES));
222  pProperties->pszwName = NULL;
223 
225  {
226  pProperties->pszwDeviceName = static_cast<LPWSTR>(CoTaskMemAlloc((wcslen(m_Props.pszwDeviceName)+1)*sizeof(WCHAR)));
227  if (pProperties->pszwDeviceName)
229  }
230 
231  *ppProps = pProperties;
232 
233  /* get updated adapter characteristics */
234  ZeroMemory(&IfEntry, sizeof(IfEntry));
235  IfEntry.dwIndex = m_dwAdapterIndex;
236  if (GetIfEntry(&IfEntry) != NO_ERROR)
237  return NOERROR;
238 
239  NormalizeOperStatus(&IfEntry, pProperties);
240 
241 
243  if (SUCCEEDED(hr))
244  {
245  wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
246  wcscat(szName, pStr);
247  wcscat(szName, L"\\Connection");
248 
250  {
251  dwSize = sizeof(dwShowIcon);
252  if (RegQueryValueExW(hKey, L"ShowIcon", NULL, &dwType, (LPBYTE)&dwShowIcon, &dwSize) == ERROR_SUCCESS && dwType == REG_DWORD)
253  {
254  if (dwShowIcon)
255  pProperties->dwCharacter |= NCCF_SHOW_ICON;
256  else
257  pProperties->dwCharacter &= ~NCCF_SHOW_ICON;
258  }
259 
260  dwSize = sizeof(dwNotifyDisconnect);
261  if (RegQueryValueExW(hKey, L"IpCheckingEnabled", NULL, &dwType, (LPBYTE)&dwNotifyDisconnect, &dwSize) == ERROR_SUCCESS && dwType == REG_DWORD)
262  {
263  if (dwNotifyDisconnect)
264  pProperties->dwCharacter |= NCCF_NOTIFY_DISCONNECTED;
265  else
266  pProperties->dwCharacter &= ~NCCF_NOTIFY_DISCONNECTED;
267  }
268 
269  dwSize = sizeof(szName);
270  if (RegQueryValueExW(hKey, L"Name", NULL, &dwType, (LPBYTE)szName, &dwSize) == ERROR_SUCCESS)
271  {
272  /* use updated name */
273  dwSize = wcslen(szName) + 1;
274  pProperties->pszwName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize * sizeof(WCHAR)));
275  if (pProperties->pszwName)
276  CopyMemory(pProperties->pszwName, szName, dwSize * sizeof(WCHAR));
277  }
278  else
279  {
280  /* use cached name */
281  if (m_Props.pszwName)
282  {
283  pProperties->pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(m_Props.pszwName)+1)*sizeof(WCHAR)));
284  if (pProperties->pszwName)
285  wcscpy(pProperties->pszwName, m_Props.pszwName);
286  }
287  }
288  RegCloseKey(hKey);
289  }
290  CoTaskMemFree(pStr);
291  }
292 
293  /* Enable 'Rename' and 'Delete' for Adminstrators only */
294  if (IsUserAdmin())
295  {
297  }
298  else
299  {
300  pProperties->dwCharacter &= ~(NCCF_ALLOW_RENAME | NCCF_ALLOW_REMOVAL);
301  }
302 
303  return S_OK;
304 }
LPWSTR pszwDeviceName
Definition: netcon.h:85
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI IsUserAdmin(VOID)
#define NOERROR
Definition: winerror.h:2354
#define KEY_READ
Definition: nt_native.h:1023
#define ZeroMemory
Definition: winbase.h:1642
static LPOLESTR
Definition: stg_prop.c:27
DWORD m_dwAdapterIndex
#define NO_ERROR
Definition: dderror.h:5
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NCCF_NOTIFY_DISCONNECTED
Definition: precomp.h:76
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID NormalizeOperStatus(MIB_IFROW *IfEntry, NETCON_PROPERTIES *Props)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
static const WCHAR szName[]
Definition: msipriv.h:1194
NETCON_PROPERTIES m_Props
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
DWORD dwIndex
Definition: ifmib.h:38
#define E_POINTER
Definition: winerror.h:2365
#define REG_DWORD
Definition: sdbapi.c:596
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

Referenced by Disconnect().

◆ GetUiObjectClassId()

HRESULT WINAPI CNetConnection::GetUiObjectClassId ( CLSID pclsid)

Implements INetConnection.

Definition at line 308 of file connectmanager.cpp.

309 {
310  if (m_Props.MediaType == NCM_LAN)
311  {
312  CopyMemory(pclsid, &CLSID_LanConnectionUi, sizeof(CLSID));
313  return S_OK;
314  }
315 
316  return E_NOTIMPL;
317 }
#define CopyMemory
Definition: winbase.h:1640
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
NETCON_PROPERTIES m_Props

◆ Initialize()

HRESULT WINAPI CNetConnection::Initialize ( PINetConnectionItem  pItem)

Definition at line 18 of file connectmanager.cpp.

19 {
20  m_Props = pItem->Props;
22 
23  if (pItem->Props.pszwName)
24  {
25  m_Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(pItem->Props.pszwName)+1)*sizeof(WCHAR)));
26  if (m_Props.pszwName)
28  }
29 
30  if (pItem->Props.pszwDeviceName)
31  {
32  m_Props.pszwDeviceName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(pItem->Props.pszwDeviceName)+1)*sizeof(WCHAR)));
35  }
36 
37  return S_OK;
38 }
DWORD m_dwAdapterIndex
__wchar_t WCHAR
Definition: xmlstorage.h:180
NETCON_PROPERTIES Props
Definition: connectmanager.h:6
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define S_OK
Definition: intsafe.h:59
NETCON_PROPERTIES m_Props
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ Rename()

HRESULT WINAPI CNetConnection::Rename ( LPCWSTR  pszwDuplicateName)

Implements INetConnection.

Definition at line 321 of file connectmanager.cpp.

322 {
323  WCHAR szName[140];
324  LPOLESTR pStr;
325  DWORD dwSize;
326  HKEY hKey;
327  HRESULT hr;
328 
329  if (pszwDuplicateName == NULL || wcslen(pszwDuplicateName) == 0)
330  return S_OK;
331 
332  if (m_Props.pszwName)
333  {
336  }
337 
338  dwSize = (wcslen(pszwDuplicateName) + 1) * sizeof(WCHAR);
339  m_Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
340  if (m_Props.pszwName == NULL)
341  return E_OUTOFMEMORY;
342 
343  wcscpy(m_Props.pszwName, pszwDuplicateName);
344 
346  if (SUCCEEDED(hr))
347  {
348  wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
349  wcscat(szName, pStr);
350  wcscat(szName, L"\\Connection");
351 
353  {
355  RegCloseKey(hKey);
356  }
357 
358  CoTaskMemFree(pStr);
359  }
360 
361  return hr;
362 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
static LPOLESTR
Definition: stg_prop.c:27
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR szName[]
Definition: msipriv.h:1194
NETCON_PROPERTIES m_Props
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define REG_SZ
Definition: layer.c:22

Member Data Documentation

◆ m_dwAdapterIndex

DWORD CNetConnection::m_dwAdapterIndex
private

Definition at line 50 of file connectmanager.h.

Referenced by GetProperties(), and Initialize().

◆ m_Props

NETCON_PROPERTIES CNetConnection::m_Props
private

The documentation for this class was generated from the following files: