Implement SetTargetPath, start the basics for tracking UI level.

This commit is contained in:
Aric Stewart 2004-07-04 00:26:54 +00:00 committed by Alexandre Julliard
parent 10e8ed071a
commit ed7c4bc84c
5 changed files with 222 additions and 18 deletions

View file

@ -52,6 +52,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
/*
* Prototypes
*/
static UINT ACTION_ProcessExecSequence(MSIHANDLE hPackage, BOOL UIran);
static UINT ACTION_ProcessUISequence(MSIHANDLE hPackage);
UINT ACTION_PerformAction(MSIHANDLE hPackage, const WCHAR *action);
static UINT ACTION_CostInitialize(MSIHANDLE hPackage);
static UINT ACTION_CreateFolders(MSIHANDLE hPackage);
@ -104,13 +107,9 @@ inline static char *strdupWtoA( const WCHAR *str )
UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
LPCWSTR szCommandLine)
{
MSIHANDLE view;
DWORD sz;
CHAR buffer[10];
UINT rc;
static const CHAR *ExecSeqQuery =
"select * from InstallExecuteSequence where Sequence > 0 order by Sequence";
MSIHANDLE db;
FIXME("****We do not do any of the UI level stuff yet***\n");
if (szPackagePath)
{
@ -128,7 +127,8 @@ UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
}
size = MAX_PATH;
if (MsiGetPropertyW(hPackage,cszSourceDir,check,&size) != ERROR_SUCCESS )
if (MsiGetPropertyW(hPackage,cszSourceDir,check,&size)
!= ERROR_SUCCESS )
MsiSetPropertyW(hPackage, cszSourceDir, pth);
}
@ -174,9 +174,57 @@ UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
MsiSetPropertyW(hPackage,prop,val);
}
}
sz = 10;
if (MsiGetPropertyA(hPackage,"UILevel",buffer,&sz) == ERROR_SUCCESS)
{
if (atoi(buffer) >= INSTALLUILEVEL_REDUCED)
{
rc = ACTION_ProcessUISequence(hPackage);
if (rc == ERROR_SUCCESS)
rc = ACTION_ProcessExecSequence(hPackage,TRUE);
}
else
rc = ACTION_ProcessExecSequence(hPackage,FALSE);
}
else
rc = ACTION_ProcessExecSequence(hPackage,FALSE);
return rc;
}
static UINT ACTION_ProcessExecSequence(MSIHANDLE hPackage, BOOL UIran)
{
MSIHANDLE view;
UINT rc;
static const CHAR *ExecSeqQuery =
"select * from InstallExecuteSequence where Sequence > %i order by Sequence";
CHAR Query[1024];
MSIHANDLE db;
MSIHANDLE row = 0;
db = MsiGetActiveDatabase(hPackage);
rc = MsiDatabaseOpenViewA(db, ExecSeqQuery, &view);
if (UIran)
{
INT seq = 0;
static const CHAR *IVQuery =
"select Sequence from InstallExecuteSequence where Action = `InstallValidate`" ;
MsiDatabaseOpenViewA(db, IVQuery, &view);
MsiViewExecute(view, 0);
MsiViewFetch(view,&row);
seq = MsiRecordGetInteger(row,1);
MsiCloseHandle(row);
MsiViewClose(view);
MsiCloseHandle(view);
sprintf(Query,ExecSeqQuery,0);
}
else
sprintf(Query,ExecSeqQuery,0);
rc = MsiDatabaseOpenViewA(db, Query, &view);
MsiCloseHandle(db);
if (rc == ERROR_SUCCESS)
@ -196,7 +244,6 @@ UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
{
WCHAR buffer[0x100];
DWORD sz = 0x100;
MSIHANDLE row = 0;
rc = MsiViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
@ -256,6 +303,93 @@ end:
}
static UINT ACTION_ProcessUISequence(MSIHANDLE hPackage)
{
MSIHANDLE view;
UINT rc;
static const CHAR *ExecSeqQuery =
"select * from InstallUISequence where Sequence > 0 order by Sequence";
MSIHANDLE db;
db = MsiGetActiveDatabase(hPackage);
rc = MsiDatabaseOpenViewA(db, ExecSeqQuery, &view);
MsiCloseHandle(db);
if (rc == ERROR_SUCCESS)
{
rc = MsiViewExecute(view, 0);
if (rc != ERROR_SUCCESS)
{
MsiViewClose(view);
MsiCloseHandle(view);
goto end;
}
TRACE("Running the actions \n");
while (1)
{
WCHAR buffer[0x100];
DWORD sz = 0x100;
MSIHANDLE row = 0;
rc = MsiViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
{
rc = ERROR_SUCCESS;
break;
}
/* check conditions */
if (!MsiRecordIsNull(row,2))
{
sz=0x100;
rc = MsiRecordGetStringW(row,2,buffer,&sz);
if (rc != ERROR_SUCCESS)
{
MsiCloseHandle(row);
break;
}
if (MsiEvaluateConditionW(hPackage, buffer) ==
MSICONDITION_FALSE)
{
MsiCloseHandle(row);
continue;
}
}
sz=0x100;
rc = MsiRecordGetStringW(row,1,buffer,&sz);
if (rc != ERROR_SUCCESS)
{
ERR("Error is %x\n",rc);
MsiCloseHandle(row);
break;
}
rc = ACTION_PerformAction(hPackage,buffer);
if (rc != ERROR_SUCCESS)
{
ERR("Execution halted due to error (%i)\n",rc);
MsiCloseHandle(row);
break;
}
MsiCloseHandle(row);
}
MsiViewClose(view);
MsiCloseHandle(view);
}
end:
return rc;
}
/********************************************************
* ACTION helper functions and functions that perform the actions
*******************************************************/
@ -2042,6 +2176,54 @@ UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder, LPWSTR
return rc;
}
UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder,
LPCSTR szFolderPath)
{
LPWSTR szwFolder;
LPWSTR szwFolderPath;
UINT rc,len;
if (!szFolder)
return ERROR_FUNCTION_FAILED;
if (hInstall == 0)
return ERROR_FUNCTION_FAILED;
len = MultiByteToWideChar( CP_ACP, 0, szFolder, -1, NULL, 0);
szwFolder= HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!szwFolder)
return ERROR_FUNCTION_FAILED;
MultiByteToWideChar( CP_ACP, 0, szFolder, -1, szwFolder, len);
len = MultiByteToWideChar( CP_ACP, 0, szFolderPath, -1, NULL, 0);
szwFolderPath= HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!szwFolderPath)
{
HeapFree(GetProcessHeap(),0,szwFolder);
return ERROR_FUNCTION_FAILED;
}
MultiByteToWideChar( CP_ACP, 0, szFolderPath, -1, szwFolderPath, len);
rc = MsiSetTargetPathW(hInstall, szwFolder, szwFolderPath);
HeapFree(GetProcessHeap(),0,szwFolder);
HeapFree(GetProcessHeap(),0,szwFolderPath);
return rc;
}
UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
LPCWSTR szFolderPath)
{
TRACE("(%s %s)\n",debugstr_w(szFolder),debugstr_w(szFolderPath));
return MsiSetPropertyW(hInstall,szFolder,szFolderPath);
}
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, DWORD iRunMode)
{
FIXME("STUB (%li)\n",iRunMode);

View file

@ -62,6 +62,10 @@ static const WCHAR szFeatures[] = {
static const WCHAR szComponents[] = {
'C','o','m','p','o','n','e','n','t','s',0 };
/* the UI level */
INSTALLUILEVEL gUILevel;
HWND gUIhwnd;
/*
* .MSI file format
*
@ -681,8 +685,17 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
{
FIXME("%08x %p\n", dwUILevel, phWnd);
return dwUILevel;
INSTALLUILEVEL old = gUILevel;
HWND oldwnd = gUIhwnd;
TRACE("%08x %p\n", dwUILevel, phWnd);
gUILevel = dwUILevel;
if (phWnd)
{
gUIhwnd = *phWnd;
*phWnd = oldwnd;
}
return old;
}
INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
@ -1071,6 +1084,8 @@ UINT WINAPI MsiVerifyPackageW( LPCWSTR szPackage )
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hinstDLL);
gUILevel = INSTALLUILEVEL_BASIC;
gUIhwnd = 0;
/* FIXME: Initialisation */
} else if (fdwReason == DLL_PROCESS_DETACH) {
/* FIXME: Cleanup */

View file

@ -143,8 +143,8 @@
143 stub MsiSetMode
144 stdcall MsiSetPropertyA(long str str)
145 stdcall MsiSetPropertyW(long wstr wstr)
146 stub MsiSetTargetPathA
147 stub MsiSetTargetPathW
146 stdcall MsiSetTargetPathA(long str str)
147 stdcall MsiSetTargetPathW(long wstr wstr)
148 stdcall MsiSummaryInfoGetPropertyA(long long ptr ptr ptr ptr ptr)
149 stdcall MsiSummaryInfoGetPropertyCount(long ptr)
150 stdcall MsiSummaryInfoGetPropertyW(long long ptr ptr ptr ptr ptr)

View file

@ -221,4 +221,9 @@ extern UINT get_raw_stream( MSIHANDLE hdb, LPCWSTR stname, IStream **stm );
extern UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm );
extern void enum_stream_names( IStorage *stg );
/* UI globals */
extern INSTALLUILEVEL gUILevel;
extern HWND gUIhwnd;
#endif /* __WINE_MSI_PRIVATE__ */

View file

@ -21,6 +21,7 @@
#define NONAMELESSUNION
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
@ -214,9 +215,6 @@ RedirectedDllSupport
Time
Date
Privilaged
DATABASE
OriginalDatabase
UILevel
*/
SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth);
@ -270,6 +268,7 @@ UINT WINAPI MsiOpenPackageW(LPCWSTR szPackage, MSIHANDLE *phPackage)
MSIHANDLE handle;
MSIHANDLE db;
MSIPACKAGE *package;
CHAR uilevel[10];
static const WCHAR OriginalDatabase[] =
{'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
@ -301,6 +300,8 @@ UINT WINAPI MsiOpenPackageW(LPCWSTR szPackage, MSIHANDLE *phPackage)
set_installer_properties(handle);
MsiSetPropertyW(handle, OriginalDatabase, szPackage);
MsiSetPropertyW(handle, Database, szPackage);
sprintf(uilevel,"%i",gUILevel);
MsiSetPropertyA(handle, "UILevel", uilevel);
*phPackage = handle;
@ -396,10 +397,11 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
if (!hInstall)
return ERROR_INVALID_HANDLE;
if (MsiGetPropertyW(hInstall,szName,0,&sz)==ERROR_MORE_DATA)
rc = MsiGetPropertyW(hInstall,szName,0,&sz);
if (rc==ERROR_MORE_DATA || rc == ERROR_SUCCESS)
{
FIXME("Cannot set exising properties! FIXME MIKE!\n");
return ERROR_FUNCTION_FAILED;
return ERROR_SUCCESS;
}
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);