Implement SetTargetPath, start the basics for tracking UI level.
This commit is contained in:
parent
10e8ed071a
commit
ed7c4bc84c
@ -52,6 +52,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|||||||
/*
|
/*
|
||||||
* Prototypes
|
* Prototypes
|
||||||
*/
|
*/
|
||||||
|
static UINT ACTION_ProcessExecSequence(MSIHANDLE hPackage, BOOL UIran);
|
||||||
|
static UINT ACTION_ProcessUISequence(MSIHANDLE hPackage);
|
||||||
|
|
||||||
UINT ACTION_PerformAction(MSIHANDLE hPackage, const WCHAR *action);
|
UINT ACTION_PerformAction(MSIHANDLE hPackage, const WCHAR *action);
|
||||||
static UINT ACTION_CostInitialize(MSIHANDLE hPackage);
|
static UINT ACTION_CostInitialize(MSIHANDLE hPackage);
|
||||||
static UINT ACTION_CreateFolders(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,
|
UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
|
||||||
LPCWSTR szCommandLine)
|
LPCWSTR szCommandLine)
|
||||||
{
|
{
|
||||||
MSIHANDLE view;
|
DWORD sz;
|
||||||
|
CHAR buffer[10];
|
||||||
UINT rc;
|
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)
|
if (szPackagePath)
|
||||||
{
|
{
|
||||||
@ -128,7 +127,8 @@ UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
size = MAX_PATH;
|
size = MAX_PATH;
|
||||||
if (MsiGetPropertyW(hPackage,cszSourceDir,check,&size) != ERROR_SUCCESS )
|
if (MsiGetPropertyW(hPackage,cszSourceDir,check,&size)
|
||||||
|
!= ERROR_SUCCESS )
|
||||||
MsiSetPropertyW(hPackage, cszSourceDir, pth);
|
MsiSetPropertyW(hPackage, cszSourceDir, pth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,9 +174,57 @@ UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
|
|||||||
MsiSetPropertyW(hPackage,prop,val);
|
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);
|
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);
|
MsiCloseHandle(db);
|
||||||
|
|
||||||
if (rc == ERROR_SUCCESS)
|
if (rc == ERROR_SUCCESS)
|
||||||
@ -196,7 +244,6 @@ UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
|
|||||||
{
|
{
|
||||||
WCHAR buffer[0x100];
|
WCHAR buffer[0x100];
|
||||||
DWORD sz = 0x100;
|
DWORD sz = 0x100;
|
||||||
MSIHANDLE row = 0;
|
|
||||||
|
|
||||||
rc = MsiViewFetch(view,&row);
|
rc = MsiViewFetch(view,&row);
|
||||||
if (rc != ERROR_SUCCESS)
|
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
|
* ACTION helper functions and functions that perform the actions
|
||||||
*******************************************************/
|
*******************************************************/
|
||||||
@ -2042,6 +2176,54 @@ UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder, LPWSTR
|
|||||||
return rc;
|
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)
|
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, DWORD iRunMode)
|
||||||
{
|
{
|
||||||
FIXME("STUB (%li)\n",iRunMode);
|
FIXME("STUB (%li)\n",iRunMode);
|
||||||
|
@ -62,6 +62,10 @@ static const WCHAR szFeatures[] = {
|
|||||||
static const WCHAR szComponents[] = {
|
static const WCHAR szComponents[] = {
|
||||||
'C','o','m','p','o','n','e','n','t','s',0 };
|
'C','o','m','p','o','n','e','n','t','s',0 };
|
||||||
|
|
||||||
|
/* the UI level */
|
||||||
|
INSTALLUILEVEL gUILevel;
|
||||||
|
HWND gUIhwnd;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* .MSI file format
|
* .MSI file format
|
||||||
*
|
*
|
||||||
@ -681,8 +685,17 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
|
|||||||
|
|
||||||
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
|
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
|
||||||
{
|
{
|
||||||
FIXME("%08x %p\n", dwUILevel, phWnd);
|
INSTALLUILEVEL old = gUILevel;
|
||||||
return dwUILevel;
|
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,
|
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) {
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
|
gUILevel = INSTALLUILEVEL_BASIC;
|
||||||
|
gUIhwnd = 0;
|
||||||
/* FIXME: Initialisation */
|
/* FIXME: Initialisation */
|
||||||
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||||
/* FIXME: Cleanup */
|
/* FIXME: Cleanup */
|
||||||
|
@ -143,8 +143,8 @@
|
|||||||
143 stub MsiSetMode
|
143 stub MsiSetMode
|
||||||
144 stdcall MsiSetPropertyA(long str str)
|
144 stdcall MsiSetPropertyA(long str str)
|
||||||
145 stdcall MsiSetPropertyW(long wstr wstr)
|
145 stdcall MsiSetPropertyW(long wstr wstr)
|
||||||
146 stub MsiSetTargetPathA
|
146 stdcall MsiSetTargetPathA(long str str)
|
||||||
147 stub MsiSetTargetPathW
|
147 stdcall MsiSetTargetPathW(long wstr wstr)
|
||||||
148 stdcall MsiSummaryInfoGetPropertyA(long long ptr ptr ptr ptr ptr)
|
148 stdcall MsiSummaryInfoGetPropertyA(long long ptr ptr ptr ptr ptr)
|
||||||
149 stdcall MsiSummaryInfoGetPropertyCount(long ptr)
|
149 stdcall MsiSummaryInfoGetPropertyCount(long ptr)
|
||||||
150 stdcall MsiSummaryInfoGetPropertyW(long long ptr ptr ptr ptr ptr)
|
150 stdcall MsiSummaryInfoGetPropertyW(long long ptr ptr ptr ptr ptr)
|
||||||
|
@ -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 UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm );
|
||||||
extern void enum_stream_names( IStorage *stg );
|
extern void enum_stream_names( IStorage *stg );
|
||||||
|
|
||||||
|
|
||||||
|
/* UI globals */
|
||||||
|
extern INSTALLUILEVEL gUILevel;
|
||||||
|
extern HWND gUIhwnd;
|
||||||
|
|
||||||
#endif /* __WINE_MSI_PRIVATE__ */
|
#endif /* __WINE_MSI_PRIVATE__ */
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define NONAMELESSUNION
|
#define NONAMELESSUNION
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
@ -214,9 +215,6 @@ RedirectedDllSupport
|
|||||||
Time
|
Time
|
||||||
Date
|
Date
|
||||||
Privilaged
|
Privilaged
|
||||||
DATABASE
|
|
||||||
OriginalDatabase
|
|
||||||
UILevel
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth);
|
SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth);
|
||||||
@ -270,6 +268,7 @@ UINT WINAPI MsiOpenPackageW(LPCWSTR szPackage, MSIHANDLE *phPackage)
|
|||||||
MSIHANDLE handle;
|
MSIHANDLE handle;
|
||||||
MSIHANDLE db;
|
MSIHANDLE db;
|
||||||
MSIPACKAGE *package;
|
MSIPACKAGE *package;
|
||||||
|
CHAR uilevel[10];
|
||||||
|
|
||||||
static const WCHAR OriginalDatabase[] =
|
static const WCHAR OriginalDatabase[] =
|
||||||
{'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
|
{'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);
|
set_installer_properties(handle);
|
||||||
MsiSetPropertyW(handle, OriginalDatabase, szPackage);
|
MsiSetPropertyW(handle, OriginalDatabase, szPackage);
|
||||||
MsiSetPropertyW(handle, Database, szPackage);
|
MsiSetPropertyW(handle, Database, szPackage);
|
||||||
|
sprintf(uilevel,"%i",gUILevel);
|
||||||
|
MsiSetPropertyA(handle, "UILevel", uilevel);
|
||||||
|
|
||||||
*phPackage = handle;
|
*phPackage = handle;
|
||||||
|
|
||||||
@ -396,10 +397,11 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
|
|||||||
if (!hInstall)
|
if (!hInstall)
|
||||||
return ERROR_INVALID_HANDLE;
|
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");
|
FIXME("Cannot set exising properties! FIXME MIKE!\n");
|
||||||
return ERROR_FUNCTION_FAILED;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
|
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user