https://git.reactos.org/?p=reactos.git;a=commitdiff;h=221fc8fd301c79023c96e7...
commit 221fc8fd301c79023c96e7f63e56f8e767804956 Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Fri Jan 19 00:30:10 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Fri Jan 19 00:30:10 2018 +0100
[HNETCFG] Sync with Wine 3.0. CORE-14225 --- dll/win32/hnetcfg/apps.c | 26 +--- dll/win32/hnetcfg/hnetcfg_private.h | 1 + dll/win32/hnetcfg/policy.c | 245 +++++++++++++++++++++++++++++++++++- media/doc/README.WINE | 2 +- 4 files changed, 247 insertions(+), 27 deletions(-)
diff --git a/dll/win32/hnetcfg/apps.c b/dll/win32/hnetcfg/apps.c index dca2622226..51463e0b27 100644 --- a/dll/win32/hnetcfg/apps.c +++ b/dll/win32/hnetcfg/apps.c @@ -25,7 +25,6 @@ typedef struct fw_app { INetFwAuthorizedApplication INetFwAuthorizedApplication_iface; LONG refs; - BSTR filename; } fw_app;
static inline fw_app *impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication *iface ) @@ -48,7 +47,6 @@ static ULONG WINAPI fw_app_Release( if (!refs) { TRACE("destroying %p\n", fw_app); - if (fw_app->filename) SysFreeString( fw_app->filename ); HeapFree( GetProcessHeap(), 0, fw_app ); } return refs; @@ -241,18 +239,7 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName( fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
FIXME("%p, %p\n", This, imageFileName); - - if (!imageFileName) - return E_INVALIDARG; - - if (!This->filename) - { - *imageFileName = NULL; - return S_OK; - } - - *imageFileName = SysAllocString( This->filename ); - return *imageFileName ? S_OK : E_OUTOFMEMORY; + return E_NOTIMPL; }
static HRESULT WINAPI fw_app_put_ProcessImageFileName( @@ -262,15 +249,7 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName( fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
FIXME("%p, %s\n", This, debugstr_w(imageFileName)); - - if (!imageFileName) - { - This->filename = NULL; - return S_OK; - } - - This->filename = SysAllocString( imageFileName ); - return This->filename ? S_OK : E_OUTOFMEMORY; + return S_OK; }
static HRESULT WINAPI fw_app_get_IpVersion( @@ -393,7 +372,6 @@ HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
fa->INetFwAuthorizedApplication_iface.lpVtbl = &fw_app_vtbl; fa->refs = 1; - fa->filename = NULL;
*ppObj = &fa->INetFwAuthorizedApplication_iface;
diff --git a/dll/win32/hnetcfg/hnetcfg_private.h b/dll/win32/hnetcfg/hnetcfg_private.h index 94751a18b6..a901d0d972 100644 --- a/dll/win32/hnetcfg/hnetcfg_private.h +++ b/dll/win32/hnetcfg/hnetcfg_private.h @@ -47,6 +47,7 @@ enum type_id INetFwPolicy_tid, INetFwPolicy2_tid, INetFwProfile_tid, + INetFwRules_tid, last_tid };
diff --git a/dll/win32/hnetcfg/policy.c b/dll/win32/hnetcfg/policy.c index f41800dd3e..a6ea0b10c5 100644 --- a/dll/win32/hnetcfg/policy.c +++ b/dll/win32/hnetcfg/policy.c @@ -32,6 +32,7 @@ static inline fw_policy *impl_from_INetFwPolicy( INetFwPolicy *iface ) typedef struct fw_policy2 { INetFwPolicy2 INetFwPolicy2_iface; + INetFwRules *fw_policy2_rules; LONG refs; } fw_policy2;
@@ -40,6 +41,224 @@ static inline fw_policy2 *impl_from_INetFwPolicy2( INetFwPolicy2 *iface ) return CONTAINING_RECORD(iface, fw_policy2, INetFwPolicy2_iface); }
+typedef struct fw_rules +{ + INetFwRules INetFwRules_iface; + LONG refs; +} fw_rules; + +static inline fw_rules *impl_from_INetFwRules( INetFwRules *iface ) +{ + return CONTAINING_RECORD(iface, fw_rules, INetFwRules_iface); +} + +static HRESULT WINAPI netfw_rules_QueryInterface( + INetFwRules *iface, + REFIID riid, + void **object) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), object ); + + if ( IsEqualGUID( riid, &IID_INetFwRules ) || + IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *object = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + INetFwRules_AddRef( iface ); + return S_OK; +} + +static ULONG WINAPI netfw_rules_AddRef( + INetFwRules *iface ) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + return InterlockedIncrement( &This->refs ); +} + +static ULONG WINAPI netfw_rules_Release( + INetFwRules *iface ) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + LONG refs = InterlockedDecrement( &This->refs ); + if (!refs) + { + TRACE("destroying %p\n", This); + HeapFree( GetProcessHeap(), 0, This ); + } + return refs; +} + +static HRESULT WINAPI netfw_rules_GetTypeInfoCount( + INetFwRules *iface, + UINT *pctinfo ) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + TRACE("%p %p\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI netfw_rules_GetTypeInfo( + INetFwRules *iface, + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo( INetFwRules_tid, ppTInfo ); +} + +static HRESULT WINAPI netfw_rules_GetIDsOfNames( + INetFwRules *iface, + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo( INetFwRules_tid, &typeinfo ); + if (SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId ); + ITypeInfo_Release( typeinfo ); + } + return hr; +} + +static HRESULT WINAPI netfw_rules_Invoke( + INetFwRules *iface, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo( INetFwRules_tid, &typeinfo ); + if (SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke( typeinfo, &This->INetFwRules_iface, dispIdMember, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr ); + ITypeInfo_Release( typeinfo ); + } + return hr; +} + +static HRESULT WINAPI netfw_rules_get_Count( + INetFwRules *iface, + LONG *count) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + FIXME("%p, %p\n", This, count); + + if (count) + *count = 0; + + return S_OK; +} + +static HRESULT WINAPI netfw_rules_Add( + INetFwRules *iface, + INetFwRule *rule) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + FIXME("%p, %p\n", This, rule); + return E_NOTIMPL; +} + +static HRESULT WINAPI netfw_rules_Remove( + INetFwRules *iface, + BSTR name) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + FIXME("%p, %s\n", This, debugstr_w(name)); + return E_NOTIMPL; +} + +static HRESULT WINAPI netfw_rules_Item( + INetFwRules *iface, + BSTR name, + INetFwRule **rule) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + FIXME("%p, %s, %p\n", This, debugstr_w(name), rule); + return E_NOTIMPL; +} + +static HRESULT WINAPI netfw_rules_get__NewEnum( + INetFwRules *iface, + IUnknown **newEnum) +{ + fw_rules *This = impl_from_INetFwRules( iface ); + + FIXME("%p, %p\n", This, newEnum); + return E_NOTIMPL; +} + +static const struct INetFwRulesVtbl fw_rules_vtbl = +{ + netfw_rules_QueryInterface, + netfw_rules_AddRef, + netfw_rules_Release, + netfw_rules_GetTypeInfoCount, + netfw_rules_GetTypeInfo, + netfw_rules_GetIDsOfNames, + netfw_rules_Invoke, + netfw_rules_get_Count, + netfw_rules_Add, + netfw_rules_Remove, + netfw_rules_Item, + netfw_rules_get__NewEnum +}; + +static HRESULT create_INetFwRules(INetFwRules **object) +{ + fw_rules *rules; + + TRACE("(%p)\n", object); + + rules = HeapAlloc( GetProcessHeap(), 0, sizeof(*rules) ); + if (!rules) return E_OUTOFMEMORY; + + rules->INetFwRules_iface.lpVtbl = &fw_rules_vtbl; + rules->refs = 1; + + *object = &rules->INetFwRules_iface; + + TRACE("returning iface %p\n", *object); + return S_OK; +} + static ULONG WINAPI fw_policy_AddRef( INetFwPolicy *iface ) { @@ -222,6 +441,11 @@ static HRESULT WINAPI fwpolicy2_QueryInterface(INetFwPolicy2 *iface, REFIID riid { *out = iface; } + else if( IsEqualGUID( riid, &IID_INetFwRules ) ) + { + TRACE("INetFwRules not supported\n"); + return E_NOINTERFACE; + } else { FIXME("interface %s not implemented\n", debugstr_guid(riid)); @@ -243,6 +467,7 @@ static ULONG WINAPI fwpolicy2_Release(INetFwPolicy2 *iface) LONG refs = InterlockedDecrement( &fw_policy->refs ); if (!refs) { + INetFwRules_Release(fw_policy->fw_policy2_rules); TRACE("destroying %p\n", fw_policy); HeapFree( GetProcessHeap(), 0, fw_policy ); } @@ -395,8 +620,18 @@ static HRESULT WINAPI fwpolicy2_get_Rules(INetFwPolicy2 *iface, INetFwRules **ru { fw_policy2 *This = impl_from_INetFwPolicy2( iface );
- FIXME("%p %p\n", This, rules); - return E_NOTIMPL; + TRACE("%p %p\n", This, rules); + + if(!rules) + return E_POINTER; + + if(rules) + { + *rules = This->fw_policy2_rules; + INetFwRules_AddRef(This->fw_policy2_rules); + } + + return S_OK; }
static HRESULT WINAPI fwpolicy2_get_ServiceRestriction(INetFwPolicy2 *iface, INetFwServiceRestriction **ServiceRestriction) @@ -526,6 +761,12 @@ HRESULT NetFwPolicy2_create( IUnknown *outer, void **obj )
*obj = &fp->INetFwPolicy2_iface;
+ if (FAILED(create_INetFwRules(&fp->fw_policy2_rules))) + { + HeapFree( GetProcessHeap(), 0, fp ); + return E_OUTOFMEMORY; + } + TRACE("returning iface %p\n", *obj); return S_OK; } diff --git a/media/doc/README.WINE b/media/doc/README.WINE index e67bc01b74..7dfd056e88 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -71,7 +71,7 @@ reactos/dll/win32/fusion # Synced to Wine-3.0 reactos/dll/win32/gdiplus # Synced to Wine-3.0 reactos/dll/win32/hhctrl.ocx # Synced to Wine-3.0 reactos/dll/win32/hlink # Synced to Wine-3.0 -reactos/dll/win32/hnetcfg # Synced to WineStaging-2.9 +reactos/dll/win32/hnetcfg # Synced to Wine-3.0 reactos/dll/win32/httpapi # Synced to WineStaging-2.9 reactos/dll/win32/iccvid # Synced to WineStaging-2.9 reactos/dll/win32/ieframe # Synced to WineStaging-2.9