59 WCHAR szDetail[200] =
L"SYSTEM\\CurrentControlSet\\Control\\Class\\";
146 swprintf(
szPath,
L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pDisplayName);
177 swprintf(
szPath,
L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Enum\\%s", pPnp);
214 DWORD dwShowIcon, dwNotifyDisconnect, dwType,
dwSize;
235 *ppProps = pProperties;
249 wcscpy(
szName,
L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
255 dwSize =
sizeof(dwShowIcon);
264 dwSize =
sizeof(dwNotifyDisconnect);
267 if (dwNotifyDisconnect)
270 pProperties->
dwCharacter &= ~NCCF_NOTIFY_DISCONNECTED;
339 if (pszwDuplicateName ==
NULL ||
wcslen(pszwDuplicateName) == 0)
358 wcscpy(
szName,
L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
376 return ShellObjectCreatorInit<CNetConnection>(pItem,
riid,
ppv);
391 IEnumNetConnection **ppEnum)
393 TRACE(
"EnumConnections\n");
401 *ppEnum =
static_cast<IEnumNetConnection*
>(
this);
419 if (!pceltFetched || !rgelt)
469 pCurrentAdapter = pAdapterInfo;
470 while (pCurrentAdapter)
475 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
482 pCurrentAdapter = pCurrentAdapter->
Next;
520 DWORD dwSize, dwResult, dwIndex, dwAdapterIndex, dwShowIcon, dwNotifyDisconnect;
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}\\";
584 DevInfo.
cbSize =
sizeof(DevInfo);
599 dwSize =
sizeof(szNetCfg);
613 IfEntry.
dwIndex = dwAdapterIndex;
646 dwSize =
sizeof(szAdapterNetCfg);
653 dwSize =
sizeof(dwShowIcon);
659 dwSize =
sizeof(dwNotifyDisconnect);
662 if (dwNotifyDisconnect)
679 pCurrent->
Next = pNew;
709 return ShellObjectCreatorInit<CNetConnectionManager>(
riid,
ppv);
#define RegCloseKey(hKey)
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
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 ERROR_INSUFFICIENT_BUFFER
#define NCCF_NOTIFY_DISCONNECTED
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define MultiByteToWideChar
#define FAILED_UNEXPECTEDLY(hr)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
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
#define IF_TYPE_IEEE80211
#define MIB_IF_OPER_STATUS_CONNECTED
#define MIB_IF_OPER_STATUS_CONNECTING
#define MIB_IF_OPER_STATUS_NON_OPERATIONAL
#define MIB_IF_OPER_STATUS_UNREACHABLE
#define MIB_IF_OPER_STATUS_OPERATIONAL
#define IF_TYPE_ETHERNET_CSMACD
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static ULONG WINAPI AddRef(IStream *iface)
_Out_ PULONG _Out_ PULONG pIndex
EXTERN_C const CLSID CLSID_ConnectionManager
@ NCM_SHAREDACCESSHOST_RAS
static BOOL IsUserAdmin(VOID)
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
static const WCHAR szName[]
_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 SetupDiSetClassInstallParams
#define DICS_FLAG_CONFIGSPECIFIC
#define SetupDiGetClassDevs
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define DIF_PROPERTYCHANGE
NETCON_MEDIATYPE MediaType
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
struct _IP_ADAPTER_INFO * Next
INTERNAL_IF_OPER_STATUS dwOperStatus
SP_CLASSINSTALL_HEADER ClassInstallHeader
struct tagINetConnectionItem * Next
NETCON_MEDIATYPE MediaType
DWORD WINAPI GetLastError(void)
#define ERROR_BUFFER_OVERFLOW
#define HRESULT_FROM_WIN32(x)
#define HKEY_LOCAL_MACHINE
_Must_inspect_result_ _In_ ULONG Flags
#define IID_PPV_ARG(Itype, ppType)