On 29.11.2016 9:58, Alistair Leslie-Hughes wrote:
From: Michael Müller michael@fds-team.de
v2: Corrected error return values.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/hnetcfg/apps.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c index 2b8d78c..a89e6a7 100644 --- a/dlls/hnetcfg/apps.c +++ b/dlls/hnetcfg/apps.c @@ -38,6 +38,7 @@ typedef struct fw_app { INetFwAuthorizedApplication INetFwAuthorizedApplication_iface; LONG refs;
- BSTR filename;
} fw_app;
static inline fw_app *impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication *iface ) @@ -60,6 +61,7 @@ static ULONG WINAPI fw_app_Release( if (!refs) { TRACE("destroying %p\n", fw_app);
if (fw_app->filename) SysFreeString( fw_app->filename );
There's no need for this check.
HeapFree( GetProcessHeap(), 0, fw_app ); } return refs;
@@ -252,7 +254,18 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName( fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
FIXME("%p, %p\n", This, imageFileName);
- return E_NOTIMPL;
- if (!imageFileName)
return E_POINTER;
- if (!This->filename)
- {
*imageFileName = NULL;
return S_OK;
- }
- *imageFileName = SysAllocString( This->filename );
- return *imageFileName ? S_OK : E_OUTOFMEMORY;
}
You can reduce this to
--- *imageFileName = SysAllocString( This->filename ); return *imageFileName || !This->filename ? S_OK : E_OUTOFMEMORY; ---
static HRESULT WINAPI fw_app_put_ProcessImageFileName( @@ -262,7 +275,12 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName( fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
FIXME("%p, %s\n", This, debugstr_w(imageFileName));
- return S_OK;
- if (!imageFileName || !imageFileName[0])
return E_INVALIDARG;
- This->filename = SysAllocString( imageFileName );
- return This->filename ? S_OK : E_OUTOFMEMORY;
}
What happens if you call put_ProcessImageFileName() repeatedly?