2005-06-16 22:40:34 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
|
|
|
* Copyright 2005 Aric Stewart for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
2005-06-16 22:40:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Msi top level apis directly related to installs */
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "msi.h"
|
|
|
|
#include "msidefs.h"
|
|
|
|
#include "msipriv.h"
|
2006-07-18 11:43:33 +02:00
|
|
|
#include "wine/unicode.h"
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiDoActionA (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
|
|
|
|
{
|
|
|
|
LPWSTR szwAction;
|
2005-09-13 12:37:46 +02:00
|
|
|
UINT ret;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 12:37:46 +02:00
|
|
|
TRACE("%s\n", debugstr_a(szAction));
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
szwAction = strdupAtoW(szAction);
|
2005-09-13 12:37:46 +02:00
|
|
|
if (szAction && !szwAction)
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2005-09-13 12:37:46 +02:00
|
|
|
ret = MsiDoActionW( hInstall, szwAction );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwAction );
|
2005-09-13 12:37:46 +02:00
|
|
|
return ret;
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiDoActionW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package;
|
2005-09-13 12:37:46 +02:00
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
TRACE("%s\n",debugstr_w(szAction));
|
|
|
|
|
|
|
|
if (!szAction)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 12:37:46 +02:00
|
|
|
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ret = ACTION_PerformUIAction( package, szAction );
|
|
|
|
msiobj_release( &package->hdr );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-20 13:37:30 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiSequenceA (MSI.@)
|
|
|
|
*/
|
2005-09-21 12:55:23 +02:00
|
|
|
UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode )
|
2005-09-20 13:37:30 +02:00
|
|
|
{
|
2005-09-21 12:55:23 +02:00
|
|
|
LPWSTR szwTable;
|
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_a(szTable));
|
|
|
|
|
|
|
|
szwTable = strdupAtoW(szTable);
|
|
|
|
if (szTable && !szwTable)
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
ret = MsiSequenceW( hInstall, szwTable, iSequenceMode );
|
|
|
|
msi_free( szwTable );
|
|
|
|
return ret;
|
2005-09-20 13:37:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiSequenceW (MSI.@)
|
|
|
|
*/
|
2005-09-21 12:55:23 +02:00
|
|
|
UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode )
|
2005-09-20 13:37:30 +02:00
|
|
|
{
|
2005-09-21 12:55:23 +02:00
|
|
|
MSIPACKAGE *package;
|
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(szTable));
|
|
|
|
|
|
|
|
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
ret = MSI_Sequence( package, szTable, iSequenceMode );
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
|
|
|
|
return ret;
|
2005-09-20 13:37:30 +02:00
|
|
|
}
|
|
|
|
|
2005-10-31 15:07:37 +01:00
|
|
|
UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz )
|
2005-09-13 13:25:20 +02:00
|
|
|
{
|
|
|
|
UINT len, r = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
if (awbuf->str.w && !sz )
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if (!sz)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
if (awbuf->unicode)
|
|
|
|
{
|
|
|
|
len = lstrlenW( str );
|
|
|
|
if (awbuf->str.w)
|
|
|
|
lstrcpynW( awbuf->str.w, str, *sz );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-31 15:07:37 +01:00
|
|
|
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
|
|
|
if (len)
|
|
|
|
len--;
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, str, -1, awbuf->str.a, *sz, NULL, NULL );
|
2006-09-26 05:03:31 +02:00
|
|
|
if ( awbuf->str.a && *sz && (len >= *sz) )
|
2005-10-31 15:07:37 +01:00
|
|
|
awbuf->str.a[*sz - 1] = 0;
|
2005-09-13 13:25:20 +02:00
|
|
|
}
|
|
|
|
|
2005-11-15 17:53:47 +01:00
|
|
|
if (awbuf->str.w && len >= *sz)
|
2005-09-13 13:25:20 +02:00
|
|
|
r = ERROR_MORE_DATA;
|
|
|
|
*sz = len;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetTargetPath (internal)
|
|
|
|
*/
|
2006-10-09 09:05:04 +02:00
|
|
|
static UINT WINAPI MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
|
|
|
|
awstring *szPathBuf, DWORD* pcchPathBuf )
|
2005-09-13 13:25:20 +02:00
|
|
|
{
|
|
|
|
MSIPACKAGE *package;
|
|
|
|
LPWSTR path;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
if (!szFolder)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
path = resolve_folder( package, szFolder, FALSE, FALSE, NULL );
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
|
|
|
|
if (!path)
|
|
|
|
return ERROR_DIRECTORY;
|
|
|
|
|
|
|
|
r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( path );
|
2005-09-13 13:25:20 +02:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2005-06-16 22:40:34 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetTargetPathA (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
|
2005-09-13 13:25:20 +02:00
|
|
|
LPSTR szPathBuf, DWORD* pcchPathBuf )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
|
|
|
LPWSTR szwFolder;
|
2005-09-13 13:25:20 +02:00
|
|
|
awstring path;
|
|
|
|
UINT r;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
szwFolder = strdupAtoW(szFolder);
|
2005-09-13 13:25:20 +02:00
|
|
|
if (szFolder && !szwFolder)
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
path.unicode = FALSE;
|
|
|
|
path.str.a = szPathBuf;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwFolder );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
return r;
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-09-13 13:25:20 +02:00
|
|
|
* MsiGetTargetPathW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
|
|
|
|
LPWSTR szPathBuf, DWORD* pcchPathBuf )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-09-13 13:25:20 +02:00
|
|
|
awstring path;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
path.unicode = TRUE;
|
|
|
|
path.str.w = szPathBuf;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-09-06 13:05:35 +02:00
|
|
|
* MsiGetSourcePath (internal)
|
|
|
|
*/
|
|
|
|
static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
|
|
|
|
awstring *szPathBuf, DWORD* pcchPathBuf )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-09-06 13:05:35 +02:00
|
|
|
MSIPACKAGE *package;
|
2005-09-13 13:25:20 +02:00
|
|
|
LPWSTR path;
|
|
|
|
UINT r;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
if (!szFolder)
|
2005-09-06 13:05:35 +02:00
|
|
|
return ERROR_INVALID_PARAMETER;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
if (szPathBuf->str.w && !pcchPathBuf )
|
|
|
|
{
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
}
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
path = resolve_folder(package, szFolder, TRUE, FALSE, NULL);
|
|
|
|
msiobj_release( &package->hdr );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
TRACE("path = %s\n",debugstr_w(path));
|
|
|
|
if (!path)
|
|
|
|
return ERROR_DIRECTORY;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-13 13:25:20 +02:00
|
|
|
r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( path );
|
2005-09-06 13:05:35 +02:00
|
|
|
return r;
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-09-06 13:05:35 +02:00
|
|
|
* MsiGetSourcePathA (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder,
|
|
|
|
LPSTR szPathBuf, DWORD* pcchPathBuf )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-09-06 13:05:35 +02:00
|
|
|
LPWSTR folder;
|
|
|
|
awstring str;
|
|
|
|
UINT r;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
TRACE("%s %p %p\n", szFolder, debugstr_a(szPathBuf), pcchPathBuf);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
str.unicode = FALSE;
|
|
|
|
str.str.a = szPathBuf;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
folder = strdupAtoW( szFolder );
|
|
|
|
r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( folder );
|
2005-09-06 13:05:35 +02:00
|
|
|
|
|
|
|
return r;
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:05:35 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetSourcePathW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder,
|
|
|
|
LPWSTR szPathBuf, DWORD* pcchPathBuf )
|
|
|
|
{
|
|
|
|
awstring str;
|
|
|
|
|
|
|
|
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
|
|
|
|
|
|
|
|
str.unicode = TRUE;
|
|
|
|
str.str.w = szPathBuf;
|
|
|
|
|
|
|
|
return MSI_GetSourcePath( hInstall, szFolder, &str, pcchPathBuf );
|
|
|
|
}
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetTargetPathA (MSI.@)
|
|
|
|
*/
|
2005-11-02 12:43:05 +01:00
|
|
|
UINT WINAPI MsiSetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
|
|
|
|
LPCSTR szFolderPath )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-11-02 12:43:05 +01:00
|
|
|
LPWSTR szwFolder = NULL, szwFolderPath = NULL;
|
|
|
|
UINT rc = ERROR_OUTOFMEMORY;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-11-02 12:43:05 +01:00
|
|
|
if ( !szFolder || !szFolderPath )
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
szwFolder = strdupAtoW(szFolder);
|
|
|
|
szwFolderPath = strdupAtoW(szFolderPath);
|
2005-11-02 12:43:05 +01:00
|
|
|
if (!szwFolder || !szwFolderPath)
|
|
|
|
goto end;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-11-02 12:43:05 +01:00
|
|
|
rc = MsiSetTargetPathW( hInstall, szwFolder, szwFolderPath );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-11-02 12:43:05 +01:00
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(szwFolder);
|
|
|
|
msi_free(szwFolderPath);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-06-17 23:25:51 +02:00
|
|
|
/*
|
|
|
|
* Ok my original interpretation of this was wrong. And it looks like msdn has
|
|
|
|
* changed a bit also. The given folder path does not have to actually already
|
|
|
|
* exist, it just cannot be read only and must be a legal folder path.
|
|
|
|
*/
|
2005-06-16 22:40:34 +02:00
|
|
|
UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
|
|
|
|
LPCWSTR szFolderPath)
|
|
|
|
{
|
2005-06-17 23:25:51 +02:00
|
|
|
DWORD attrib;
|
2005-06-16 22:40:34 +02:00
|
|
|
LPWSTR path = NULL;
|
|
|
|
LPWSTR path2 = NULL;
|
|
|
|
MSIFOLDER *folder;
|
2006-07-13 00:43:30 +02:00
|
|
|
MSIFILE *file;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2006-07-15 06:56:09 +02:00
|
|
|
TRACE("%p %s %s\n",package, debugstr_w(szFolder),debugstr_w(szFolderPath));
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-06-17 23:25:51 +02:00
|
|
|
attrib = GetFileAttributesW(szFolderPath);
|
2006-07-15 06:56:09 +02:00
|
|
|
/* native MSI tests writeability by making temporary files at each drive */
|
2005-06-17 23:25:51 +02:00
|
|
|
if ( attrib != INVALID_FILE_ATTRIBUTES &&
|
2006-06-25 14:05:20 +02:00
|
|
|
(attrib & FILE_ATTRIBUTE_OFFLINE ||
|
2006-07-15 06:56:09 +02:00
|
|
|
attrib & FILE_ATTRIBUTE_READONLY))
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
path = resolve_folder(package,szFolder,FALSE,FALSE,&folder);
|
|
|
|
if (!path)
|
2005-11-02 12:43:05 +01:00
|
|
|
return ERROR_DIRECTORY;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(folder->Property);
|
2005-06-16 22:40:34 +02:00
|
|
|
folder->Property = build_directory_name(2, szFolderPath, NULL);
|
|
|
|
|
|
|
|
if (lstrcmpiW(path, folder->Property) == 0)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Resolved Target has not really changed, so just
|
|
|
|
* set this folder and do not recalculate everything.
|
|
|
|
*/
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(folder->ResolvedTarget);
|
2005-06-16 22:40:34 +02:00
|
|
|
folder->ResolvedTarget = NULL;
|
|
|
|
path2 = resolve_folder(package,szFolder,FALSE,TRUE,NULL);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(path2);
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-23 20:15:44 +02:00
|
|
|
MSIFOLDER *f;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(f->ResolvedTarget);
|
2005-08-23 20:15:44 +02:00
|
|
|
f->ResolvedTarget=NULL;
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
2005-08-23 20:15:44 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-08-23 20:15:44 +02:00
|
|
|
path2 = resolve_folder(package, f->Directory, FALSE, TRUE, NULL);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(path2);
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
2006-07-13 00:43:30 +02:00
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
|
|
|
{
|
|
|
|
MSICOMPONENT *comp = file->Component;
|
|
|
|
LPWSTR p;
|
|
|
|
|
|
|
|
if (!comp)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
|
|
|
|
msi_free(file->TargetPath);
|
|
|
|
|
|
|
|
file->TargetPath = build_directory_name(2, p, file->FileName);
|
|
|
|
msi_free(p);
|
|
|
|
}
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(path);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetTargetPathW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
|
|
|
|
LPCWSTR szFolderPath)
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package;
|
|
|
|
UINT ret;
|
|
|
|
|
2006-07-15 06:56:09 +02:00
|
|
|
TRACE("%s %s\n",debugstr_w(szFolder),debugstr_w(szFolderPath));
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-11-02 12:43:05 +01:00
|
|
|
if ( !szFolder || !szFolderPath )
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2005-06-16 22:40:34 +02:00
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
2005-11-02 12:43:05 +01:00
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-06-16 22:40:34 +02:00
|
|
|
ret = MSI_SetTargetPathW( package, szFolder, szFolderPath );
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetMode (MSI.@)
|
|
|
|
*
|
|
|
|
* Returns an internal installer state (if it is running in a mode iRunMode)
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hInstall [I] Handle to the installation
|
|
|
|
* hRunMode [I] Checking run mode
|
|
|
|
* MSIRUNMODE_ADMIN Administrative mode
|
|
|
|
* MSIRUNMODE_ADVERTISE Advertisement mode
|
|
|
|
* MSIRUNMODE_MAINTENANCE Maintenance mode
|
|
|
|
* MSIRUNMODE_ROLLBACKENABLED Rollback is enabled
|
|
|
|
* MSIRUNMODE_LOGENABLED Log file is writing
|
|
|
|
* MSIRUNMODE_OPERATIONS Operations in progress??
|
|
|
|
* MSIRUNMODE_REBOOTATEND We need to reboot after installation completed
|
|
|
|
* MSIRUNMODE_REBOOTNOW We need to reboot to continue the installation
|
|
|
|
* MSIRUNMODE_CABINET Files from cabinet are installed
|
|
|
|
* MSIRUNMODE_SOURCESHORTNAMES Long names in source files is suppressed
|
|
|
|
* MSIRUNMODE_TARGETSHORTNAMES Long names in destination files is suppressed
|
|
|
|
* MSIRUNMODE_RESERVED11 Reserved
|
|
|
|
* MSIRUNMODE_WINDOWS9X Running under Windows95/98
|
|
|
|
* MSIRUNMODE_ZAWENABLED Demand installation is supported
|
|
|
|
* MSIRUNMODE_RESERVED14 Reserved
|
|
|
|
* MSIRUNMODE_RESERVED15 Reserved
|
|
|
|
* MSIRUNMODE_SCHEDULED called from install script
|
|
|
|
* MSIRUNMODE_ROLLBACK called from rollback script
|
|
|
|
* MSIRUNMODE_COMMIT called from commit script
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* In the state: TRUE
|
|
|
|
* Not in the state: FALSE
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
|
|
|
|
{
|
2006-01-03 12:12:15 +01:00
|
|
|
BOOL r = FALSE;
|
|
|
|
|
|
|
|
switch (iRunMode)
|
|
|
|
{
|
|
|
|
case MSIRUNMODE_WINDOWS9X:
|
|
|
|
if (GetVersion() & 0x80000000)
|
|
|
|
r = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSIRUNMODE_RESERVED11:
|
|
|
|
case MSIRUNMODE_RESERVED14:
|
|
|
|
case MSIRUNMODE_RESERVED15:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSIRUNMODE_SCHEDULED:
|
|
|
|
case MSIRUNMODE_ROLLBACK:
|
|
|
|
case MSIRUNMODE_COMMIT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("%ld %d\n", hInstall, iRunMode);
|
|
|
|
r = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
2005-10-30 20:05:13 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetMode (MSI.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
|
|
|
|
{
|
|
|
|
switch (iRunMode)
|
|
|
|
{
|
|
|
|
case MSIRUNMODE_RESERVED11:
|
|
|
|
case MSIRUNMODE_WINDOWS9X:
|
|
|
|
case MSIRUNMODE_RESERVED14:
|
|
|
|
case MSIRUNMODE_RESERVED15:
|
|
|
|
return FALSE;
|
|
|
|
default:
|
|
|
|
FIXME("%ld %d %d\n", hInstall, iRunMode, fState);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-06-16 22:40:34 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetFeatureStateA (MSI.@)
|
|
|
|
*
|
|
|
|
* According to the docs, when this is called it immediately recalculates
|
|
|
|
* all the component states as well
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
|
|
|
|
INSTALLSTATE iState)
|
|
|
|
{
|
|
|
|
LPWSTR szwFeature = NULL;
|
|
|
|
UINT rc;
|
|
|
|
|
|
|
|
szwFeature = strdupAtoW(szFeature);
|
|
|
|
|
|
|
|
if (!szwFeature)
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
rc = MsiSetFeatureStateW(hInstall,szwFeature, iState);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(szwFeature);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE* package, LPCWSTR szFeature,
|
|
|
|
INSTALLSTATE iState)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature, *child;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2006-07-15 06:56:09 +02:00
|
|
|
TRACE("%s %i\n", debugstr_w(szFeature), iState);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
feature = get_loaded_feature(package,szFeature);
|
|
|
|
if (!feature)
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_UNKNOWN_FEATURE;
|
|
|
|
|
|
|
|
if (iState == INSTALLSTATE_ADVERTISED &&
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->Attributes & msidbFeatureAttributesDisallowAdvertise)
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->ActionRequest = iState;
|
|
|
|
feature->Action = iState;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
ACTION_UpdateComponentStates(package,szFeature);
|
|
|
|
|
|
|
|
/* update all the features that are children of this feature */
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( child, &package->features, MSIFEATURE, entry )
|
2005-06-16 22:40:34 +02:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
if (lstrcmpW(szFeature, child->Feature_Parent) == 0)
|
|
|
|
MSI_SetFeatureStateW(package, child->Feature, iState);
|
2005-06-16 22:40:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetFeatureStateW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
|
|
|
|
INSTALLSTATE iState)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package;
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
|
2006-07-15 06:56:09 +02:00
|
|
|
TRACE("%s %i\n",debugstr_w(szFeature), iState);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
rc = MSI_SetFeatureStateW(package,szFeature,iState);
|
|
|
|
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFeatureStateA (MSI.@)
|
|
|
|
*/
|
2006-08-04 23:27:42 +02:00
|
|
|
UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
|
2005-06-16 22:40:34 +02:00
|
|
|
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
|
|
|
|
{
|
|
|
|
LPWSTR szwFeature = NULL;
|
|
|
|
UINT rc;
|
|
|
|
|
|
|
|
szwFeature = strdupAtoW(szFeature);
|
|
|
|
|
|
|
|
rc = MsiGetFeatureStateW(hInstall,szwFeature,piInstalled, piAction);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwFeature);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-08-04 23:27:42 +02:00
|
|
|
UINT MSI_GetFeatureStateW(MSIPACKAGE *package, LPCWSTR szFeature,
|
2005-06-16 22:40:34 +02:00
|
|
|
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
|
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
feature = get_loaded_feature(package,szFeature);
|
|
|
|
if (!feature)
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_UNKNOWN_FEATURE;
|
|
|
|
|
|
|
|
if (piInstalled)
|
2005-08-22 16:09:17 +02:00
|
|
|
*piInstalled = feature->Installed;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
if (piAction)
|
2005-08-22 16:09:17 +02:00
|
|
|
*piAction = feature->Action;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
TRACE("returning %i %i\n", feature->Installed, feature->Action);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFeatureStateW (MSI.@)
|
|
|
|
*/
|
2006-08-04 23:27:42 +02:00
|
|
|
UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
|
2005-06-16 22:40:34 +02:00
|
|
|
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package;
|
|
|
|
UINT ret;
|
|
|
|
|
2006-07-15 06:56:09 +02:00
|
|
|
TRACE("%ld %s %p %p\n", hInstall, debugstr_w(szFeature), piInstalled, piAction);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
ret = MSI_GetFeatureStateW(package, szFeature, piInstalled, piAction);
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-08-15 23:56:19 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFeatureCostA (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature,
|
|
|
|
MSICOSTTREE iCostTree, INSTALLSTATE iState, INT *piCost)
|
|
|
|
{
|
|
|
|
FIXME("(%ld %s %i %i %p): stub\n", hInstall, debugstr_a(szFeature),
|
|
|
|
iCostTree, iState, piCost);
|
|
|
|
if (piCost) *piCost = 0;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetFeatureCostW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature,
|
|
|
|
MSICOSTTREE iCostTree, INSTALLSTATE iState, INT *piCost)
|
|
|
|
{
|
|
|
|
FIXME("(%ld %s %i %i %p): stub\n", hInstall, debugstr_w(szFeature),
|
|
|
|
iCostTree, iState, piCost);
|
|
|
|
if (piCost) *piCost = 0;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-08-24 12:56:27 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetComponentStateA (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
|
|
|
|
INSTALLSTATE iState)
|
|
|
|
{
|
2005-08-24 20:13:09 +02:00
|
|
|
UINT rc;
|
|
|
|
LPWSTR szwComponent = strdupAtoW(szComponent);
|
|
|
|
|
|
|
|
rc = MsiSetComponentStateW(hInstall, szwComponent, iState);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(szwComponent);
|
2005-08-24 20:13:09 +02:00
|
|
|
|
|
|
|
return rc;
|
2005-08-24 12:56:27 +02:00
|
|
|
}
|
|
|
|
|
2005-06-16 22:40:34 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetComponentStateA (MSI.@)
|
|
|
|
*/
|
2006-08-04 23:27:42 +02:00
|
|
|
UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
|
2005-06-16 22:40:34 +02:00
|
|
|
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
|
|
|
|
{
|
|
|
|
LPWSTR szwComponent= NULL;
|
|
|
|
UINT rc;
|
|
|
|
|
|
|
|
szwComponent= strdupAtoW(szComponent);
|
|
|
|
|
|
|
|
rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( szwComponent);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-08-24 20:13:09 +02:00
|
|
|
static UINT MSI_SetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent,
|
|
|
|
INSTALLSTATE iState)
|
|
|
|
{
|
|
|
|
MSICOMPONENT *comp;
|
|
|
|
|
|
|
|
TRACE("%p %s %d\n", package, debugstr_w(szComponent), iState);
|
|
|
|
|
|
|
|
comp = get_loaded_component(package, szComponent);
|
|
|
|
if (!comp)
|
|
|
|
return ERROR_UNKNOWN_COMPONENT;
|
|
|
|
|
|
|
|
comp->Installed = iState;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-08-04 23:27:42 +02:00
|
|
|
UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent,
|
2005-06-16 22:40:34 +02:00
|
|
|
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
|
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
TRACE("%p %s %p %p\n", package, debugstr_w(szComponent),
|
|
|
|
piInstalled, piAction);
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,szComponent);
|
|
|
|
if (!comp)
|
2005-06-16 22:40:34 +02:00
|
|
|
return ERROR_UNKNOWN_COMPONENT;
|
|
|
|
|
|
|
|
if (piInstalled)
|
2005-08-22 11:15:23 +02:00
|
|
|
*piInstalled = comp->Installed;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
if (piAction)
|
2005-08-22 11:15:23 +02:00
|
|
|
*piAction = comp->Action;
|
2005-06-16 22:40:34 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
TRACE("states (%i, %i)\n", comp->Installed, comp->Action );
|
2005-06-16 22:40:34 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-08-24 12:56:27 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetComponentStateW (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
|
|
|
|
INSTALLSTATE iState)
|
|
|
|
{
|
2005-08-24 20:13:09 +02:00
|
|
|
MSIPACKAGE* package;
|
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
ret = MSI_SetComponentStateW(package, szComponent, iState);
|
|
|
|
msiobj_release(&package->hdr);
|
|
|
|
return ret;
|
2005-08-24 12:56:27 +02:00
|
|
|
}
|
|
|
|
|
2005-06-16 22:40:34 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetComponentStateW (MSI.@)
|
|
|
|
*/
|
2006-08-04 23:27:42 +02:00
|
|
|
UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
|
2005-06-16 22:40:34 +02:00
|
|
|
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package;
|
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
TRACE("%ld %s %p %p\n", hInstall, debugstr_w(szComponent),
|
|
|
|
piInstalled, piAction);
|
|
|
|
|
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
ret = MSI_GetComponentStateW( package, szComponent, piInstalled, piAction);
|
|
|
|
msiobj_release( &package->hdr );
|
|
|
|
return ret;
|
|
|
|
}
|
2005-07-10 19:39:14 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiGetLanguage (MSI.@)
|
|
|
|
*/
|
|
|
|
LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package;
|
|
|
|
LANGID langid;
|
|
|
|
static const WCHAR szProductLanguage[] =
|
|
|
|
{'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
|
|
|
|
|
|
|
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2006-07-15 06:56:09 +02:00
|
|
|
langid = msi_get_property_int( package, szProductLanguage, 0 );
|
|
|
|
msiobj_release( &package->hdr );
|
2005-07-10 19:39:14 +02:00
|
|
|
return langid;
|
|
|
|
}
|
2006-07-18 11:43:33 +02:00
|
|
|
|
2006-07-19 20:17:28 +02:00
|
|
|
UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel )
|
2006-07-18 11:43:33 +02:00
|
|
|
{
|
|
|
|
static const WCHAR szInstallLevel[] = {
|
|
|
|
'I','N','S','T','A','L','L','L','E','V','E','L',0 };
|
|
|
|
static const WCHAR fmt[] = { '%','d',0 };
|
|
|
|
WCHAR level[6];
|
|
|
|
UINT r;
|
|
|
|
|
2006-07-19 20:17:28 +02:00
|
|
|
TRACE("%p %i\n", package, iInstallLevel);
|
2006-07-18 11:43:33 +02:00
|
|
|
|
|
|
|
if (iInstallLevel<1 || iInstallLevel>32767)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
sprintfW( level, fmt, iInstallLevel );
|
|
|
|
r = MSI_SetPropertyW( package, szInstallLevel, level );
|
2006-07-19 20:17:16 +02:00
|
|
|
if ( r == ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
r = MSI_SetFeatureStates( package );
|
|
|
|
}
|
|
|
|
|
2006-07-19 20:17:28 +02:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsiSetInstallLevel (MSI.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
TRACE("%ld %i\n", hInstall, iInstallLevel);
|
|
|
|
|
|
|
|
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
|
|
|
|
if ( !package )
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
r = MSI_SetInstallLevel( package, iInstallLevel );
|
|
|
|
|
2006-07-18 11:43:33 +02:00
|
|
|
msiobj_release( &package->hdr );
|
2006-07-19 20:17:16 +02:00
|
|
|
|
2006-07-18 11:43:33 +02:00
|
|
|
return r;
|
|
|
|
}
|