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 @@
#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 *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
*
*
......@@ -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 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( MSIDATABASE *db )
{
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( MSIDATABASE *db )
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, MSIPACKAGE **pPackage)
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, MSIPACKAGE **pPackage)
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;
......
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