Hans Leidekker : hnetcfg: Add IDispatch support for INetFwAuthorizedApplication and INetFwAuthorizedApplications .
Alexandre Julliard
julliard at winehq.org
Wed Sep 26 14:06:49 CDT 2012
Module: wine
Branch: master
Commit: 9ff1b4c8b2770a7ab233d27f2029e79b50d016d5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9ff1b4c8b2770a7ab233d27f2029e79b50d016d5
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Sep 26 09:37:08 2012 +0200
hnetcfg: Add IDispatch support for INetFwAuthorizedApplication and INetFwAuthorizedApplications.
---
dlls/hnetcfg/Makefile.in | 2 +-
dlls/hnetcfg/apps.c | 110 ++++++++++++++++++++++++++++++++++-----
dlls/hnetcfg/hnetcfg_private.h | 9 +++
3 files changed, 106 insertions(+), 15 deletions(-)
diff --git a/dlls/hnetcfg/Makefile.in b/dlls/hnetcfg/Makefile.in
index 198a6bb..165152d 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 90a1807..0418865 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 cc7519b..bd92392 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;
More information about the wine-cvs
mailing list