Use the newly implemented UPDATE code to set properties.

This commit is contained in:
Aric Stewart 2004-07-04 00:31:17 +00:00 committed by Alexandre Julliard
parent 11553baa63
commit 2e9b5f7c07
4 changed files with 94 additions and 18 deletions

View File

@ -1245,6 +1245,8 @@ static UINT ACTION_CostFinalize(MSIHANDLE hPackage)
MsiViewClose(view); MsiViewClose(view);
MsiCloseHandle(view); MsiCloseHandle(view);
MsiSetPropertyA(hPackage,"CostingComplete","1");
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }

View File

@ -65,6 +65,9 @@ static const WCHAR szComponents[] = {
/* the UI level */ /* the UI level */
INSTALLUILEVEL gUILevel; INSTALLUILEVEL gUILevel;
HWND gUIhwnd; HWND gUIhwnd;
INSTALLUI_HANDLERA gUIHandler;
DWORD gUIFilter;
LPVOID gUIContext;
/* /*
* .MSI file format * .MSI file format
@ -701,8 +704,14 @@ INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler, INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
DWORD dwMessageFilter, LPVOID pvContext) DWORD dwMessageFilter, LPVOID pvContext)
{ {
FIXME("STUB\n"); INSTALLUI_HANDLERA prev = gUIHandler;
return NULL;
TRACE("(%p %lx %p)\n",puiHandler,dwMessageFilter,pvContext);
gUIHandler = puiHandler;
gUIFilter = dwMessageFilter;
gUIContext = pvContext;
return prev;
} }
UINT WINAPI MsiLoadStringA(HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int nBufferMax, DWORD e) UINT WINAPI MsiLoadStringA(HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int nBufferMax, DWORD e)
@ -1084,8 +1093,14 @@ 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);
/*
* UI Initialization
*/
gUILevel = INSTALLUILEVEL_BASIC; gUILevel = INSTALLUILEVEL_BASIC;
gUIhwnd = 0; gUIhwnd = 0;
gUIHandler = NULL;
gUIFilter = 0;
gUIContext = NULL;
/* FIXME: Initialisation */ /* FIXME: Initialisation */
} else if (fdwReason == DLL_PROCESS_DETACH) { } else if (fdwReason == DLL_PROCESS_DETACH) {
/* FIXME: Cleanup */ /* FIXME: Cleanup */

View File

@ -225,5 +225,8 @@ extern void enum_stream_names( IStorage *stg );
/* UI globals */ /* UI globals */
extern INSTALLUILEVEL gUILevel; extern INSTALLUILEVEL gUILevel;
extern HWND gUIhwnd; extern HWND gUIhwnd;
extern INSTALLUI_HANDLERA gUIHandler;
extern DWORD gUIFilter;
extern LPVOID gUIContext;
#endif /* __WINE_MSI_PRIVATE__ */ #endif /* __WINE_MSI_PRIVATE__ */

View File

@ -338,7 +338,43 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType,
MSIHANDLE hRecord) MSIHANDLE hRecord)
{ {
FIXME("STUB: \n"); DWORD log_type = 0;
LPSTR message;
DWORD sz;
INT msg_field=1;
FIXME("STUB: %x \n",eMessageType);
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ERROR)
log_type |= INSTALLLOGMODE_ERROR;
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_WARNING)
log_type |= INSTALLLOGMODE_WARNING;
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_USER)
log_type |= INSTALLLOGMODE_USER;
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_INFO)
log_type |= INSTALLLOGMODE_INFO;
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_COMMONDATA)
log_type |= INSTALLLOGMODE_COMMONDATA;
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ACTIONSTART)
{
log_type |= INSTALLLOGMODE_ACTIONSTART;
msg_field = 2;
}
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ACTIONDATA)
log_type |= INSTALLLOGMODE_ACTIONDATA;
sz = 0;
MsiRecordGetStringA(hRecord,msg_field,NULL,&sz);
sz++;
message = HeapAlloc(GetProcessHeap(),0,sz);
MsiRecordGetStringA(hRecord,msg_field,message,&sz);
TRACE("(%p %lx %lx)\n",gUIHandler, gUIFilter, log_type);
if (gUIHandler && (gUIFilter & log_type))
gUIHandler(gUIContext,eMessageType,message);
else
TRACE("%s\n",debugstr_a(message));
HeapFree(GetProcessHeap(),0,message);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -388,8 +424,17 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
MSIHANDLE view,row; MSIHANDLE view,row;
UINT rc; UINT rc;
DWORD sz = 0; DWORD sz = 0;
static const CHAR Insert[]= static const WCHAR Insert[]=
"INSERT into `_Property` (`_Property`,`Value`) VALUES (?)"; {'I','N','S','E','R','T',' ','i','n','t','o',' ','`','_','P','r','o','p'
,'e','r','t','y','`',' ','(','`','_','P','r','o','p','e','r','t','y','`'
,',','`','V','a','l','u','e','`',')',' ','V','A','L','U','E','S'
,' ','(','?',')',0};
static const WCHAR Update[]=
{'U','P','D','A','T','E',' ','_','P','r','o','p','e'
,'r','t','y',' ','s','e','t',' ','`','V','a','l','u','e','`',' ','='
,' ','?',' ','w','h','e','r','e',' ','`','_','P','r','o','p'
,'e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
WCHAR Query[1024];
TRACE("Setting property (%s %s)\n",debugstr_w(szName), TRACE("Setting property (%s %s)\n",debugstr_w(szName),
debugstr_w(szValue)); debugstr_w(szValue));
@ -397,24 +442,35 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
if (!hInstall) if (!hInstall)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
rc = MsiGetPropertyW(hInstall,szName,0,&sz);
if (rc==ERROR_MORE_DATA || rc == ERROR_SUCCESS)
{
FIXME("Cannot set exising properties! FIXME MIKE!\n");
return ERROR_SUCCESS;
}
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
if( !package) if( !package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
rc = MsiDatabaseOpenViewA(package->db,Insert,&view); rc = MsiGetPropertyW(hInstall,szName,0,&sz);
if (rc!= ERROR_SUCCESS) if (rc==ERROR_MORE_DATA || rc == ERROR_SUCCESS)
return rc; {
sprintfW(Query,Update,szName);
row = MsiCreateRecord(2); row = MsiCreateRecord(1);
MsiRecordSetStringW(row,1,szName); MsiRecordSetStringW(row,1,szValue);
MsiRecordSetStringW(row,2,szValue);
}
else
{
strcpyW(Query,Insert);
row = MsiCreateRecord(2);
MsiRecordSetStringW(row,1,szName);
MsiRecordSetStringW(row,2,szValue);
}
rc = MsiDatabaseOpenViewW(package->db,Query,&view);
if (rc!= ERROR_SUCCESS)
{
MsiCloseHandle(row);
return rc;
}
rc = MsiViewExecute(view,row); rc = MsiViewExecute(view,row);