From fd6ffc24592422c0e3d0c3a93ea582bf479a0328 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 9 Sep 2008 10:20:12 +0000 Subject: [PATCH] - Check for NULL before releasing INetCfg and INetCfgLock interface - ONLY destroy property sheet page on success !!! - Fix registration of LANStatusUI LANPropertyUI interfaces - Fix creating LanPropertyUI interface - Release LANPropertyUI interface when finished svn path=/trunk/; revision=36079 --- reactos/dll/win32/netshell/lanconnectui.c | 23 +++++++++++++++---- reactos/dll/win32/netshell/netshell.c | 4 ++-- reactos/dll/win32/netshell/precomp.h | 1 + .../dll/win32/netshell/shfldr_netconnect.c | 9 +++++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/reactos/dll/win32/netshell/lanconnectui.c b/reactos/dll/win32/netshell/lanconnectui.c index 4a390643ac9..314fbcab187 100644 --- a/reactos/dll/win32/netshell/lanconnectui.c +++ b/reactos/dll/win32/netshell/lanconnectui.c @@ -433,9 +433,19 @@ INetConnectionPropertyUi2_fnRelease( if (!refCount) { - INetCfg_Release(This->pNCfg); - INetCfgLock_Release(This->NCfgLock); - NcFreeNetconProperties(This->pProperties); + if (This->pNCfg) + { + INetCfg_Uninitialize(This->pNCfg); + INetCfg_Release(This->pNCfg); + } + if (This->NCfgLock) + { + INetCfgLock_Release(This->NCfgLock); + } + if (This->pProperties) + { + NcFreeNetconProperties(This->pProperties); + } CoTaskMemFree (This); } return refCount; @@ -486,7 +496,7 @@ INetConnectionPropertyUi2_fnAddPages( if (FAILED(hr)) return hr; - hProp = InitializePropertySheetPage(MAKEINTRESOURCEW(IDD_NETPROPERTIES), LANPropertiesUIDlg, (LPARAM)This, This->pProperties->pszwName); + hProp = InitializePropertySheetPage(MAKEINTRESOURCEW(IDD_NETPROPERTIES), LANPropertiesUIDlg, (LPARAM)This, This->pProperties->pszwName); if (hProp) { ret = (*pfnAddPage)(hProp, lParam); @@ -494,7 +504,10 @@ INetConnectionPropertyUi2_fnAddPages( { hr = NOERROR; } - DestroyPropertySheetPage(hProp); + else + { + DestroyPropertySheetPage(hProp); + } } return hr; } diff --git a/reactos/dll/win32/netshell/netshell.c b/reactos/dll/win32/netshell/netshell.c index 9d1b0b39ba1..37ecd0fa201 100644 --- a/reactos/dll/win32/netshell/netshell.c +++ b/reactos/dll/win32/netshell/netshell.c @@ -8,8 +8,8 @@ const GUID CLSID_NetworkConnections = {0x7007ACC7, 0x3202, 0x11D1, {0xAA, 0 const GUID CLSID_LanConnectStatusUI = {0x7007ACCF, 0x3202, 0x11D1, {0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E}}; static const WCHAR szNetConnectClass[] = L"CLSID\\{7007ACC7-3202-11D1-AAD2-00805FC1270E}"; -static const WCHAR szLanConnectUI[] = L"CLSID\\{7007ACC5-3202-11D1-AA-D200805FC1270E}"; -static const WCHAR szLanConnectStatusUI[] = L"CLSID\\{7007ACCF-3202-11D1-AA-D200805FC1270E}"; +static const WCHAR szLanConnectUI[] = L"CLSID\\{7007ACC5-3202-11D1-AAD2-00805FC1270E}"; +static const WCHAR szLanConnectStatusUI[] = L"CLSID\\{7007ACCF-3202-11D1-AAD2-00805FC1270E}"; static const WCHAR szNamespaceKey[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace\\{7007ACC7-3202-11D1-AAD2-00805FC1270E}"; static INTERFACE_TABLE InterfaceTable[] = diff --git a/reactos/dll/win32/netshell/precomp.h b/reactos/dll/win32/netshell/precomp.h index 60c0e65738e..55eddea1480 100644 --- a/reactos/dll/win32/netshell/precomp.h +++ b/reactos/dll/win32/netshell/precomp.h @@ -36,6 +36,7 @@ #include #include #include +#include #include "wine/debug.h" diff --git a/reactos/dll/win32/netshell/shfldr_netconnect.c b/reactos/dll/win32/netshell/shfldr_netconnect.c index 0f4d4263306..2191019c4f5 100644 --- a/reactos/dll/win32/netshell/shfldr_netconnect.c +++ b/reactos/dll/win32/netshell/shfldr_netconnect.c @@ -745,7 +745,7 @@ PropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam) pinfo->u3.phpage[pinfo->nPages++] = hPage; return TRUE; } - return FALSE; + return FALSE; } /************************************************************************** @@ -788,7 +788,7 @@ static HRESULT WINAPI ISF_NetConnect_IContextMenu2_InvokeCommand( if (SUCCEEDED(hr)) { /* FIXME perform version checks */ - hr = CoCreateInstance(&ClassID, NULL, 0, &IID_INetConnectionPropertyUi, (LPVOID)&pNCP); + hr = CoCreateInstance(&ClassID, NULL, CLSCTX_INPROC_SERVER, &IID_INetConnectionPropertyUi, (LPVOID)&pNCP); if (SUCCEEDED(hr)) { hr = INetConnectionPropertyUi_SetConnection(pNCP, val->pItem); @@ -799,8 +799,9 @@ static HRESULT WINAPI ISF_NetConnect_IContextMenu2_InvokeCommand( pinfo.dwSize = sizeof(PROPSHEETHEADERW); pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW; pinfo.u3.phpage = hppages; - pinfo.pszCaption = pProperties->pszwName; + pinfo.hwndParent = lpcmi->hwnd; + pinfo.pszCaption = pProperties->pszwName; hr = INetConnectionPropertyUi_AddPages(pNCP, lpcmi->hwnd, PropSheetExCallback, (LPARAM)&pinfo); if (SUCCEEDED(hr)) { @@ -808,7 +809,9 @@ static HRESULT WINAPI ISF_NetConnect_IContextMenu2_InvokeCommand( hr = E_FAIL; } } + INetConnectionPropertyUi_Release(pNCP); } + } NcFreeNetconProperties(pProperties); return hr;