2 * Copyright (C) 2007 Jeff Latimer
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
29 #include "hnetcfg_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg
);
33 typedef HRESULT (*fnCreateInstance
)( IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
37 const struct IClassFactoryVtbl
*vtbl
;
38 fnCreateInstance pfnCreateInstance
;
41 static inline hnetcfg_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
43 return (hnetcfg_cf
*)((char *)iface
- FIELD_OFFSET( hnetcfg_cf
, vtbl
));
46 static HRESULT WINAPI
hnetcfg_cf_QueryInterface( IClassFactory
*iface
, REFIID riid
, LPVOID
*ppobj
)
48 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
49 IsEqualGUID(riid
, &IID_IClassFactory
))
51 IClassFactory_AddRef( iface
);
55 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
59 static ULONG WINAPI
hnetcfg_cf_AddRef( IClassFactory
*iface
)
64 static ULONG WINAPI
hnetcfg_cf_Release( IClassFactory
*iface
)
69 static HRESULT WINAPI
hnetcfg_cf_CreateInstance( IClassFactory
*iface
, LPUNKNOWN pOuter
,
70 REFIID riid
, LPVOID
*ppobj
)
72 hnetcfg_cf
*This
= impl_from_IClassFactory( iface
);
76 TRACE("%p %s %p\n", pOuter
, debugstr_guid(riid
), ppobj
);
81 return CLASS_E_NOAGGREGATION
;
83 r
= This
->pfnCreateInstance( pOuter
, (LPVOID
*)&punk
);
87 r
= IUnknown_QueryInterface( punk
, riid
, ppobj
);
91 IUnknown_Release( punk
);
95 static HRESULT WINAPI
hnetcfg_cf_LockServer( IClassFactory
*iface
, BOOL dolock
)
97 FIXME("(%p)->(%d)\n", iface
, dolock
);
101 static const struct IClassFactoryVtbl hnetcfg_cf_vtbl
=
103 hnetcfg_cf_QueryInterface
,
106 hnetcfg_cf_CreateInstance
,
107 hnetcfg_cf_LockServer
110 static hnetcfg_cf fw_manager_cf
= { &hnetcfg_cf_vtbl
, NetFwMgr_create
};
111 static hnetcfg_cf fw_app_cf
= { &hnetcfg_cf_vtbl
, NetFwAuthorizedApplication_create
};
113 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
115 TRACE("(0x%p, %d, %p)\n",hInstDLL
,fdwReason
,lpvReserved
);
118 case DLL_WINE_PREATTACH
:
120 case DLL_PROCESS_ATTACH
:
121 DisableThreadLibraryCalls(hInstDLL
);
123 case DLL_PROCESS_DETACH
:
129 HRESULT WINAPI
DllGetClassObject( REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
131 IClassFactory
*cf
= NULL
;
133 TRACE("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
135 if (IsEqualGUID( rclsid
, &CLSID_NetFwMgr
))
137 cf
= (IClassFactory
*)&fw_manager_cf
.vtbl
;
139 else if (IsEqualGUID( rclsid
, &CLSID_NetFwAuthorizedApplication
))
141 cf
= (IClassFactory
*)&fw_app_cf
.vtbl
;
144 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
145 return IClassFactory_QueryInterface( cf
, iid
, ppv
);
148 HRESULT WINAPI
DllCanUnloadNow( void )