diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 32865f3e986..7c2accb9b22 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -29,6 +29,8 @@ extern HRESULT WINAPI QUARTZ_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLS extern HRESULT WINAPI QUARTZ_DllCanUnloadNow(void) DECLSPEC_HIDDEN; extern BOOL WINAPI QUARTZ_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN; +static LONG server_locks = 0; + /* For the moment, do nothing here. */ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) { @@ -142,6 +144,10 @@ static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock) { IClassFactoryImpl *This = impl_from_IClassFactory(iface); FIXME("(%p)->(%d),stub!\n",This,dolock); + if(dolock) + InterlockedIncrement(&server_locks); + else + InterlockedDecrement(&server_locks); return S_OK; } @@ -204,7 +210,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) */ HRESULT WINAPI DllCanUnloadNow(void) { - return QUARTZ_DllCanUnloadNow(); + if(server_locks == 0 && QUARTZ_DllCanUnloadNow() == S_OK) + return S_OK; + return S_FALSE; }