Dmitry Timoshkov : mapi32: Implement FGetComponentPath.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu May 25 14:18:44 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 64152a756454182ff5ee020d6059f9c4608ad58d
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=64152a756454182ff5ee020d6059f9c4608ad58d
Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date: Thu May 25 22:18:11 2006 +0900
mapi32: Implement FGetComponentPath.
---
dlls/mapi32/mapi32.spec | 5 +---
dlls/mapi32/util.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/dlls/mapi32/mapi32.spec b/dlls/mapi32/mapi32.spec
index 296a9bc..ab134cd 100644
--- a/dlls/mapi32/mapi32.spec
+++ b/dlls/mapi32/mapi32.spec
@@ -186,6 +186,5 @@
251 stub GetOutlookVersion at 0
252 stub FixMAPI
253 stub FixMAPI at 0
-# This entry point is sometimes used to detect if the mapi dll came from Outlook
-#254 stub FGetComponentPath
-#255 stub FGetComponentPath at 20
+254 stdcall FGetComponentPath(str str ptr long long)
+255 stdcall FGetComponentPath at 20(str str ptr long long) FGetComponentPath
diff --git a/dlls/mapi32/util.c b/dlls/mapi32/util.c
index d441527..d3184c6 100644
--- a/dlls/mapi32/util.c
+++ b/dlls/mapi32/util.c
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
+#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
@@ -35,6 +36,7 @@ #include "wine/debug.h"
#include "wine/unicode.h"
#include "mapival.h"
#include "xcmc.h"
+#include "msi.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
@@ -821,3 +823,67 @@ CMC_return_code WINAPI cmc_query_configu
FIXME("stub");
return CMC_E_NOT_SUPPORTED;
}
+
+/**************************************************************************
+ * FGetComponentPath (MAPI32.254)
+ * FGetComponentPath at 20 (MAPI32.255)
+ *
+ * Return the installed component path, usually to the private mapi32.dll.
+ *
+ * PARAMS
+ * component [I] Component ID
+ * qualifier [I] Application LCID
+ * dll_path [O] returned component path
+ * dll_path_length [I] component path length
+ * install [I] install mode
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES
+ * Previously documented in Q229700 "How to locate the correct path
+ * to the Mapisvc.inf file in Microsoft Outlook".
+ */
+BOOL WINAPI FGetComponentPath(LPCSTR component, LPCSTR qualifier, LPSTR dll_path,
+ DWORD dll_path_length, BOOL install)
+{
+ BOOL ret = FALSE;
+ HMODULE hmsi;
+
+ TRACE("%s %s %p %lu %d\n", component, qualifier, dll_path, dll_path_length, install);
+
+ dll_path[0] = 0;
+
+ hmsi = LoadLibraryA("msi.dll");
+ if (hmsi)
+ {
+ FARPROC pMsiProvideQualifiedComponentA = GetProcAddress(hmsi, "MsiProvideQualifiedComponentA");
+
+ if (pMsiProvideQualifiedComponentA)
+ {
+ static const char * const fmt[] = { "%d\\NT", "%d\\95", "%d" };
+ char lcid_ver[20];
+ UINT i;
+
+ for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++)
+ {
+ /* FIXME: what's the correct behaviour here? */
+ if (!qualifier || qualifier == lcid_ver)
+ {
+ sprintf(lcid_ver, fmt[i], GetUserDefaultUILanguage());
+ qualifier = lcid_ver;
+ }
+
+ if (pMsiProvideQualifiedComponentA(component, qualifier,
+ install ? INSTALLMODE_DEFAULT : INSTALLMODE_EXISTING,
+ dll_path, &dll_path_length) == ERROR_SUCCESS)
+ ret = TRUE;
+
+ if (qualifier != lcid_ver) break;
+ }
+ }
+ FreeLibrary(hmsi);
+ }
+ return ret;
+}
More information about the wine-cvs
mailing list