MAPI32: implement FGetComponentPath
Dmitry Timoshkov
dmitry at codeweavers.com
Thu May 25 08:18:11 CDT 2006
Hello,
Changelog:
MAPI32: implement FGetComponentPath based on the MSDN information,
news groups posts, relay traces and tests.
diff -up cvs/hq/wine/dlls/mapi32/mapi32.spec wine/dlls/mapi32/mapi32.spec
--- cvs/hq/wine/dlls/mapi32/mapi32.spec 2006-02-18 09:40:12.000000000 +0800
+++ wine/dlls/mapi32/mapi32.spec 2006-05-25 21:40:40.000000000 +0900
@@ -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 -up cvs/hq/wine/dlls/mapi32/util.c wine/dlls/mapi32/util.c
--- cvs/hq/wine/dlls/mapi32/util.c 2006-05-24 13:16:10.000000000 +0900
+++ wine/dlls/mapi32/util.c 2006-05-25 21:43:52.000000000 +0900
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
+#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
@@ -35,6 +36,7 @@
#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-patches
mailing list