mapi32: Implement FGetComponentPath.

This commit is contained in:
Dmitry Timoshkov 2006-05-25 22:18:11 +09:00 committed by Alexandre Julliard
parent 0d13a99e79
commit 64152a7564
2 changed files with 68 additions and 3 deletions

View File

@ -186,6 +186,5 @@
251 stub GetOutlookVersion@0
252 stub FixMAPI
253 stub FixMAPI@0
# This entry point is sometimes used to detect if the mapi dll came from Outlook
#254 stub FGetComponentPath
#255 stub FGetComponentPath@20
254 stdcall FGetComponentPath(str str ptr long long)
255 stdcall FGetComponentPath@20(str str ptr long long) FGetComponentPath

View File

@ -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_configuration(
FIXME("stub");
return CMC_E_NOT_SUPPORTED;
}
/**************************************************************************
* FGetComponentPath (MAPI32.254)
* FGetComponentPath@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;
}