ReactOS 0.4.15-dev-7897-g78dc504
connectmanager.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Shell
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: CNetConnectionManager class
5 * COPYRIGHT: Copyright 2008 Johannes Anderwald (johannes.anderwald@reactos.org)
6 */
7
8#include "precomp.h"
9
11
12/***************************************************************
13 * INetConnection Interface
14 */
15
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}
39
41{
44}
45
49{
50 return E_NOTIMPL;
51}
52
53BOOL
55{
56 DWORD dwIndex, dwSize;
57 HKEY hSubKey;
58 WCHAR szNetCfg[50];
59 WCHAR szDetail[200] = L"SYSTEM\\CurrentControlSet\\Control\\Class\\";
60
61 dwIndex = 0;
62 do
63 {
64 ZeroMemory(pDevInfo, sizeof(SP_DEVINFO_DATA));
65 pDevInfo->cbSize = sizeof(SP_DEVINFO_DATA);
66
67 /* get device info */
68 if (!SetupDiEnumDeviceInfo(hInfo, dwIndex++, pDevInfo))
69 break;
70
71 /* get device software registry path */
72 if (!SetupDiGetDeviceRegistryPropertyW(hInfo, pDevInfo, SPDRP_DRIVER, NULL, (LPBYTE)&szDetail[39], sizeof(szDetail)/sizeof(WCHAR) - 40, &dwSize))
73 break;
74
75 /* open device registry key */
76 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szDetail, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
77 break;
78
79 /* query NetCfgInstanceId for current device */
80 dwSize = sizeof(szNetCfg);
81 if (RegQueryValueExW(hSubKey, L"NetCfgInstanceId", NULL, NULL, (LPBYTE)szNetCfg, &dwSize) != ERROR_SUCCESS)
82 {
83 RegCloseKey(hSubKey);
84 break;
85 }
86 RegCloseKey(hSubKey);
87 if (!_wcsicmp(pGuid, szNetCfg))
88 {
89 return TRUE;
90 }
91 } while (TRUE);
92
93 return FALSE;
94}
95
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);
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)) ||
140 {
142 }
143 }
145
146 swprintf(szPath, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pDisplayName);
147 CoTaskMemFree(pDisplayName);
148
150 return hr;
151
153 return E_FAIL;
154
155 dwSize = 0;
156 if (RegQueryValueExW(hKey, L"PnpInstanceID", NULL, &dwType, NULL, &dwSize) != ERROR_SUCCESS || dwType != REG_SZ)
157 {
159 return E_FAIL;
160 }
161
162 pPnp = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
163 if (!pPnp)
164 {
166 return E_FAIL;
167 }
168
169 if (RegQueryValueExW(hKey, L"PnpInstanceID", NULL, &dwType, (LPBYTE)pPnp, &dwSize) != ERROR_SUCCESS)
170 {
171 CoTaskMemFree(pPnp);
173 return E_FAIL;
174 }
176
177 swprintf(szPath, L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Enum\\%s", pPnp);
178 CoTaskMemFree(pPnp);
179
181 return E_FAIL;
182
183 dwSize = 1; /* enable = 0, disable = 1 */
184 RegSetValueExW(hKey, L"CSConfigFlags", 0, REG_DWORD, (LPBYTE)&dwSize, sizeof(DWORD));
186
187 return S_OK;
188}
189
191WINAPI
193{
194 return E_NOTIMPL;
195}
196
198WINAPI
200 LPCWSTR pszwDuplicateName,
201 INetConnection **ppCon)
202{
203 return E_NOTIMPL;
204}
205
207WINAPI
209{
210 MIB_IFROW IfEntry;
211 HKEY hKey;
212 LPOLESTR pStr;
213 WCHAR szName[140];
214 DWORD dwShowIcon, dwNotifyDisconnect, dwType, dwSize;
215 NETCON_PROPERTIES * pProperties;
216 HRESULT hr;
217
218 if (!ppProps)
219 return E_POINTER;
220
221 pProperties = static_cast<NETCON_PROPERTIES*>(CoTaskMemAlloc(sizeof(NETCON_PROPERTIES)));
222 if (!pProperties)
223 return E_OUTOFMEMORY;
224
225 CopyMemory(pProperties, &m_Props, sizeof(NETCON_PROPERTIES));
226 pProperties->pszwName = NULL;
227
229 {
230 pProperties->pszwDeviceName = static_cast<LPWSTR>(CoTaskMemAlloc((wcslen(m_Props.pszwDeviceName)+1)*sizeof(WCHAR)));
231 if (pProperties->pszwDeviceName)
233 }
234
235 *ppProps = pProperties;
236
237 /* get updated adapter characteristics */
238 ZeroMemory(&IfEntry, sizeof(IfEntry));
239 IfEntry.dwIndex = m_dwAdapterIndex;
240 if (GetIfEntry(&IfEntry) != NO_ERROR)
241 return NOERROR;
242
243 NormalizeOperStatus(&IfEntry, pProperties);
244
245
247 if (SUCCEEDED(hr))
248 {
249 wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
250 wcscat(szName, pStr);
251 wcscat(szName, L"\\Connection");
252
254 {
255 dwSize = sizeof(dwShowIcon);
256 if (RegQueryValueExW(hKey, L"ShowIcon", NULL, &dwType, (LPBYTE)&dwShowIcon, &dwSize) == ERROR_SUCCESS && dwType == REG_DWORD)
257 {
258 if (dwShowIcon)
259 pProperties->dwCharacter |= NCCF_SHOW_ICON;
260 else
261 pProperties->dwCharacter &= ~NCCF_SHOW_ICON;
262 }
263
264 dwSize = sizeof(dwNotifyDisconnect);
265 if (RegQueryValueExW(hKey, L"IpCheckingEnabled", NULL, &dwType, (LPBYTE)&dwNotifyDisconnect, &dwSize) == ERROR_SUCCESS && dwType == REG_DWORD)
266 {
267 if (dwNotifyDisconnect)
269 else
270 pProperties->dwCharacter &= ~NCCF_NOTIFY_DISCONNECTED;
271 }
272
273 dwSize = sizeof(szName);
274 if (RegQueryValueExW(hKey, L"Name", NULL, &dwType, (LPBYTE)szName, &dwSize) == ERROR_SUCCESS)
275 {
276 /* use updated name */
277 dwSize = wcslen(szName) + 1;
278 pProperties->pszwName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize * sizeof(WCHAR)));
279 if (pProperties->pszwName)
280 CopyMemory(pProperties->pszwName, szName, dwSize * sizeof(WCHAR));
281 }
282 else
283 {
284 /* use cached name */
285 if (m_Props.pszwName)
286 {
287 pProperties->pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(m_Props.pszwName)+1)*sizeof(WCHAR)));
288 if (pProperties->pszwName)
289 wcscpy(pProperties->pszwName, m_Props.pszwName);
290 }
291 }
293 }
294 CoTaskMemFree(pStr);
295 }
296
297 /* Enable 'Rename' and 'Delete' for Adminstrators only */
298 if (IsUserAdmin())
299 {
300 pProperties->dwCharacter |= NCCF_ALLOW_RENAME;
301
302 /* Virtual network interfaces can be deleted */
303 if (IfEntry.dwType == IF_TYPE_TUNNEL)
304 {
305 pProperties->dwCharacter |= NCCF_ALLOW_REMOVAL;
306 }
307 }
308 else
309 {
311 }
312
313 return S_OK;
314}
315
317WINAPI
319{
321 {
322 CopyMemory(pclsid, &CLSID_LanConnectionUi, sizeof(CLSID));
323 return S_OK;
324 }
325
326 return E_NOTIMPL;
327}
328
330WINAPI
332{
333 WCHAR szName[140];
334 LPOLESTR pStr;
336 HKEY hKey;
337 HRESULT hr;
338
339 if (pszwDuplicateName == NULL || wcslen(pszwDuplicateName) == 0)
340 return S_OK;
341
342 if (m_Props.pszwName)
343 {
346 }
347
348 dwSize = (wcslen(pszwDuplicateName) + 1) * sizeof(WCHAR);
349 m_Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
350 if (m_Props.pszwName == NULL)
351 return E_OUTOFMEMORY;
352
353 wcscpy(m_Props.pszwName, pszwDuplicateName);
354
356 if (SUCCEEDED(hr))
357 {
358 wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
359 wcscat(szName, pStr);
360 wcscat(szName, L"\\Connection");
361
363 {
366 }
367
368 CoTaskMemFree(pStr);
369 }
370
371 return hr;
372}
373
375{
376 return ShellObjectCreatorInit<CNetConnection>(pItem, riid, ppv);
377}
378
379
380
382 m_pHead(NULL),
383 m_pCurrent(NULL)
384{
385}
386
388WINAPI
391 IEnumNetConnection **ppEnum)
392{
393 TRACE("EnumConnections\n");
394
395 if (!ppEnum)
396 return E_POINTER;
397
398 if (Flags != NCME_DEFAULT)
399 return E_FAIL;
400
401 *ppEnum = static_cast<IEnumNetConnection*>(this);
402 AddRef();
403 return S_OK;
404}
405
406/***************************************************************
407 * IEnumNetConnection Interface
408 */
409
411WINAPI
413 ULONG celt,
414 INetConnection **rgelt,
415 ULONG *pceltFetched)
416{
417 HRESULT hr;
418
419 if (!pceltFetched || !rgelt)
420 return E_POINTER;
421
422 if (celt != 1)
423 return E_FAIL;
424
425 if (!m_pCurrent)
426 return S_FALSE;
427
430
431 return hr;
432}
433
435WINAPI
437{
438 while (m_pCurrent && celt-- > 0)
440
441 if (celt)
442 return S_FALSE;
443 else
444 return S_OK;
445
446}
447
449WINAPI
451{
453 return S_OK;
454}
455
457WINAPI
458CNetConnectionManager::Clone(IEnumNetConnection **ppenum)
459{
460 return E_NOTIMPL;
461}
462
463BOOL
465{
466 WCHAR szBuffer[50];
467 IP_ADAPTER_INFO * pCurrentAdapter;
468
469 pCurrentAdapter = pAdapterInfo;
470 while (pCurrentAdapter)
471 {
472 szBuffer[0] = L'\0';
473 if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
474 {
475 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
476 }
477 if (!_wcsicmp(szBuffer, szNetCfg))
478 {
479 *pIndex = pCurrentAdapter->Index;
480 return TRUE;
481 }
482 pCurrentAdapter = pCurrentAdapter->Next;
483 }
484 return FALSE;
485}
486
487VOID
489 MIB_IFROW *IfEntry,
490 NETCON_PROPERTIES * Props)
491{
492 switch (IfEntry->dwOperStatus)
493 {
496 break;
498 Props->Status = NCS_DISCONNECTED;
499 break;
502 break;
504 Props->Status = NCS_CONNECTING;
505 break;
507 Props->Status = NCS_CONNECTED;
508 break;
510 Props->Status = NCS_CONNECTED;
511 break;
512 default:
513 break;
514 }
515}
516
519{
520 DWORD dwSize, dwResult, dwIndex, dwAdapterIndex, dwShowIcon, dwNotifyDisconnect;
521 MIB_IFTABLE *pIfTable;
522 MIB_IFROW IfEntry;
523 IP_ADAPTER_INFO * pAdapterInfo;
524 HDEVINFO hInfo;
525 SP_DEVINFO_DATA DevInfo;
526 HKEY hSubKey;
527 WCHAR szNetCfg[50];
528 WCHAR szAdapterNetCfg[50];
529 WCHAR szDetail[200] = L"SYSTEM\\CurrentControlSet\\Control\\Class\\";
530 WCHAR szName[130] = L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
531 PINetConnectionItem pCurrent = NULL;
532
533 /* get the IfTable */
534 dwSize = 0;
536 return E_FAIL;
537
538 pIfTable = static_cast<PMIB_IFTABLE>(CoTaskMemAlloc(dwSize));
539 if (!pIfTable)
540 return E_OUTOFMEMORY;
541
542 dwResult = GetIfTable(pIfTable, &dwSize, TRUE);
543 if (dwResult != NO_ERROR)
544 {
545 CoTaskMemFree(pIfTable);
546 return HRESULT_FROM_WIN32(dwResult);
547 }
548
549 dwSize = 0;
550 dwResult = GetAdaptersInfo(NULL, &dwSize);
551 if (dwResult!= ERROR_BUFFER_OVERFLOW)
552 {
553 CoTaskMemFree(pIfTable);
554 return HRESULT_FROM_WIN32(dwResult);
555 }
556
557 pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
558 if (!pAdapterInfo)
559 {
560 CoTaskMemFree(pIfTable);
561 return E_OUTOFMEMORY;
562 }
563
564 dwResult = GetAdaptersInfo(pAdapterInfo, &dwSize);
565 if (dwResult != NO_ERROR)
566 {
567 CoTaskMemFree(pIfTable);
568 CoTaskMemFree(pAdapterInfo);
569 return HRESULT_FROM_WIN32(dwResult);
570 }
571
572 hInfo = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, NULL, NULL, DIGCF_PRESENT );
573 if (!hInfo)
574 {
575 CoTaskMemFree(pIfTable);
576 CoTaskMemFree(pAdapterInfo);
577 return E_FAIL;
578 }
579
580 dwIndex = 0;
581 do
582 {
583 ZeroMemory(&DevInfo, sizeof(SP_DEVINFO_DATA));
584 DevInfo.cbSize = sizeof(DevInfo);
585
586 /* get device info */
587 if (!SetupDiEnumDeviceInfo(hInfo, dwIndex++, &DevInfo))
588 break;
589
590 /* get device software registry path */
591 if (!SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DRIVER, NULL, (LPBYTE)&szDetail[39], sizeof(szDetail)/sizeof(WCHAR) - 40, &dwSize))
592 break;
593
594 /* open device registry key */
595 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szDetail, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
596 break;
597
598 /* query NetCfgInstanceId for current device */
599 dwSize = sizeof(szNetCfg);
600 if (RegQueryValueExW(hSubKey, L"NetCfgInstanceId", NULL, NULL, (LPBYTE)szNetCfg, &dwSize) != ERROR_SUCCESS)
601 {
602 RegCloseKey(hSubKey);
603 break;
604 }
605 RegCloseKey(hSubKey);
606
607 /* get the current adapter index from NetCfgInstanceId */
608 if (!GetAdapterIndexFromNetCfgInstanceId(pAdapterInfo, szNetCfg, &dwAdapterIndex))
609 continue;
610
611 /* get detailed adapter info */
612 ZeroMemory(&IfEntry, sizeof(IfEntry));
613 IfEntry.dwIndex = dwAdapterIndex;
614 if (GetIfEntry(&IfEntry) != NO_ERROR)
615 break;
616
617 /* allocate new INetConnectionItem */
619 if (!pNew)
620 break;
621
622 ZeroMemory(pNew, sizeof(INetConnectionItem));
623 pNew->dwAdapterIndex = dwAdapterIndex;
624 /* store NetCfgInstanceId */
625 CLSIDFromString(szNetCfg, &pNew->Props.guidId);
626 NormalizeOperStatus(&IfEntry, &pNew->Props);
627
628 switch (IfEntry.dwType)
629 {
631 pNew->Props.MediaType = NCM_LAN;
632 break;
635 break;
636 default:
637 break;
638 }
639 /* open network connections details */
640 wcscpy(&szName[80], szNetCfg);
641 wcscpy(&szName[118], L"\\Connection");
642
644 {
645 /* retrieve name of connection */
646 dwSize = sizeof(szAdapterNetCfg);
647 if (RegQueryValueExW(hSubKey, L"Name", NULL, NULL, (LPBYTE)szAdapterNetCfg, &dwSize) == ERROR_SUCCESS)
648 {
649 pNew->Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(szAdapterNetCfg)+1) * sizeof(WCHAR)));
650 if (pNew->Props.pszwName)
651 wcscpy(pNew->Props.pszwName, szAdapterNetCfg);
652 }
653 dwSize = sizeof(dwShowIcon);
654 if (RegQueryValueExW(hSubKey, L"ShowIcon", NULL, NULL, (LPBYTE)&dwShowIcon, &dwSize) == ERROR_SUCCESS)
655 {
656 if (dwShowIcon)
658 }
659 dwSize = sizeof(dwNotifyDisconnect);
660 if (RegQueryValueExW(hSubKey, L"IpCheckingEnabled", NULL, NULL, (LPBYTE)&dwNotifyDisconnect, &dwSize) == ERROR_SUCCESS)
661 {
662 if (dwNotifyDisconnect)
664 }
665 RegCloseKey(hSubKey);
666 }
667
668 /* Get the adapter device description */
669 dwSize = 0;
671 if (dwSize != 0)
672 {
673 pNew->Props.pszwDeviceName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
674 if (pNew->Props.pszwDeviceName)
676 }
677
678 if (pCurrent)
679 pCurrent->Next = pNew;
680 else
681 m_pHead = pNew;
682
683 pCurrent = pNew;
684 } while (TRUE);
685
686 CoTaskMemFree(pIfTable);
687 CoTaskMemFree(pAdapterInfo);
689
691 return (m_pHead != NULL ? S_OK : S_FALSE);
692}
693
695{
698 {
699 /* If something went wrong during the enumeration print an error don't enumerate anything */
701 return S_FALSE;
702 }
703 return S_OK;
704}
705
707{
708#if USE_CUSTOM_CONMGR
709 return ShellObjectCreatorInit<CNetConnectionManager>(riid, ppv);
710#else
712#endif
713}
#define RegCloseKey(hKey)
Definition: registry.h:49
PINetConnectionItem m_pCurrent
STDMETHOD() Clone(IEnumNetConnection **ppenum) override
HRESULT EnumerateINetConnections()
STDMETHOD() Reset() override
STDMETHOD() Skip(ULONG celt) override
STDMETHOD() Next(ULONG celt, INetConnection **rgelt, ULONG *pceltFetched) override
STDMETHOD() EnumConnections(NETCONMGR_ENUM_FLAGS Flags, IEnumNetConnection **ppEnum) override
PINetConnectionItem m_pHead
STDMETHOD() GetUiObjectClassId(CLSID *pclsid) override
STDMETHOD() Rename(LPCWSTR pszwDuplicateName) override
STDMETHOD() Disconnect() override
NETCON_PROPERTIES m_Props
STDMETHOD() Connect() override
STDMETHOD() GetProperties(NETCON_PROPERTIES **ppProps) override
DWORD m_dwAdapterIndex
STDMETHOD() Delete() override
HRESULT WINAPI Initialize(PINetConnectionItem pItem)
STDMETHOD() Duplicate(LPCWSTR pszwDuplicateName, INetConnection **ppCon) override
HRESULT WINAPI CNetConnection_CreateInstance(PINetConnectionItem pItem, REFIID riid, LPVOID *ppv)
BOOL GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetCfg, PDWORD pIndex)
BOOL FindNetworkAdapter(HDEVINFO hInfo, SP_DEVINFO_DATA *pDevInfo, LPWSTR pGuid)
VOID NormalizeOperStatus(MIB_IFROW *IfEntry, NETCON_PROPERTIES *Props)
HRESULT WINAPI CNetConnectionManager_CreateInstance(REFIID riid, LPVOID *ppv)
BOOL GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetCfg, PDWORD pIndex)
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NCCF_NOTIFY_DISCONNECTED
Definition: precomp.h:76
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:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
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:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1787
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4024
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3224
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2292
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2893
#define swprintf
Definition: precomp.h:40
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
@ NCCF_ALLOW_REMOVAL
Definition: netcon.idl:40
@ NCCF_ALLOW_RENAME
Definition: netcon.idl:41
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
#define MIB_IF_OPER_STATUS_DISCONNECTED
Definition: ipifcons.h:248
#define IF_TYPE_IEEE80211
Definition: ipifcons.h:91
#define IF_TYPE_TUNNEL
Definition: ipifcons.h:151
#define MIB_IF_OPER_STATUS_CONNECTED
Definition: ipifcons.h:250
#define MIB_IF_OPER_STATUS_CONNECTING
Definition: ipifcons.h:249
#define MIB_IF_OPER_STATUS_NON_OPERATIONAL
Definition: ipifcons.h:246
#define MIB_IF_OPER_STATUS_UNREACHABLE
Definition: ipifcons.h:247
#define MIB_IF_OPER_STATUS_OPERATIONAL
Definition: ipifcons.h:251
#define IF_TYPE_ETHERNET_CSMACD
Definition: ipifcons.h:26
#define REG_SZ
Definition: layer.c:22
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static LPOLESTR
Definition: stg_prop.c:27
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565
@ NCCF_SHOW_ICON
Definition: netcon.h:20
EXTERN_C const CLSID CLSID_ConnectionManager
Definition: netcon.h:172
@ NCS_CONNECTING
Definition: netcon.h:40
@ NCS_MEDIA_DISCONNECTED
Definition: netcon.h:46
@ NCS_CONNECTED
Definition: netcon.h:41
@ NCS_DISCONNECTED
Definition: netcon.h:39
@ NCS_HARDWARE_DISABLED
Definition: netcon.h:44
@ NCM_LAN
Definition: netcon.h:71
@ NCM_SHAREDACCESSHOST_RAS
Definition: netcon.h:77
NETCONMGR_ENUM_FLAGS
Definition: netcon.h:9
@ NCME_DEFAULT
Definition: netcon.h:10
static BOOL IsUserAdmin(VOID)
Definition: netid.c:163
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
static const WCHAR szName[]
Definition: powrprof.c:45
#define REFIID
Definition: guiddef.h:118
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define SPDRP_DRIVER
Definition: setupapi.h:516
#define SPDRP_DEVICEDESC
Definition: setupapi.h:507
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2617
#define DICS_DISABLE
Definition: setupapi.h:114
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
#define SetupDiGetClassDevs
Definition: setupapi.h:2593
#define DIGCF_PRESENT
Definition: setupapi.h:171
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:55
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:53
INTERNAL_IF_OPER_STATUS dwOperStatus
Definition: ifmib.h:45
DWORD dwType
Definition: ifmib.h:39
DWORD dwIndex
Definition: ifmib.h:38
DI_FUNCTION InstallFunction
Definition: setupapi.h:904
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:916
struct tagINetConnectionItem * Next
Definition: connectmanager.h:4
NETCON_PROPERTIES Props
Definition: connectmanager.h:6
NETCON_STATUS Status
Definition: netcon.h:86
LPWSTR pszwDeviceName
Definition: netcon.h:85
NETCON_MEDIATYPE MediaType
Definition: netcon.h:87
uint16_t * PWSTR
Definition: typedefs.h:56
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CopyMemory
Definition: winbase.h:1710
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define NOERROR
Definition: winerror.h:2354
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185