diff --git a/dlls/hnetcfg/Makefile.in b/dlls/hnetcfg/Makefile.in index 198a6bbcfa4..165152d5596 100644 --- a/dlls/hnetcfg/Makefile.in +++ b/dlls/hnetcfg/Makefile.in @@ -1,5 +1,5 @@ MODULE = hnetcfg.dll -IMPORTS = ole32 advapi32 +IMPORTS = oleaut32 ole32 advapi32 C_SRCS = \ apps.c \ diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c index 90a18079019..04188650a1d 100644 --- a/dlls/hnetcfg/apps.c +++ b/dlls/hnetcfg/apps.c @@ -95,8 +95,52 @@ static HRESULT WINAPI fw_app_GetTypeInfoCount( { fw_app *This = impl_from_INetFwAuthorizedApplication( iface ); - FIXME("%p %p\n", This, pctinfo); - return E_NOTIMPL; + TRACE("%p %p\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static ITypeLib *typelib; +static ITypeInfo *typeinfo[last_tid]; + +static REFIID tid_id[] = +{ + &IID_INetFwAuthorizedApplication, + &IID_INetFwAuthorizedApplications +}; + +HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret ) +{ + HRESULT hr; + + if (!typelib) + { + ITypeLib *lib; + + hr = LoadRegTypeLib( &LIBID_NetFwPublicTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &lib ); + if (FAILED(hr)) + { + ERR("LoadRegTypeLib failed: %08x\n", hr); + return hr; + } + if (InterlockedCompareExchangePointer( (void **)&typelib, lib, NULL )) + ITypeLib_Release( lib ); + } + if (!typeinfo[tid]) + { + ITypeInfo *info; + + hr = ITypeLib_GetTypeInfoOfGuid( typelib, tid_id[tid], &info ); + if (FAILED(hr)) + { + ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id[tid]), hr); + return hr; + } + if (InterlockedCompareExchangePointer( (void **)(typeinfo + tid), info, NULL )) + ITypeInfo_Release( info ); + } + *ret = typeinfo[tid]; + return S_OK; } static HRESULT WINAPI fw_app_GetTypeInfo( @@ -107,8 +151,8 @@ static HRESULT WINAPI fw_app_GetTypeInfo( { fw_app *This = impl_from_INetFwAuthorizedApplication( iface ); - FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo); - return E_NOTIMPL; + TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo( INetFwAuthorizedApplication_tid, ppTInfo ); } static HRESULT WINAPI fw_app_GetIDsOfNames( @@ -120,9 +164,18 @@ static HRESULT WINAPI fw_app_GetIDsOfNames( DISPID *rgDispId ) { fw_app *This = impl_from_INetFwAuthorizedApplication( iface ); + ITypeInfo *typeinfo; + HRESULT hr; - FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); - return E_NOTIMPL; + TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo ); + if (SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId ); + ITypeInfo_Release( typeinfo ); + } + return hr; } static HRESULT WINAPI fw_app_Invoke( @@ -137,10 +190,20 @@ static HRESULT WINAPI fw_app_Invoke( UINT *puArgErr ) { fw_app *This = impl_from_INetFwAuthorizedApplication( iface ); + ITypeInfo *typeinfo; + HRESULT hr; - FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid), + TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return E_NOTIMPL; + + hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo ); + if (SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplication_iface, dispIdMember, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr ); + ITypeInfo_Release( typeinfo ); + } + return hr; } static HRESULT WINAPI fw_app_get_Name( @@ -378,8 +441,8 @@ static HRESULT WINAPI fw_apps_GetTypeInfo( { fw_apps *This = impl_from_INetFwAuthorizedApplications( iface ); - FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo); - return E_NOTIMPL; + TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo( INetFwAuthorizedApplications_tid, ppTInfo ); } static HRESULT WINAPI fw_apps_GetIDsOfNames( @@ -391,9 +454,18 @@ static HRESULT WINAPI fw_apps_GetIDsOfNames( DISPID *rgDispId ) { fw_apps *This = impl_from_INetFwAuthorizedApplications( iface ); + ITypeInfo *typeinfo; + HRESULT hr; - FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); - return E_NOTIMPL; + TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo ); + if (SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId ); + ITypeInfo_Release( typeinfo ); + } + return hr; } static HRESULT WINAPI fw_apps_Invoke( @@ -408,10 +480,20 @@ static HRESULT WINAPI fw_apps_Invoke( UINT *puArgErr ) { fw_apps *This = impl_from_INetFwAuthorizedApplications( iface ); + ITypeInfo *typeinfo; + HRESULT hr; - FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid), + TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return E_NOTIMPL; + + hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo ); + if (SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplications_iface, dispIdMember, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr ); + ITypeInfo_Release( typeinfo ); + } + return hr; } static HRESULT WINAPI fw_apps_get_Count( diff --git a/dlls/hnetcfg/hnetcfg_private.h b/dlls/hnetcfg/hnetcfg_private.h index cc7519b23ea..bd92392e2b4 100644 --- a/dlls/hnetcfg/hnetcfg_private.h +++ b/dlls/hnetcfg/hnetcfg_private.h @@ -16,6 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +enum type_id +{ + INetFwAuthorizedApplication_tid, + INetFwAuthorizedApplications_tid, + last_tid +}; + +HRESULT get_typeinfo(enum type_id, ITypeInfo **) DECLSPEC_HIDDEN; + HRESULT NetFwMgr_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT NetFwPolicy_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT NetFwProfile_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;