hnetcfg: Release typeinfos and typelib on dll unload.

This commit is contained in:
Nikolay Sivov 2015-01-14 13:39:22 +03:00 committed by Alexandre Julliard
parent aef50786fb
commit 4782be7e31
3 changed files with 19 additions and 2 deletions

View File

@ -148,6 +148,18 @@ HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
return S_OK; return S_OK;
} }
void release_typelib(void)
{
unsigned i;
for (i = 0; i < sizeof(typeinfo)/sizeof(*typeinfo); i++)
if (typeinfo[i])
ITypeInfo_Release(typeinfo[i]);
if (typelib)
ITypeLib_Release(typelib);
}
static HRESULT WINAPI fw_app_GetTypeInfo( static HRESULT WINAPI fw_app_GetTypeInfo(
INetFwAuthorizedApplication *iface, INetFwAuthorizedApplication *iface,
UINT iTInfo, UINT iTInfo,

View File

@ -114,9 +114,9 @@ static hnetcfg_cf fw_manager_cf = { { &hnetcfg_cf_vtbl }, NetFwMgr_create };
static hnetcfg_cf fw_app_cf = { { &hnetcfg_cf_vtbl }, NetFwAuthorizedApplication_create }; static hnetcfg_cf fw_app_cf = { { &hnetcfg_cf_vtbl }, NetFwAuthorizedApplication_create };
static hnetcfg_cf fw_openport_cf = { { &hnetcfg_cf_vtbl }, NetFwOpenPort_create }; static hnetcfg_cf fw_openport_cf = { { &hnetcfg_cf_vtbl }, NetFwOpenPort_create };
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
{ {
TRACE("(0x%p, %d, %p)\n",hInstDLL,fdwReason,lpvReserved); TRACE("(0x%p, %d, %p)\n", hInstDLL, fdwReason, reserved);
switch(fdwReason) { switch(fdwReason) {
case DLL_WINE_PREATTACH: case DLL_WINE_PREATTACH:
@ -125,6 +125,10 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
instance = hInstDLL; instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL); DisableThreadLibraryCalls(hInstDLL);
break; break;
case DLL_PROCESS_DETACH:
if (reserved) break;
release_typelib();
break;
} }
return TRUE; return TRUE;
} }

View File

@ -28,6 +28,7 @@ enum type_id
}; };
HRESULT get_typeinfo(enum type_id, ITypeInfo **) DECLSPEC_HIDDEN; HRESULT get_typeinfo(enum type_id, ITypeInfo **) DECLSPEC_HIDDEN;
void release_typelib(void) DECLSPEC_HIDDEN;
HRESULT NetFwMgr_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT NetFwMgr_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT NetFwPolicy_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT NetFwPolicy_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;