Commit 828280f4 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Set the Installed property if the product is already installed.

parent 80b997a2
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "msi.h" #include "msi.h"
#include "msiquery.h" #include "msiquery.h"
#include "msipriv.h"
#include "objidl.h" #include "objidl.h"
#include "wincrypt.h" #include "wincrypt.h"
#include "winuser.h" #include "winuser.h"
...@@ -39,6 +38,9 @@ ...@@ -39,6 +38,9 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "objbase.h" #include "objbase.h"
#include "msipriv.h"
#include "action.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
static void MSI_FreePackage( MSIOBJECTHDR *arg) static void MSI_FreePackage( MSIOBJECTHDR *arg)
...@@ -121,6 +123,30 @@ static UINT clone_properties(MSIDATABASE *db) ...@@ -121,6 +123,30 @@ static UINT clone_properties(MSIDATABASE *db)
} }
/* /*
* 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 * There are a whole slew of these we need to set
* *
* *
...@@ -203,29 +229,14 @@ static VOID set_installer_properties(MSIPACKAGE *package) ...@@ -203,29 +229,14 @@ static VOID set_installer_properties(MSIPACKAGE *package)
static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0}; static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0};
static const WCHAR szScreenFormat[] = {'%','d',0}; static const WCHAR szScreenFormat[] = {'%','d',0};
/* /*
* Other things I notice set * Other things that probably should be set:
* *
SystemLanguageID * SystemLanguageID ComputerName UserLanguageID LogonUser VirtualMemory
ComputerName * Intel ShellAdvSupport DefaultUIFont VersionDatabase PackagecodeChanging
UserLanguageID * ProductState CaptionHeight BorderTop BorderSide TextHeight
LogonUser * RedirectedDllSupport Time Date Privileged
VirtualMemory */
Intel
ShellAdvSupport
DefaultUIFont
VersionDatabase
PackagecodeChanging
ProductState
CaptionHeight
BorderTop
BorderSide
TextHeight
RedirectedDllSupport
Time
Date
Privileged
*/
SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth); SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth);
strcatW(pth,cszbs); strcatW(pth,cszbs);
...@@ -357,6 +368,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) ...@@ -357,6 +368,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
{ {
static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 }; static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 };
static const WCHAR szpi[] = {'%','i',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; MSIPACKAGE *package = NULL;
WCHAR uilevel[10]; WCHAR uilevel[10];
...@@ -393,6 +406,9 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) ...@@ -393,6 +406,9 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
set_installer_properties(package); set_installer_properties(package);
sprintfW(uilevel,szpi,gUILevel); sprintfW(uilevel,szpi,gUILevel);
MSI_SetPropertyW(package, szLevel, uilevel); MSI_SetPropertyW(package, szLevel, uilevel);
package->ProductCode = msi_dup_property( package, szProductCode );
set_installed_prop( package );
} }
return package; return package;
...@@ -431,8 +447,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) ...@@ -431,8 +447,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
MSIDATABASE *db = NULL; MSIDATABASE *db = NULL;
MSIPACKAGE *package; MSIPACKAGE *package;
MSIHANDLE handle; MSIHANDLE handle;
DWORD size;
static const WCHAR szProductCode[]= {'P','r','o','d','u','c','t','C','o','d','e',0};
UINT r; UINT r;
TRACE("%s %p\n", debugstr_w(szPackage), pPackage); TRACE("%s %p\n", debugstr_w(szPackage), pPackage);
...@@ -478,13 +492,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) ...@@ -478,13 +492,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
MSI_SetPropertyW( package, Database, 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; *pPackage = package;
return ERROR_SUCCESS; return ERROR_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment