2003-08-13 03:27:48 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
2005-01-24 12:22:00 +01:00
|
|
|
* Copyright 2002,2003,2004,2005 Mike McCormack for CodeWeavers
|
2003-08-13 03:27:48 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-08-13 03:27:48 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
|
2003-08-13 03:27:48 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
2003-09-27 04:24:31 +02:00
|
|
|
#include "winnls.h"
|
2003-08-13 03:27:48 +02:00
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "msi.h"
|
2007-06-15 23:08:37 +02:00
|
|
|
#include "msidefs.h"
|
2003-08-13 03:27:48 +02:00
|
|
|
#include "msiquery.h"
|
|
|
|
#include "msipriv.h"
|
2003-09-02 01:57:06 +02:00
|
|
|
#include "wincrypt.h"
|
2004-09-06 23:25:48 +02:00
|
|
|
#include "winver.h"
|
2005-01-24 12:22:00 +01:00
|
|
|
#include "winuser.h"
|
2005-10-29 12:28:30 +02:00
|
|
|
#include "shlobj.h"
|
|
|
|
#include "shobjidl.h"
|
|
|
|
#include "objidl.h"
|
2005-04-20 14:50:05 +02:00
|
|
|
#include "wine/unicode.h"
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|
|
|
|
2005-05-11 14:01:12 +02:00
|
|
|
static const WCHAR installerW[] = {'\\','I','n','s','t','a','l','l','e','r',0};
|
|
|
|
|
2003-08-13 03:27:48 +02:00
|
|
|
UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
|
|
|
|
{
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r;
|
2003-10-30 23:47:42 +01:00
|
|
|
LPWSTR szwProd = NULL;
|
|
|
|
|
|
|
|
TRACE("%s %p\n",debugstr_a(szProduct), phProduct);
|
|
|
|
|
|
|
|
if( szProduct )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwProd = strdupAtoW( szProduct );
|
|
|
|
if( !szwProd )
|
|
|
|
return ERROR_OUTOFMEMORY;
|
2003-10-30 23:47:42 +01:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
r = MsiOpenProductW( szwProd, phProduct );
|
2003-10-30 23:47:42 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwProd );
|
2003-10-30 23:47:42 +01:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
static UINT MSI_OpenProductW( LPCWSTR szProduct, MSIPACKAGE **ppackage )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2003-11-05 01:34:51 +01:00
|
|
|
LPWSTR path = NULL;
|
|
|
|
UINT r;
|
2005-01-25 11:58:36 +01:00
|
|
|
HKEY hKeyProduct = NULL;
|
2003-11-05 01:34:51 +01:00
|
|
|
DWORD count, type;
|
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
TRACE("%s %p\n", debugstr_w(szProduct), ppackage );
|
2003-11-05 01:34:51 +01:00
|
|
|
|
2005-01-25 11:58:36 +01:00
|
|
|
r = MSIREG_OpenUninstallKey(szProduct,&hKeyProduct,FALSE);
|
2003-11-05 01:34:51 +01:00
|
|
|
if( r != ERROR_SUCCESS )
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
|
|
|
r = ERROR_UNKNOWN_PRODUCT;
|
2003-11-05 01:34:51 +01:00
|
|
|
goto end;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
2003-11-05 01:34:51 +01:00
|
|
|
|
|
|
|
/* find the size of the path */
|
|
|
|
type = count = 0;
|
2005-07-13 14:07:41 +02:00
|
|
|
r = RegQueryValueExW( hKeyProduct, INSTALLPROPERTY_LOCALPACKAGEW,
|
2003-11-05 01:34:51 +01:00
|
|
|
NULL, &type, NULL, &count );
|
|
|
|
if( r != ERROR_SUCCESS )
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
|
|
|
r = ERROR_UNKNOWN_PRODUCT;
|
2003-11-05 01:34:51 +01:00
|
|
|
goto end;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
2003-11-05 01:34:51 +01:00
|
|
|
|
|
|
|
/* now alloc and fetch the path of the database to open */
|
2005-09-20 13:59:14 +02:00
|
|
|
path = msi_alloc( count );
|
2003-11-05 01:34:51 +01:00
|
|
|
if( !path )
|
|
|
|
goto end;
|
|
|
|
|
2005-07-13 14:07:41 +02:00
|
|
|
r = RegQueryValueExW( hKeyProduct, INSTALLPROPERTY_LOCALPACKAGEW,
|
2003-11-05 01:34:51 +01:00
|
|
|
NULL, &type, (LPBYTE) path, &count );
|
|
|
|
if( r != ERROR_SUCCESS )
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
|
|
|
r = ERROR_UNKNOWN_PRODUCT;
|
2003-11-05 01:34:51 +01:00
|
|
|
goto end;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
2003-11-05 01:34:51 +01:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
r = MSI_OpenPackageW( path, ppackage );
|
2003-11-05 01:34:51 +01:00
|
|
|
|
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( path );
|
2003-11-05 01:34:51 +01:00
|
|
|
if( hKeyProduct )
|
|
|
|
RegCloseKey( hKeyProduct );
|
|
|
|
|
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
UINT WINAPI MsiOpenProductW( LPCWSTR szProduct, MSIHANDLE *phProduct )
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package = NULL;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MSI_OpenProductW( szProduct, &package );
|
|
|
|
if( r == ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
*phProduct = alloc_msihandle( &package->hdr );
|
2006-08-28 18:44:35 +02:00
|
|
|
if (! *phProduct)
|
|
|
|
r = ERROR_NOT_ENOUGH_MEMORY;
|
2005-09-28 12:13:18 +02:00
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiAdvertiseProductA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
|
|
|
|
LPCSTR szTransforms, LANGID lgidLanguage)
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2005-01-24 12:22:00 +01:00
|
|
|
FIXME("%s %s %s %08x\n",debugstr_a(szPackagePath),
|
|
|
|
debugstr_a(szScriptfilePath), debugstr_a(szTransforms), lgidLanguage);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiAdvertiseProductW(LPCWSTR szPackagePath, LPCWSTR szScriptfilePath,
|
|
|
|
LPCWSTR szTransforms, LANGID lgidLanguage)
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2005-01-24 12:22:00 +01:00
|
|
|
FIXME("%s %s %s %08x\n",debugstr_w(szPackagePath),
|
|
|
|
debugstr_w(szScriptfilePath), debugstr_w(szTransforms), lgidLanguage);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiAdvertiseProductExA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
|
|
|
|
LPCSTR szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %s %s %08x %08x %08x\n", debugstr_a(szPackagePath),
|
2005-01-24 12:22:00 +01:00
|
|
|
debugstr_a(szScriptfilePath), debugstr_a(szTransforms),
|
|
|
|
lgidLanguage, dwPlatform, dwOptions);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiAdvertiseProductExW( LPCWSTR szPackagePath, LPCWSTR szScriptfilePath,
|
|
|
|
LPCWSTR szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %s %s %08x %08x %08x\n", debugstr_w(szPackagePath),
|
2005-01-24 12:22:00 +01:00
|
|
|
debugstr_w(szScriptfilePath), debugstr_w(szTransforms),
|
|
|
|
lgidLanguage, dwPlatform, dwOptions);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2003-08-13 03:27:48 +02:00
|
|
|
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
|
|
|
|
{
|
|
|
|
LPWSTR szwPath = NULL, szwCommand = NULL;
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r = ERROR_OUTOFMEMORY;
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
TRACE("%s %s\n",debugstr_a(szPackagePath), debugstr_a(szCommandLine));
|
|
|
|
|
|
|
|
if( szPackagePath )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwPath = strdupAtoW( szPackagePath );
|
2003-09-27 04:24:31 +02:00
|
|
|
if( !szwPath )
|
|
|
|
goto end;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if( szCommandLine )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwCommand = strdupAtoW( szCommandLine );
|
2003-09-27 04:24:31 +02:00
|
|
|
if( !szwCommand )
|
|
|
|
goto end;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2003-08-13 03:27:48 +02:00
|
|
|
r = MsiInstallProductW( szwPath, szwCommand );
|
|
|
|
|
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwPath );
|
|
|
|
msi_free( szwCommand );
|
2003-08-13 03:27:48 +02:00
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
|
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIPACKAGE *package = NULL;
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2006-07-21 07:04:09 +02:00
|
|
|
TRACE("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
|
2003-08-13 03:27:48 +02:00
|
|
|
|
2005-09-25 17:14:32 +02:00
|
|
|
r = MSI_OpenPackageW( szPackagePath, &package );
|
2005-09-28 12:13:18 +02:00
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
2005-09-30 12:32:41 +02:00
|
|
|
r = MSI_InstallPackage( package, szPackagePath, szCommandLine );
|
2005-09-28 12:13:18 +02:00
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
}
|
2005-06-28 21:14:30 +02:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2004-07-19 23:19:45 +02:00
|
|
|
UINT WINAPI MsiReinstallProductA(LPCSTR szProduct, DWORD dwReinstallMode)
|
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %08x\n", debugstr_a(szProduct), dwReinstallMode);
|
2005-01-24 12:22:00 +01:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
2004-07-19 23:19:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode)
|
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %08x\n", debugstr_w(szProduct), dwReinstallMode);
|
2005-01-24 12:22:00 +01:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
2004-07-19 23:19:45 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage,
|
|
|
|
INSTALLTYPE eInstallType, LPCSTR szCommandLine)
|
2004-07-29 04:39:20 +02:00
|
|
|
{
|
2007-06-15 23:04:04 +02:00
|
|
|
LPWSTR patch_package = NULL;
|
|
|
|
LPWSTR install_package = NULL;
|
|
|
|
LPWSTR command_line = NULL;
|
|
|
|
UINT r = ERROR_OUTOFMEMORY;
|
|
|
|
|
|
|
|
TRACE("%s %s %d %s\n", debugstr_a(szPatchPackage), debugstr_a(szInstallPackage),
|
2005-01-24 12:22:00 +01:00
|
|
|
eInstallType, debugstr_a(szCommandLine));
|
2007-06-15 23:04:04 +02:00
|
|
|
|
|
|
|
if (szPatchPackage && !(patch_package = strdupAtoW(szPatchPackage)))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (szInstallPackage && !(install_package = strdupAtoW(szInstallPackage)))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (szCommandLine && !(command_line = strdupAtoW(szCommandLine)))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
r = MsiApplyPatchW(patch_package, install_package, eInstallType, command_line);
|
|
|
|
|
|
|
|
done:
|
|
|
|
msi_free(patch_package);
|
|
|
|
msi_free(install_package);
|
|
|
|
msi_free(command_line);
|
|
|
|
|
|
|
|
return r;
|
2004-07-29 04:39:20 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage,
|
|
|
|
INSTALLTYPE eInstallType, LPCWSTR szCommandLine)
|
2004-07-29 04:39:20 +02:00
|
|
|
{
|
2007-06-15 23:08:37 +02:00
|
|
|
MSIHANDLE patch, info;
|
|
|
|
UINT r, type;
|
|
|
|
DWORD size = 0;
|
|
|
|
LPCWSTR cmd_ptr = szCommandLine;
|
|
|
|
LPWSTR beg, end;
|
|
|
|
LPWSTR cmd = NULL, codes = NULL;
|
|
|
|
|
|
|
|
static const WCHAR space[] = {' ',0};
|
|
|
|
static const WCHAR patcheq[] = {'P','A','T','C','H','=',0};
|
|
|
|
static WCHAR empty[] = {0};
|
|
|
|
|
|
|
|
TRACE("%s %s %d %s\n", debugstr_w(szPatchPackage), debugstr_w(szInstallPackage),
|
2005-01-24 12:22:00 +01:00
|
|
|
eInstallType, debugstr_w(szCommandLine));
|
2007-06-15 23:08:37 +02:00
|
|
|
|
|
|
|
if (szInstallPackage || eInstallType == INSTALLTYPE_NETWORK_IMAGE ||
|
|
|
|
eInstallType == INSTALLTYPE_SINGLE_INSTANCE)
|
|
|
|
{
|
|
|
|
FIXME("Only reading target products from patch\n");
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = MsiOpenDatabaseW(szPatchPackage, MSIDBOPEN_READONLY, &patch);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
r = MsiGetSummaryInformationW(patch, NULL, 0, &info);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
r = MsiSummaryInfoGetPropertyW(info, PID_TEMPLATE, &type, NULL, NULL, empty, &size);
|
|
|
|
if (r != ERROR_MORE_DATA || !size || type != VT_LPSTR)
|
|
|
|
{
|
|
|
|
ERR("Failed to read product codes from patch\n");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
codes = msi_alloc(++size * sizeof(WCHAR));
|
|
|
|
if (!codes)
|
|
|
|
{
|
|
|
|
r = ERROR_OUTOFMEMORY;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = MsiSummaryInfoGetPropertyW(info, PID_TEMPLATE, &type, NULL, NULL, codes, &size);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (!szCommandLine)
|
|
|
|
cmd_ptr = empty;
|
|
|
|
|
|
|
|
size = lstrlenW(cmd_ptr) + lstrlenW(patcheq) + lstrlenW(szPatchPackage) + 1;
|
|
|
|
cmd = msi_alloc(size * sizeof(WCHAR));
|
|
|
|
if (!cmd)
|
|
|
|
{
|
|
|
|
r = ERROR_OUTOFMEMORY;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
lstrcpyW(cmd, cmd_ptr);
|
|
|
|
if (szCommandLine) lstrcatW(cmd, space);
|
|
|
|
lstrcatW(cmd, patcheq);
|
|
|
|
lstrcatW(cmd, szPatchPackage);
|
|
|
|
|
|
|
|
beg = codes;
|
|
|
|
while ((end = strchrW(beg, '}')))
|
|
|
|
{
|
|
|
|
*(end + 1) = '\0';
|
|
|
|
|
|
|
|
r = MsiConfigureProductExW(beg, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
beg = end + 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
msi_free(cmd);
|
|
|
|
msi_free(codes);
|
|
|
|
|
|
|
|
MsiCloseHandle(info);
|
|
|
|
MsiCloseHandle(patch);
|
|
|
|
|
|
|
|
return r;
|
2004-07-29 04:39:20 +02:00
|
|
|
}
|
|
|
|
|
2005-01-19 17:58:03 +01:00
|
|
|
UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
|
|
|
|
INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
|
|
|
|
{
|
2005-09-28 12:13:18 +02:00
|
|
|
MSIPACKAGE* package = NULL;
|
|
|
|
UINT r;
|
2005-01-19 17:58:03 +01:00
|
|
|
DWORD sz;
|
2005-07-12 19:56:17 +02:00
|
|
|
WCHAR sourcepath[MAX_PATH];
|
|
|
|
WCHAR filename[MAX_PATH];
|
2005-01-19 17:58:03 +01:00
|
|
|
static const WCHAR szInstalled[] = {
|
|
|
|
' ','I','n','s','t','a','l','l','e','d','=','1',0};
|
|
|
|
LPWSTR commandline;
|
|
|
|
|
2006-07-21 07:04:09 +02:00
|
|
|
TRACE("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState,
|
2005-01-24 12:22:00 +01:00
|
|
|
debugstr_w(szCommandLine));
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
if (eInstallState != INSTALLSTATE_LOCAL &&
|
2005-01-25 11:58:36 +01:00
|
|
|
eInstallState != INSTALLSTATE_DEFAULT)
|
2005-01-19 17:58:03 +01:00
|
|
|
{
|
|
|
|
FIXME("Not implemented for anything other than local installs\n");
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-07-12 19:56:17 +02:00
|
|
|
sz = sizeof(sourcepath);
|
|
|
|
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
|
2005-07-13 14:07:41 +02:00
|
|
|
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath,
|
2005-07-12 19:56:17 +02:00
|
|
|
&sz);
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-07-12 19:56:17 +02:00
|
|
|
sz = sizeof(filename);
|
|
|
|
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
|
2005-07-13 14:07:41 +02:00
|
|
|
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
lstrcatW(sourcepath,filename);
|
2005-01-25 11:58:36 +01:00
|
|
|
|
2005-01-19 17:58:03 +01:00
|
|
|
/*
|
|
|
|
* ok 1, we need to find the msi file for this product.
|
|
|
|
* 2, find the source dir for the files
|
|
|
|
* 3, do the configure/install.
|
2005-03-29 13:28:57 +02:00
|
|
|
* 4, cleanupany runonce entry.
|
2005-01-19 17:58:03 +01:00
|
|
|
*/
|
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
r = MSI_OpenProductW( szProduct, &package );
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
sz = lstrlenW(szInstalled) + 1;
|
2005-01-19 17:58:03 +01:00
|
|
|
|
|
|
|
if (szCommandLine)
|
2005-03-24 20:04:06 +01:00
|
|
|
sz += lstrlenW(szCommandLine);
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
commandline = msi_alloc(sz * sizeof(WCHAR));
|
2005-09-28 12:13:18 +02:00
|
|
|
if (!commandline )
|
|
|
|
{
|
|
|
|
r = ERROR_OUTOFMEMORY;
|
|
|
|
goto end;
|
|
|
|
}
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
commandline[0] = 0;
|
2005-03-29 13:28:57 +02:00
|
|
|
if (szCommandLine)
|
|
|
|
lstrcpyW(commandline,szCommandLine);
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-01-25 11:58:36 +01:00
|
|
|
if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN)
|
2005-03-29 13:28:57 +02:00
|
|
|
lstrcatW(commandline,szInstalled);
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-09-30 12:32:41 +02:00
|
|
|
r = MSI_InstallPackage( package, sourcepath, commandline );
|
2005-02-09 14:22:49 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(commandline);
|
2005-09-28 12:13:18 +02:00
|
|
|
|
2005-01-19 17:58:03 +01:00
|
|
|
end:
|
2005-09-28 12:13:18 +02:00
|
|
|
msiobj_release( &package->hdr );
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
return r;
|
2005-01-19 17:58:03 +01:00
|
|
|
}
|
|
|
|
|
2005-01-25 11:58:36 +01:00
|
|
|
UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
|
|
|
|
INSTALLSTATE eInstallState, LPCSTR szCommandLine)
|
|
|
|
{
|
|
|
|
LPWSTR szwProduct = NULL;
|
|
|
|
LPWSTR szwCommandLine = NULL;
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r = ERROR_OUTOFMEMORY;
|
2005-01-25 11:58:36 +01:00
|
|
|
|
|
|
|
if( szProduct )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwProduct = strdupAtoW( szProduct );
|
2005-01-25 11:58:36 +01:00
|
|
|
if( !szwProduct )
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( szCommandLine)
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwCommandLine = strdupAtoW( szCommandLine );
|
2005-01-25 11:58:36 +01:00
|
|
|
if( !szwCommandLine)
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
|
2005-01-25 11:58:36 +01:00
|
|
|
szwCommandLine );
|
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwProduct );
|
|
|
|
msi_free( szwCommandLine);
|
2005-01-25 11:58:36 +01:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
return r;
|
2005-01-25 11:58:36 +01:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
|
2005-01-19 17:58:03 +01:00
|
|
|
INSTALLSTATE eInstallState)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2004-04-28 02:29:25 +02:00
|
|
|
LPWSTR szwProduct = NULL;
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r;
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
TRACE("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
|
2004-04-28 02:29:25 +02:00
|
|
|
|
|
|
|
if( szProduct )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwProduct = strdupAtoW( szProduct );
|
2004-04-28 02:29:25 +02:00
|
|
|
if( !szwProduct )
|
2005-03-29 13:28:57 +02:00
|
|
|
return ERROR_OUTOFMEMORY;
|
2004-04-28 02:29:25 +02:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwProduct );
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel,
|
2005-01-19 17:58:03 +01:00
|
|
|
INSTALLSTATE eInstallState)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2005-03-29 13:28:57 +02:00
|
|
|
return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState, NULL);
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
|
|
|
|
{
|
2005-01-24 12:22:00 +01:00
|
|
|
LPWSTR szwComponent = NULL;
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r;
|
2005-01-24 12:22:00 +01:00
|
|
|
WCHAR szwBuffer[GUID_SIZE];
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
TRACE("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer));
|
2004-04-28 02:29:25 +02:00
|
|
|
|
|
|
|
if( szComponent )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwComponent = strdupAtoW( szComponent );
|
2004-04-28 02:29:25 +02:00
|
|
|
if( !szwComponent )
|
2005-03-29 13:28:57 +02:00
|
|
|
return ERROR_OUTOFMEMORY;
|
2004-04-28 02:29:25 +02:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
r = MsiGetProductCodeW( szwComponent, szwBuffer );
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
if( ERROR_SUCCESS == r )
|
2004-04-28 02:29:25 +02:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwComponent );
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
|
|
|
|
{
|
2005-05-20 20:59:11 +02:00
|
|
|
UINT rc;
|
|
|
|
HKEY hkey;
|
|
|
|
WCHAR szSquished[GUID_SIZE];
|
|
|
|
DWORD sz = GUID_SIZE;
|
|
|
|
static const WCHAR szPermKey[] =
|
|
|
|
{ '0','0','0','0','0','0','0','0','0','0','0','0',
|
2005-10-28 12:41:20 +02:00
|
|
|
'0','0','0','0','0','0','0','0','0','0','0','0',
|
2005-05-20 20:59:11 +02:00
|
|
|
'0','0','0','0','0','0','0','0',0};
|
|
|
|
|
|
|
|
TRACE("%s %p\n",debugstr_w(szComponent), szBuffer);
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if (NULL == szComponent)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
2005-05-20 20:59:11 +02:00
|
|
|
|
|
|
|
rc = MSIREG_OpenComponentsKey( szComponent, &hkey, FALSE);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_UNKNOWN_COMPONENT;
|
|
|
|
|
|
|
|
rc = RegEnumValueW(hkey, 0, szSquished, &sz, NULL, NULL, NULL, NULL);
|
|
|
|
if (rc == ERROR_SUCCESS && strcmpW(szSquished,szPermKey)==0)
|
|
|
|
{
|
|
|
|
sz = GUID_SIZE;
|
|
|
|
rc = RegEnumValueW(hkey, 1, szSquished, &sz, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_INSTALL_FAILURE;
|
|
|
|
|
|
|
|
unsquash_guid(szSquished, szBuffer);
|
|
|
|
return ERROR_SUCCESS;
|
2004-04-28 02:29:25 +02:00
|
|
|
}
|
|
|
|
|
2006-10-09 09:05:04 +02:00
|
|
|
static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
|
|
|
|
awstring *szValue, DWORD *pcchValueBuf)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT r;
|
2006-07-14 08:20:44 +02:00
|
|
|
HKEY hkey;
|
|
|
|
LPWSTR val = NULL;
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2006-07-14 08:21:10 +02:00
|
|
|
TRACE("%s %s %p %p\n", debugstr_w(szProduct),
|
|
|
|
debugstr_w(szAttribute), szValue, pcchValueBuf);
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2006-07-14 08:21:10 +02:00
|
|
|
/*
|
|
|
|
* FIXME: Values seem scattered/duplicated in the registry. Is there a system?
|
2006-07-14 08:20:44 +02:00
|
|
|
*/
|
|
|
|
|
2007-05-17 07:42:20 +02:00
|
|
|
if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szProduct[0] || !szAttribute)
|
2005-01-24 12:22:00 +01:00
|
|
|
return ERROR_INVALID_PARAMETER;
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2005-04-26 16:30:31 +02:00
|
|
|
/* check for special properties */
|
2006-07-14 08:20:44 +02:00
|
|
|
if (!lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGECODEW))
|
2005-04-26 16:30:31 +02:00
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
LPWSTR regval;
|
|
|
|
WCHAR packagecode[35];
|
2005-04-26 16:30:31 +02:00
|
|
|
|
|
|
|
r = MSIREG_OpenUserProductsKey(szProduct, &hkey, FALSE);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return ERROR_UNKNOWN_PRODUCT;
|
|
|
|
|
2006-07-14 08:20:44 +02:00
|
|
|
regval = msi_reg_get_val_str( hkey, szAttribute );
|
|
|
|
if (regval)
|
2005-04-27 10:11:52 +02:00
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
if (unsquash_guid(regval, packagecode))
|
|
|
|
val = strdupW(packagecode);
|
|
|
|
msi_free(regval);
|
2005-04-27 10:11:52 +02:00
|
|
|
}
|
2005-04-26 16:30:31 +02:00
|
|
|
|
2005-04-27 10:11:52 +02:00
|
|
|
RegCloseKey(hkey);
|
2005-04-26 16:30:31 +02:00
|
|
|
}
|
2006-07-14 08:20:44 +02:00
|
|
|
else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW))
|
2005-04-26 16:30:31 +02:00
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
static const WCHAR one[] = { '1',0 };
|
|
|
|
/*
|
|
|
|
* FIXME: should be in the Product key (user or system?)
|
|
|
|
* but isn't written yet...
|
|
|
|
*/
|
|
|
|
val = strdupW( one );
|
2005-04-26 16:30:31 +02:00
|
|
|
}
|
2006-07-14 08:20:44 +02:00
|
|
|
else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_LANGUAGEW) ||
|
|
|
|
!lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONW))
|
2005-04-26 16:30:31 +02:00
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
static const WCHAR fmt[] = { '%','u',0 };
|
|
|
|
WCHAR szVal[16];
|
|
|
|
DWORD regval;
|
|
|
|
|
|
|
|
r = MSIREG_OpenUninstallKey(szProduct, &hkey, FALSE);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return ERROR_UNKNOWN_PRODUCT;
|
|
|
|
|
|
|
|
if (msi_reg_get_val_dword( hkey, szAttribute, ®val))
|
2005-06-13 21:04:39 +02:00
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
sprintfW(szVal, fmt, regval);
|
|
|
|
val = strdupW( szVal );
|
2005-06-13 21:04:39 +02:00
|
|
|
}
|
2006-07-14 08:20:44 +02:00
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
2005-04-26 16:30:31 +02:00
|
|
|
}
|
2006-07-14 08:20:44 +02:00
|
|
|
else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_PRODUCTNAMEW))
|
2005-06-08 20:35:43 +02:00
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
r = MSIREG_OpenUserProductsKey(szProduct, &hkey, FALSE);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return ERROR_UNKNOWN_PRODUCT;
|
|
|
|
|
|
|
|
val = msi_reg_get_val_str( hkey, szAttribute );
|
2005-06-08 20:35:43 +02:00
|
|
|
|
2006-07-14 08:20:44 +02:00
|
|
|
RegCloseKey(hkey);
|
2005-06-08 20:35:43 +02:00
|
|
|
}
|
2007-05-17 07:42:20 +02:00
|
|
|
else if (!szAttribute[0])
|
|
|
|
{
|
|
|
|
return ERROR_UNKNOWN_PROPERTY;
|
|
|
|
}
|
2005-04-26 16:30:31 +02:00
|
|
|
else
|
|
|
|
{
|
2006-07-14 08:20:44 +02:00
|
|
|
static const WCHAR szDisplayVersion[] = {
|
|
|
|
'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0 };
|
|
|
|
|
2006-07-14 08:21:10 +02:00
|
|
|
FIXME("%s\n", debugstr_w(szAttribute));
|
|
|
|
/* FIXME: some attribute values not tested... */
|
|
|
|
|
|
|
|
if (!lstrcmpW( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW ))
|
2006-07-14 08:20:44 +02:00
|
|
|
szAttribute = szDisplayVersion;
|
|
|
|
|
2006-07-14 08:21:10 +02:00
|
|
|
r = MSIREG_OpenUninstallKey( szProduct, &hkey, FALSE );
|
2006-07-14 08:20:44 +02:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return ERROR_UNKNOWN_PRODUCT;
|
|
|
|
|
|
|
|
val = msi_reg_get_val_str( hkey, szAttribute );
|
2005-04-26 16:30:31 +02:00
|
|
|
|
2006-07-14 08:20:44 +02:00
|
|
|
RegCloseKey(hkey);
|
2005-04-26 16:30:31 +02:00
|
|
|
}
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2006-07-14 08:20:44 +02:00
|
|
|
TRACE("returning %s\n", debugstr_w(val));
|
|
|
|
|
|
|
|
if (!val)
|
|
|
|
return ERROR_UNKNOWN_PROPERTY;
|
|
|
|
|
2006-07-14 08:21:10 +02:00
|
|
|
r = msi_strcpy_to_awstring( val, szValue, pcchValueBuf );
|
2006-07-14 08:20:44 +02:00
|
|
|
|
2006-07-27 04:05:45 +02:00
|
|
|
msi_free(val);
|
2006-07-14 08:20:44 +02:00
|
|
|
|
2006-07-14 08:21:10 +02:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
|
|
|
|
LPSTR szBuffer, DWORD *pcchValueBuf)
|
|
|
|
{
|
|
|
|
LPWSTR szwProduct, szwAttribute = NULL;
|
|
|
|
UINT r = ERROR_OUTOFMEMORY;
|
|
|
|
awstring buffer;
|
|
|
|
|
|
|
|
TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szAttribute),
|
|
|
|
szBuffer, pcchValueBuf);
|
|
|
|
|
|
|
|
szwProduct = strdupAtoW( szProduct );
|
|
|
|
if( szProduct && !szwProduct )
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
szwAttribute = strdupAtoW( szAttribute );
|
|
|
|
if( szAttribute && !szwAttribute )
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
buffer.unicode = FALSE;
|
|
|
|
buffer.str.a = szBuffer;
|
|
|
|
|
|
|
|
r = MSI_GetProductInfo( szwProduct, szwAttribute,
|
|
|
|
&buffer, pcchValueBuf );
|
|
|
|
|
|
|
|
end:
|
|
|
|
msi_free( szwProduct );
|
|
|
|
msi_free( szwAttribute );
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
|
|
|
|
LPWSTR szBuffer, DWORD *pcchValueBuf)
|
|
|
|
{
|
|
|
|
awstring buffer;
|
|
|
|
|
|
|
|
TRACE("%s %s %p %p\n", debugstr_w(szProduct), debugstr_w(szAttribute),
|
|
|
|
szBuffer, pcchValueBuf);
|
|
|
|
|
|
|
|
buffer.unicode = TRUE;
|
|
|
|
buffer.str.w = szBuffer;
|
|
|
|
|
|
|
|
return MSI_GetProductInfo( szProduct, szAttribute,
|
|
|
|
&buffer, pcchValueBuf );
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2004-07-24 01:28:45 +02:00
|
|
|
UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2004-04-28 02:29:25 +02:00
|
|
|
LPWSTR szwLogFile = NULL;
|
2005-03-25 17:38:26 +01:00
|
|
|
UINT r;
|
2004-04-28 02:29:25 +02:00
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%08x %s %08x\n", dwLogMode, debugstr_a(szLogFile), attributes);
|
2004-04-28 02:29:25 +02:00
|
|
|
|
|
|
|
if( szLogFile )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwLogFile = strdupAtoW( szLogFile );
|
2004-04-28 02:29:25 +02:00
|
|
|
if( !szwLogFile )
|
2005-03-25 17:38:26 +01:00
|
|
|
return ERROR_OUTOFMEMORY;
|
2004-04-28 02:29:25 +02:00
|
|
|
}
|
2005-03-25 17:38:26 +01:00
|
|
|
r = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwLogFile );
|
2005-03-25 17:38:26 +01:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2004-07-24 01:28:45 +02:00
|
|
|
UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2005-01-24 12:22:00 +01:00
|
|
|
HANDLE file = INVALID_HANDLE_VALUE;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%08x %s %08x\n", dwLogMode, debugstr_w(szLogFile), attributes);
|
2005-01-24 12:22:00 +01:00
|
|
|
|
2006-07-24 12:45:50 +02:00
|
|
|
if (szLogFile)
|
|
|
|
{
|
|
|
|
lstrcpyW(gszLogFile,szLogFile);
|
|
|
|
if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
|
|
|
|
DeleteFileW(szLogFile);
|
|
|
|
file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
|
|
|
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
if (file != INVALID_HANDLE_VALUE)
|
|
|
|
CloseHandle(file);
|
|
|
|
else
|
|
|
|
ERR("Unable to enable log %s\n",debugstr_w(szLogFile));
|
|
|
|
}
|
2004-07-09 21:26:30 +02:00
|
|
|
else
|
2006-07-24 12:45:50 +02:00
|
|
|
gszLogFile[0] = '\0';
|
2004-07-09 21:26:30 +02:00
|
|
|
|
2004-04-28 02:29:25 +02:00
|
|
|
return ERROR_SUCCESS;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2007-06-26 01:44:47 +02:00
|
|
|
UINT WINAPI MsiQueryComponentStateA(LPSTR szProductCode, LPSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szComponent, INSTALLSTATE *pdwState)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %d, %s, %p): stub!\n", debugstr_a(szProductCode), debugstr_a(szUserSid), dwContext, debugstr_a(szComponent), pdwState);
|
|
|
|
|
|
|
|
if (!pdwState)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
*pdwState = INSTALLSTATE_UNKNOWN;
|
|
|
|
return ERROR_UNKNOWN_PRODUCT;
|
|
|
|
}
|
|
|
|
|
2003-08-13 03:27:48 +02:00
|
|
|
INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
LPWSTR szwProduct = NULL;
|
|
|
|
INSTALLSTATE r;
|
2005-01-17 14:39:57 +01:00
|
|
|
|
2005-03-24 20:04:06 +01:00
|
|
|
if( szProduct )
|
|
|
|
{
|
|
|
|
szwProduct = strdupAtoW( szProduct );
|
|
|
|
if( !szwProduct )
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
r = MsiQueryProductStateW( szwProduct );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwProduct );
|
2005-03-24 20:04:06 +01:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
|
|
|
|
{
|
2005-01-17 14:39:57 +01:00
|
|
|
UINT rc;
|
2007-06-27 01:36:02 +02:00
|
|
|
INSTALLSTATE state = INSTALLSTATE_UNKNOWN;
|
2007-06-27 04:01:03 +02:00
|
|
|
HKEY hkey = 0, props = 0;
|
2005-01-17 14:39:57 +01:00
|
|
|
DWORD sz;
|
2007-06-27 04:04:08 +02:00
|
|
|
BOOL userkey_exists = FALSE;
|
2005-01-17 14:39:57 +01:00
|
|
|
|
2007-06-27 01:30:40 +02:00
|
|
|
static const int GUID_LEN = 38;
|
2007-06-27 04:01:03 +02:00
|
|
|
static const WCHAR szInstallProperties[] = {
|
|
|
|
'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0
|
|
|
|
};
|
2007-06-27 01:30:40 +02:00
|
|
|
static const WCHAR szWindowsInstaller[] = {
|
|
|
|
'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0
|
|
|
|
};
|
|
|
|
|
2005-01-17 14:39:57 +01:00
|
|
|
TRACE("%s\n", debugstr_w(szProduct));
|
|
|
|
|
2007-06-27 01:30:40 +02:00
|
|
|
if (!szProduct || !*szProduct || lstrlenW(szProduct) != GUID_LEN)
|
2006-04-17 11:17:52 +02:00
|
|
|
return INSTALLSTATE_INVALIDARG;
|
|
|
|
|
2005-01-25 11:58:36 +01:00
|
|
|
rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
|
2007-06-27 04:04:08 +02:00
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
userkey_exists = TRUE;
|
|
|
|
state = INSTALLSTATE_ADVERTISED;
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
2005-01-17 14:39:57 +01:00
|
|
|
|
2007-06-27 04:01:03 +02:00
|
|
|
rc = MSIREG_OpenUserDataProductKey(szProduct,&hkey,FALSE);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
rc = RegOpenKeyW(hkey, szInstallProperties, &props);
|
2005-01-17 14:39:57 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
2007-06-27 01:36:02 +02:00
|
|
|
sz = sizeof(state);
|
2007-06-27 04:01:03 +02:00
|
|
|
rc = RegQueryValueExW(props,szWindowsInstaller,NULL,NULL,(LPVOID)&state, &sz);
|
2005-01-17 14:39:57 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
2007-06-27 04:01:37 +02:00
|
|
|
if (state)
|
2007-06-27 01:36:02 +02:00
|
|
|
state = INSTALLSTATE_DEFAULT;
|
2007-06-27 04:01:37 +02:00
|
|
|
else
|
2007-06-27 01:36:02 +02:00
|
|
|
state = INSTALLSTATE_UNKNOWN;
|
2007-06-27 04:01:37 +02:00
|
|
|
|
2007-06-27 04:04:08 +02:00
|
|
|
if (state == INSTALLSTATE_DEFAULT && !userkey_exists)
|
|
|
|
state = INSTALLSTATE_ABSENT;
|
|
|
|
|
2005-01-17 14:39:57 +01:00
|
|
|
end:
|
2007-06-27 04:01:03 +02:00
|
|
|
RegCloseKey(props);
|
2005-01-17 14:39:57 +01:00
|
|
|
RegCloseKey(hkey);
|
2007-06-27 01:36:02 +02:00
|
|
|
return state;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
|
|
|
|
{
|
2004-07-04 02:26:54 +02:00
|
|
|
INSTALLUILEVEL old = gUILevel;
|
|
|
|
HWND oldwnd = gUIhwnd;
|
2005-01-24 12:22:00 +01:00
|
|
|
|
2004-07-04 02:26:54 +02:00
|
|
|
TRACE("%08x %p\n", dwUILevel, phWnd);
|
|
|
|
|
|
|
|
gUILevel = dwUILevel;
|
|
|
|
if (phWnd)
|
|
|
|
{
|
|
|
|
gUIhwnd = *phWnd;
|
|
|
|
*phWnd = oldwnd;
|
|
|
|
}
|
|
|
|
return old;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
|
2004-06-28 22:34:35 +02:00
|
|
|
DWORD dwMessageFilter, LPVOID pvContext)
|
|
|
|
{
|
2005-01-24 13:55:31 +01:00
|
|
|
INSTALLUI_HANDLERA prev = gUIHandlerA;
|
2004-07-04 02:31:17 +02:00
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%p %x %p\n",puiHandler, dwMessageFilter,pvContext);
|
2005-01-24 13:55:31 +01:00
|
|
|
gUIHandlerA = puiHandler;
|
2004-07-04 02:31:17 +02:00
|
|
|
gUIFilter = dwMessageFilter;
|
|
|
|
gUIContext = pvContext;
|
|
|
|
|
|
|
|
return prev;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
2004-12-23 12:22:00 +01:00
|
|
|
INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(INSTALLUI_HANDLERW puiHandler,
|
|
|
|
DWORD dwMessageFilter, LPVOID pvContext)
|
|
|
|
{
|
2005-01-03 17:54:43 +01:00
|
|
|
INSTALLUI_HANDLERW prev = gUIHandlerW;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%p %x %p\n",puiHandler,dwMessageFilter,pvContext);
|
2005-01-03 17:54:43 +01:00
|
|
|
gUIHandlerW = puiHandler;
|
|
|
|
gUIFilter = dwMessageFilter;
|
|
|
|
gUIContext = pvContext;
|
|
|
|
|
|
|
|
return prev;
|
2004-12-23 12:22:00 +01:00
|
|
|
}
|
|
|
|
|
2005-02-08 13:12:29 +01:00
|
|
|
/******************************************************************
|
|
|
|
* MsiLoadStringW [MSI.@]
|
|
|
|
*
|
|
|
|
* Loads a string from MSI's string resources.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
*
|
|
|
|
* handle [I] only -1 is handled currently
|
|
|
|
* id [I] id of the string to be loaded
|
|
|
|
* lpBuffer [O] buffer for the string to be written to
|
|
|
|
* nBufferMax [I] maximum size of the buffer in characters
|
2005-02-25 15:07:56 +01:00
|
|
|
* lang [I] the preferred language for the string
|
2005-02-08 13:12:29 +01:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
* If successful, this function returns the language id of the string loaded
|
|
|
|
* If the function fails, the function returns zero.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
*
|
|
|
|
* The type of the first parameter is unknown. LoadString's prototype
|
|
|
|
* suggests that it might be a module handle. I have made it an MSI handle
|
|
|
|
* for starters, as -1 is an invalid MSI handle, but not an invalid module
|
|
|
|
* handle. Maybe strings can be stored in an MSI database somehow.
|
|
|
|
*/
|
|
|
|
LANGID WINAPI MsiLoadStringW( MSIHANDLE handle, UINT id, LPWSTR lpBuffer,
|
|
|
|
int nBufferMax, LANGID lang )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2005-02-08 13:12:29 +01:00
|
|
|
HRSRC hres;
|
|
|
|
HGLOBAL hResData;
|
|
|
|
LPWSTR p;
|
|
|
|
DWORD i, len;
|
|
|
|
|
|
|
|
TRACE("%ld %u %p %d %d\n", handle, id, lpBuffer, nBufferMax, lang);
|
|
|
|
|
|
|
|
if( handle != -1 )
|
|
|
|
FIXME("don't know how to deal with handle = %08lx\n", handle);
|
|
|
|
|
|
|
|
if( !lang )
|
|
|
|
lang = GetUserDefaultLangID();
|
|
|
|
|
|
|
|
hres = FindResourceExW( msi_hInstance, (LPCWSTR) RT_STRING,
|
|
|
|
(LPWSTR)1, lang );
|
|
|
|
if( !hres )
|
|
|
|
return 0;
|
|
|
|
hResData = LoadResource( msi_hInstance, hres );
|
|
|
|
if( !hResData )
|
|
|
|
return 0;
|
|
|
|
p = LockResource( hResData );
|
|
|
|
if( !p )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i = 0; i < (id&0xf); i++)
|
|
|
|
p += *p + 1;
|
|
|
|
len = *p;
|
|
|
|
|
|
|
|
if( nBufferMax <= len )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
memcpy( lpBuffer, p+1, len * sizeof(WCHAR));
|
|
|
|
lpBuffer[ len ] = 0;
|
|
|
|
|
|
|
|
TRACE("found -> %s\n", debugstr_w(lpBuffer));
|
|
|
|
|
|
|
|
return lang;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-02-08 13:12:29 +01:00
|
|
|
LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
|
|
|
|
int nBufferMax, LANGID lang )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2005-02-08 13:12:29 +01:00
|
|
|
LPWSTR bufW;
|
|
|
|
LANGID r;
|
|
|
|
DWORD len;
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
bufW = msi_alloc(nBufferMax*sizeof(WCHAR));
|
2005-02-08 13:12:29 +01:00
|
|
|
r = MsiLoadStringW(handle, id, bufW, nBufferMax, lang);
|
|
|
|
if( r )
|
|
|
|
{
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL, NULL );
|
|
|
|
if( len <= nBufferMax )
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, bufW, -1,
|
|
|
|
lpBuffer, nBufferMax, NULL, NULL );
|
|
|
|
else
|
|
|
|
r = 0;
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(bufW);
|
2005-02-08 13:12:29 +01:00
|
|
|
return r;
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
INSTALLSTATE WINAPI MsiLocateComponentA(LPCSTR szComponent, LPSTR lpPathBuf,
|
|
|
|
DWORD *pcchBuf)
|
2004-04-13 00:06:12 +02:00
|
|
|
{
|
2006-05-29 12:51:00 +02:00
|
|
|
char szProduct[GUID_SIZE];
|
|
|
|
|
|
|
|
TRACE("%s %p %p\n", debugstr_a(szComponent), lpPathBuf, pcchBuf);
|
|
|
|
|
|
|
|
if (MsiGetProductCodeA( szComponent, szProduct ) != ERROR_SUCCESS)
|
|
|
|
return INSTALLSTATE_UNKNOWN;
|
|
|
|
|
|
|
|
return MsiGetComponentPathA( szProduct, szComponent, lpPathBuf, pcchBuf );
|
2004-04-13 00:06:12 +02:00
|
|
|
}
|
|
|
|
|
2005-05-30 13:12:24 +02:00
|
|
|
INSTALLSTATE WINAPI MsiLocateComponentW(LPCWSTR szComponent, LPWSTR lpPathBuf,
|
2005-01-24 12:22:00 +01:00
|
|
|
DWORD *pcchBuf)
|
2004-04-13 00:06:12 +02:00
|
|
|
{
|
2006-05-29 12:51:00 +02:00
|
|
|
WCHAR szProduct[GUID_SIZE];
|
|
|
|
|
|
|
|
TRACE("%s %p %p\n", debugstr_w(szComponent), lpPathBuf, pcchBuf);
|
|
|
|
|
|
|
|
if (MsiGetProductCodeW( szComponent, szProduct ) != ERROR_SUCCESS)
|
|
|
|
return INSTALLSTATE_UNKNOWN;
|
|
|
|
|
|
|
|
return MsiGetComponentPathW( szProduct, szComponent, lpPathBuf, pcchBuf );
|
2004-04-13 00:06:12 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,
|
|
|
|
WORD wLanguageId, DWORD f)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%p %s %s %u %08x %08x\n", hWnd, debugstr_a(lpText), debugstr_a(lpCaption),
|
|
|
|
uType, wLanguageId, f);
|
2005-11-11 11:52:53 +01:00
|
|
|
return MessageBoxExA(hWnd,lpText,lpCaption,uType,wLanguageId);
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,
|
|
|
|
WORD wLanguageId, DWORD f)
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%p %s %s %u %08x %08x\n", hWnd, debugstr_w(lpText), debugstr_w(lpCaption),
|
|
|
|
uType, wLanguageId, f);
|
2005-11-11 11:52:53 +01:00
|
|
|
return MessageBoxExW(hWnd,lpText,lpCaption,uType,wLanguageId);
|
2003-08-13 03:27:48 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiProvideAssemblyA( LPCSTR szAssemblyName, LPCSTR szAppContext,
|
|
|
|
DWORD dwInstallMode, DWORD dwAssemblyInfo, LPSTR lpPathBuf,
|
2005-03-29 13:28:57 +02:00
|
|
|
DWORD* pcchPathBuf )
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %s %08x %08x %p %p\n", debugstr_a(szAssemblyName),
|
2005-01-24 12:22:00 +01:00
|
|
|
debugstr_a(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
|
|
|
|
pcchPathBuf);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiProvideAssemblyW( LPCWSTR szAssemblyName, LPCWSTR szAppContext,
|
|
|
|
DWORD dwInstallMode, DWORD dwAssemblyInfo, LPWSTR lpPathBuf,
|
|
|
|
DWORD* pcchPathBuf )
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %s %08x %08x %p %p\n", debugstr_w(szAssemblyName),
|
2005-01-24 12:22:00 +01:00
|
|
|
debugstr_w(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
|
|
|
|
pcchPathBuf);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiProvideComponentFromDescriptorA( LPCSTR szDescriptor,
|
|
|
|
LPSTR szPath, DWORD *pcchPath, DWORD *pcchArgs )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
|
|
|
FIXME("%s %p %p %p\n", debugstr_a(szDescriptor), szPath, pcchPath, pcchArgs );
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiProvideComponentFromDescriptorW( LPCWSTR szDescriptor,
|
|
|
|
LPWSTR szPath, DWORD *pcchPath, DWORD *pcchArgs )
|
2003-08-13 03:27:48 +02:00
|
|
|
{
|
|
|
|
FIXME("%s %p %p %p\n", debugstr_w(szDescriptor), szPath, pcchPath, pcchArgs );
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
HRESULT WINAPI MsiGetFileSignatureInformationA( LPCSTR szSignedObjectPath,
|
|
|
|
DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, BYTE* pbHashData,
|
|
|
|
DWORD* pcbHashData)
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %08x %p %p %p\n", debugstr_a(szSignedObjectPath), dwFlags,
|
2005-01-24 12:22:00 +01:00
|
|
|
ppcCertContext, pbHashData, pcbHashData);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
HRESULT WINAPI MsiGetFileSignatureInformationW( LPCWSTR szSignedObjectPath,
|
|
|
|
DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, BYTE* pbHashData,
|
|
|
|
DWORD* pcbHashData)
|
2003-09-02 01:57:06 +02:00
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %08x %p %p %p\n", debugstr_w(szSignedObjectPath), dwFlags,
|
2005-01-24 12:22:00 +01:00
|
|
|
ppcCertContext, pbHashData, pcbHashData);
|
2003-09-02 01:57:06 +02:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2003-10-30 23:47:42 +01:00
|
|
|
UINT WINAPI MsiGetProductPropertyA( MSIHANDLE hProduct, LPCSTR szProperty,
|
|
|
|
LPSTR szValue, DWORD *pccbValue )
|
|
|
|
{
|
|
|
|
FIXME("%ld %s %p %p\n", hProduct, debugstr_a(szProperty), szValue, pccbValue);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiGetProductPropertyW( MSIHANDLE hProduct, LPCWSTR szProperty,
|
|
|
|
LPWSTR szValue, DWORD *pccbValue )
|
|
|
|
{
|
|
|
|
FIXME("%ld %s %p %p\n", hProduct, debugstr_w(szProperty), szValue, pccbValue);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2003-11-05 02:42:02 +01:00
|
|
|
UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
UINT r;
|
2004-07-10 00:58:27 +02:00
|
|
|
LPWSTR szPack = NULL;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_a(szPackage) );
|
|
|
|
|
|
|
|
if( szPackage )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szPack = strdupAtoW( szPackage );
|
2004-07-10 00:58:27 +02:00
|
|
|
if( !szPack )
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = MsiVerifyPackageW( szPack );
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szPack );
|
2004-07-10 00:58:27 +02:00
|
|
|
|
|
|
|
return r;
|
2003-11-05 02:42:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiVerifyPackageW( LPCWSTR szPackage )
|
|
|
|
{
|
2004-07-10 00:58:27 +02:00
|
|
|
MSIHANDLE handle;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(szPackage) );
|
|
|
|
|
|
|
|
r = MsiOpenDatabaseW( szPackage, MSIDBOPEN_READONLY, &handle );
|
|
|
|
MsiCloseHandle( handle );
|
|
|
|
|
|
|
|
return r;
|
2003-11-05 02:42:02 +01:00
|
|
|
}
|
|
|
|
|
2006-10-09 09:05:04 +02:00
|
|
|
static INSTALLSTATE WINAPI MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
|
|
|
|
awstring* lpPathBuf, DWORD* pcchBuf)
|
2004-07-09 21:38:40 +02:00
|
|
|
{
|
2006-07-06 12:01:11 +02:00
|
|
|
WCHAR squished_pc[GUID_SIZE], squished_comp[GUID_SIZE];
|
2005-01-14 18:05:53 +01:00
|
|
|
UINT rc;
|
2005-02-16 17:04:36 +01:00
|
|
|
HKEY hkey = 0;
|
|
|
|
LPWSTR path = NULL;
|
2006-07-21 07:04:26 +02:00
|
|
|
INSTALLSTATE r;
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
TRACE("%s %s %p %p\n", debugstr_w(szProduct),
|
2006-07-18 11:43:03 +02:00
|
|
|
debugstr_w(szComponent), lpPathBuf->str.w, pcchBuf);
|
2004-07-09 21:38:40 +02:00
|
|
|
|
2006-07-18 11:43:03 +02:00
|
|
|
if( !szProduct || !szComponent )
|
2005-10-28 12:41:20 +02:00
|
|
|
return INSTALLSTATE_INVALIDARG;
|
2006-07-18 11:43:03 +02:00
|
|
|
if( lpPathBuf->str.w && !pcchBuf )
|
2005-02-16 17:04:36 +01:00
|
|
|
return INSTALLSTATE_INVALIDARG;
|
|
|
|
|
2006-07-06 12:01:11 +02:00
|
|
|
if (!squash_guid( szProduct, squished_pc ) ||
|
|
|
|
!squash_guid( szComponent, squished_comp ))
|
|
|
|
return INSTALLSTATE_INVALIDARG;
|
2005-01-17 14:39:57 +01:00
|
|
|
|
2005-02-16 17:04:36 +01:00
|
|
|
rc = MSIREG_OpenProductsKey( szProduct, &hkey, FALSE);
|
|
|
|
if( rc != ERROR_SUCCESS )
|
2006-07-06 12:00:45 +02:00
|
|
|
return INSTALLSTATE_UNKNOWN;
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2005-01-25 11:58:36 +01:00
|
|
|
RegCloseKey(hkey);
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2005-02-16 17:04:36 +01:00
|
|
|
rc = MSIREG_OpenComponentsKey( szComponent, &hkey, FALSE);
|
|
|
|
if( rc != ERROR_SUCCESS )
|
2006-07-06 12:00:45 +02:00
|
|
|
return INSTALLSTATE_UNKNOWN;
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2006-07-15 04:05:02 +02:00
|
|
|
path = msi_reg_get_val_str( hkey, squished_pc );
|
2006-07-06 12:00:45 +02:00
|
|
|
RegCloseKey(hkey);
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2005-01-25 11:58:36 +01:00
|
|
|
TRACE("found path of (%s:%s)(%s)\n", debugstr_w(szComponent),
|
2005-02-16 17:04:36 +01:00
|
|
|
debugstr_w(szProduct), debugstr_w(path));
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2006-07-06 12:00:45 +02:00
|
|
|
if (!path)
|
|
|
|
return INSTALLSTATE_UNKNOWN;
|
|
|
|
|
2006-07-21 07:04:26 +02:00
|
|
|
if (path[0])
|
|
|
|
r = INSTALLSTATE_LOCAL;
|
|
|
|
else
|
|
|
|
r = INSTALLSTATE_NOTUSED;
|
2005-01-14 18:05:53 +01:00
|
|
|
|
2006-07-06 12:00:45 +02:00
|
|
|
msi_strcpy_to_awstring( path, lpPathBuf, pcchBuf );
|
2005-02-16 17:04:36 +01:00
|
|
|
|
2006-07-06 12:00:45 +02:00
|
|
|
msi_free( path );
|
2006-07-21 07:04:26 +02:00
|
|
|
return r;
|
2004-07-09 21:38:40 +02:00
|
|
|
}
|
|
|
|
|
2006-07-06 12:00:45 +02:00
|
|
|
/******************************************************************
|
|
|
|
* MsiGetComponentPathW [MSI.@]
|
|
|
|
*/
|
|
|
|
INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
|
|
|
|
LPWSTR lpPathBuf, DWORD* pcchBuf)
|
|
|
|
{
|
|
|
|
awstring path;
|
|
|
|
|
|
|
|
path.unicode = TRUE;
|
|
|
|
path.str.w = lpPathBuf;
|
|
|
|
|
|
|
|
return MSI_GetComponentPath( szProduct, szComponent, &path, pcchBuf );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* MsiGetComponentPathA [MSI.@]
|
|
|
|
*/
|
|
|
|
INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
|
|
|
|
LPSTR lpPathBuf, DWORD* pcchBuf)
|
|
|
|
{
|
|
|
|
LPWSTR szwProduct, szwComponent = NULL;
|
|
|
|
INSTALLSTATE r = INSTALLSTATE_UNKNOWN;
|
|
|
|
awstring path;
|
|
|
|
|
|
|
|
szwProduct = strdupAtoW( szProduct );
|
|
|
|
if( szProduct && !szwProduct)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
szwComponent = strdupAtoW( szComponent );
|
|
|
|
if( szComponent && !szwComponent )
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
path.unicode = FALSE;
|
|
|
|
path.str.a = lpPathBuf;
|
|
|
|
|
|
|
|
r = MSI_GetComponentPath( szwProduct, szwComponent, &path, pcchBuf );
|
|
|
|
|
|
|
|
end:
|
|
|
|
msi_free( szwProduct );
|
|
|
|
msi_free( szwComponent );
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2005-04-20 17:18:42 +02:00
|
|
|
/******************************************************************
|
|
|
|
* MsiQueryFeatureStateA [MSI.@]
|
|
|
|
*/
|
2004-07-09 21:38:40 +02:00
|
|
|
INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
|
|
|
|
{
|
2005-10-31 15:07:20 +01:00
|
|
|
LPWSTR szwProduct = NULL, szwFeature= NULL;
|
|
|
|
INSTALLSTATE rc = INSTALLSTATE_UNKNOWN;
|
2004-07-09 21:38:40 +02:00
|
|
|
|
2005-10-31 15:07:20 +01:00
|
|
|
szwProduct = strdupAtoW( szProduct );
|
|
|
|
if ( szProduct && !szwProduct )
|
|
|
|
goto end;
|
2004-07-09 21:38:40 +02:00
|
|
|
|
2005-10-31 15:07:20 +01:00
|
|
|
szwFeature = strdupAtoW( szFeature );
|
|
|
|
if ( szFeature && !szwFeature )
|
|
|
|
goto end;
|
2004-07-09 21:38:40 +02:00
|
|
|
|
|
|
|
rc = MsiQueryFeatureStateW(szwProduct, szwFeature);
|
|
|
|
|
2005-10-31 15:07:20 +01:00
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwProduct);
|
|
|
|
msi_free( szwFeature);
|
2004-07-09 21:38:40 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-04-20 17:18:42 +02:00
|
|
|
/******************************************************************
|
|
|
|
* MsiQueryFeatureStateW [MSI.@]
|
2005-04-28 14:01:06 +02:00
|
|
|
*
|
2006-07-06 12:01:50 +02:00
|
|
|
* Checks the state of a feature
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* szProduct [I] Product's GUID string
|
|
|
|
* szFeature [I] Feature's GUID string
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* INSTALLSTATE_LOCAL Feature is installed and useable
|
|
|
|
* INSTALLSTATE_ABSENT Feature is absent
|
|
|
|
* INSTALLSTATE_ADVERTISED Feature should be installed on demand
|
2006-08-06 12:28:32 +02:00
|
|
|
* INSTALLSTATE_UNKNOWN An error occurred
|
2006-07-06 12:01:50 +02:00
|
|
|
* INSTALLSTATE_INVALIDARG One of the GUIDs was invalid
|
|
|
|
*
|
2005-04-20 17:18:42 +02:00
|
|
|
*/
|
2004-07-09 21:38:40 +02:00
|
|
|
INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
|
|
|
|
{
|
2006-07-19 10:18:02 +02:00
|
|
|
WCHAR squishProduct[33], comp[GUID_SIZE];
|
2006-07-15 04:05:20 +02:00
|
|
|
GUID guid;
|
2007-07-03 05:24:40 +02:00
|
|
|
LPWSTR components, p, parent_feature, path;
|
2005-04-28 14:01:06 +02:00
|
|
|
UINT rc;
|
|
|
|
HKEY hkey;
|
2006-07-15 04:05:20 +02:00
|
|
|
INSTALLSTATE r;
|
2006-07-21 07:04:44 +02:00
|
|
|
BOOL missing = FALSE;
|
2005-04-28 14:01:06 +02:00
|
|
|
|
|
|
|
TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
|
|
|
|
|
2005-10-31 15:07:20 +01:00
|
|
|
if (!szProduct || !szFeature)
|
|
|
|
return INSTALLSTATE_INVALIDARG;
|
|
|
|
|
|
|
|
if (!squash_guid( szProduct, squishProduct ))
|
|
|
|
return INSTALLSTATE_INVALIDARG;
|
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
/* check that it's installed at all */
|
2006-07-06 12:01:50 +02:00
|
|
|
rc = MSIREG_OpenUserFeaturesKey(szProduct, &hkey, FALSE);
|
2005-04-28 14:01:06 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return INSTALLSTATE_UNKNOWN;
|
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
parent_feature = msi_reg_get_val_str( hkey, szFeature );
|
2005-04-28 14:01:06 +02:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
if (!parent_feature)
|
|
|
|
return INSTALLSTATE_UNKNOWN;
|
|
|
|
|
|
|
|
r = (parent_feature[0] == 6) ? INSTALLSTATE_ABSENT : INSTALLSTATE_LOCAL;
|
|
|
|
msi_free(parent_feature);
|
|
|
|
if (r == INSTALLSTATE_ABSENT)
|
|
|
|
return r;
|
2006-07-06 12:01:50 +02:00
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
/* now check if it's complete or advertised */
|
2007-07-03 05:22:57 +02:00
|
|
|
rc = MSIREG_OpenUserDataFeaturesKey(szProduct, &hkey, FALSE);
|
2006-07-15 04:05:20 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
2007-07-03 05:22:57 +02:00
|
|
|
return INSTALLSTATE_ADVERTISED;
|
2006-07-06 12:01:50 +02:00
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
components = msi_reg_get_val_str( hkey, szFeature );
|
|
|
|
RegCloseKey(hkey);
|
2006-07-06 12:01:50 +02:00
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
TRACE("rc = %d buffer = %s\n", rc, debugstr_w(components));
|
2005-10-31 15:07:20 +01:00
|
|
|
|
2006-07-15 04:05:20 +02:00
|
|
|
if (!components)
|
2007-07-03 05:23:28 +02:00
|
|
|
return INSTALLSTATE_ADVERTISED;
|
2006-07-15 04:05:20 +02:00
|
|
|
|
2007-07-03 05:23:58 +02:00
|
|
|
for( p = components; *p && *p != 2 ; p += 20)
|
2006-07-15 04:05:20 +02:00
|
|
|
{
|
|
|
|
if (!decode_base85_guid( p, &guid ))
|
|
|
|
{
|
2007-07-03 05:23:58 +02:00
|
|
|
if (p != components)
|
|
|
|
break;
|
|
|
|
|
|
|
|
msi_free(components);
|
|
|
|
return INSTALLSTATE_BADCONFIG;
|
2006-07-15 04:05:20 +02:00
|
|
|
}
|
2007-07-03 05:23:58 +02:00
|
|
|
|
2006-07-19 10:18:02 +02:00
|
|
|
StringFromGUID2(&guid, comp, GUID_SIZE);
|
2007-07-03 05:24:40 +02:00
|
|
|
rc = MSIREG_OpenUserDataComponentKey(comp, &hkey, FALSE);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
2006-07-15 04:05:20 +02:00
|
|
|
{
|
2007-07-03 05:24:40 +02:00
|
|
|
msi_free(components);
|
|
|
|
return INSTALLSTATE_ADVERTISED;
|
2006-07-15 04:05:20 +02:00
|
|
|
}
|
2007-07-03 05:24:40 +02:00
|
|
|
|
|
|
|
path = msi_reg_get_val_str(hkey, squishProduct);
|
|
|
|
if (!path)
|
|
|
|
missing = TRUE;
|
|
|
|
|
|
|
|
msi_free(path);
|
2006-07-15 04:05:20 +02:00
|
|
|
}
|
|
|
|
|
2006-07-21 07:04:44 +02:00
|
|
|
TRACE("%s %s -> %d\n", debugstr_w(szProduct), debugstr_w(szFeature), r);
|
2006-07-15 04:05:20 +02:00
|
|
|
msi_free(components);
|
|
|
|
|
2006-07-21 07:04:44 +02:00
|
|
|
if (missing)
|
|
|
|
return INSTALLSTATE_ADVERTISED;
|
|
|
|
|
|
|
|
return INSTALLSTATE_LOCAL;
|
2004-07-09 21:38:40 +02:00
|
|
|
}
|
|
|
|
|
2005-04-20 17:18:42 +02:00
|
|
|
/******************************************************************
|
|
|
|
* MsiGetFileVersionA [MSI.@]
|
|
|
|
*/
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
|
|
|
|
DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf)
|
2004-09-06 23:25:48 +02:00
|
|
|
{
|
2005-01-24 12:22:00 +01:00
|
|
|
LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
|
2005-03-24 20:04:06 +01:00
|
|
|
UINT ret = ERROR_OUTOFMEMORY;
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if( szFilePath )
|
|
|
|
{
|
2005-03-24 20:04:06 +01:00
|
|
|
szwFilePath = strdupAtoW( szFilePath );
|
2005-01-24 12:22:00 +01:00
|
|
|
if( !szwFilePath )
|
|
|
|
goto end;
|
2004-09-06 23:25:48 +02:00
|
|
|
}
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
|
|
|
|
{
|
2005-09-20 13:59:14 +02:00
|
|
|
lpwVersionBuff = msi_alloc(*pcchVersionBuf*sizeof(WCHAR));
|
2005-01-24 12:22:00 +01:00
|
|
|
if( !lpwVersionBuff )
|
2004-12-10 16:24:52 +01:00
|
|
|
goto end;
|
2004-09-06 23:25:48 +02:00
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
|
|
|
|
{
|
2007-06-10 09:43:30 +02:00
|
|
|
lpwLangBuff = msi_alloc(*pcchLangBuf*sizeof(WCHAR));
|
2005-01-24 12:22:00 +01:00
|
|
|
if( !lpwLangBuff )
|
2004-12-10 16:24:52 +01:00
|
|
|
goto end;
|
2004-09-06 23:25:48 +02:00
|
|
|
}
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf,
|
|
|
|
lpwLangBuff, pcchLangBuf);
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if( lpwVersionBuff )
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, lpwVersionBuff, -1,
|
|
|
|
lpVersionBuf, *pcchVersionBuf, NULL, NULL);
|
|
|
|
if( lpwLangBuff )
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1,
|
|
|
|
lpLangBuf, *pcchLangBuf, NULL, NULL);
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2004-12-10 16:24:52 +01:00
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(szwFilePath);
|
|
|
|
msi_free(lpwVersionBuff);
|
|
|
|
msi_free(lpwLangBuff);
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2004-09-06 23:25:48 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-04-20 17:18:42 +02:00
|
|
|
/******************************************************************
|
|
|
|
* MsiGetFileVersionW [MSI.@]
|
|
|
|
*/
|
2005-01-24 12:22:00 +01:00
|
|
|
UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
|
|
|
|
DWORD* pcchVersionBuf, LPWSTR lpLangBuf, DWORD* pcchLangBuf)
|
2004-09-06 23:25:48 +02:00
|
|
|
{
|
2007-02-17 20:24:20 +01:00
|
|
|
static const WCHAR szVersionResource[] = {'\\',0};
|
2005-01-24 12:22:00 +01:00
|
|
|
static const WCHAR szVersionFormat[] = {
|
|
|
|
'%','d','.','%','d','.','%','d','.','%','d',0};
|
2004-09-06 23:25:48 +02:00
|
|
|
static const WCHAR szLangFormat[] = {'%','d',0};
|
|
|
|
UINT ret = 0;
|
|
|
|
DWORD dwVerLen;
|
|
|
|
LPVOID lpVer = NULL;
|
|
|
|
VS_FIXEDFILEINFO *ffi;
|
|
|
|
UINT puLen;
|
|
|
|
WCHAR tmp[32];
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %p %d %p %d\n", debugstr_w(szFilePath),
|
2004-09-06 23:25:48 +02:00
|
|
|
lpVersionBuf, pcchVersionBuf?*pcchVersionBuf:0,
|
|
|
|
lpLangBuf, pcchLangBuf?*pcchLangBuf:0);
|
|
|
|
|
|
|
|
dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL);
|
2005-01-24 12:22:00 +01:00
|
|
|
if( !dwVerLen )
|
2004-09-06 23:25:48 +02:00
|
|
|
return GetLastError();
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
lpVer = msi_alloc(dwVerLen);
|
2005-01-24 12:22:00 +01:00
|
|
|
if( !lpVer )
|
|
|
|
{
|
2004-09-06 23:25:48 +02:00
|
|
|
ret = ERROR_OUTOFMEMORY;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if( !GetFileVersionInfoW(szFilePath, 0, dwVerLen, lpVer) )
|
|
|
|
{
|
2004-09-06 23:25:48 +02:00
|
|
|
ret = GetLastError();
|
|
|
|
goto end;
|
|
|
|
}
|
2005-01-24 12:22:00 +01:00
|
|
|
if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
|
|
|
|
{
|
|
|
|
if( VerQueryValueW(lpVer, szVersionResource, (LPVOID*)&ffi, &puLen) &&
|
|
|
|
(puLen > 0) )
|
|
|
|
{
|
|
|
|
wsprintfW(tmp, szVersionFormat,
|
|
|
|
HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
|
|
|
|
HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
|
2004-09-06 23:25:48 +02:00
|
|
|
lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
|
2005-03-29 13:28:57 +02:00
|
|
|
*pcchVersionBuf = lstrlenW(lpVersionBuf);
|
2004-09-06 23:25:48 +02:00
|
|
|
}
|
2005-01-24 12:22:00 +01:00
|
|
|
else
|
|
|
|
{
|
2004-09-06 23:25:48 +02:00
|
|
|
*lpVersionBuf = 0;
|
|
|
|
*pcchVersionBuf = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-24 12:22:00 +01:00
|
|
|
if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
|
|
|
|
{
|
2004-09-06 23:25:48 +02:00
|
|
|
DWORD lang = GetUserDefaultLangID();
|
2005-01-24 12:22:00 +01:00
|
|
|
|
2004-09-06 23:25:48 +02:00
|
|
|
FIXME("Retrieve language from file\n");
|
|
|
|
wsprintfW(tmp, szLangFormat, lang);
|
|
|
|
lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
|
2005-03-29 13:28:57 +02:00
|
|
|
*pcchLangBuf = lstrlenW(lpLangBuf);
|
2004-09-06 23:25:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(lpVer);
|
2004-09-06 23:25:48 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-10-29 13:36:57 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFeatureUsageW [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetFeatureUsageW( LPCWSTR szProduct, LPCWSTR szFeature,
|
|
|
|
DWORD* pdwUseCount, WORD* pwDateUsed )
|
2005-01-03 17:54:43 +01:00
|
|
|
{
|
|
|
|
FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szFeature),
|
|
|
|
pdwUseCount, pwDateUsed);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-10-29 13:36:57 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFeatureUsageA [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetFeatureUsageA( LPCSTR szProduct, LPCSTR szFeature,
|
|
|
|
DWORD* pdwUseCount, WORD* pwDateUsed )
|
2005-01-03 17:54:43 +01:00
|
|
|
{
|
2005-10-29 13:36:57 +02:00
|
|
|
LPWSTR prod = NULL, feat = NULL;
|
|
|
|
UINT ret = ERROR_OUTOFMEMORY;
|
|
|
|
|
|
|
|
TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szFeature),
|
2005-01-03 17:54:43 +01:00
|
|
|
pdwUseCount, pwDateUsed);
|
2005-10-29 13:36:57 +02:00
|
|
|
|
|
|
|
prod = strdupAtoW( szProduct );
|
|
|
|
if (szProduct && !prod)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
feat = strdupAtoW( szFeature );
|
|
|
|
if (szFeature && !feat)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
ret = MsiGetFeatureUsageW( prod, feat, pdwUseCount, pwDateUsed );
|
|
|
|
|
|
|
|
end:
|
|
|
|
msi_free( prod );
|
|
|
|
msi_free( feat );
|
|
|
|
|
|
|
|
return ret;
|
2004-06-29 06:04:13 +02:00
|
|
|
}
|
2005-01-19 17:58:03 +01:00
|
|
|
|
2005-10-29 13:36:57 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiUseFeatureExW [MSI.@]
|
|
|
|
*/
|
|
|
|
INSTALLSTATE WINAPI MsiUseFeatureExW( LPCWSTR szProduct, LPCWSTR szFeature,
|
|
|
|
DWORD dwInstallMode, DWORD dwReserved )
|
2005-01-19 17:58:03 +01:00
|
|
|
{
|
2005-10-31 15:07:20 +01:00
|
|
|
INSTALLSTATE state;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %s %i %i\n", debugstr_w(szProduct), debugstr_w(szFeature),
|
2005-01-19 17:58:03 +01:00
|
|
|
dwInstallMode, dwReserved);
|
2005-02-16 17:24:38 +01:00
|
|
|
|
2005-10-31 15:07:20 +01:00
|
|
|
state = MsiQueryFeatureStateW( szProduct, szFeature );
|
|
|
|
|
|
|
|
if (dwReserved)
|
|
|
|
return INSTALLSTATE_INVALIDARG;
|
|
|
|
|
|
|
|
if (state == INSTALLSTATE_LOCAL && dwInstallMode != INSTALLMODE_NODETECTION)
|
|
|
|
{
|
|
|
|
FIXME("mark product %s feature %s as used\n",
|
|
|
|
debugstr_w(szProduct), debugstr_w(szFeature) );
|
|
|
|
}
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-10-31 15:07:20 +01:00
|
|
|
return state;
|
2005-02-16 17:24:38 +01:00
|
|
|
}
|
|
|
|
|
2005-04-20 17:18:42 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiUseFeatureExA [MSI.@]
|
|
|
|
*/
|
2005-10-29 13:36:57 +02:00
|
|
|
INSTALLSTATE WINAPI MsiUseFeatureExA( LPCSTR szProduct, LPCSTR szFeature,
|
|
|
|
DWORD dwInstallMode, DWORD dwReserved )
|
2005-02-16 17:24:38 +01:00
|
|
|
{
|
2005-10-29 13:36:57 +02:00
|
|
|
INSTALLSTATE ret = INSTALLSTATE_UNKNOWN;
|
|
|
|
LPWSTR prod = NULL, feat = NULL;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %s %i %i\n", debugstr_a(szProduct), debugstr_a(szFeature),
|
2005-02-16 17:24:38 +01:00
|
|
|
dwInstallMode, dwReserved);
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2005-10-29 13:36:57 +02:00
|
|
|
prod = strdupAtoW( szProduct );
|
|
|
|
if (szProduct && !prod)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
feat = strdupAtoW( szFeature );
|
|
|
|
if (szFeature && !feat)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
ret = MsiUseFeatureExW( prod, feat, dwInstallMode, dwReserved );
|
|
|
|
|
|
|
|
end:
|
|
|
|
msi_free( prod );
|
|
|
|
msi_free( feat );
|
|
|
|
|
|
|
|
return ret;
|
2005-02-16 17:24:38 +01:00
|
|
|
}
|
|
|
|
|
2006-07-05 11:34:13 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiUseFeatureW [MSI.@]
|
|
|
|
*/
|
2005-10-29 13:36:57 +02:00
|
|
|
INSTALLSTATE WINAPI MsiUseFeatureW( LPCWSTR szProduct, LPCWSTR szFeature )
|
2005-02-16 17:24:38 +01:00
|
|
|
{
|
2006-07-05 11:34:13 +02:00
|
|
|
return MsiUseFeatureExW(szProduct, szFeature, 0, 0);
|
2005-02-16 17:24:38 +01:00
|
|
|
}
|
|
|
|
|
2006-07-05 11:34:13 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiUseFeatureA [MSI.@]
|
|
|
|
*/
|
2005-10-29 13:36:57 +02:00
|
|
|
INSTALLSTATE WINAPI MsiUseFeatureA( LPCSTR szProduct, LPCSTR szFeature )
|
2005-02-16 17:24:38 +01:00
|
|
|
{
|
2006-07-05 11:34:13 +02:00
|
|
|
return MsiUseFeatureExA(szProduct, szFeature, 0, 0);
|
2005-01-19 17:58:03 +01:00
|
|
|
}
|
|
|
|
|
2005-11-10 12:06:04 +01:00
|
|
|
/***********************************************************************
|
2006-07-21 07:05:29 +02:00
|
|
|
* MSI_ProvideQualifiedComponentEx [internal]
|
2005-11-10 12:06:04 +01:00
|
|
|
*/
|
2006-10-09 09:05:04 +02:00
|
|
|
static UINT WINAPI MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent,
|
2007-06-05 19:53:43 +02:00
|
|
|
LPCWSTR szQualifier, DWORD dwInstallMode, LPCWSTR szProduct,
|
2006-07-21 07:05:29 +02:00
|
|
|
DWORD Unused1, DWORD Unused2, awstring *lpPathBuf,
|
2005-01-24 12:22:00 +01:00
|
|
|
DWORD* pcchPathBuf)
|
2005-01-19 17:58:03 +01:00
|
|
|
{
|
2006-07-21 07:05:29 +02:00
|
|
|
WCHAR product[MAX_FEATURE_CHARS+1], component[MAX_FEATURE_CHARS+1],
|
|
|
|
feature[MAX_FEATURE_CHARS+1];
|
2005-04-20 14:50:05 +02:00
|
|
|
LPWSTR info;
|
2006-07-21 07:05:29 +02:00
|
|
|
HKEY hkey;
|
2005-04-20 14:50:05 +02:00
|
|
|
DWORD sz;
|
2006-07-21 07:05:29 +02:00
|
|
|
UINT rc;
|
2005-04-20 14:50:05 +02:00
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %s %i %s %i %i %p %p\n", debugstr_w(szComponent),
|
2005-01-24 12:22:00 +01:00
|
|
|
debugstr_w(szQualifier), dwInstallMode, debugstr_w(szProduct),
|
|
|
|
Unused1, Unused2, lpPathBuf, pcchPathBuf);
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2005-04-20 14:50:05 +02:00
|
|
|
rc = MSIREG_OpenUserComponentsKey(szComponent, &hkey, FALSE);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_INDEX_ABSENT;
|
|
|
|
|
2006-07-21 07:05:15 +02:00
|
|
|
info = msi_reg_get_val_str( hkey, szQualifier );
|
|
|
|
RegCloseKey(hkey);
|
2005-04-20 14:50:05 +02:00
|
|
|
|
2006-07-21 07:05:15 +02:00
|
|
|
if (!info)
|
2005-04-20 14:50:05 +02:00
|
|
|
return ERROR_INDEX_ABSENT;
|
|
|
|
|
2005-11-10 12:06:04 +01:00
|
|
|
MsiDecomposeDescriptorW(info, product, feature, component, &sz);
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2005-04-20 14:50:05 +02:00
|
|
|
if (!szProduct)
|
2006-07-21 07:05:29 +02:00
|
|
|
rc = MSI_GetComponentPath(product, component, lpPathBuf, pcchPathBuf);
|
2005-04-20 14:50:05 +02:00
|
|
|
else
|
2006-07-21 07:05:29 +02:00
|
|
|
rc = MSI_GetComponentPath(szProduct, component, lpPathBuf, pcchPathBuf);
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2006-07-27 16:17:57 +02:00
|
|
|
msi_free( info );
|
2005-04-21 19:24:27 +02:00
|
|
|
|
2006-07-21 07:05:29 +02:00
|
|
|
if (rc != INSTALLSTATE_LOCAL)
|
2005-04-21 19:24:27 +02:00
|
|
|
return ERROR_FILE_NOT_FOUND;
|
2006-07-21 07:05:29 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiProvideQualifiedComponentExW [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
|
|
|
|
LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR szProduct,
|
|
|
|
DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf,
|
|
|
|
DWORD* pcchPathBuf)
|
|
|
|
{
|
|
|
|
awstring path;
|
|
|
|
|
|
|
|
path.unicode = TRUE;
|
|
|
|
path.str.w = lpPathBuf;
|
|
|
|
|
|
|
|
return MSI_ProvideQualifiedComponentEx(szComponent, szQualifier,
|
|
|
|
dwInstallMode, szProduct, Unused1, Unused2, &path, pcchPathBuf);
|
2005-04-20 14:50:05 +02:00
|
|
|
}
|
|
|
|
|
2006-07-21 07:05:00 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiProvideQualifiedComponentExA [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiProvideQualifiedComponentExA(LPCSTR szComponent,
|
|
|
|
LPCSTR szQualifier, DWORD dwInstallMode, LPSTR szProduct,
|
|
|
|
DWORD Unused1, DWORD Unused2, LPSTR lpPathBuf,
|
|
|
|
DWORD* pcchPathBuf)
|
|
|
|
{
|
2006-07-21 07:05:29 +02:00
|
|
|
LPWSTR szwComponent, szwQualifier = NULL, szwProduct = NULL;
|
|
|
|
UINT r = ERROR_OUTOFMEMORY;
|
|
|
|
awstring path;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %s %u %s %u %u %p %p\n", debugstr_a(szComponent),
|
2006-07-21 07:05:00 +02:00
|
|
|
debugstr_a(szQualifier), dwInstallMode, debugstr_a(szProduct),
|
|
|
|
Unused1, Unused2, lpPathBuf, pcchPathBuf);
|
|
|
|
|
2006-07-21 07:05:29 +02:00
|
|
|
szwComponent = strdupAtoW( szComponent );
|
|
|
|
if (szComponent && !szwComponent)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
szwQualifier = strdupAtoW( szQualifier );
|
|
|
|
if (szQualifier && !szwQualifier)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
szwProduct = strdupAtoW( szProduct );
|
|
|
|
if (szProduct && !szwProduct)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
path.unicode = FALSE;
|
|
|
|
path.str.a = lpPathBuf;
|
|
|
|
|
|
|
|
r = MSI_ProvideQualifiedComponentEx(szwComponent, szwQualifier,
|
|
|
|
dwInstallMode, szwProduct, Unused1,
|
|
|
|
Unused2, &path, pcchPathBuf);
|
|
|
|
end:
|
|
|
|
msi_free(szwProduct);
|
|
|
|
msi_free(szwComponent);
|
|
|
|
msi_free(szwQualifier);
|
|
|
|
|
|
|
|
return r;
|
2006-07-21 07:05:00 +02:00
|
|
|
}
|
|
|
|
|
2005-04-22 21:04:41 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiProvideQualifiedComponentW [MSI.@]
|
|
|
|
*/
|
2005-04-20 14:50:05 +02:00
|
|
|
UINT WINAPI MsiProvideQualifiedComponentW( LPCWSTR szComponent,
|
|
|
|
LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf,
|
|
|
|
DWORD* pcchPathBuf)
|
|
|
|
{
|
|
|
|
return MsiProvideQualifiedComponentExW(szComponent, szQualifier,
|
|
|
|
dwInstallMode, NULL, 0, 0, lpPathBuf, pcchPathBuf);
|
|
|
|
}
|
|
|
|
|
2005-04-22 21:04:41 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiProvideQualifiedComponentA [MSI.@]
|
|
|
|
*/
|
2005-04-20 14:50:05 +02:00
|
|
|
UINT WINAPI MsiProvideQualifiedComponentA( LPCSTR szComponent,
|
|
|
|
LPCSTR szQualifier, DWORD dwInstallMode, LPSTR lpPathBuf,
|
|
|
|
DWORD* pcchPathBuf)
|
|
|
|
{
|
2006-07-21 07:05:29 +02:00
|
|
|
return MsiProvideQualifiedComponentExA(szComponent, szQualifier,
|
|
|
|
dwInstallMode, NULL, 0, 0, lpPathBuf, pcchPathBuf);
|
2005-01-19 17:58:03 +01:00
|
|
|
}
|
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MSI_GetUserInfo [internal]
|
|
|
|
*/
|
2006-10-09 09:05:04 +02:00
|
|
|
static USERINFOSTATE WINAPI MSI_GetUserInfo(LPCWSTR szProduct,
|
2006-07-24 08:25:29 +02:00
|
|
|
awstring *lpUserNameBuf, DWORD* pcchUserNameBuf,
|
|
|
|
awstring *lpOrgNameBuf, DWORD* pcchOrgNameBuf,
|
|
|
|
awstring *lpSerialBuf, DWORD* pcchSerialBuf)
|
2005-01-19 17:58:03 +01:00
|
|
|
{
|
2005-05-20 20:59:11 +02:00
|
|
|
HKEY hkey;
|
2006-07-24 08:25:29 +02:00
|
|
|
LPWSTR user, org, serial;
|
|
|
|
UINT r;
|
|
|
|
USERINFOSTATE state;
|
2005-05-20 20:59:11 +02:00
|
|
|
|
|
|
|
TRACE("%s %p %p %p %p %p %p\n",debugstr_w(szProduct), lpUserNameBuf,
|
2005-02-10 19:57:42 +01:00
|
|
|
pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
|
|
|
|
pcchSerialBuf);
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
if (!szProduct)
|
|
|
|
return USERINFOSTATE_INVALIDARG;
|
|
|
|
|
|
|
|
r = MSIREG_OpenUninstallKey(szProduct, &hkey, FALSE);
|
|
|
|
if (r != ERROR_SUCCESS)
|
2005-05-20 20:59:11 +02:00
|
|
|
return USERINFOSTATE_UNKNOWN;
|
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
user = msi_reg_get_val_str( hkey, INSTALLPROPERTY_REGOWNERW );
|
|
|
|
org = msi_reg_get_val_str( hkey, INSTALLPROPERTY_REGCOMPANYW );
|
|
|
|
serial = msi_reg_get_val_str( hkey, INSTALLPROPERTY_PRODUCTIDW );
|
2005-05-20 20:59:11 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
RegCloseKey(hkey);
|
2005-05-20 20:59:11 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
state = USERINFOSTATE_PRESENT;
|
2005-05-20 20:59:11 +02:00
|
|
|
|
2007-04-12 07:46:43 +02:00
|
|
|
if (user)
|
|
|
|
{
|
|
|
|
r = msi_strcpy_to_awstring( user, lpUserNameBuf, pcchUserNameBuf );
|
|
|
|
if (r == ERROR_MORE_DATA)
|
|
|
|
state = USERINFOSTATE_MOREDATA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
state = USERINFOSTATE_ABSENT;
|
|
|
|
if (org)
|
|
|
|
{
|
|
|
|
r = msi_strcpy_to_awstring( org, lpOrgNameBuf, pcchOrgNameBuf );
|
|
|
|
if (r == ERROR_MORE_DATA && state == USERINFOSTATE_PRESENT)
|
|
|
|
state = USERINFOSTATE_MOREDATA;
|
|
|
|
}
|
|
|
|
/* msdn states: The user information is considered to be present even in the absence of a company name. */
|
|
|
|
if (serial)
|
|
|
|
{
|
|
|
|
r = msi_strcpy_to_awstring( serial, lpSerialBuf, pcchSerialBuf );
|
|
|
|
if (r == ERROR_MORE_DATA && state == USERINFOSTATE_PRESENT)
|
|
|
|
state = USERINFOSTATE_MOREDATA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
state = USERINFOSTATE_ABSENT;
|
2005-05-20 20:59:11 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
msi_free( user );
|
|
|
|
msi_free( org );
|
|
|
|
msi_free( serial );
|
2005-05-20 20:59:11 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
return state;
|
|
|
|
}
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetUserInfoW [MSI.@]
|
|
|
|
*/
|
|
|
|
USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct,
|
|
|
|
LPWSTR lpUserNameBuf, DWORD* pcchUserNameBuf,
|
|
|
|
LPWSTR lpOrgNameBuf, DWORD* pcchOrgNameBuf,
|
|
|
|
LPWSTR lpSerialBuf, DWORD* pcchSerialBuf)
|
|
|
|
{
|
|
|
|
awstring user, org, serial;
|
|
|
|
|
|
|
|
user.unicode = TRUE;
|
|
|
|
user.str.w = lpUserNameBuf;
|
|
|
|
org.unicode = TRUE;
|
|
|
|
org.str.w = lpOrgNameBuf;
|
|
|
|
serial.unicode = TRUE;
|
|
|
|
serial.str.w = lpSerialBuf;
|
|
|
|
|
|
|
|
return MSI_GetUserInfo( szProduct, &user, pcchUserNameBuf,
|
|
|
|
&org, pcchOrgNameBuf,
|
|
|
|
&serial, pcchSerialBuf );
|
2005-02-10 19:57:42 +01:00
|
|
|
}
|
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct,
|
|
|
|
LPSTR lpUserNameBuf, DWORD* pcchUserNameBuf,
|
|
|
|
LPSTR lpOrgNameBuf, DWORD* pcchOrgNameBuf,
|
|
|
|
LPSTR lpSerialBuf, DWORD* pcchSerialBuf)
|
2005-02-10 19:57:42 +01:00
|
|
|
{
|
2006-07-24 08:25:29 +02:00
|
|
|
awstring user, org, serial;
|
|
|
|
LPWSTR prod;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
prod = strdupAtoW( szProduct );
|
|
|
|
if (szProduct && !prod)
|
|
|
|
return ERROR_OUTOFMEMORY;
|
2005-03-29 13:28:57 +02:00
|
|
|
|
2006-07-24 08:25:29 +02:00
|
|
|
user.unicode = FALSE;
|
|
|
|
user.str.a = lpUserNameBuf;
|
|
|
|
org.unicode = FALSE;
|
|
|
|
org.str.a = lpOrgNameBuf;
|
|
|
|
serial.unicode = FALSE;
|
|
|
|
serial.str.a = lpSerialBuf;
|
|
|
|
|
|
|
|
r = MSI_GetUserInfo( prod, &user, pcchUserNameBuf,
|
|
|
|
&org, pcchOrgNameBuf,
|
|
|
|
&serial, pcchSerialBuf );
|
|
|
|
|
|
|
|
msi_free( prod );
|
|
|
|
|
|
|
|
return r;
|
2005-01-19 17:58:03 +01:00
|
|
|
}
|
|
|
|
|
2005-01-26 20:41:13 +01:00
|
|
|
UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
|
2005-01-19 17:58:03 +01:00
|
|
|
{
|
2005-05-20 20:59:11 +02:00
|
|
|
MSIHANDLE handle;
|
|
|
|
UINT rc;
|
2005-05-23 18:23:54 +02:00
|
|
|
MSIPACKAGE *package;
|
2005-05-20 20:59:11 +02:00
|
|
|
static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
|
|
|
|
|
|
|
|
TRACE("(%s)\n",debugstr_w(szProduct));
|
|
|
|
|
|
|
|
rc = MsiOpenProductW(szProduct,&handle);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2005-05-23 18:23:54 +02:00
|
|
|
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
|
2007-06-25 21:47:38 +02:00
|
|
|
rc = ACTION_PerformUIAction(package, szFirstRun, -1);
|
2005-05-23 18:23:54 +02:00
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
|
2005-05-20 20:59:11 +02:00
|
|
|
MsiCloseHandle(handle);
|
|
|
|
|
|
|
|
return rc;
|
2005-01-26 20:41:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
|
|
|
|
{
|
2005-05-20 20:59:11 +02:00
|
|
|
MSIHANDLE handle;
|
|
|
|
UINT rc;
|
2005-05-23 18:23:54 +02:00
|
|
|
MSIPACKAGE *package;
|
2005-05-20 20:59:11 +02:00
|
|
|
static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
|
|
|
|
|
|
|
|
TRACE("(%s)\n",debugstr_a(szProduct));
|
|
|
|
|
|
|
|
rc = MsiOpenProductA(szProduct,&handle);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2005-05-23 18:23:54 +02:00
|
|
|
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
|
2007-06-25 21:47:38 +02:00
|
|
|
rc = ACTION_PerformUIAction(package, szFirstRun, -1);
|
2005-05-23 18:23:54 +02:00
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
|
2005-05-20 20:59:11 +02:00
|
|
|
MsiCloseHandle(handle);
|
|
|
|
|
|
|
|
return rc;
|
2005-01-26 20:41:13 +01:00
|
|
|
}
|
|
|
|
|
2005-09-16 20:45:04 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiConfigureFeatureA [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiConfigureFeatureA(LPCSTR szProduct, LPCSTR szFeature, INSTALLSTATE eInstallState)
|
2005-08-03 12:56:43 +02:00
|
|
|
{
|
2006-07-17 10:44:29 +02:00
|
|
|
LPWSTR prod, feat = NULL;
|
|
|
|
UINT r = ERROR_OUTOFMEMORY;
|
|
|
|
|
|
|
|
TRACE("%s %s %i\n", debugstr_a(szProduct), debugstr_a(szFeature), eInstallState);
|
|
|
|
|
|
|
|
prod = strdupAtoW( szProduct );
|
|
|
|
if (szProduct && !prod)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
feat = strdupAtoW( szFeature );
|
|
|
|
if (szFeature && !feat)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
r = MsiConfigureFeatureW(prod, feat, eInstallState);
|
|
|
|
|
|
|
|
end:
|
|
|
|
msi_free(feat);
|
|
|
|
msi_free(prod);
|
|
|
|
|
|
|
|
return r;
|
2005-08-03 12:56:43 +02:00
|
|
|
}
|
|
|
|
|
2005-09-16 20:45:04 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiConfigureFeatureW [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLSTATE eInstallState)
|
|
|
|
{
|
2006-07-19 10:39:04 +02:00
|
|
|
static const WCHAR szCostInit[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 };
|
|
|
|
MSIPACKAGE *package = NULL;
|
|
|
|
UINT r;
|
|
|
|
WCHAR sourcepath[MAX_PATH], filename[MAX_PATH];
|
|
|
|
DWORD sz;
|
|
|
|
|
|
|
|
TRACE("%s %s %i\n", debugstr_w(szProduct), debugstr_w(szFeature), eInstallState);
|
|
|
|
|
|
|
|
if (!szProduct || !szFeature)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2006-07-24 13:34:14 +02:00
|
|
|
switch (eInstallState)
|
|
|
|
{
|
|
|
|
case INSTALLSTATE_DEFAULT:
|
|
|
|
/* FIXME: how do we figure out the default location? */
|
|
|
|
eInstallState = INSTALLSTATE_LOCAL;
|
|
|
|
break;
|
|
|
|
case INSTALLSTATE_LOCAL:
|
|
|
|
case INSTALLSTATE_SOURCE:
|
|
|
|
case INSTALLSTATE_ABSENT:
|
|
|
|
case INSTALLSTATE_ADVERTISED:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
2006-07-19 10:39:04 +02:00
|
|
|
r = MSI_OpenProductW( szProduct, &package );
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
sz = sizeof(sourcepath);
|
|
|
|
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
|
|
|
|
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
|
|
|
|
|
|
|
|
sz = sizeof(filename);
|
|
|
|
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
|
|
|
|
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
|
|
|
|
|
|
|
|
lstrcatW( sourcepath, filename );
|
|
|
|
|
|
|
|
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
|
|
|
|
|
2007-06-25 21:47:38 +02:00
|
|
|
r = ACTION_PerformUIAction( package, szCostInit, -1 );
|
2006-07-19 10:39:04 +02:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
r = MSI_SetFeatureStateW( package, szFeature, eInstallState);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
r = MSI_InstallPackage( package, sourcepath, NULL );
|
|
|
|
|
|
|
|
end:
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
|
|
|
|
return r;
|
2005-09-16 20:45:04 +02:00
|
|
|
}
|
2005-08-03 12:56:43 +02:00
|
|
|
|
2006-07-17 10:45:04 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiCreateAndVerifyInstallerDirectory [MSI.@]
|
|
|
|
*
|
|
|
|
* Notes: undocumented
|
|
|
|
*/
|
2005-03-23 11:24:53 +01:00
|
|
|
UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved)
|
2005-01-26 20:41:13 +01:00
|
|
|
{
|
2005-05-11 14:01:12 +02:00
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%d\n", dwReserved);
|
2006-07-17 10:45:04 +02:00
|
|
|
|
|
|
|
if (dwReserved)
|
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("dwReserved=%d\n", dwReserved);
|
2006-07-17 10:45:04 +02:00
|
|
|
return ERROR_INVALID_PARAMETER;
|
2005-05-11 14:01:12 +02:00
|
|
|
}
|
|
|
|
|
2006-07-17 10:45:04 +02:00
|
|
|
if (!GetWindowsDirectoryW(path, MAX_PATH))
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2005-05-11 14:01:12 +02:00
|
|
|
|
2006-07-17 10:45:04 +02:00
|
|
|
lstrcatW(path, installerW);
|
2005-05-11 14:01:12 +02:00
|
|
|
|
2006-07-17 10:45:04 +02:00
|
|
|
if (!CreateDirectoryW(path, NULL))
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2005-05-11 14:01:12 +02:00
|
|
|
|
2006-07-17 10:45:04 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-01-19 17:58:03 +01:00
|
|
|
}
|
2005-02-10 18:10:14 +01:00
|
|
|
|
2005-10-29 12:28:30 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetShortcutTargetA [MSI.@]
|
|
|
|
*/
|
2005-02-10 18:10:14 +01:00
|
|
|
UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget,
|
2005-02-16 17:24:38 +01:00
|
|
|
LPSTR szProductCode, LPSTR szFeatureId,
|
|
|
|
LPSTR szComponentCode )
|
2005-02-10 18:10:14 +01:00
|
|
|
{
|
2005-09-23 12:48:42 +02:00
|
|
|
LPWSTR target;
|
|
|
|
const int len = MAX_FEATURE_CHARS+1;
|
|
|
|
WCHAR product[MAX_FEATURE_CHARS+1], feature[MAX_FEATURE_CHARS+1], component[MAX_FEATURE_CHARS+1];
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
target = strdupAtoW( szShortcutTarget );
|
|
|
|
if (szShortcutTarget && !target )
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
product[0] = 0;
|
|
|
|
feature[0] = 0;
|
|
|
|
component[0] = 0;
|
|
|
|
r = MsiGetShortcutTargetW( target, product, feature, component );
|
|
|
|
msi_free( target );
|
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, product, -1, szProductCode, len, NULL, NULL );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, feature, -1, szFeatureId, len, NULL, NULL );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, component, -1, szComponentCode, len, NULL, NULL );
|
|
|
|
}
|
|
|
|
return r;
|
2005-02-10 18:10:14 +01:00
|
|
|
}
|
|
|
|
|
2005-10-29 12:28:30 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetShortcutTargetW [MSI.@]
|
|
|
|
*/
|
2005-02-10 18:10:14 +01:00
|
|
|
UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
|
2005-02-16 17:24:38 +01:00
|
|
|
LPWSTR szProductCode, LPWSTR szFeatureId,
|
|
|
|
LPWSTR szComponentCode )
|
2005-02-10 18:10:14 +01:00
|
|
|
{
|
2005-10-29 12:28:30 +02:00
|
|
|
IShellLinkDataList *dl = NULL;
|
|
|
|
IPersistFile *pf = NULL;
|
|
|
|
LPEXP_DARWIN_LINK darwin = NULL;
|
2005-11-09 11:58:24 +01:00
|
|
|
HRESULT r, init;
|
2005-10-29 12:28:30 +02:00
|
|
|
|
|
|
|
TRACE("%s %p %p %p\n", debugstr_w(szShortcutTarget),
|
|
|
|
szProductCode, szFeatureId, szComponentCode );
|
|
|
|
|
2005-11-09 11:58:24 +01:00
|
|
|
init = CoInitialize(NULL);
|
2005-10-29 12:28:30 +02:00
|
|
|
|
|
|
|
r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IPersistFile, (LPVOID*) &pf );
|
|
|
|
if( SUCCEEDED( r ) )
|
|
|
|
{
|
|
|
|
r = IPersistFile_Load( pf, szShortcutTarget,
|
|
|
|
STGM_READ | STGM_SHARE_DENY_WRITE );
|
|
|
|
if( SUCCEEDED( r ) )
|
|
|
|
{
|
|
|
|
r = IPersistFile_QueryInterface( pf, &IID_IShellLinkDataList,
|
2005-11-09 11:58:24 +01:00
|
|
|
(LPVOID*) &dl );
|
2005-10-29 12:28:30 +02:00
|
|
|
if( SUCCEEDED( r ) )
|
|
|
|
{
|
|
|
|
IShellLinkDataList_CopyDataBlock( dl, EXP_DARWIN_ID_SIG,
|
|
|
|
(LPVOID) &darwin );
|
|
|
|
IShellLinkDataList_Release( dl );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IPersistFile_Release( pf );
|
|
|
|
}
|
|
|
|
|
2005-11-09 11:58:24 +01:00
|
|
|
if (SUCCEEDED(init))
|
|
|
|
CoUninitialize();
|
2005-10-29 12:28:30 +02:00
|
|
|
|
|
|
|
TRACE("darwin = %p\n", darwin);
|
|
|
|
|
|
|
|
if (darwin)
|
|
|
|
{
|
|
|
|
DWORD sz;
|
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
ret = MsiDecomposeDescriptorW( darwin->szwDarwinID,
|
|
|
|
szProductCode, szFeatureId, szComponentCode, &sz );
|
|
|
|
LocalFree( darwin );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2005-02-10 18:10:14 +01:00
|
|
|
}
|
2005-02-16 17:24:38 +01:00
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
|
2005-02-16 17:24:38 +01:00
|
|
|
DWORD dwReinstallMode )
|
|
|
|
{
|
2005-09-28 12:13:18 +02:00
|
|
|
MSIPACKAGE* package = NULL;
|
|
|
|
UINT r;
|
2005-09-07 15:26:06 +02:00
|
|
|
WCHAR sourcepath[MAX_PATH];
|
|
|
|
WCHAR filename[MAX_PATH];
|
2006-07-18 11:45:41 +02:00
|
|
|
static const WCHAR szLogVerbose[] = {
|
|
|
|
' ','L','O','G','V','E','R','B','O','S','E',0 };
|
|
|
|
static const WCHAR szInstalled[] = { 'I','n','s','t','a','l','l','e','d',0};
|
|
|
|
static const WCHAR szReinstall[] = {'R','E','I','N','S','T','A','L','L',0};
|
|
|
|
static const WCHAR szReinstallMode[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
|
|
|
|
static const WCHAR szOne[] = {'1',0};
|
2005-09-07 15:26:06 +02:00
|
|
|
WCHAR reinstallmode[11];
|
|
|
|
LPWSTR ptr;
|
2006-07-18 11:45:41 +02:00
|
|
|
DWORD sz;
|
2005-09-07 15:26:06 +02:00
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %s %i\n", debugstr_w(szProduct), debugstr_w(szFeature),
|
2005-02-16 17:24:38 +01:00
|
|
|
dwReinstallMode);
|
2005-09-07 15:26:06 +02:00
|
|
|
|
|
|
|
ptr = reinstallmode;
|
|
|
|
|
|
|
|
if (dwReinstallMode & REINSTALLMODE_FILEMISSING)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'p';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_FILEOLDERVERSION)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'o';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_FILEEQUALVERSION)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'w';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_FILEEXACT)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'd';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_FILEVERIFY)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'c';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_FILEREPLACE)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'a';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_USERDATA)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'u';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_MACHINEDATA)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'm';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_SHORTCUT)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 's';
|
2005-09-07 15:26:06 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_PACKAGE)
|
2006-04-18 19:29:03 +02:00
|
|
|
*ptr++ = 'v';
|
|
|
|
*ptr = 0;
|
2005-09-07 15:26:06 +02:00
|
|
|
|
|
|
|
sz = sizeof(sourcepath);
|
|
|
|
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
|
2006-07-18 11:45:41 +02:00
|
|
|
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
|
2005-09-07 15:26:06 +02:00
|
|
|
|
|
|
|
sz = sizeof(filename);
|
|
|
|
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
|
|
|
|
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
|
|
|
|
|
2006-07-18 11:45:41 +02:00
|
|
|
lstrcatW( sourcepath, filename );
|
2005-09-07 15:26:06 +02:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
if (dwReinstallMode & REINSTALLMODE_PACKAGE)
|
|
|
|
r = MSI_OpenPackageW( sourcepath, &package );
|
2005-09-07 15:26:06 +02:00
|
|
|
else
|
2005-09-28 12:13:18 +02:00
|
|
|
r = MSI_OpenProductW( szProduct, &package );
|
2005-09-07 15:26:06 +02:00
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
2005-09-07 15:26:06 +02:00
|
|
|
|
2006-07-18 11:45:41 +02:00
|
|
|
MSI_SetPropertyW( package, szReinstallMode, reinstallmode );
|
|
|
|
MSI_SetPropertyW( package, szInstalled, szOne );
|
|
|
|
MSI_SetPropertyW( package, szLogVerbose, szOne );
|
|
|
|
MSI_SetPropertyW( package, szReinstall, szFeature );
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2006-07-18 11:45:41 +02:00
|
|
|
r = MSI_InstallPackage( package, sourcepath, NULL );
|
2005-09-07 15:26:06 +02:00
|
|
|
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
|
2005-09-28 12:13:18 +02:00
|
|
|
return r;
|
2005-02-16 17:24:38 +01:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:28:57 +02:00
|
|
|
UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature,
|
2005-02-16 17:24:38 +01:00
|
|
|
DWORD dwReinstallMode )
|
|
|
|
{
|
2005-09-07 15:26:06 +02:00
|
|
|
LPWSTR wszProduct;
|
|
|
|
LPWSTR wszFeature;
|
|
|
|
UINT rc;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %s %i\n", debugstr_a(szProduct), debugstr_a(szFeature),
|
2005-02-16 17:24:38 +01:00
|
|
|
dwReinstallMode);
|
2005-09-07 15:26:06 +02:00
|
|
|
|
|
|
|
wszProduct = strdupAtoW(szProduct);
|
|
|
|
wszFeature = strdupAtoW(szFeature);
|
|
|
|
|
|
|
|
rc = MsiReinstallFeatureW(wszProduct, wszFeature, dwReinstallMode);
|
2006-07-14 08:21:10 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(wszProduct);
|
|
|
|
msi_free(wszFeature);
|
2005-09-07 15:26:06 +02:00
|
|
|
return rc;
|
2005-02-16 17:24:38 +01:00
|
|
|
}
|
2005-09-06 13:05:24 +02:00
|
|
|
|
2006-07-24 11:13:25 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned int i[2];
|
|
|
|
unsigned int buf[4];
|
|
|
|
unsigned char in[64];
|
|
|
|
unsigned char digest[16];
|
|
|
|
} MD5_CTX;
|
|
|
|
|
|
|
|
extern VOID WINAPI MD5Init( MD5_CTX *);
|
|
|
|
extern VOID WINAPI MD5Update( MD5_CTX *, const unsigned char *, unsigned int );
|
|
|
|
extern VOID WINAPI MD5Final( MD5_CTX *);
|
|
|
|
|
2005-11-02 11:56:54 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFileHashW [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetFileHashW( LPCWSTR szFilePath, DWORD dwOptions,
|
|
|
|
PMSIFILEHASHINFO pHash )
|
|
|
|
{
|
2006-07-24 11:13:25 +02:00
|
|
|
HANDLE handle, mapping;
|
|
|
|
void *p;
|
|
|
|
DWORD length;
|
|
|
|
UINT r = ERROR_FUNCTION_FAILED;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %08x %p\n", debugstr_w(szFilePath), dwOptions, pHash );
|
2006-07-24 11:13:25 +02:00
|
|
|
|
|
|
|
if (dwOptions)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
if (!pHash)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
if (pHash->dwFileHashInfoSize < sizeof *pHash)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
handle = CreateFileW( szFilePath, GENERIC_READ,
|
|
|
|
FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL );
|
|
|
|
if (handle == INVALID_HANDLE_VALUE)
|
|
|
|
return ERROR_FILE_NOT_FOUND;
|
|
|
|
|
|
|
|
length = GetFileSize( handle, NULL );
|
|
|
|
|
|
|
|
mapping = CreateFileMappingW( handle, NULL, PAGE_READONLY, 0, 0, NULL );
|
|
|
|
if (mapping)
|
|
|
|
{
|
|
|
|
p = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, length );
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
MD5_CTX ctx;
|
|
|
|
|
|
|
|
MD5Init( &ctx );
|
|
|
|
MD5Update( &ctx, p, length );
|
|
|
|
MD5Final( &ctx );
|
|
|
|
UnmapViewOfFile( p );
|
|
|
|
|
|
|
|
memcpy( pHash->dwData, &ctx.digest, sizeof pHash->dwData );
|
|
|
|
r = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
CloseHandle( mapping );
|
|
|
|
}
|
|
|
|
CloseHandle( handle );
|
|
|
|
|
|
|
|
return r;
|
2005-11-02 11:56:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFileHashA [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetFileHashA( LPCSTR szFilePath, DWORD dwOptions,
|
|
|
|
PMSIFILEHASHINFO pHash )
|
|
|
|
{
|
2006-07-24 11:13:25 +02:00
|
|
|
LPWSTR file;
|
|
|
|
UINT r;
|
|
|
|
|
2006-10-05 06:41:22 +02:00
|
|
|
TRACE("%s %08x %p\n", debugstr_a(szFilePath), dwOptions, pHash );
|
2006-07-24 11:13:25 +02:00
|
|
|
|
|
|
|
file = strdupAtoW( szFilePath );
|
|
|
|
if (szFilePath && !file)
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
|
|
|
|
r = MsiGetFileHashW( file, dwOptions, pHash );
|
|
|
|
msi_free( file );
|
|
|
|
return r;
|
2005-11-02 11:56:54 +01:00
|
|
|
}
|
2005-11-02 20:54:31 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiAdvertiseScriptW [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiAdvertiseScriptW( LPCWSTR szScriptFile, DWORD dwFlags,
|
|
|
|
PHKEY phRegData, BOOL fRemoveItems )
|
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %08x %p %d\n",
|
2005-11-02 20:54:31 +01:00
|
|
|
debugstr_w( szScriptFile ), dwFlags, phRegData, fRemoveItems );
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiAdvertiseScriptA [MSI.@]
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiAdvertiseScriptA( LPCSTR szScriptFile, DWORD dwFlags,
|
|
|
|
PHKEY phRegData, BOOL fRemoveItems )
|
|
|
|
{
|
2006-10-05 06:41:22 +02:00
|
|
|
FIXME("%s %08x %p %d\n",
|
2005-11-02 20:54:31 +01:00
|
|
|
debugstr_a( szScriptFile ), dwFlags, phRegData, fRemoveItems );
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|