Christian Gmeiner : msi: Implemented DllCanUnloadNow.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Dec 5 14:06:02 CST 2005
Module: wine
Branch: refs/heads/master
Commit: e02e539c1e91cffe4f29281c8a120ba60c041ba2
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e02e539c1e91cffe4f29281c8a120ba60c041ba2
Author: Christian Gmeiner <christian.gmeiner at students.fh-vorarlberg.ac.at>
Date: Mon Dec 5 20:39:33 2005 +0100
msi: Implemented DllCanUnloadNow.
---
dlls/msi/msi.c | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 625b16c..0591a42 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -53,8 +53,24 @@ LPVOID gUIContext = NULL;
WCHAR gszLogFile[MAX_PATH];
HINSTANCE msi_hInstance;
+static LONG dll_count;
+
static const WCHAR installerW[] = {'\\','I','n','s','t','a','l','l','e','r',0};
+/**********************************************************************
+ * Dll lifetime tracking declaration
+ */
+static void LockModule(void)
+{
+ InterlockedIncrement(&dll_count);
+}
+
+static void UnlockModule(void)
+{
+ InterlockedDecrement(&dll_count);
+}
+
+
UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
{
UINT r;
@@ -1285,11 +1301,13 @@ static HRESULT WINAPI MsiCF_QueryInterfa
static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface)
{
+ LockModule();
return 2;
}
static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface)
{
+ UnlockModule();
return 1;
}
@@ -1304,9 +1322,13 @@ static HRESULT WINAPI MsiCF_CreateInstan
static HRESULT WINAPI MsiCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+ TRACE("(%p)->(%d)\n", iface, dolock);
+
+ if(dolock)
+ LockModule();
+ else
+ UnlockModule();
- FIXME("%p %d\n", This, dolock);
return S_OK;
}
@@ -1363,7 +1385,7 @@ HRESULT WINAPI DllGetVersion(DLLVERSIONI
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
- return S_FALSE;
+ return dll_count == 0 ? S_OK : S_FALSE;
}
/***********************************************************************
More information about the wine-cvs
mailing list