mirror of
https://github.com/reactos/reactos.git
synced 2024-07-05 04:06:22 +00:00
[NETSHELL]
Fix artifacts from incomplete C++ conversion: - Add m_ prefix to member variables to avoid shadowing locals - Use initializer lists in constructors - Use destructors instead of putting code in Release - Avoid C-style casts (not exhaustive) svn path=/trunk/; revision=67307
This commit is contained in:
parent
2a8f6b6f83
commit
1b57c10937
|
@ -5,7 +5,7 @@ set_cpp(WITH_RUNTIME)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
# HACK: this should be enabled globally!
|
# HACK: this should be enabled globally!
|
||||||
add_compile_flags_language("-std=c++11" "CXX")
|
add_compile_flags_language("-std=c++11 -Wshadow" "CXX")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||||
|
|
|
@ -16,14 +16,14 @@ class CNetshellClassFactory :
|
||||||
virtual HRESULT WINAPI LockServer(BOOL fLock);
|
virtual HRESULT WINAPI LockServer(BOOL fLock);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LONG ref;
|
LONG m_ref;
|
||||||
CLSID clsid;
|
CLSID m_clsid;
|
||||||
};
|
};
|
||||||
|
|
||||||
CNetshellClassFactory::CNetshellClassFactory(REFCLSID rclsid)
|
CNetshellClassFactory::CNetshellClassFactory(REFCLSID rclsid) :
|
||||||
|
m_ref(0),
|
||||||
|
m_clsid(rclsid)
|
||||||
{
|
{
|
||||||
ref = 0;
|
|
||||||
clsid = rclsid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
|
@ -33,10 +33,10 @@ CNetshellClassFactory::QueryInterface(
|
||||||
LPVOID *ppvObj)
|
LPVOID *ppvObj)
|
||||||
{
|
{
|
||||||
*ppvObj = NULL;
|
*ppvObj = NULL;
|
||||||
if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory))
|
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory))
|
||||||
{
|
{
|
||||||
*ppvObj = (IClassFactory*)this;
|
*ppvObj = static_cast<IClassFactory*>(this);
|
||||||
InterlockedIncrement(&ref);
|
AddRef();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -46,7 +46,7 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetshellClassFactory::AddRef()
|
CNetshellClassFactory::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&ref);
|
ULONG refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -55,13 +55,11 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetshellClassFactory::Release()
|
CNetshellClassFactory::Release()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedDecrement(&ref);
|
ULONG refCount = InterlockedDecrement(&m_ref);
|
||||||
|
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
{
|
|
||||||
CoTaskMemFree(this);
|
CoTaskMemFree(this);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +72,13 @@ CNetshellClassFactory::CreateInstance(
|
||||||
{
|
{
|
||||||
*ppvObject = NULL;
|
*ppvObject = NULL;
|
||||||
|
|
||||||
if (IsEqualCLSID(clsid, CLSID_NetworkConnections))
|
if (IsEqualCLSID(m_clsid, CLSID_NetworkConnections))
|
||||||
return ISF_NetConnect_Constructor(pUnkOuter, riid, ppvObject);
|
return ISF_NetConnect_Constructor(pUnkOuter, riid, ppvObject);
|
||||||
else if (IsEqualCLSID(clsid, CLSID_ConnectionManager))
|
else if (IsEqualCLSID(m_clsid, CLSID_ConnectionManager))
|
||||||
return INetConnectionManager_Constructor(pUnkOuter, riid, ppvObject);
|
return INetConnectionManager_Constructor(pUnkOuter, riid, ppvObject);
|
||||||
else if (IsEqualCLSID(clsid, CLSID_LANConnectUI))
|
else if (IsEqualCLSID(m_clsid, CLSID_LANConnectUI))
|
||||||
return LanConnectUI_Constructor(pUnkOuter, riid, ppvObject);
|
return LanConnectUI_Constructor(pUnkOuter, riid, ppvObject);
|
||||||
else if (IsEqualCLSID(clsid, CLSID_LanConnectStatusUI))
|
else if (IsEqualCLSID(m_clsid, CLSID_LanConnectStatusUI))
|
||||||
return LanConnectStatusUI_Constructor(pUnkOuter, riid, ppvObject);
|
return LanConnectStatusUI_Constructor(pUnkOuter, riid, ppvObject);
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
|
|
@ -30,9 +30,9 @@ class CNetConnectionManager final :
|
||||||
virtual HRESULT WINAPI Clone(IEnumNetConnection **ppenum);
|
virtual HRESULT WINAPI Clone(IEnumNetConnection **ppenum);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LONG ref;
|
LONG m_ref;
|
||||||
PINetConnectionItem pHead;
|
PINetConnectionItem m_pHead;
|
||||||
PINetConnectionItem pCurrent;
|
PINetConnectionItem m_pCurrent;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CNetConnection final :
|
class CNetConnection final :
|
||||||
|
@ -40,6 +40,7 @@ class CNetConnection final :
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CNetConnection(PINetConnectionItem pItem);
|
CNetConnection(PINetConnectionItem pItem);
|
||||||
|
~CNetConnection();
|
||||||
|
|
||||||
// IUnknown
|
// IUnknown
|
||||||
virtual HRESULT WINAPI QueryInterface(REFIID riid, LPVOID *ppvOut);
|
virtual HRESULT WINAPI QueryInterface(REFIID riid, LPVOID *ppvOut);
|
||||||
|
@ -56,18 +57,18 @@ class CNetConnection final :
|
||||||
HRESULT WINAPI Rename(LPCWSTR pszwDuplicateName);
|
HRESULT WINAPI Rename(LPCWSTR pszwDuplicateName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LONG ref;
|
LONG m_ref;
|
||||||
NETCON_PROPERTIES Props;
|
NETCON_PROPERTIES m_Props;
|
||||||
DWORD dwAdapterIndex;
|
DWORD m_dwAdapterIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
VOID NormalizeOperStatus(MIB_IFROW *IfEntry, NETCON_PROPERTIES * Props);
|
VOID NormalizeOperStatus(MIB_IFROW *IfEntry, NETCON_PROPERTIES * Props);
|
||||||
|
|
||||||
CNetConnectionManager::CNetConnectionManager()
|
CNetConnectionManager::CNetConnectionManager() :
|
||||||
|
m_ref(0),
|
||||||
|
m_pHead(NULL),
|
||||||
|
m_pCurrent(NULL)
|
||||||
{
|
{
|
||||||
ref = 0;
|
|
||||||
pHead = NULL;
|
|
||||||
pCurrent = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
|
@ -81,7 +82,7 @@ CNetConnectionManager::QueryInterface(
|
||||||
if (IsEqualIID(iid, IID_IUnknown) ||
|
if (IsEqualIID(iid, IID_IUnknown) ||
|
||||||
IsEqualIID(iid, IID_INetConnectionManager))
|
IsEqualIID(iid, IID_INetConnectionManager))
|
||||||
{
|
{
|
||||||
*ppvObj = (INetConnectionManager*)this;
|
*ppvObj = static_cast<INetConnectionManager*>(this);
|
||||||
AddRef();
|
AddRef();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +94,7 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionManager::AddRef()
|
CNetConnectionManager::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&ref);
|
ULONG refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +103,7 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionManager::Release()
|
CNetConnectionManager::Release()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedDecrement(&ref);
|
ULONG refCount = InterlockedDecrement(&m_ref);
|
||||||
|
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
delete this;
|
delete this;
|
||||||
|
@ -124,7 +125,7 @@ CNetConnectionManager::EnumConnections(
|
||||||
if (Flags != NCME_DEFAULT)
|
if (Flags != NCME_DEFAULT)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*ppEnum = (IEnumNetConnection*)this;
|
*ppEnum = static_cast<IEnumNetConnection*>(this);
|
||||||
AddRef();
|
AddRef();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -133,27 +134,32 @@ CNetConnectionManager::EnumConnections(
|
||||||
* INetConnection Interface
|
* INetConnection Interface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CNetConnection::CNetConnection(PINetConnectionItem pItem)
|
CNetConnection::CNetConnection(PINetConnectionItem pItem) :
|
||||||
|
m_ref(0),
|
||||||
|
m_Props(pItem->Props),
|
||||||
|
m_dwAdapterIndex(pItem->dwAdapterIndex)
|
||||||
{
|
{
|
||||||
ref = 0;
|
|
||||||
dwAdapterIndex = pItem->dwAdapterIndex;
|
|
||||||
CopyMemory(&Props, &pItem->Props, sizeof(NETCON_PROPERTIES));
|
|
||||||
|
|
||||||
if (pItem->Props.pszwName)
|
if (pItem->Props.pszwName)
|
||||||
{
|
{
|
||||||
Props.pszwName = (LPWSTR)CoTaskMemAlloc((wcslen(pItem->Props.pszwName)+1)*sizeof(WCHAR));
|
m_Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(pItem->Props.pszwName)+1)*sizeof(WCHAR)));
|
||||||
if (Props.pszwName)
|
if (m_Props.pszwName)
|
||||||
wcscpy(Props.pszwName, pItem->Props.pszwName);
|
wcscpy(m_Props.pszwName, pItem->Props.pszwName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pItem->Props.pszwDeviceName)
|
if (pItem->Props.pszwDeviceName)
|
||||||
{
|
{
|
||||||
Props.pszwDeviceName = (LPWSTR)CoTaskMemAlloc((wcslen(pItem->Props.pszwDeviceName)+1)*sizeof(WCHAR));
|
m_Props.pszwDeviceName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(pItem->Props.pszwDeviceName)+1)*sizeof(WCHAR)));
|
||||||
if (Props.pszwDeviceName)
|
if (m_Props.pszwDeviceName)
|
||||||
wcscpy(Props.pszwDeviceName, pItem->Props.pszwDeviceName);
|
wcscpy(m_Props.pszwDeviceName, pItem->Props.pszwDeviceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CNetConnection::~CNetConnection()
|
||||||
|
{
|
||||||
|
CoTaskMemFree(m_Props.pszwName);
|
||||||
|
CoTaskMemFree(m_Props.pszwDeviceName);
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnection::QueryInterface(
|
CNetConnection::QueryInterface(
|
||||||
|
@ -177,7 +183,7 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnection::AddRef()
|
CNetConnection::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&ref);
|
ULONG refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -186,14 +192,10 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnection::Release()
|
CNetConnection::Release()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedDecrement(&ref);
|
ULONG refCount = InterlockedDecrement(&m_ref);
|
||||||
|
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
{
|
|
||||||
CoTaskMemFree(Props.pszwName);
|
|
||||||
CoTaskMemFree(Props.pszwDeviceName);
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -243,32 +245,32 @@ CNetConnection::GetProperties(NETCON_PROPERTIES **ppProps)
|
||||||
if (!ppProps)
|
if (!ppProps)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
pProperties = (NETCON_PROPERTIES*)CoTaskMemAlloc(sizeof(NETCON_PROPERTIES));
|
pProperties = static_cast<NETCON_PROPERTIES*>(CoTaskMemAlloc(sizeof(NETCON_PROPERTIES)));
|
||||||
if (!pProperties)
|
if (!pProperties)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
CopyMemory(pProperties, &Props, sizeof(NETCON_PROPERTIES));
|
CopyMemory(pProperties, &m_Props, sizeof(NETCON_PROPERTIES));
|
||||||
pProperties->pszwName = NULL;
|
pProperties->pszwName = NULL;
|
||||||
|
|
||||||
if (Props.pszwDeviceName)
|
if (m_Props.pszwDeviceName)
|
||||||
{
|
{
|
||||||
pProperties->pszwDeviceName = (LPWSTR)CoTaskMemAlloc((wcslen(Props.pszwDeviceName)+1)*sizeof(WCHAR));
|
pProperties->pszwDeviceName = static_cast<LPWSTR>(CoTaskMemAlloc((wcslen(m_Props.pszwDeviceName)+1)*sizeof(WCHAR)));
|
||||||
if (pProperties->pszwDeviceName)
|
if (pProperties->pszwDeviceName)
|
||||||
wcscpy(pProperties->pszwDeviceName, Props.pszwDeviceName);
|
wcscpy(pProperties->pszwDeviceName, m_Props.pszwDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppProps = pProperties;
|
*ppProps = pProperties;
|
||||||
|
|
||||||
/* get updated adapter characteristics */
|
/* get updated adapter characteristics */
|
||||||
ZeroMemory(&IfEntry, sizeof(IfEntry));
|
ZeroMemory(&IfEntry, sizeof(IfEntry));
|
||||||
IfEntry.dwIndex = dwAdapterIndex;
|
IfEntry.dwIndex = m_dwAdapterIndex;
|
||||||
if(GetIfEntry(&IfEntry) != NO_ERROR)
|
if (GetIfEntry(&IfEntry) != NO_ERROR)
|
||||||
return NOERROR;
|
return NOERROR;
|
||||||
|
|
||||||
NormalizeOperStatus(&IfEntry, pProperties);
|
NormalizeOperStatus(&IfEntry, pProperties);
|
||||||
|
|
||||||
|
|
||||||
hr = StringFromCLSID((CLSID)Props.guidId, &pStr);
|
hr = StringFromCLSID((CLSID)m_Props.guidId, &pStr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
|
wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
|
||||||
|
@ -290,18 +292,18 @@ CNetConnection::GetProperties(NETCON_PROPERTIES **ppProps)
|
||||||
{
|
{
|
||||||
/* use updated name */
|
/* use updated name */
|
||||||
dwSize = wcslen(szName) + 1;
|
dwSize = wcslen(szName) + 1;
|
||||||
pProperties->pszwName = (LPWSTR)CoTaskMemAlloc(dwSize * sizeof(WCHAR));
|
pProperties->pszwName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize * sizeof(WCHAR)));
|
||||||
if (pProperties->pszwName)
|
if (pProperties->pszwName)
|
||||||
CopyMemory(pProperties->pszwName, szName, dwSize * sizeof(WCHAR));
|
CopyMemory(pProperties->pszwName, szName, dwSize * sizeof(WCHAR));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* use cached name */
|
/* use cached name */
|
||||||
if (Props.pszwName)
|
if (m_Props.pszwName)
|
||||||
{
|
{
|
||||||
pProperties->pszwName = (LPWSTR)CoTaskMemAlloc((wcslen(Props.pszwName)+1)*sizeof(WCHAR));
|
pProperties->pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(m_Props.pszwName)+1)*sizeof(WCHAR)));
|
||||||
if (pProperties->pszwName)
|
if (pProperties->pszwName)
|
||||||
wcscpy(pProperties->pszwName, Props.pszwName);
|
wcscpy(pProperties->pszwName, m_Props.pszwName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
@ -316,7 +318,7 @@ HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnection::GetUiObjectClassId(CLSID *pclsid)
|
CNetConnection::GetUiObjectClassId(CLSID *pclsid)
|
||||||
{
|
{
|
||||||
if (Props.MediaType == NCM_LAN)
|
if (m_Props.MediaType == NCM_LAN)
|
||||||
{
|
{
|
||||||
CopyMemory(pclsid, &CLSID_LANConnectUI, sizeof(CLSID));
|
CopyMemory(pclsid, &CLSID_LANConnectUI, sizeof(CLSID));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -338,20 +340,20 @@ CNetConnection::Rename(LPCWSTR pszwDuplicateName)
|
||||||
if (pszwDuplicateName == NULL || wcslen(pszwDuplicateName) == 0)
|
if (pszwDuplicateName == NULL || wcslen(pszwDuplicateName) == 0)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
if (Props.pszwName)
|
if (m_Props.pszwName)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(Props.pszwName);
|
CoTaskMemFree(m_Props.pszwName);
|
||||||
Props.pszwName = NULL;
|
m_Props.pszwName = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwSize = (wcslen(pszwDuplicateName) + 1) * sizeof(WCHAR);
|
dwSize = (wcslen(pszwDuplicateName) + 1) * sizeof(WCHAR);
|
||||||
Props.pszwName = (LPWSTR)CoTaskMemAlloc(dwSize);
|
m_Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
|
||||||
if (Props.pszwName == NULL)
|
if (m_Props.pszwName == NULL)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
wcscpy(Props.pszwName, pszwDuplicateName);
|
wcscpy(m_Props.pszwName, pszwDuplicateName);
|
||||||
|
|
||||||
hr = StringFromCLSID((CLSID)Props.guidId, &pStr);
|
hr = StringFromCLSID((CLSID)m_Props.guidId, &pStr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
|
wcscpy(szName, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\");
|
||||||
|
@ -360,7 +362,7 @@ CNetConnection::Rename(LPCWSTR pszwDuplicateName)
|
||||||
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szName, 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szName, 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
RegSetValueExW(hKey, L"Name", NULL, REG_SZ, (LPBYTE)Props.pszwName, dwSize);
|
RegSetValueExW(hKey, L"Name", NULL, REG_SZ, (LPBYTE)m_Props.pszwName, dwSize);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +382,7 @@ HRESULT WINAPI IConnection_Constructor(INetConnection **ppv, PINetConnectionItem
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
pConnection->AddRef();
|
pConnection->AddRef();
|
||||||
*ppv = (INetConnection *)pConnection;
|
*ppv = pConnection;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -405,11 +407,11 @@ CNetConnectionManager::Next(
|
||||||
if (celt != 1)
|
if (celt != 1)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (!pCurrent)
|
if (!m_pCurrent)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
hr = IConnection_Constructor(rgelt, pCurrent);
|
hr = IConnection_Constructor(rgelt, m_pCurrent);
|
||||||
pCurrent = pCurrent->Next;
|
m_pCurrent = m_pCurrent->Next;
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -418,8 +420,8 @@ HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionManager::Skip(ULONG celt)
|
CNetConnectionManager::Skip(ULONG celt)
|
||||||
{
|
{
|
||||||
while(pCurrent && celt-- > 0)
|
while (m_pCurrent && celt-- > 0)
|
||||||
pCurrent = pCurrent->Next;
|
m_pCurrent = m_pCurrent->Next;
|
||||||
|
|
||||||
if (celt)
|
if (celt)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
@ -432,7 +434,7 @@ HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionManager::Reset()
|
CNetConnectionManager::Reset()
|
||||||
{
|
{
|
||||||
pCurrent = pHead;
|
m_pCurrent = m_pHead;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +452,7 @@ GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetC
|
||||||
IP_ADAPTER_INFO * pCurrentAdapter;
|
IP_ADAPTER_INFO * pCurrentAdapter;
|
||||||
|
|
||||||
pCurrentAdapter = pAdapterInfo;
|
pCurrentAdapter = pAdapterInfo;
|
||||||
while(pCurrentAdapter)
|
while (pCurrentAdapter)
|
||||||
{
|
{
|
||||||
szBuffer[0] = L'\0';
|
szBuffer[0] = L'\0';
|
||||||
if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
|
if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
|
||||||
|
@ -472,7 +474,7 @@ NormalizeOperStatus(
|
||||||
MIB_IFROW *IfEntry,
|
MIB_IFROW *IfEntry,
|
||||||
NETCON_PROPERTIES * Props)
|
NETCON_PROPERTIES * Props)
|
||||||
{
|
{
|
||||||
switch(IfEntry->dwOperStatus)
|
switch (IfEntry->dwOperStatus)
|
||||||
{
|
{
|
||||||
case MIB_IF_OPER_STATUS_NON_OPERATIONAL:
|
case MIB_IF_OPER_STATUS_NON_OPERATIONAL:
|
||||||
Props->Status = NCS_HARDWARE_DISABLED;
|
Props->Status = NCS_HARDWARE_DISABLED;
|
||||||
|
@ -518,7 +520,7 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
if (GetIfTable(NULL, &dwSize, TRUE) != ERROR_INSUFFICIENT_BUFFER)
|
if (GetIfTable(NULL, &dwSize, TRUE) != ERROR_INSUFFICIENT_BUFFER)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pIfTable = (PMIB_IFTABLE)CoTaskMemAlloc(dwSize);
|
pIfTable = static_cast<PMIB_IFTABLE>(CoTaskMemAlloc(dwSize));
|
||||||
if (!pIfTable)
|
if (!pIfTable)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -537,7 +539,7 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pAdapterInfo = (PIP_ADAPTER_INFO)CoTaskMemAlloc(dwSize);
|
pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
|
||||||
if (!pAdapterInfo)
|
if (!pAdapterInfo)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(pIfTable);
|
CoTaskMemFree(pIfTable);
|
||||||
|
@ -593,11 +595,11 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
/* get detailed adapter info */
|
/* get detailed adapter info */
|
||||||
ZeroMemory(&IfEntry, sizeof(IfEntry));
|
ZeroMemory(&IfEntry, sizeof(IfEntry));
|
||||||
IfEntry.dwIndex = dwAdapterIndex;
|
IfEntry.dwIndex = dwAdapterIndex;
|
||||||
if(GetIfEntry(&IfEntry) != NO_ERROR)
|
if (GetIfEntry(&IfEntry) != NO_ERROR)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* allocate new INetConnectionItem */
|
/* allocate new INetConnectionItem */
|
||||||
PINetConnectionItem pNew = (PINetConnectionItem)CoTaskMemAlloc(sizeof(INetConnectionItem));
|
PINetConnectionItem pNew = static_cast<PINetConnectionItem>(CoTaskMemAlloc(sizeof(INetConnectionItem)));
|
||||||
if (!pNew)
|
if (!pNew)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -607,7 +609,7 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
CLSIDFromString(szNetCfg, &pNew->Props.guidId);
|
CLSIDFromString(szNetCfg, &pNew->Props.guidId);
|
||||||
NormalizeOperStatus(&IfEntry, &pNew->Props);
|
NormalizeOperStatus(&IfEntry, &pNew->Props);
|
||||||
|
|
||||||
switch(IfEntry.dwType)
|
switch (IfEntry.dwType)
|
||||||
{
|
{
|
||||||
case IF_TYPE_ETHERNET_CSMACD:
|
case IF_TYPE_ETHERNET_CSMACD:
|
||||||
pNew->Props.MediaType = NCM_LAN;
|
pNew->Props.MediaType = NCM_LAN;
|
||||||
|
@ -628,7 +630,7 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
dwSize = sizeof(szAdapterNetCfg);
|
dwSize = sizeof(szAdapterNetCfg);
|
||||||
if (RegQueryValueExW(hSubKey, L"Name", NULL, NULL, (LPBYTE)szAdapterNetCfg, &dwSize) == ERROR_SUCCESS)
|
if (RegQueryValueExW(hSubKey, L"Name", NULL, NULL, (LPBYTE)szAdapterNetCfg, &dwSize) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
pNew->Props.pszwName = (LPWSTR)CoTaskMemAlloc((wcslen(szAdapterNetCfg)+1) * sizeof(WCHAR));
|
pNew->Props.pszwName = static_cast<PWSTR>(CoTaskMemAlloc((wcslen(szAdapterNetCfg)+1) * sizeof(WCHAR)));
|
||||||
if (pNew->Props.pszwName)
|
if (pNew->Props.pszwName)
|
||||||
wcscpy(pNew->Props.pszwName, szAdapterNetCfg);
|
wcscpy(pNew->Props.pszwName, szAdapterNetCfg);
|
||||||
}
|
}
|
||||||
|
@ -646,7 +648,7 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, NULL, 0, &dwSize);
|
SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, NULL, 0, &dwSize);
|
||||||
if (dwSize != 0)
|
if (dwSize != 0)
|
||||||
{
|
{
|
||||||
pNew->Props.pszwDeviceName = (LPWSTR)CoTaskMemAlloc(dwSize);
|
pNew->Props.pszwDeviceName = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
|
||||||
if (pNew->Props.pszwDeviceName)
|
if (pNew->Props.pszwDeviceName)
|
||||||
SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, (PBYTE)pNew->Props.pszwDeviceName, dwSize, &dwSize);
|
SetupDiGetDeviceRegistryPropertyW(hInfo, &DevInfo, SPDRP_DEVICEDESC, NULL, (PBYTE)pNew->Props.pszwDeviceName, dwSize, &dwSize);
|
||||||
}
|
}
|
||||||
|
@ -654,16 +656,16 @@ CNetConnectionManager::EnumerateINetConnections()
|
||||||
if (pCurrent)
|
if (pCurrent)
|
||||||
pCurrent->Next = pNew;
|
pCurrent->Next = pNew;
|
||||||
else
|
else
|
||||||
pHead = pNew;
|
m_pHead = pNew;
|
||||||
|
|
||||||
pCurrent = pNew;
|
pCurrent = pNew;
|
||||||
}while(TRUE);
|
} while (TRUE);
|
||||||
|
|
||||||
CoTaskMemFree(pIfTable);
|
CoTaskMemFree(pIfTable);
|
||||||
CoTaskMemFree(pAdapterInfo);
|
CoTaskMemFree(pAdapterInfo);
|
||||||
SetupDiDestroyDeviceInfoList(hInfo);
|
SetupDiDestroyDeviceInfoList(hInfo);
|
||||||
|
|
||||||
this->pCurrent = pHead;
|
m_pCurrent = m_pHead;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* AddToEnumList()
|
* AddToEnumList()
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
CEnumIDList::AddToEnumList(LPITEMIDLIST pidl)
|
CEnumIDList::AddToEnumList(LPITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
LPENUMLIST pNew;
|
LPENUMLIST pNew;
|
||||||
|
@ -11,37 +11,50 @@ CEnumIDList::AddToEnumList(LPITEMIDLIST pidl)
|
||||||
if (!pidl)
|
if (!pidl)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST));
|
pNew = static_cast<LPENUMLIST>(SHAlloc(sizeof(ENUMLIST)));
|
||||||
if(pNew)
|
if (pNew)
|
||||||
{
|
{
|
||||||
pNew->pNext = NULL;
|
pNew->pNext = NULL;
|
||||||
pNew->pidl = pidl;
|
pNew->pidl = pidl;
|
||||||
|
|
||||||
if(!mpFirst)
|
if (!m_pFirst)
|
||||||
{
|
{
|
||||||
mpFirst = pNew;
|
m_pFirst = pNew;
|
||||||
mpCurrent = pNew;
|
m_pCurrent = pNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mpLast)
|
if (m_pLast)
|
||||||
{
|
{
|
||||||
/*add the new item to the end of the list */
|
/*add the new item to the end of the list */
|
||||||
mpLast->pNext = pNew;
|
m_pLast->pNext = pNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*update the last item pointer */
|
/*update the last item pointer */
|
||||||
mpLast = pNew;
|
m_pLast = pNew;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEnumIDList::CEnumIDList()
|
CEnumIDList::CEnumIDList() :
|
||||||
|
m_ref(0),
|
||||||
|
m_pFirst(NULL),
|
||||||
|
m_pLast(NULL),
|
||||||
|
m_pCurrent(NULL)
|
||||||
{
|
{
|
||||||
ref = 0;
|
}
|
||||||
mpCurrent = NULL;
|
|
||||||
mpLast = NULL;
|
CEnumIDList::~CEnumIDList()
|
||||||
mpFirst = NULL;
|
{
|
||||||
|
LPENUMLIST pDelete;
|
||||||
|
|
||||||
|
while (m_pFirst)
|
||||||
|
{
|
||||||
|
pDelete = m_pFirst;
|
||||||
|
m_pFirst = pDelete->pNext;
|
||||||
|
SHFree(pDelete->pidl);
|
||||||
|
SHFree(pDelete);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
|
@ -54,7 +67,7 @@ CEnumIDList::QueryInterface(
|
||||||
|
|
||||||
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IEnumIDList))
|
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IEnumIDList))
|
||||||
{
|
{
|
||||||
*ppvObj = (IEnumIDList*)this;
|
*ppvObj = static_cast<IEnumIDList*>(this);
|
||||||
AddRef();
|
AddRef();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +79,7 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CEnumIDList::AddRef()
|
CEnumIDList::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&ref);
|
ULONG refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -74,20 +87,11 @@ CEnumIDList::AddRef()
|
||||||
ULONG
|
ULONG
|
||||||
WINAPI CEnumIDList::Release()
|
WINAPI CEnumIDList::Release()
|
||||||
{
|
{
|
||||||
LPENUMLIST pDelete;
|
ULONG refCount = InterlockedDecrement(&m_ref);
|
||||||
ULONG refCount = InterlockedDecrement(&ref);
|
|
||||||
|
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
{
|
|
||||||
while (mpFirst)
|
|
||||||
{
|
|
||||||
pDelete = mpFirst;
|
|
||||||
mpFirst = pDelete->pNext;
|
|
||||||
SHFree(pDelete->pidl);
|
|
||||||
SHFree(pDelete);
|
|
||||||
}
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +106,7 @@ CEnumIDList::Next(
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
LPITEMIDLIST temp;
|
LPITEMIDLIST temp;
|
||||||
|
|
||||||
if(pceltFetched)
|
if (pceltFetched)
|
||||||
*pceltFetched = 0;
|
*pceltFetched = 0;
|
||||||
|
|
||||||
*rgelt=0;
|
*rgelt=0;
|
||||||
|
@ -112,19 +116,19 @@ CEnumIDList::Next(
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (celt > 0 && !mpCurrent)
|
if (celt > 0 && !m_pCurrent)
|
||||||
{
|
{
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < celt; i++)
|
for (i = 0; i < celt; i++)
|
||||||
{
|
{
|
||||||
if (!mpCurrent)
|
if (!m_pCurrent)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
temp = ILClone(mpCurrent->pidl);
|
temp = ILClone(m_pCurrent->pidl);
|
||||||
rgelt[i] = temp;
|
rgelt[i] = temp;
|
||||||
mpCurrent = mpCurrent->pNext;
|
m_pCurrent = m_pCurrent->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pceltFetched)
|
if (pceltFetched)
|
||||||
|
@ -142,12 +146,12 @@ CEnumIDList::Skip(ULONG celt)
|
||||||
|
|
||||||
for (dwIndex = 0; dwIndex < celt; dwIndex++)
|
for (dwIndex = 0; dwIndex < celt; dwIndex++)
|
||||||
{
|
{
|
||||||
if (!mpCurrent)
|
if (!m_pCurrent)
|
||||||
{
|
{
|
||||||
hr = S_FALSE;
|
hr = S_FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mpCurrent = mpCurrent->pNext;
|
m_pCurrent = m_pCurrent->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -157,7 +161,7 @@ HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CEnumIDList::Reset()
|
CEnumIDList::Reset()
|
||||||
{
|
{
|
||||||
mpCurrent = mpFirst;
|
m_pCurrent = m_pFirst;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +177,7 @@ CEnumIDList::Clone(
|
||||||
|
|
||||||
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
|
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
if(pidl && pidl->mkid.cb != 0x00)
|
if (pidl && pidl->mkid.cb != 0x00)
|
||||||
return (LPPIDLDATA) &(pidl->mkid.abID);
|
return (LPPIDLDATA) &(pidl->mkid.abID);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +187,7 @@ LPITEMIDLIST _ILAlloc(BYTE type, unsigned int size)
|
||||||
LPITEMIDLIST pidlOut = NULL;
|
LPITEMIDLIST pidlOut = NULL;
|
||||||
|
|
||||||
pidlOut = (LPITEMIDLIST)SHAlloc(size + 5);
|
pidlOut = (LPITEMIDLIST)SHAlloc(size + 5);
|
||||||
if(pidlOut)
|
if (pidlOut)
|
||||||
{
|
{
|
||||||
LPPIDLDATA pData;
|
LPPIDLDATA pData;
|
||||||
|
|
||||||
|
@ -243,7 +247,7 @@ LPITEMIDLIST ILCreateNetConnectItem(INetConnection * pItem)
|
||||||
|
|
||||||
pidl = _ILAlloc(0x99, sizeof(PIDLDATA));
|
pidl = _ILAlloc(0x99, sizeof(PIDLDATA));
|
||||||
pdata = _ILGetDataPointer(pidl);
|
pdata = _ILGetDataPointer(pidl);
|
||||||
pdata->u.value.pItem = (INetConnection*)pItem;
|
pdata->u.value.pItem = pItem;
|
||||||
|
|
||||||
return pidl;
|
return pidl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,10 @@ class CEnumIDList final :
|
||||||
virtual HRESULT STDMETHODCALLTYPE Clone(IEnumIDList **ppenum);
|
virtual HRESULT STDMETHODCALLTYPE Clone(IEnumIDList **ppenum);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LONG ref;
|
~CEnumIDList();
|
||||||
LPENUMLIST mpFirst;
|
|
||||||
LPENUMLIST mpLast;
|
LONG m_ref;
|
||||||
LPENUMLIST mpCurrent;
|
LPENUMLIST m_pFirst;
|
||||||
|
LPENUMLIST m_pLast;
|
||||||
|
LPENUMLIST m_pCurrent;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,6 +31,7 @@ class CNetConnectionPropertyUi final :
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CNetConnectionPropertyUi();
|
CNetConnectionPropertyUi();
|
||||||
|
~CNetConnectionPropertyUi();
|
||||||
|
|
||||||
// IUnknown
|
// IUnknown
|
||||||
virtual HRESULT WINAPI QueryInterface(REFIID riid, LPVOID *ppvOut);
|
virtual HRESULT WINAPI QueryInterface(REFIID riid, LPVOID *ppvOut);
|
||||||
|
@ -57,20 +58,37 @@ class CNetConnectionPropertyUi final :
|
||||||
BOOL GetDeviceInstanceID(OUT LPOLESTR *DeviceInstanceID);
|
BOOL GetDeviceInstanceID(OUT LPOLESTR *DeviceInstanceID);
|
||||||
static INT_PTR CALLBACK LANPropertiesUIDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static INT_PTR CALLBACK LANPropertiesUIDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
INetConnection * pCon;
|
INetConnection * m_pCon;
|
||||||
INetCfgLock *NCfgLock;
|
INetCfgLock *m_NCfgLock;
|
||||||
INetCfg * pNCfg;
|
INetCfg * m_pNCfg;
|
||||||
NETCON_PROPERTIES * pProperties;
|
NETCON_PROPERTIES * m_pProperties;
|
||||||
LONG ref;
|
LONG m_ref;
|
||||||
};
|
};
|
||||||
|
|
||||||
CNetConnectionPropertyUi::CNetConnectionPropertyUi()
|
CNetConnectionPropertyUi::CNetConnectionPropertyUi() :
|
||||||
|
m_pCon(NULL),
|
||||||
|
m_NCfgLock(NULL),
|
||||||
|
m_pNCfg(NULL),
|
||||||
|
m_pProperties(NULL),
|
||||||
|
m_ref(0)
|
||||||
{
|
{
|
||||||
ref = 0;
|
}
|
||||||
pCon = NULL;
|
|
||||||
pNCfg = NULL;
|
CNetConnectionPropertyUi::~CNetConnectionPropertyUi()
|
||||||
NCfgLock = NULL;
|
{
|
||||||
pProperties = NULL;
|
if (m_pNCfg)
|
||||||
|
{
|
||||||
|
m_pNCfg->Uninitialize();
|
||||||
|
m_pNCfg->Release();
|
||||||
|
}
|
||||||
|
if (m_NCfgLock)
|
||||||
|
{
|
||||||
|
m_NCfgLock->Release();
|
||||||
|
}
|
||||||
|
if (m_pProperties)
|
||||||
|
{
|
||||||
|
NcFreeNetconProperties(m_pProperties);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HPROPSHEETPAGE
|
HPROPSHEETPAGE
|
||||||
|
@ -127,7 +145,7 @@ CNetConnectionPropertyUi::GetINetCfgComponent(INetCfg *pNCfg, INetCfgComponent *
|
||||||
hr = pNCg->GetDisplayName(&pName);
|
hr = pNCg->GetDisplayName(&pName);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
if (!_wcsicmp(pName, pProperties->pszwDeviceName))
|
if (!_wcsicmp(pName, m_pProperties->pszwDeviceName))
|
||||||
{
|
{
|
||||||
*pOut = pNCg;
|
*pOut = pNCg;
|
||||||
pEnumCfg->Release();
|
pEnumCfg->Release();
|
||||||
|
@ -160,7 +178,7 @@ CNetConnectionPropertyUi::EnumComponents(HWND hDlgCtrl, INetCfg *pNCfg, const GU
|
||||||
pNCfg->Release();
|
pNCfg->Release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while(pENetCfg->Next(1, &pNCfgComp, &Num) == S_OK)
|
while (pENetCfg->Next(1, &pNCfgComp, &Num) == S_OK)
|
||||||
{
|
{
|
||||||
hr = pNCfgComp->GetCharacteristics(&dwCharacteristics);
|
hr = pNCfgComp->GetCharacteristics(&dwCharacteristics);
|
||||||
if (SUCCEEDED(hr) && (dwCharacteristics & NCF_HIDDEN))
|
if (SUCCEEDED(hr) && (dwCharacteristics & NCF_HIDDEN))
|
||||||
|
@ -188,7 +206,7 @@ CNetConnectionPropertyUi::EnumComponents(HWND hDlgCtrl, INetCfg *pNCfg, const GU
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pItem = (NET_ITEM*)CoTaskMemAlloc(sizeof(NET_ITEM));
|
pItem = static_cast<NET_ITEM*>(CoTaskMemAlloc(sizeof(NET_ITEM)));
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -217,13 +235,13 @@ CNetConnectionPropertyUi::InitializeLANPropertiesUIDlg(HWND hwndDlg)
|
||||||
LPWSTR pDisplayName;
|
LPWSTR pDisplayName;
|
||||||
LVITEMW li;
|
LVITEMW li;
|
||||||
|
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_NETCARDNAME, WM_SETTEXT, 0, (LPARAM)pProperties->pszwDeviceName);
|
SendDlgItemMessageW(hwndDlg, IDC_NETCARDNAME, WM_SETTEXT, 0, (LPARAM)m_pProperties->pszwDeviceName);
|
||||||
if (pProperties->dwCharacter & NCCF_SHOW_ICON)
|
if (m_pProperties->dwCharacter & NCCF_SHOW_ICON)
|
||||||
{
|
{
|
||||||
/* check show item on taskbar*/
|
/* check show item on taskbar*/
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_SHOWTASKBAR, BM_SETCHECK, BST_CHECKED, 0);
|
SendDlgItemMessageW(hwndDlg, IDC_SHOWTASKBAR, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
}
|
}
|
||||||
if (pProperties->dwCharacter & NCCF_NOTIFY_DISCONNECTED)
|
if (m_pProperties->dwCharacter & NCCF_NOTIFY_DISCONNECTED)
|
||||||
{
|
{
|
||||||
/* check notify item */
|
/* check notify item */
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_NOTIFYNOCONNECTION, BM_SETCHECK, BST_CHECKED, 0);
|
SendDlgItemMessageW(hwndDlg, IDC_NOTIFYNOCONNECTION, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
@ -255,7 +273,7 @@ CNetConnectionPropertyUi::InitializeLANPropertiesUIDlg(HWND hwndDlg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NCfgLock = pNCfgLock;
|
m_NCfgLock = pNCfgLock;
|
||||||
hr = pNCfg->Initialize(NULL);
|
hr = pNCfg->Initialize(NULL);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -266,7 +284,7 @@ CNetConnectionPropertyUi::InitializeLANPropertiesUIDlg(HWND hwndDlg)
|
||||||
EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETCLIENT, NET_TYPE_CLIENT);
|
EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETCLIENT, NET_TYPE_CLIENT);
|
||||||
EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETSERVICE, NET_TYPE_SERVICE);
|
EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETSERVICE, NET_TYPE_SERVICE);
|
||||||
EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETTRANS, NET_TYPE_PROTOCOL);
|
EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETTRANS, NET_TYPE_PROTOCOL);
|
||||||
this->pNCfg = pNCfg;
|
m_pNCfg = pNCfg;
|
||||||
|
|
||||||
ZeroMemory(&li, sizeof(li));
|
ZeroMemory(&li, sizeof(li));
|
||||||
li.mask = LVIF_STATE;
|
li.mask = LVIF_STATE;
|
||||||
|
@ -337,7 +355,7 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg(
|
||||||
LPOLESTR pStr;
|
LPOLESTR pStr;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
page = (PROPSHEETPAGE*)lParam;
|
page = (PROPSHEETPAGE*)lParam;
|
||||||
|
@ -351,9 +369,9 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg(
|
||||||
if (lppsn->hdr.code == PSN_APPLY)
|
if (lppsn->hdr.code == PSN_APPLY)
|
||||||
{
|
{
|
||||||
This = (CNetConnectionPropertyUi*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
This = (CNetConnectionPropertyUi*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||||
if (This->pNCfg)
|
if (This->m_pNCfg)
|
||||||
{
|
{
|
||||||
hr = This->pNCfg->Apply();
|
hr = This->m_pNCfg->Apply();
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return PSNRET_INVALID;
|
return PSNRET_INVALID;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +382,7 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg(
|
||||||
dwShowIcon = 0;
|
dwShowIcon = 0;
|
||||||
|
|
||||||
|
|
||||||
if (StringFromCLSID((CLSID)This->pProperties->guidId, &pStr) == ERROR_SUCCESS)
|
if (StringFromCLSID((CLSID)This->m_pProperties->guidId, &pStr) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
swprintf(szKey, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pStr);
|
swprintf(szKey, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pStr);
|
||||||
CoTaskMemFree(pStr);
|
CoTaskMemFree(pStr);
|
||||||
|
@ -381,9 +399,9 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg(
|
||||||
else if (lppsn->hdr.code == PSN_CANCEL)
|
else if (lppsn->hdr.code == PSN_CANCEL)
|
||||||
{
|
{
|
||||||
This = (CNetConnectionPropertyUi*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
This = (CNetConnectionPropertyUi*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||||
if (This->pNCfg)
|
if (This->m_pNCfg)
|
||||||
{
|
{
|
||||||
hr = This->pNCfg->Cancel();
|
hr = This->m_pNCfg->Cancel();
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
return PSNRET_NOERROR;
|
return PSNRET_NOERROR;
|
||||||
else
|
else
|
||||||
|
@ -465,7 +483,7 @@ CNetConnectionPropertyUi::GetDeviceInstanceID(
|
||||||
WCHAR szKeyName[2*MAX_PATH];
|
WCHAR szKeyName[2*MAX_PATH];
|
||||||
WCHAR szInstanceID[2*MAX_PATH];
|
WCHAR szInstanceID[2*MAX_PATH];
|
||||||
|
|
||||||
if (StringFromCLSID(pProperties->guidId, &pStr) != ERROR_SUCCESS)
|
if (StringFromCLSID(m_pProperties->guidId, &pStr) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// failed to convert guid to string
|
// failed to convert guid to string
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -484,7 +502,7 @@ CNetConnectionPropertyUi::GetDeviceInstanceID(
|
||||||
if (RegGetValueW(hKey, NULL, L"PnpInstanceId", RRF_RT_REG_SZ, NULL, (PVOID)szInstanceID, &dwInstanceID) == ERROR_SUCCESS)
|
if (RegGetValueW(hKey, NULL, L"PnpInstanceId", RRF_RT_REG_SZ, NULL, (PVOID)szInstanceID, &dwInstanceID) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
szInstanceID[MAX_PATH-1] = L'\0';
|
szInstanceID[MAX_PATH-1] = L'\0';
|
||||||
pResult = (LPOLESTR)CoTaskMemAlloc((wcslen(szInstanceID) + 1) * sizeof(WCHAR));
|
pResult = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(szInstanceID) + 1) * sizeof(WCHAR)));
|
||||||
if (pResult != 0)
|
if (pResult != 0)
|
||||||
{
|
{
|
||||||
wcscpy(pResult, szInstanceID);
|
wcscpy(pResult, szInstanceID);
|
||||||
|
@ -537,7 +555,7 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionPropertyUi::AddRef()
|
CNetConnectionPropertyUi::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&ref);
|
ULONG refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -546,25 +564,10 @@ ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionPropertyUi::Release()
|
CNetConnectionPropertyUi::Release()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedDecrement(&ref);
|
ULONG refCount = InterlockedDecrement(&m_ref);
|
||||||
|
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
{
|
|
||||||
if (pNCfg)
|
|
||||||
{
|
|
||||||
pNCfg->Uninitialize();
|
|
||||||
pNCfg->Release();
|
|
||||||
}
|
|
||||||
if (NCfgLock)
|
|
||||||
{
|
|
||||||
NCfgLock->Release();
|
|
||||||
}
|
|
||||||
if (pProperties)
|
|
||||||
{
|
|
||||||
NcFreeNetconProperties(pProperties);
|
|
||||||
}
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -583,14 +586,14 @@ CNetConnectionPropertyUi::AddPages(
|
||||||
|
|
||||||
initEx.dwSize = sizeof(initEx);
|
initEx.dwSize = sizeof(initEx);
|
||||||
initEx.dwICC = ICC_LISTVIEW_CLASSES;
|
initEx.dwICC = ICC_LISTVIEW_CLASSES;
|
||||||
if(!InitCommonControlsEx(&initEx))
|
if (!InitCommonControlsEx(&initEx))
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
hr = pCon->GetProperties(&pProperties);
|
hr = m_pCon->GetProperties(&m_pProperties);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
hProp = InitializePropertySheetPage(MAKEINTRESOURCEW(IDD_NETPROPERTIES), LANPropertiesUIDlg, (LPARAM)this, pProperties->pszwName);
|
hProp = InitializePropertySheetPage(MAKEINTRESOURCEW(IDD_NETPROPERTIES), LANPropertiesUIDlg, (LPARAM)this, m_pProperties->pszwName);
|
||||||
if (hProp)
|
if (hProp)
|
||||||
{
|
{
|
||||||
ret = (*pfnAddPage)(hProp, lParam);
|
ret = (*pfnAddPage)(hProp, lParam);
|
||||||
|
@ -619,7 +622,7 @@ HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionPropertyUi::GetDeviceGuid(GUID *pGuid)
|
CNetConnectionPropertyUi::GetDeviceGuid(GUID *pGuid)
|
||||||
{
|
{
|
||||||
CopyMemory(pGuid, &pProperties->guidId, sizeof(GUID));
|
CopyMemory(pGuid, &m_pProperties->guidId, sizeof(GUID));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,13 +630,13 @@ HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CNetConnectionPropertyUi::SetConnection(INetConnection* pCon)
|
CNetConnectionPropertyUi::SetConnection(INetConnection* pCon)
|
||||||
{
|
{
|
||||||
if (this->pCon)
|
if (m_pCon)
|
||||||
this->pCon->Release();
|
m_pCon->Release();
|
||||||
|
|
||||||
if (!pCon)
|
if (!pCon)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
this->pCon = pCon;
|
m_pCon = pCon;
|
||||||
|
|
||||||
pCon->AddRef();
|
pCon->AddRef();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -645,12 +648,12 @@ CNetConnectionPropertyUi::Connect(
|
||||||
HWND hwndParent,
|
HWND hwndParent,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
if (!pCon)
|
if (!m_pCon)
|
||||||
return E_POINTER; //FIXME
|
return E_POINTER; //FIXME
|
||||||
|
|
||||||
|
|
||||||
if (dwFlags & NCUC_NO_UI)
|
if (dwFlags & NCUC_NO_UI)
|
||||||
return pCon->Connect();
|
return m_pCon->Connect();
|
||||||
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ UpdateLanStatus(HWND hwndDlg, LANSTATUSUI_CONTEXT * pContext)
|
||||||
|
|
||||||
ZeroMemory(&IfEntry, sizeof(IfEntry));
|
ZeroMemory(&IfEntry, sizeof(IfEntry));
|
||||||
IfEntry.dwIndex = pContext->dwAdapterIndex;
|
IfEntry.dwIndex = pContext->dwAdapterIndex;
|
||||||
if(GetIfEntry(&IfEntry) != NO_ERROR)
|
if (GetIfEntry(&IfEntry) != NO_ERROR)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ AddIPAddressToListView(
|
||||||
}
|
}
|
||||||
SubIndex++;
|
SubIndex++;
|
||||||
pCur = pCur->Next;
|
pCur = pCur->Next;
|
||||||
}while(pCur && pCur->IpAddress.String[0]);
|
} while (pCur && pCur->IpAddress.String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -423,7 +423,7 @@ LANStatusUiDetailsDlg(
|
||||||
HWND hDlgCtrl;
|
HWND hDlgCtrl;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
pContext = (LANSTATUSUI_CONTEXT*)lParam;
|
pContext = (LANSTATUSUI_CONTEXT*)lParam;
|
||||||
|
@ -444,16 +444,16 @@ LANStatusUiDetailsDlg(
|
||||||
pAdapterInfo = NULL;
|
pAdapterInfo = NULL;
|
||||||
if (GetAdaptersInfo(NULL, &dwSize) == ERROR_BUFFER_OVERFLOW)
|
if (GetAdaptersInfo(NULL, &dwSize) == ERROR_BUFFER_OVERFLOW)
|
||||||
{
|
{
|
||||||
pAdapterInfo = (PIP_ADAPTER_INFO)CoTaskMemAlloc(dwSize);
|
pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
|
||||||
if (pAdapterInfo)
|
if (pAdapterInfo)
|
||||||
{
|
{
|
||||||
if (GetAdaptersInfo(pAdapterInfo, &dwSize) == NO_ERROR)
|
if (GetAdaptersInfo(pAdapterInfo, &dwSize) == NO_ERROR)
|
||||||
{
|
{
|
||||||
pCurAdapter = pAdapterInfo;
|
pCurAdapter = pAdapterInfo;
|
||||||
while(pCurAdapter && pCurAdapter->Index != pContext->dwAdapterIndex)
|
while (pCurAdapter && pCurAdapter->Index != pContext->dwAdapterIndex)
|
||||||
pCurAdapter = pCurAdapter->Next;
|
pCurAdapter = pCurAdapter->Next;
|
||||||
|
|
||||||
if(pCurAdapter->Index != pContext->dwAdapterIndex)
|
if (pCurAdapter->Index != pContext->dwAdapterIndex)
|
||||||
pCurAdapter = NULL;
|
pCurAdapter = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ LANStatusUiDetailsDlg(
|
||||||
dwSize = 0;
|
dwSize = 0;
|
||||||
if (GetPerAdapterInfo(pContext->dwAdapterIndex, NULL, &dwSize) == ERROR_BUFFER_OVERFLOW)
|
if (GetPerAdapterInfo(pContext->dwAdapterIndex, NULL, &dwSize) == ERROR_BUFFER_OVERFLOW)
|
||||||
{
|
{
|
||||||
pPerAdapter = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(dwSize);
|
pPerAdapter = static_cast<PIP_PER_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
|
||||||
if (pPerAdapter)
|
if (pPerAdapter)
|
||||||
{
|
{
|
||||||
if (GetPerAdapterInfo(pContext->dwAdapterIndex, pPerAdapter, &dwSize) == ERROR_SUCCESS)
|
if (GetPerAdapterInfo(pContext->dwAdapterIndex, pPerAdapter, &dwSize) == ERROR_SUCCESS)
|
||||||
|
@ -544,7 +544,7 @@ LANStatusUiAdvancedDlg(
|
||||||
DWORD dwIpAddr;
|
DWORD dwIpAddr;
|
||||||
|
|
||||||
|
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
page = (PROPSHEETPAGE*)lParam;
|
page = (PROPSHEETPAGE*)lParam;
|
||||||
|
@ -633,8 +633,7 @@ FindNetworkAdapter(HDEVINFO hInfo, SP_DEVINFO_DATA *pDevInfo, LPWSTR pGuid)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
} while (TRUE);
|
||||||
while(TRUE);
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +701,7 @@ DisableNetworkAdapter(INetConnection * pNet, LANSTATUSUI_CONTEXT * pContext, HWN
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPnp = (LPWSTR)CoTaskMemAlloc(dwSize);
|
pPnp = static_cast<PWSTR>(CoTaskMemAlloc(dwSize));
|
||||||
if (!pPnp)
|
if (!pPnp)
|
||||||
{
|
{
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
@ -755,7 +754,7 @@ LANStatusUiDlg(
|
||||||
LANSTATUSUI_CONTEXT * pContext;
|
LANSTATUSUI_CONTEXT * pContext;
|
||||||
LPPSHNOTIFY lppsn;
|
LPPSHNOTIFY lppsn;
|
||||||
|
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
page = (PROPSHEETPAGE*)lParam;
|
page = (PROPSHEETPAGE*)lParam;
|
||||||
|
@ -817,7 +816,7 @@ InitializePropertyDialog(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pAdapterInfo = (PIP_ADAPTER_INFO)CoTaskMemAlloc(dwSize);
|
pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
|
||||||
if (!pAdapterInfo)
|
if (!pAdapterInfo)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(pAdapterInfo);
|
CoTaskMemFree(pAdapterInfo);
|
||||||
|
@ -840,7 +839,7 @@ InitializePropertyDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
pCurAdapter = pAdapterInfo;
|
pCurAdapter = pAdapterInfo;
|
||||||
while(pCurAdapter->Index != dwAdapterIndex)
|
while (pCurAdapter->Index != dwAdapterIndex)
|
||||||
pCurAdapter = pCurAdapter->Next;
|
pCurAdapter = pCurAdapter->Next;
|
||||||
|
|
||||||
|
|
||||||
|
@ -912,7 +911,7 @@ LANStatusDlg(
|
||||||
{
|
{
|
||||||
LANSTATUSUI_CONTEXT * pContext;
|
LANSTATUSUI_CONTEXT * pContext;
|
||||||
|
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
pContext = (LANSTATUSUI_CONTEXT *)lParam;
|
pContext = (LANSTATUSUI_CONTEXT *)lParam;
|
||||||
|
@ -969,7 +968,7 @@ CLanStatus::InitializeNetTaskbarNotifications()
|
||||||
if (pHead)
|
if (pHead)
|
||||||
{
|
{
|
||||||
pItem = pHead;
|
pItem = pHead;
|
||||||
while(pItem)
|
while (pItem)
|
||||||
{
|
{
|
||||||
hr = pItem->pNet->GetProperties(&pProps);
|
hr = pItem->pNet->GetProperties(&pProps);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
@ -1018,11 +1017,11 @@ CLanStatus::InitializeNetTaskbarNotifications()
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
TRACE("new connection\n");
|
TRACE("new connection\n");
|
||||||
pItem = (NOTIFICATION_ITEM*)CoTaskMemAlloc(sizeof(NOTIFICATION_ITEM));
|
pItem = static_cast<NOTIFICATION_ITEM*>(CoTaskMemAlloc(sizeof(NOTIFICATION_ITEM)));
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pContext = (LANSTATUSUI_CONTEXT*)CoTaskMemAlloc(sizeof(LANSTATUSUI_CONTEXT));
|
pContext = static_cast<LANSTATUSUI_CONTEXT*>(CoTaskMemAlloc(sizeof(LANSTATUSUI_CONTEXT)));
|
||||||
if (!pContext)
|
if (!pContext)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(pItem);
|
CoTaskMemFree(pItem);
|
||||||
|
@ -1091,7 +1090,7 @@ CLanStatus::InitializeNetTaskbarNotifications()
|
||||||
} else
|
} else
|
||||||
ERR("CreateDialogParamW failed\n");
|
ERR("CreateDialogParamW failed\n");
|
||||||
}
|
}
|
||||||
} while(hr == S_OK);
|
} while (hr == S_OK);
|
||||||
|
|
||||||
lpNetMan = pNetConMan;
|
lpNetMan = pNetConMan;
|
||||||
pEnumCon->Release();
|
pEnumCon->Release();
|
||||||
|
@ -1104,7 +1103,7 @@ CLanStatus::ShowStatusDialogByCLSID(const GUID *pguidCmdGroup)
|
||||||
NOTIFICATION_ITEM *pItem;
|
NOTIFICATION_ITEM *pItem;
|
||||||
|
|
||||||
pItem = pHead;
|
pItem = pHead;
|
||||||
while(pItem)
|
while (pItem)
|
||||||
{
|
{
|
||||||
if (IsEqualGUID(pItem->guidItem, *pguidCmdGroup))
|
if (IsEqualGUID(pItem->guidItem, *pguidCmdGroup))
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ class CNetworkConnections final :
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CNetworkConnections();
|
CNetworkConnections();
|
||||||
|
~CNetworkConnections();
|
||||||
|
|
||||||
/* IUnknown */
|
/* IUnknown */
|
||||||
virtual HRESULT WINAPI QueryInterface(REFIID riid, LPVOID *ppvOut);
|
virtual HRESULT WINAPI QueryInterface(REFIID riid, LPVOID *ppvOut);
|
||||||
|
@ -40,7 +41,7 @@ class CNetworkConnections final :
|
||||||
virtual ULONG WINAPI Release();
|
virtual ULONG WINAPI Release();
|
||||||
|
|
||||||
// IShellFolder
|
// IShellFolder
|
||||||
virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, LPITEMIDLIST *ppidl, DWORD *pdwAttributes);
|
virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
|
||||||
virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
|
virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
|
||||||
virtual HRESULT WINAPI BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
|
virtual HRESULT WINAPI BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
|
||||||
virtual HRESULT WINAPI BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
|
virtual HRESULT WINAPI BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
|
||||||
|
@ -51,7 +52,7 @@ class CNetworkConnections final :
|
||||||
virtual HRESULT WINAPI GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet);
|
virtual HRESULT WINAPI GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet);
|
||||||
virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut);
|
virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut);
|
||||||
|
|
||||||
/* ShellFolder2 */
|
/* IShellFolder2 */
|
||||||
virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
|
virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
|
||||||
virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
|
virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
|
||||||
virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
|
virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
|
||||||
|
@ -69,11 +70,10 @@ class CNetworkConnections final :
|
||||||
virtual HRESULT WINAPI Execute(LPSHELLEXECUTEINFOW pei);
|
virtual HRESULT WINAPI Execute(LPSHELLEXECUTEINFOW pei);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LONG ref;
|
LONG m_ref;
|
||||||
/* both paths are parsible from the desktop */
|
/* both paths are parsible from the desktop */
|
||||||
LPITEMIDLIST pidlRoot; /* absolute pidl */
|
LPITEMIDLIST m_pidlRoot; /* absolute pidl */
|
||||||
LPITEMIDLIST pidl; /* enumerated pidl */
|
IOleCommandTarget *m_lpOleCmd;
|
||||||
IOleCommandTarget * lpOleCmd;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CNetConUiObject final :
|
class CNetConUiObject final :
|
||||||
|
@ -110,10 +110,10 @@ class CNetConUiObject final :
|
||||||
virtual HRESULT STDMETHODCALLTYPE Extract(LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
|
virtual HRESULT STDMETHODCALLTYPE Extract(LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LONG ref;
|
LONG m_ref;
|
||||||
LPCITEMIDLIST apidl;
|
LPCITEMIDLIST m_apidl;
|
||||||
IUnknown *pUnknown;
|
IUnknown *m_pUnknown;
|
||||||
IOleCommandTarget * lpOleCmd;
|
IOleCommandTarget *m_lpOleCmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const shvheader NetConnectSFHeader[] = {
|
static const shvheader NetConnectSFHeader[] = {
|
||||||
|
@ -137,8 +137,15 @@ static const shvheader NetConnectSFHeader[] = {
|
||||||
HRESULT ShowNetConnectionStatus(IOleCommandTarget * lpOleCmd, INetConnection * pNetConnect, HWND hwnd);
|
HRESULT ShowNetConnectionStatus(IOleCommandTarget * lpOleCmd, INetConnection * pNetConnect, HWND hwnd);
|
||||||
|
|
||||||
CNetworkConnections::CNetworkConnections()
|
CNetworkConnections::CNetworkConnections()
|
||||||
|
: m_ref(0),
|
||||||
|
m_pidlRoot(_ILCreateNetConnect()),
|
||||||
|
m_lpOleCmd(NULL)
|
||||||
{
|
{
|
||||||
pidlRoot = _ILCreateNetConnect(); /* my qualified pidl */
|
}
|
||||||
|
|
||||||
|
CNetworkConnections::~CNetworkConnections()
|
||||||
|
{
|
||||||
|
SHFree(m_pidlRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -155,21 +162,21 @@ HRESULT WINAPI CNetworkConnections::QueryInterface(REFIID riid, LPVOID *ppvObj)
|
||||||
IsEqualIID(riid, IID_IShellFolder) ||
|
IsEqualIID(riid, IID_IShellFolder) ||
|
||||||
IsEqualIID(riid, IID_IShellFolder2))
|
IsEqualIID(riid, IID_IShellFolder2))
|
||||||
{
|
{
|
||||||
*ppvObj = (IShellFolder2*)this;
|
*ppvObj = static_cast<IShellFolder2*>(this);
|
||||||
}
|
}
|
||||||
else if (IsEqualIID (riid, IID_IPersistFolder) ||
|
else if (IsEqualIID (riid, IID_IPersistFolder) ||
|
||||||
IsEqualIID (riid, IID_IPersistFolder2))
|
IsEqualIID (riid, IID_IPersistFolder2))
|
||||||
{
|
{
|
||||||
*ppvObj = (IPersistFolder2*)this;
|
*ppvObj = static_cast<IPersistFolder2*>(this);
|
||||||
}
|
}
|
||||||
else if (IsEqualIID(riid, IID_IShellExecuteHookW))
|
else if (IsEqualIID(riid, IID_IShellExecuteHookW))
|
||||||
{
|
{
|
||||||
*ppvObj = (IShellExecuteHookW*)this;
|
*ppvObj = static_cast<IShellExecuteHookW*>(this);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
else if (IsEqualIID(riid, IID_IPersistIDList))
|
else if (IsEqualIID(riid, IID_IPersistIDList))
|
||||||
{
|
{
|
||||||
//*ppvObj = (IPersistIDList*)this;
|
//*ppvObj = static_cast<IPersistIDList*>(this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (*ppvObj)
|
if (*ppvObj)
|
||||||
|
@ -191,20 +198,18 @@ HRESULT WINAPI CNetworkConnections::QueryInterface(REFIID riid, LPVOID *ppvObj)
|
||||||
|
|
||||||
ULONG WINAPI CNetworkConnections::AddRef()
|
ULONG WINAPI CNetworkConnections::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&ref);
|
ULONG refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG WINAPI CNetworkConnections::Release()
|
ULONG WINAPI CNetworkConnections::Release()
|
||||||
{
|
{
|
||||||
ULONG refCount = InterlockedDecrement(&ref);
|
ULONG refCount = InterlockedDecrement(&m_ref);
|
||||||
|
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
{
|
|
||||||
SHFree(pidlRoot);
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +268,7 @@ static BOOL CreateNetConnectEnumList(CEnumIDList *list, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}while(TRUE);
|
} while (TRUE);
|
||||||
|
|
||||||
pEnumCon->Release();
|
pEnumCon->Release();
|
||||||
pNetConMan->Release();
|
pNetConMan->Release();
|
||||||
|
@ -278,7 +283,7 @@ HRESULT WINAPI CNetworkConnections::EnumObjects(
|
||||||
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
|
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
|
||||||
{
|
{
|
||||||
CEnumIDList *pList = new CEnumIDList;
|
CEnumIDList *pList = new CEnumIDList;
|
||||||
*ppEnumIDList = (LPENUMIDLIST)pList;
|
*ppEnumIDList = static_cast<LPENUMIDLIST>(pList);
|
||||||
if (!pList)
|
if (!pList)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -338,7 +343,7 @@ HRESULT WINAPI CNetworkConnections::CreateViewObject(
|
||||||
{
|
{
|
||||||
ZeroMemory(&cvf, sizeof(cvf));
|
ZeroMemory(&cvf, sizeof(cvf));
|
||||||
cvf.cbSize = sizeof(cvf);
|
cvf.cbSize = sizeof(cvf);
|
||||||
cvf.pshf = (IShellFolder*)this;
|
cvf.pshf = static_cast<IShellFolder*>(this);
|
||||||
|
|
||||||
IShellView* pShellView;
|
IShellView* pShellView;
|
||||||
hr = SHCreateShellFolderViewEx(&cvf, &pShellView);
|
hr = SHCreateShellFolderViewEx(&cvf, &pShellView);
|
||||||
|
@ -375,7 +380,7 @@ HRESULT WINAPI CNetworkConnections::GetAttributesOf(
|
||||||
if (*rgfInOut == 0)
|
if (*rgfInOut == 0)
|
||||||
*rgfInOut = ~0;
|
*rgfInOut = ~0;
|
||||||
|
|
||||||
if(cidl == 0)
|
if (cidl == 0)
|
||||||
*rgfInOut = dwNetConnectAttributes;
|
*rgfInOut = dwNetConnectAttributes;
|
||||||
else
|
else
|
||||||
*rgfInOut = dwNetConnectItemAttributes;
|
*rgfInOut = dwNetConnectItemAttributes;
|
||||||
|
@ -423,10 +428,10 @@ HRESULT WINAPI CNetworkConnections::GetUIObjectOf(
|
||||||
|
|
||||||
*ppvOut = NULL;
|
*ppvOut = NULL;
|
||||||
|
|
||||||
if ((IsEqualIID (riid, IID_IContextMenu) || IsEqualIID (riid, IID_IContextMenu2) || IsEqualIID(riid, IID_IContextMenu3) ||
|
if ((IsEqualIID(riid, IID_IContextMenu) || IsEqualIID (riid, IID_IContextMenu2) || IsEqualIID(riid, IID_IContextMenu3) ||
|
||||||
IsEqualIID(riid, IID_IQueryInfo) || IsEqualIID(riid, IID_IExtractIconW)) && cidl >= 1)
|
IsEqualIID(riid, IID_IQueryInfo) || IsEqualIID(riid, IID_IExtractIconW)) && cidl >= 1)
|
||||||
{
|
{
|
||||||
return IContextMenuImpl_Constructor(riid, apidl[0], ppvOut, lpOleCmd);
|
return IContextMenuImpl_Constructor(riid, apidl[0], ppvOut, m_lpOleCmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hr = E_NOINTERFACE;
|
hr = E_NOINTERFACE;
|
||||||
|
@ -449,7 +454,7 @@ HRESULT WINAPI CNetworkConnections::GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD d
|
||||||
if (!strRet)
|
if (!strRet)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
pszName = (WCHAR*)CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR));
|
pszName = static_cast<LPWSTR>(CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR)));
|
||||||
if (!pszName)
|
if (!pszName)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -593,7 +598,7 @@ HRESULT WINAPI CNetworkConnections::GetDetailsOf(
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
|
||||||
switch(iColumn)
|
switch (iColumn)
|
||||||
{
|
{
|
||||||
case COLUMN_TYPE:
|
case COLUMN_TYPE:
|
||||||
if (pProperties->MediaType == NCM_LAN || pProperties->MediaType == NCM_SHAREDACCESSHOST_RAS)
|
if (pProperties->MediaType == NCM_LAN || pProperties->MediaType == NCM_SHAREDACCESSHOST_RAS)
|
||||||
|
@ -663,11 +668,11 @@ HRESULT WINAPI CNetworkConnections::MapColumnToSCID(UINT column, SHCOLUMNID *psc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CNetConUiObject::CNetConUiObject(LPCITEMIDLIST apidl, IOleCommandTarget *lpOleCmd)
|
CNetConUiObject::CNetConUiObject(LPCITEMIDLIST apidl, IOleCommandTarget *lpOleCmd)
|
||||||
|
: m_ref(0),
|
||||||
|
m_apidl(apidl),
|
||||||
|
m_pUnknown(NULL),
|
||||||
|
m_lpOleCmd(lpOleCmd)
|
||||||
{
|
{
|
||||||
this->apidl = apidl;
|
|
||||||
pUnknown = NULL;
|
|
||||||
this->lpOleCmd = lpOleCmd;
|
|
||||||
ref = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -678,17 +683,17 @@ HRESULT WINAPI CNetConUiObject::QueryInterface(REFIID iid, LPVOID *ppvObject)
|
||||||
*ppvObject = NULL;
|
*ppvObject = NULL;
|
||||||
|
|
||||||
if (IsEqualIID(iid, IID_IContextMenu) || IsEqualIID(iid, IID_IContextMenu2) || IsEqualIID(iid, IID_IContextMenu3))
|
if (IsEqualIID(iid, IID_IContextMenu) || IsEqualIID(iid, IID_IContextMenu2) || IsEqualIID(iid, IID_IContextMenu3))
|
||||||
*ppvObject = (IContextMenu3*)this;
|
*ppvObject = static_cast<IContextMenu3*>(this);
|
||||||
else if (IsEqualIID(iid, IID_IObjectWithSite))
|
else if (IsEqualIID(iid, IID_IObjectWithSite))
|
||||||
*ppvObject = (IObjectWithSite*)this;
|
*ppvObject = static_cast<IObjectWithSite*>(this);
|
||||||
else if (IsEqualIID(iid, IID_IQueryInfo))
|
else if (IsEqualIID(iid, IID_IQueryInfo))
|
||||||
*ppvObject = (IQueryInfo*)this;
|
*ppvObject = static_cast<IQueryInfo*>(this);
|
||||||
else if(IsEqualIID(iid, IID_IExtractIconW))
|
else if (IsEqualIID(iid, IID_IExtractIconW))
|
||||||
*ppvObject = (IExtractIconW*)this;
|
*ppvObject = static_cast<IExtractIconW*>(this);
|
||||||
|
|
||||||
if (*ppvObject)
|
if (*ppvObject)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&ref);
|
AddRef();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +710,7 @@ ULONG WINAPI CNetConUiObject::AddRef()
|
||||||
{
|
{
|
||||||
ULONG refCount;
|
ULONG refCount;
|
||||||
|
|
||||||
refCount = InterlockedIncrement(&ref);
|
refCount = InterlockedIncrement(&m_ref);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
@ -717,7 +722,7 @@ ULONG WINAPI CNetConUiObject::Release()
|
||||||
{
|
{
|
||||||
ULONG refCount;
|
ULONG refCount;
|
||||||
|
|
||||||
refCount = InterlockedDecrement(&ref);
|
refCount = InterlockedDecrement(&m_ref);
|
||||||
if (!refCount)
|
if (!refCount)
|
||||||
delete this;
|
delete this;
|
||||||
|
|
||||||
|
@ -782,7 +787,7 @@ HRESULT WINAPI CNetConUiObject::QueryContextMenu(
|
||||||
VALUEStruct * val;
|
VALUEStruct * val;
|
||||||
NETCON_PROPERTIES * pProperties;
|
NETCON_PROPERTIES * pProperties;
|
||||||
|
|
||||||
val = _ILGetValueStruct(apidl);
|
val = _ILGetValueStruct(m_apidl);
|
||||||
if (!val)
|
if (!val)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
@ -903,7 +908,7 @@ ShowNetConnectionProperties(
|
||||||
hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
|
hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
if(PropertySheetW(&pinfo) < 0)
|
if (PropertySheetW(&pinfo) < 0)
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -920,14 +925,14 @@ HRESULT WINAPI CNetConUiObject::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
|
||||||
{
|
{
|
||||||
VALUEStruct * val;
|
VALUEStruct * val;
|
||||||
|
|
||||||
val = _ILGetValueStruct(apidl);
|
val = _ILGetValueStruct(m_apidl);
|
||||||
if (!val)
|
if (!val)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_STATUS) ||
|
if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_STATUS) ||
|
||||||
lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_STATUS-1)) //HACK for Windows XP
|
lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_STATUS-1)) //HACK for Windows XP
|
||||||
{
|
{
|
||||||
return ShowNetConnectionStatus(lpOleCmd, val->pItem, lpcmi->hwnd);
|
return ShowNetConnectionStatus(m_lpOleCmd, val->pItem, lpcmi->hwnd);
|
||||||
}
|
}
|
||||||
else if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_PROPERTIES) ||
|
else if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_PROPERTIES) ||
|
||||||
lpcmi->lpVerb == MAKEINTRESOURCEA(10099)) //HACK for Windows XP
|
lpcmi->lpVerb == MAKEINTRESOURCEA(10099)) //HACK for Windows XP
|
||||||
|
@ -978,13 +983,13 @@ HRESULT WINAPI CNetConUiObject::GetSite(REFIID riid, PVOID *ppvSite)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IUnknown *pUnknown;
|
IUnknown *pUnknown;
|
||||||
|
|
||||||
if (!this->pUnknown)
|
if (!m_pUnknown)
|
||||||
{
|
{
|
||||||
*ppvSite = NULL;
|
*ppvSite = NULL;
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = this->pUnknown->QueryInterface(riid, (LPVOID*)&pUnknown);
|
hr = m_pUnknown->QueryInterface(riid, reinterpret_cast<PVOID*>(&pUnknown));
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
pUnknown->AddRef();
|
pUnknown->AddRef();
|
||||||
|
@ -998,20 +1003,20 @@ HRESULT WINAPI CNetConUiObject::GetSite(REFIID riid, PVOID *ppvSite)
|
||||||
|
|
||||||
HRESULT WINAPI CNetConUiObject::SetSite(IUnknown *pUnkSite)
|
HRESULT WINAPI CNetConUiObject::SetSite(IUnknown *pUnkSite)
|
||||||
{
|
{
|
||||||
if(!pUnkSite)
|
if (!pUnkSite)
|
||||||
{
|
{
|
||||||
if (this->pUnknown)
|
if (m_pUnknown)
|
||||||
{
|
{
|
||||||
this->pUnknown->Release();
|
m_pUnknown->Release();
|
||||||
this->pUnknown = NULL;
|
m_pUnknown = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pUnkSite->AddRef();
|
pUnkSite->AddRef();
|
||||||
if (this->pUnknown)
|
if (m_pUnknown)
|
||||||
this->pUnknown->Release();
|
m_pUnknown->Release();
|
||||||
this->pUnknown = pUnkSite;
|
m_pUnknown = pUnkSite;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -1037,7 +1042,7 @@ HRESULT WINAPI CNetConUiObject::GetIconLocation(
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = _ILGetValueStruct(apidl);
|
val = _ILGetValueStruct(m_apidl);
|
||||||
if (!val)
|
if (!val)
|
||||||
{
|
{
|
||||||
ERR("_ILGetValueStruct failed\n");
|
ERR("_ILGetValueStruct failed\n");
|
||||||
|
@ -1107,8 +1112,8 @@ HRESULT WINAPI CNetworkConnections::GetClassID(CLSID *lpClassId)
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI CNetworkConnections::Initialize(LPCITEMIDLIST pidl)
|
HRESULT WINAPI CNetworkConnections::Initialize(LPCITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
SHFree(pidlRoot);
|
SHFree(m_pidlRoot);
|
||||||
pidlRoot = ILClone(pidl);
|
m_pidlRoot = ILClone(pidl);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1121,7 +1126,7 @@ HRESULT WINAPI CNetworkConnections::GetCurFolder(LPITEMIDLIST *pidl)
|
||||||
if (!pidl)
|
if (!pidl)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
*pidl = ILClone(pidlRoot);
|
*pidl = ILClone(m_pidlRoot);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1144,7 +1149,7 @@ HRESULT WINAPI CNetworkConnections::Execute(LPSHELLEXECUTEINFOW pei)
|
||||||
if (pProperties->Status == NCS_CONNECTED)
|
if (pProperties->Status == NCS_CONNECTED)
|
||||||
{
|
{
|
||||||
NcFreeNetconProperties(pProperties);
|
NcFreeNetconProperties(pProperties);
|
||||||
return ShowNetConnectionStatus(lpOleCmd, val->pItem, pei->hwnd);
|
return ShowNetConnectionStatus(m_lpOleCmd, val->pItem, pei->hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
NcFreeNetconProperties(pProperties);
|
NcFreeNetconProperties(pProperties);
|
||||||
|
|
Loading…
Reference in a new issue