ChangeSet ID: 21267 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/15 06:00:14
Modified files: dlls/msi : package.c
Log message: Mike McCormack mike@codeweavers.com Set the Installed property if the product is already installed.
Patch: http://cvs.winehq.org/patch.py?id=21267
Old revision New revision Changes Path 1.66 1.67 +40 -33 wine/dlls/msi/package.c
Index: wine/dlls/msi/package.c diff -u -p wine/dlls/msi/package.c:1.66 wine/dlls/msi/package.c:1.67 --- wine/dlls/msi/package.c:1.66 15 Nov 2005 12: 0:14 -0000 +++ wine/dlls/msi/package.c 15 Nov 2005 12: 0:14 -0000 @@ -31,7 +31,6 @@ #include "wine/debug.h" #include "msi.h" #include "msiquery.h" -#include "msipriv.h" #include "objidl.h" #include "wincrypt.h" #include "winuser.h" @@ -39,6 +38,9 @@ #include "wine/unicode.h" #include "objbase.h"
+#include "msipriv.h" +#include "action.h" + WINE_DEFAULT_DEBUG_CHANNEL(msi);
static void MSI_FreePackage( MSIOBJECTHDR *arg) @@ -121,6 +123,30 @@ static UINT clone_properties(MSIDATABASE }
/* + * set_installed_prop + * + * Sets the "Installed" property to indicate that + * the product is installed for the current user. + */ +static UINT set_installed_prop( MSIPACKAGE *package ) +{ + static const WCHAR szInstalled[] = { + 'I','n','s','t','a','l','l','e','d',0 }; + WCHAR val[2] = { '1', 0 }; + HKEY hkey = 0; + UINT r; + + r = MSIREG_OpenUninstallKey( package->ProductCode, &hkey, FALSE ); + if (r == ERROR_SUCCESS) + { + RegCloseKey( hkey ); + MSI_SetPropertyW( package, szInstalled, val ); + } + + return r; +} + +/* * There are a whole slew of these we need to set * * @@ -203,29 +229,14 @@ static VOID set_installer_properties(MSI static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0}; static const WCHAR szScreenFormat[] = {'%','d',0};
-/* - * Other things I notice set - * -SystemLanguageID -ComputerName -UserLanguageID -LogonUser -VirtualMemory -Intel -ShellAdvSupport -DefaultUIFont -VersionDatabase -PackagecodeChanging -ProductState -CaptionHeight -BorderTop -BorderSide -TextHeight -RedirectedDllSupport -Time -Date -Privileged -*/ + /* + * Other things that probably should be set: + * + * SystemLanguageID ComputerName UserLanguageID LogonUser VirtualMemory + * Intel ShellAdvSupport DefaultUIFont VersionDatabase PackagecodeChanging + * ProductState CaptionHeight BorderTop BorderSide TextHeight + * RedirectedDllSupport Time Date Privileged + */
SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth); strcatW(pth,cszbs); @@ -357,6 +368,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABA { static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 }; static const WCHAR szpi[] = {'%','i',0}; + static const WCHAR szProductCode[] = { + 'P','r','o','d','u','c','t','C','o','d','e',0}; MSIPACKAGE *package = NULL; WCHAR uilevel[10];
@@ -393,6 +406,9 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABA set_installer_properties(package); sprintfW(uilevel,szpi,gUILevel); MSI_SetPropertyW(package, szLevel, uilevel); + + package->ProductCode = msi_dup_property( package, szProductCode ); + set_installed_prop( package ); }
return package; @@ -431,8 +447,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIDATABASE *db = NULL; MSIPACKAGE *package; MSIHANDLE handle; - DWORD size; - static const WCHAR szProductCode[]= {'P','r','o','d','u','c','t','C','o','d','e',0}; UINT r;
TRACE("%s %p\n", debugstr_w(szPackage), pPackage); @@ -478,13 +492,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSI_SetPropertyW( package, Database, szPackage ); }
- /* this property must exist */ - size = 0; - MSI_GetPropertyW(package,szProductCode,NULL,&size); - size ++; - package->ProductCode = msi_alloc(size * sizeof(WCHAR)); - MSI_GetPropertyW(package,szProductCode,package->ProductCode, &size); - *pPackage = package;
return ERROR_SUCCESS;