Commit 5af53a97 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

dllhost: Implement ISurrogate::FreeSurrogate().

parent 0bf6066b
...@@ -204,6 +204,7 @@ struct surrogate ...@@ -204,6 +204,7 @@ struct surrogate
ISurrogate ISurrogate_iface; ISurrogate ISurrogate_iface;
IClassFactory *factory; IClassFactory *factory;
DWORD cookie; DWORD cookie;
HANDLE event;
LONG ref; LONG ref;
}; };
...@@ -267,15 +268,35 @@ static HRESULT WINAPI surrogate_LoadDllServer(ISurrogate *iface, const CLSID *cl ...@@ -267,15 +268,35 @@ static HRESULT WINAPI surrogate_LoadDllServer(ISurrogate *iface, const CLSID *cl
if (hr != S_OK) if (hr != S_OK)
IClassFactory_Release(&factory->IClassFactory_iface); IClassFactory_Release(&factory->IClassFactory_iface);
else else
{
surrogate->factory = &factory->IClassFactory_iface; surrogate->factory = &factory->IClassFactory_iface;
surrogate->event = CreateEventW(NULL, FALSE, FALSE, NULL);
}
return hr; return hr;
} }
static HRESULT WINAPI surrogate_FreeSurrogate(ISurrogate *iface) static HRESULT WINAPI surrogate_FreeSurrogate(ISurrogate *iface)
{ {
FIXME("(%p): stub\n", iface); struct surrogate *surrogate = impl_from_ISurrogate(iface);
return E_NOTIMPL;
TRACE("(%p)\n", iface);
if (surrogate->cookie)
{
CoRevokeClassObject(surrogate->cookie);
surrogate->cookie = 0;
}
if (surrogate->factory)
{
IClassFactory_Release(surrogate->factory);
surrogate->factory = NULL;
}
SetEvent(surrogate->event);
return S_OK;
} }
static const ISurrogateVtbl Surrogate_Vtbl = static const ISurrogateVtbl Surrogate_Vtbl =
...@@ -301,6 +322,7 @@ int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int sho ...@@ -301,6 +322,7 @@ int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int sho
surrogate.ISurrogate_iface.lpVtbl = &Surrogate_Vtbl; surrogate.ISurrogate_iface.lpVtbl = &Surrogate_Vtbl;
surrogate.factory = NULL; surrogate.factory = NULL;
surrogate.cookie = 0; surrogate.cookie = 0;
surrogate.event = NULL;
surrogate.ref = 1; surrogate.ref = 1;
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoInitializeEx(NULL, COINIT_MULTITHREADED);
...@@ -317,8 +339,7 @@ int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int sho ...@@ -317,8 +339,7 @@ int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int sho
goto cleanup; goto cleanup;
} }
/* FIXME: wait for FreeSurrogate being called */ WaitForSingleObject(surrogate.event, INFINITE);
Sleep(INFINITE);
} }
cleanup: cleanup:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment