-sync msi with wine 1.1.32
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 25 Oct 2009 11:06:09 +0000 (11:06 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 25 Oct 2009 11:06:09 +0000 (11:06 +0000)
svn path=/trunk/; revision=43735

25 files changed:
reactos/dll/win32/msi/action.c
reactos/dll/win32/msi/appsearch.c
reactos/dll/win32/msi/classes.c
reactos/dll/win32/msi/cond.tab.c
reactos/dll/win32/msi/cond.tab.h
reactos/dll/win32/msi/cond.y
reactos/dll/win32/msi/custom.c
reactos/dll/win32/msi/database.c
reactos/dll/win32/msi/dialog.c
reactos/dll/win32/msi/events.c
reactos/dll/win32/msi/files.c
reactos/dll/win32/msi/helpers.c
reactos/dll/win32/msi/media.c
reactos/dll/win32/msi/msi.c
reactos/dll/win32/msi/msi_De.rc
reactos/dll/win32/msi/msipriv.h
reactos/dll/win32/msi/msiquery.c
reactos/dll/win32/msi/package.c
reactos/dll/win32/msi/preview.c
reactos/dll/win32/msi/registry.c
reactos/dll/win32/msi/source.c
reactos/dll/win32/msi/string.c
reactos/dll/win32/msi/suminfo.c
reactos/dll/win32/msi/table.c
reactos/dll/win32/msi/upgrade.c

index 46249c2..a6af7cc 100644 (file)
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
-/*
- * Prototypes
- */
-static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran);
-static UINT ACTION_ProcessUISequence(MSIPACKAGE *package);
-static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI);
-static BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action, UINT* rc, BOOL force);
-
 /*
  * consts and values used
  */
 /*
  * consts and values used
  */
@@ -62,13 +54,8 @@ static const WCHAR szCreateFolders[] =
     {'C','r','e','a','t','e','F','o','l','d','e','r','s',0};
 static const WCHAR szCostFinalize[] =
     {'C','o','s','t','F','i','n','a','l','i','z','e',0};
     {'C','r','e','a','t','e','F','o','l','d','e','r','s',0};
 static const WCHAR szCostFinalize[] =
     {'C','o','s','t','F','i','n','a','l','i','z','e',0};
-const WCHAR szInstallFiles[] =
-    {'I','n','s','t','a','l','l','F','i','l','e','s',0};
-const WCHAR szDuplicateFiles[] =
-    {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
 static const WCHAR szWriteRegistryValues[] =
 static const WCHAR szWriteRegistryValues[] =
-    {'W','r','i','t','e','R','e','g','i','s','t','r','y',
-            'V','a','l','u','e','s',0};
+    {'W','r','i','t','e','R','e','g','i','s','t','r','y','V','a','l','u','e','s',0};
 static const WCHAR szCostInitialize[] =
     {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
 static const WCHAR szFileCost[] = 
 static const WCHAR szCostInitialize[] =
     {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
 static const WCHAR szFileCost[] = 
@@ -82,12 +69,7 @@ static const WCHAR szLaunchConditions[] =
 static const WCHAR szProcessComponents[] = 
     {'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szRegisterTypeLibraries[] = 
 static const WCHAR szProcessComponents[] = 
     {'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szRegisterTypeLibraries[] = 
-    {'R','e','g','i','s','t','e','r','T','y','p','e',
-            'L','i','b','r','a','r','i','e','s',0};
-const WCHAR szRegisterClassInfo[] = 
-    {'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
-const WCHAR szRegisterProgIdInfo[] = 
-    {'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
+    {'R','e','g','i','s','t','e','r','T','y','p','e','L','i','b','r','a','r','i','e','s',0};
 static const WCHAR szCreateShortcuts[] = 
     {'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0};
 static const WCHAR szPublishProduct[] = 
 static const WCHAR szCreateShortcuts[] = 
     {'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0};
 static const WCHAR szPublishProduct[] = 
@@ -103,8 +85,7 @@ static const WCHAR szRegisterProduct[] =
 static const WCHAR szInstallExecute[] = 
     {'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0};
 static const WCHAR szInstallExecuteAgain[] = 
 static const WCHAR szInstallExecute[] = 
     {'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0};
 static const WCHAR szInstallExecuteAgain[] = 
-    {'I','n','s','t','a','l','l','E','x','e','c','u','t','e',
-            'A','g','a','i','n',0};
+    {'I','n','s','t','a','l','l','E','x','e','c','u','t','e','A','g','a','i','n',0};
 static const WCHAR szInstallFinalize[] = 
     {'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0};
 static const WCHAR szForceReboot[] = 
 static const WCHAR szInstallFinalize[] = 
     {'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0};
 static const WCHAR szForceReboot[] = 
@@ -114,8 +95,7 @@ static const WCHAR szResolveSource[] =
 static const WCHAR szAppSearch[] = 
     {'A','p','p','S','e','a','r','c','h',0};
 static const WCHAR szAllocateRegistrySpace[] = 
 static const WCHAR szAppSearch[] = 
     {'A','p','p','S','e','a','r','c','h',0};
 static const WCHAR szAllocateRegistrySpace[] = 
-    {'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y',
-            'S','p','a','c','e',0};
+    {'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y','S','p','a','c','e',0};
 static const WCHAR szBindImage[] = 
     {'B','i','n','d','I','m','a','g','e',0};
 static const WCHAR szCCPSearch[] = 
 static const WCHAR szBindImage[] = 
     {'B','i','n','d','I','m','a','g','e',0};
 static const WCHAR szCCPSearch[] = 
@@ -126,58 +106,40 @@ static const WCHAR szDisableRollback[] =
     {'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0};
 static const WCHAR szExecuteAction[] = 
     {'E','x','e','c','u','t','e','A','c','t','i','o','n',0};
     {'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0};
 static const WCHAR szExecuteAction[] = 
     {'E','x','e','c','u','t','e','A','c','t','i','o','n',0};
-const WCHAR szFindRelatedProducts[] = 
-    {'F','i','n','d','R','e','l','a','t','e','d',
-            'P','r','o','d','u','c','t','s',0};
 static const WCHAR szInstallAdminPackage[] = 
 static const WCHAR szInstallAdminPackage[] = 
-    {'I','n','s','t','a','l','l','A','d','m','i','n',
-            'P','a','c','k','a','g','e',0};
+    {'I','n','s','t','a','l','l','A','d','m','i','n','P','a','c','k','a','g','e',0};
 static const WCHAR szInstallSFPCatalogFile[] = 
 static const WCHAR szInstallSFPCatalogFile[] = 
-    {'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g',
-            'F','i','l','e',0};
+    {'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g','F','i','l','e',0};
 static const WCHAR szIsolateComponents[] = 
     {'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szIsolateComponents[] = 
     {'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0};
-const WCHAR szMigrateFeatureStates[] = 
-    {'M','i','g','r','a','t','e','F','e','a','t','u','r','e',
-            'S','t','a','t','e','s',0};
-const WCHAR szMoveFiles[] = 
+static const WCHAR szMigrateFeatureStates[] =
+    {'M','i','g','r','a','t','e','F','e','a','t','u','r','e','S','t','a','t','e','s',0};
+static const WCHAR szMoveFiles[] =
     {'M','o','v','e','F','i','l','e','s',0};
 static const WCHAR szMsiPublishAssemblies[] = 
     {'M','o','v','e','F','i','l','e','s',0};
 static const WCHAR szMsiPublishAssemblies[] = 
-    {'M','s','i','P','u','b','l','i','s','h',
-            'A','s','s','e','m','b','l','i','e','s',0};
+    {'M','s','i','P','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0};
 static const WCHAR szMsiUnpublishAssemblies[] = 
 static const WCHAR szMsiUnpublishAssemblies[] = 
-    {'M','s','i','U','n','p','u','b','l','i','s','h',
-            'A','s','s','e','m','b','l','i','e','s',0};
+    {'M','s','i','U','n','p','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0};
 static const WCHAR szInstallODBC[] = 
     {'I','n','s','t','a','l','l','O','D','B','C',0};
 static const WCHAR szInstallServices[] = 
     {'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0};
 static const WCHAR szInstallODBC[] = 
     {'I','n','s','t','a','l','l','O','D','B','C',0};
 static const WCHAR szInstallServices[] = 
     {'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0};
-const WCHAR szPatchFiles[] = 
+static const WCHAR szPatchFiles[] =
     {'P','a','t','c','h','F','i','l','e','s',0};
 static const WCHAR szPublishComponents[] = 
     {'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szRegisterComPlus[] =
     {'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
     {'P','a','t','c','h','F','i','l','e','s',0};
 static const WCHAR szPublishComponents[] = 
     {'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szRegisterComPlus[] =
     {'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
-const WCHAR szRegisterExtensionInfo[] =
-    {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n',
-            'I','n','f','o',0};
 static const WCHAR szRegisterFonts[] =
     {'R','e','g','i','s','t','e','r','F','o','n','t','s',0};
 static const WCHAR szRegisterFonts[] =
     {'R','e','g','i','s','t','e','r','F','o','n','t','s',0};
-const WCHAR szRegisterMIMEInfo[] =
-    {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
 static const WCHAR szRegisterUser[] =
     {'R','e','g','i','s','t','e','r','U','s','e','r',0};
 static const WCHAR szRegisterUser[] =
     {'R','e','g','i','s','t','e','r','U','s','e','r',0};
-const WCHAR szRemoveDuplicateFiles[] =
-    {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e',
-            'F','i','l','e','s',0};
+static const WCHAR szRemoveDuplicateFiles[] =
+    {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
 static const WCHAR szRemoveEnvironmentStrings[] =
 static const WCHAR szRemoveEnvironmentStrings[] =
-    {'R','e','m','o','v','e','E','n','v','i','r','o','n','m','e','n','t',
-            'S','t','r','i','n','g','s',0};
-const WCHAR szRemoveExistingProducts[] =
-    {'R','e','m','o','v','e','E','x','i','s','t','i','n','g',
-            'P','r','o','d','u','c','t','s',0};
-const WCHAR szRemoveFiles[] =
-    {'R','e','m','o','v','e','F','i','l','e','s',0};
+    {'R','e','m','o','v','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0};
+static const WCHAR szRemoveExistingProducts[] =
+    {'R','e','m','o','v','e','E','x','i','s','t','i','n','g','P','r','o','d','u','c','t','s',0};
 static const WCHAR szRemoveFolders[] =
     {'R','e','m','o','v','e','F','o','l','d','e','r','s',0};
 static const WCHAR szRemoveIniValues[] =
 static const WCHAR szRemoveFolders[] =
     {'R','e','m','o','v','e','F','o','l','d','e','r','s',0};
 static const WCHAR szRemoveIniValues[] =
@@ -185,8 +147,7 @@ static const WCHAR szRemoveIniValues[] =
 static const WCHAR szRemoveODBC[] =
     {'R','e','m','o','v','e','O','D','B','C',0};
 static const WCHAR szRemoveRegistryValues[] =
 static const WCHAR szRemoveODBC[] =
     {'R','e','m','o','v','e','O','D','B','C',0};
 static const WCHAR szRemoveRegistryValues[] =
-    {'R','e','m','o','v','e','R','e','g','i','s','t','r','y',
-            'V','a','l','u','e','s',0};
+    {'R','e','m','o','v','e','R','e','g','i','s','t','r','y','V','a','l','u','e','s',0};
 static const WCHAR szRemoveShortcuts[] =
     {'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0};
 static const WCHAR szRMCCPSearch[] =
 static const WCHAR szRemoveShortcuts[] =
     {'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0};
 static const WCHAR szRMCCPSearch[] =
@@ -202,42 +163,27 @@ static const WCHAR szStartServices[] =
 static const WCHAR szStopServices[] =
     {'S','t','o','p','S','e','r','v','i','c','e','s',0};
 static const WCHAR szUnpublishComponents[] =
 static const WCHAR szStopServices[] =
     {'S','t','o','p','S','e','r','v','i','c','e','s',0};
 static const WCHAR szUnpublishComponents[] =
-    {'U','n','p','u','b','l','i','s','h',
-            'C','o','m','p','o','n','e','n','t','s',0};
+    {'U','n','p','u','b','l','i','s','h', 'C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szUnpublishFeatures[] =
     {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
 static const WCHAR szUnpublishFeatures[] =
     {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
-const WCHAR szUnregisterClassInfo[] =
-    {'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s',
-            'I','n','f','o',0};
+static const WCHAR szUnregisterClassInfo[] =
+    {'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
 static const WCHAR szUnregisterComPlus[] =
     {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
 static const WCHAR szUnregisterComPlus[] =
     {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
-const WCHAR szUnregisterExtensionInfo[] =
-    {'U','n','r','e','g','i','s','t','e','r',
-            'E','x','t','e','n','s','i','o','n','I','n','f','o',0};
+static const WCHAR szUnregisterExtensionInfo[] =
+    {'U','n','r','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
 static const WCHAR szUnregisterFonts[] =
     {'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0};
 static const WCHAR szUnregisterFonts[] =
     {'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0};
-const WCHAR szUnregisterMIMEInfo[] =
+static const WCHAR szUnregisterMIMEInfo[] =
     {'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
     {'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
-const WCHAR szUnregisterProgIdInfo[] =
-    {'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d',
-            'I','n','f','o',0};
+static const WCHAR szUnregisterProgIdInfo[] =
+    {'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
 static const WCHAR szUnregisterTypeLibraries[] =
 static const WCHAR szUnregisterTypeLibraries[] =
-    {'U','n','r','e','g','i','s','t','e','r','T','y','p','e',
-            'L','i','b','r','a','r','i','e','s',0};
+    {'U','n','r','e','g','i','s','t','e','r','T','y','p','e','L','i','b','r','a','r','i','e','s',0};
 static const WCHAR szValidateProductID[] =
     {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
 static const WCHAR szWriteEnvironmentStrings[] =
 static const WCHAR szValidateProductID[] =
     {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
 static const WCHAR szWriteEnvironmentStrings[] =
-    {'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t',
-            'S','t','r','i','n','g','s',0};
-
-/* action handlers */
-typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*);
-
-struct _actions {
-    LPCWSTR action;
-    STANDARDACTIONHANDLER handler;
-};
-
+    {'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0};
 
 /********************************************************
  * helper functions
 
 /********************************************************
  * helper functions
@@ -401,8 +347,6 @@ static LPWSTR* msi_split_string( LPCWSTR str, WCHAR sep )
 
 static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch )
 {
 
 static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch )
 {
-    static const WCHAR szProductCode[] =
-        { 'P','r','o','d','u','c','t','C','o','d','e',0 };
     static const WCHAR szSystemLanguageID[] =
         { 'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0 };
 
     static const WCHAR szSystemLanguageID[] =
         { 'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0 };
 
@@ -416,7 +360,6 @@ static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch
 
     if ( strstrW( patch_product, prod_code ) )
     {
 
     if ( strstrW( patch_product, prod_code ) )
     {
-        static const WCHAR zero[] = {'0',0};
         MSISUMMARYINFO *si;
         const WCHAR *p;
 
         MSISUMMARYINFO *si;
         const WCHAR *p;
 
@@ -450,7 +393,7 @@ static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch
         }
 
         p = strchrW( template, ';' );
         }
 
         p = strchrW( template, ';' );
-        if (p && (!strcmpW( p + 1, langid ) || !strcmpW( p + 1, zero )))
+        if (p && (!strcmpW( p + 1, langid ) || !strcmpW( p + 1, szZero )))
         {
             TRACE("applicable transform\n");
             ret = ERROR_SUCCESS;
         {
             TRACE("applicable transform\n");
             ret = ERROR_SUCCESS;
@@ -503,11 +446,10 @@ static UINT msi_apply_substorage_transform( MSIPACKAGE *package,
 
 UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si )
 {
 
 UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si )
 {
-    static const WCHAR szProdCode[] = { 'P','r','o','d','u','c','t','C','o','d','e',0 };
     LPWSTR guid_list, *guids, product_code;
     UINT i, ret = ERROR_FUNCTION_FAILED;
 
     LPWSTR guid_list, *guids, product_code;
     UINT i, ret = ERROR_FUNCTION_FAILED;
 
-    product_code = msi_dup_property( package, szProdCode );
+    product_code = msi_dup_property( package, szProductCode );
     if (!product_code)
     {
         /* FIXME: the property ProductCode should be written into the DB somewhere */
     if (!product_code)
     {
         /* FIXME: the property ProductCode should be written into the DB somewhere */
@@ -537,7 +479,6 @@ static UINT msi_set_media_source_prop(MSIPACKAGE *package)
     LPCWSTR prop;
     UINT r;
 
     LPCWSTR prop;
     UINT r;
 
-    static const WCHAR szPatch[] = {'P','A','T','C','H',0};
     static const WCHAR query[] = {'S','E','L','E','C','T',' ',
         '`','S','o','u','r','c','e','`',' ','F','R','O','M',' ',
         '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ',
     static const WCHAR query[] = {'S','E','L','E','C','T',' ',
         '`','S','o','u','r','c','e','`',' ','F','R','O','M',' ',
         '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ',
@@ -642,7 +583,6 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, LPCWSTR file )
 /* get the PATCH property, and apply all the patches it specifies */
 static UINT msi_apply_patches( MSIPACKAGE *package )
 {
 /* get the PATCH property, and apply all the patches it specifies */
 static UINT msi_apply_patches( MSIPACKAGE *package )
 {
-    static const WCHAR szPatch[] = { 'P','A','T','C','H',0 };
     LPWSTR patch_list, *patches;
     UINT i, r = ERROR_SUCCESS;
 
     LPWSTR patch_list, *patches;
     UINT i, r = ERROR_SUCCESS;
 
@@ -753,6 +693,12 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
+static BOOL needs_ui_sequence(MSIPACKAGE *package)
+{
+    INT level = msi_get_property_int(package, szUILevel, 0);
+    return (level & INSTALLUILEVEL_MASK) >= INSTALLUILEVEL_REDUCED;
+}
+
 static UINT msi_set_context(MSIPACKAGE *package)
 {
     WCHAR val[10];
 static UINT msi_set_context(MSIPACKAGE *package)
 {
     WCHAR val[10];
@@ -760,9 +706,6 @@ static UINT msi_set_context(MSIPACKAGE *package)
     DWORD num;
     UINT r;
 
     DWORD num;
     UINT r;
 
-    static const WCHAR szOne[] = {'1',0};
-    static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0};
-
     package->Context = MSIINSTALLCONTEXT_USERUNMANAGED;
 
     r = MSI_GetPropertyW(package, szAllUsers, val, &sz);
     package->Context = MSIINSTALLCONTEXT_USERUNMANAGED;
 
     r = MSI_GetPropertyW(package, szAllUsers, val, &sz);
@@ -777,180 +720,11 @@ static UINT msi_set_context(MSIPACKAGE *package)
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
-/****************************************************
- * TOP level entry points 
- *****************************************************/
-
-UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
-                         LPCWSTR szCommandLine )
-{
-    UINT rc;
-    BOOL ui = FALSE, ui_exists;
-    static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
-    static const WCHAR szAction[] = {'A','C','T','I','O','N',0};
-    static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0};
-    static const WCHAR szReinstall[] = {'R','E','I','N','S','T','A','L','L',0};
-    static const WCHAR szInstalled[] = {'I','n','s','t','a','l','l','e','d',0};
-    static const WCHAR szAll[] = {'A','L','L',0};
-
-    MSI_SetPropertyW(package, szAction, szInstall);
-
-    package->script = msi_alloc_zero(sizeof(MSISCRIPT));
-
-    package->script->InWhatSequence = SEQUENCE_INSTALL;
-
-    if (szPackagePath)   
-    {
-        LPWSTR p, dir;
-        LPCWSTR file;
-
-        dir = strdupW(szPackagePath);
-        p = strrchrW(dir, '\\');
-        if (p)
-        {
-            *(++p) = 0;
-            file = szPackagePath + (p - dir);
-        }
-        else
-        {
-            msi_free(dir);
-            dir = msi_alloc(MAX_PATH*sizeof(WCHAR));
-            GetCurrentDirectoryW(MAX_PATH, dir);
-            lstrcatW(dir, cszbs);
-            file = szPackagePath;
-        }
-
-        msi_free( package->PackagePath );
-        package->PackagePath = msi_alloc((lstrlenW(dir) + lstrlenW(file) + 1) * sizeof(WCHAR));
-        if (!package->PackagePath)
-        {
-            msi_free(dir);
-            return ERROR_OUTOFMEMORY;
-        }
-
-        lstrcpyW(package->PackagePath, dir);
-        lstrcatW(package->PackagePath, file);
-        msi_free(dir);
-
-        msi_set_sourcedir_props(package, FALSE);
-    }
-
-    msi_parse_command_line( package, szCommandLine, FALSE );
-
-    msi_apply_transforms( package );
-    msi_apply_patches( package );
-
-    if (!szCommandLine && msi_get_property_int( package, szInstalled, 0 ))
-    {
-        TRACE("setting reinstall property\n");
-        MSI_SetPropertyW( package, szReinstall, szAll );
-    }
-
-    /* properties may have been added by a transform */
-    msi_clone_properties( package );
-    msi_set_context( package );
-
-    if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) >= INSTALLUILEVEL_REDUCED )
-    {
-        package->script->InWhatSequence |= SEQUENCE_UI;
-        rc = ACTION_ProcessUISequence(package);
-        ui = TRUE;
-        ui_exists = ui_sequence_exists(package);
-        if (rc == ERROR_SUCCESS || !ui_exists)
-        {
-            package->script->InWhatSequence |= SEQUENCE_EXEC;
-            rc = ACTION_ProcessExecSequence(package,ui_exists);
-        }
-    }
-    else
-        rc = ACTION_ProcessExecSequence(package,FALSE);
-
-    package->script->CurrentlyScripting= FALSE;
-
-    /* process the ending type action */
-    if (rc == ERROR_SUCCESS)
-        ACTION_PerformActionSequence(package,-1,ui);
-    else if (rc == ERROR_INSTALL_USEREXIT) 
-        ACTION_PerformActionSequence(package,-2,ui);
-    else if (rc == ERROR_INSTALL_SUSPEND) 
-        ACTION_PerformActionSequence(package,-4,ui);
-    else  /* failed */
-        ACTION_PerformActionSequence(package,-3,ui);
-
-    /* finish up running custom actions */
-    ACTION_FinishCustomActions(package);
-    
-    if (rc == ERROR_SUCCESS && package->need_reboot)
-        return ERROR_SUCCESS_REBOOT_REQUIRED;
-
-    return rc;
-}
-
-static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI)
-{
-    UINT rc = ERROR_SUCCESS;
-    MSIRECORD * row = 0;
-    static const WCHAR ExecSeqQuery[] =
-        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e',
-         'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ',
-         '`','S','e','q','u','e','n','c','e','`',' ', '=',' ','%','i',0};
-
-    static const WCHAR UISeqQuery[] =
-        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-     '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e',
-     '`', ' ', 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',
-        ' ', '=',' ','%','i',0};
-
-    if (UI)
-        row = MSI_QueryGetRecord(package->db, UISeqQuery, seq);
-    else
-        row = MSI_QueryGetRecord(package->db, ExecSeqQuery, seq);
-
-    if (row)
-    {
-        LPCWSTR action, cond;
-
-        TRACE("Running the actions\n"); 
-
-        /* check conditions */
-        cond = MSI_RecordGetString(row,2);
-
-        /* this is a hack to skip errors in the condition code */
-        if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE)
-            goto end;
-
-        action = MSI_RecordGetString(row,1);
-        if (!action)
-        {
-            ERR("failed to fetch action\n");
-            rc = ERROR_FUNCTION_FAILED;
-            goto end;
-        }
-
-        if (UI)
-            rc = ACTION_PerformUIAction(package,action,-1);
-        else
-            rc = ACTION_PerformAction(package,action,-1,FALSE);
-end:
-        msiobj_release(&row->hdr);
-    }
-    else
-        rc = ERROR_SUCCESS;
-
-    return rc;
-}
-
-typedef struct {
-    MSIPACKAGE* package;
-    BOOL UI;
-} iterate_action_param;
-
 static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
 {
 static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
 {
-    iterate_action_param *iap = param;
     UINT rc;
     LPCWSTR cond, action;
     UINT rc;
     LPCWSTR cond, action;
+    MSIPACKAGE *package = param;
 
     action = MSI_RecordGetString(row,1);
     if (!action)
 
     action = MSI_RecordGetString(row,1);
     if (!action)
@@ -963,21 +737,21 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
     cond = MSI_RecordGetString(row,2);
 
     /* this is a hack to skip errors in the condition code */
     cond = MSI_RecordGetString(row,2);
 
     /* this is a hack to skip errors in the condition code */
-    if (MSI_EvaluateConditionW(iap->package, cond) == MSICONDITION_FALSE)
+    if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE)
     {
         TRACE("Skipping action: %s (condition is false)\n", debugstr_w(action));
         return ERROR_SUCCESS;
     }
 
     {
         TRACE("Skipping action: %s (condition is false)\n", debugstr_w(action));
         return ERROR_SUCCESS;
     }
 
-    if (iap->UI)
-        rc = ACTION_PerformUIAction(iap->package,action,-1);
+    if (needs_ui_sequence(package))
+        rc = ACTION_PerformUIAction(package, action, -1);
     else
     else
-        rc = ACTION_PerformAction(iap->package,action,-1,FALSE);
+        rc = ACTION_PerformAction(package, action, -1, FALSE);
 
     msi_dialog_check_messages( NULL );
 
 
     msi_dialog_check_messages( NULL );
 
-    if (iap->package->CurrentInstallState != ERROR_SUCCESS )
-        rc = iap->package->CurrentInstallState;
+    if (package->CurrentInstallState != ERROR_SUCCESS)
+        rc = package->CurrentInstallState;
 
     if (rc == ERROR_FUNCTION_NOT_CALLED)
         rc = ERROR_SUCCESS;
 
     if (rc == ERROR_FUNCTION_NOT_CALLED)
         rc = ERROR_SUCCESS;
@@ -999,23 +773,13 @@ UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode )
          '`','S','e','q','u','e','n','c','e','`',' ',
          '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
          '`','S','e','q','u','e','n','c','e','`',0};
          '`','S','e','q','u','e','n','c','e','`',' ',
          '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
          '`','S','e','q','u','e','n','c','e','`',0};
-    iterate_action_param iap;
-
-    /*
-     * FIXME: probably should be checking UILevel in the
-     *       ACTION_PerformUIAction/ACTION_PerformAction
-     *       rather than saving the UI level here. Those
-     *       two functions can be merged too.
-     */
-    iap.package = package;
-    iap.UI = TRUE;
 
     TRACE("%p %s %i\n", package, debugstr_w(szTable), iSequenceMode );
 
     r = MSI_OpenQuery( package->db, &view, query, szTable );
     if (r == ERROR_SUCCESS)
     {
 
     TRACE("%p %s %i\n", package, debugstr_w(szTable), iSequenceMode );
 
     r = MSI_OpenQuery( package->db, &view, query, szTable );
     if (r == ERROR_SUCCESS)
     {
-        r = MSI_IterateRecords( view, NULL, ITERATE_Actions, &iap );
+        r = MSI_IterateRecords( view, NULL, ITERATE_Actions, package );
         msiobj_release(&view->hdr);
     }
 
         msiobj_release(&view->hdr);
     }
 
@@ -1033,7 +797,6 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
          '`','S','e','q','u','e','n','c','e','`',' ', '>',' ','%','i',' ',
          'O','R','D','E','R',' ', 'B','Y',' ',
          '`','S','e','q','u','e','n','c','e','`',0 };
          '`','S','e','q','u','e','n','c','e','`',' ', '>',' ','%','i',' ',
          'O','R','D','E','R',' ', 'B','Y',' ',
          '`','S','e','q','u','e','n','c','e','`',0 };
-    MSIRECORD * row = 0;
     static const WCHAR IVQuery[] =
         {'S','E','L','E','C','T',' ','`','S','e','q','u','e','n','c','e','`',
          ' ', 'F','R','O','M',' ','`','I','n','s','t','a','l','l',
     static const WCHAR IVQuery[] =
         {'S','E','L','E','C','T',' ','`','S','e','q','u','e','n','c','e','`',
          ' ', 'F','R','O','M',' ','`','I','n','s','t','a','l','l',
@@ -1042,10 +805,6 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
          ' ','\'', 'I','n','s','t','a','l','l',
          'V','a','l','i','d','a','t','e','\'', 0};
     INT seq = 0;
          ' ','\'', 'I','n','s','t','a','l','l',
          'V','a','l','i','d','a','t','e','\'', 0};
     INT seq = 0;
-    iterate_action_param iap;
-
-    iap.package = package;
-    iap.UI = FALSE;
 
     if (package->script->ExecuteSequenceRun)
     {
 
     if (package->script->ExecuteSequenceRun)
     {
@@ -1058,7 +817,7 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
     /* get the sequence number */
     if (UIran)
     {
     /* get the sequence number */
     if (UIran)
     {
-        row = MSI_QueryGetRecord(package->db, IVQuery);
+        MSIRECORD *row = MSI_QueryGetRecord(package->db, IVQuery);
         if( !row )
             return ERROR_FUNCTION_FAILED;
         seq = MSI_RecordGetInteger(row,1);
         if( !row )
             return ERROR_FUNCTION_FAILED;
         seq = MSI_RecordGetInteger(row,1);
@@ -1070,7 +829,7 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
     {
         TRACE("Running the actions\n");
 
     {
         TRACE("Running the actions\n");
 
-        rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap);
+        rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, package);
         msiobj_release(&view->hdr);
     }
 
         msiobj_release(&view->hdr);
     }
 
@@ -1089,18 +848,13 @@ static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
          '`','S','e','q','u','e','n','c','e','`',' ',
          '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
          '`','S','e','q','u','e','n','c','e','`',0};
          '`','S','e','q','u','e','n','c','e','`',' ',
          '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
          '`','S','e','q','u','e','n','c','e','`',0};
-    iterate_action_param iap;
-
-    iap.package = package;
-    iap.UI = TRUE;
 
     rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
 
     rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
-    
     if (rc == ERROR_SUCCESS)
     {
         TRACE("Running the actions\n"); 
 
     if (rc == ERROR_SUCCESS)
     {
         TRACE("Running the actions\n"); 
 
-        rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap);
+        rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, package);
         msiobj_release(&view->hdr);
     }
 
         msiobj_release(&view->hdr);
     }
 
@@ -1126,60 +880,6 @@ static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
     return ret;
 }
 
     return ret;
 }
 
-/* 
- * A lot of actions are really important even if they don't do anything
- * explicit... Lots of properties are set at the beginning of the installation
- * CostFinalize does a bunch of work to translate the directories and such
- * 
- * But until I get write access to the database that is hard, so I am going to
- * hack it to see if I can get something to run.
- */
-UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script, BOOL force)
-{
-    UINT rc = ERROR_SUCCESS; 
-    BOOL handled;
-
-    TRACE("Performing action (%s)\n",debugstr_w(action));
-
-    handled = ACTION_HandleStandardAction(package, action, &rc, force);
-
-    if (!handled)
-        handled = ACTION_HandleCustomAction(package, action, &rc, script, force);
-
-    if (!handled)
-    {
-        WARN("unhandled msi action %s\n",debugstr_w(action));
-        rc = ERROR_FUNCTION_NOT_CALLED;
-    }
-
-    return rc;
-}
-
-UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
-{
-    UINT rc = ERROR_SUCCESS;
-    BOOL handled = FALSE;
-
-    TRACE("Performing action (%s)\n",debugstr_w(action));
-
-    handled = ACTION_HandleStandardAction(package, action, &rc,TRUE);
-
-    if (!handled)
-        handled = ACTION_HandleCustomAction(package, action, &rc, script, FALSE);
-
-    if( !handled && ACTION_DialogBox(package,action) == ERROR_SUCCESS )
-        handled = TRUE;
-
-    if (!handled)
-    {
-        WARN("unhandled msi action %s\n",debugstr_w(action));
-        rc = ERROR_FUNCTION_NOT_CALLED;
-    }
-
-    return rc;
-}
-
-
 /*
  * Actual Action Handlers
  */
 /*
  * Actual Action Handlers
  */
@@ -1650,7 +1350,6 @@ static UINT load_all_files(MSIPACKAGE *package)
 static UINT load_folder( MSIRECORD *row, LPVOID param )
 {
     MSIPACKAGE *package = param;
 static UINT load_folder( MSIRECORD *row, LPVOID param )
 {
     MSIPACKAGE *package = param;
-    static const WCHAR szDot[] = { '.',0 };
     static WCHAR szEmpty[] = { 0 };
     LPWSTR p, tgt_short, tgt_long, src_short, src_long;
     MSIFOLDER *folder;
     static WCHAR szEmpty[] = { 0 };
     LPWSTR p, tgt_short, tgt_long, src_short, src_long;
     MSIFOLDER *folder;
@@ -1748,7 +1447,6 @@ static UINT ACTION_CostInitialize(MSIPACKAGE *package)
 {
     static const WCHAR szCosting[] =
         {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
 {
     static const WCHAR szCosting[] =
         {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
-    static const WCHAR szZero[] = { '0', 0 };
 
     MSI_SetPropertyW(package, szCosting, szZero);
     MSI_SetPropertyW(package, cszRootDrive, c_colon);
 
     MSI_SetPropertyW(package, szCosting, szZero);
     MSI_SetPropertyW(package, cszRootDrive, c_colon);
@@ -1841,9 +1539,6 @@ static void ACTION_GetFeatureInstallStates(MSIPACKAGE *package)
 static BOOL process_state_property(MSIPACKAGE* package, int level,
                                    LPCWSTR property, INSTALLSTATE state)
 {
 static BOOL process_state_property(MSIPACKAGE* package, int level,
                                    LPCWSTR property, INSTALLSTATE state)
 {
-    static const WCHAR all[]={'A','L','L',0};
-    static const WCHAR remove[] = {'R','E','M','O','V','E',0};
-    static const WCHAR reinstall[] = {'R','E','I','N','S','T','A','L','L',0};
     LPWSTR override;
     MSIFEATURE *feature;
 
     LPWSTR override;
     MSIFEATURE *feature;
 
@@ -1853,13 +1548,13 @@ static BOOL process_state_property(MSIPACKAGE* package, int level,
 
     LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
     {
 
     LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
     {
-        if (lstrcmpW(property, remove) &&
+        if (lstrcmpW(property, szRemove) &&
             (feature->Level <= 0 || feature->Level > level))
             continue;
 
             (feature->Level <= 0 || feature->Level > level))
             continue;
 
-        if (!strcmpW(property, reinstall)) state = feature->Installed;
+        if (!strcmpW(property, szReinstall)) state = feature->Installed;
 
 
-        if (strcmpiW(override,all)==0)
+        if (strcmpiW(override, szAll)==0)
             msi_feature_set_state(package, feature, state);
         else
         {
             msi_feature_set_state(package, feature, state);
         else
         {
@@ -1898,10 +1593,6 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
         {'A','D','D','L','O','C','A','L',0};
     static const WCHAR szAddSource[] =
         {'A','D','D','S','O','U','R','C','E',0};
         {'A','D','D','L','O','C','A','L',0};
     static const WCHAR szAddSource[] =
         {'A','D','D','S','O','U','R','C','E',0};
-    static const WCHAR szRemove[] =
-        {'R','E','M','O','V','E',0};
-    static const WCHAR szReinstall[] =
-        {'R','E','I','N','S','T','A','L','L',0};
     static const WCHAR szAdvertise[] =
         {'A','D','V','E','R','T','I','S','E',0};
     BOOL override = FALSE;
     static const WCHAR szAdvertise[] =
         {'A','D','V','E','R','T','I','S','E',0};
     BOOL override = FALSE;
@@ -1972,13 +1663,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
         }
     }
     else
         }
     }
     else
-    {
-        /* set the Preselected Property */
-        static const WCHAR szPreselected[] = {'P','r','e','s','e','l','e','c','t','e','d',0};
-        static const WCHAR szOne[] = { '1', 0 };
-
-        MSI_SetPropertyW(package,szPreselected,szOne);
-    }
+        MSI_SetPropertyW(package, szPreselected, szOne);
 
     /*
      * now we want to enable or disable components base on feature
 
     /*
      * now we want to enable or disable components base on feature
@@ -2276,8 +1961,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
         {'I','N','S','T','A','L','L','L','E','V','E','L',0};
     static const WCHAR szOutOfDiskSpace[] =
         {'O','u','t','O','f','D','i','s','k','S','p','a','c','e',0};
         {'I','N','S','T','A','L','L','L','E','V','E','L',0};
     static const WCHAR szOutOfDiskSpace[] =
         {'O','u','t','O','f','D','i','s','k','S','p','a','c','e',0};
-    static const WCHAR szOne[] = { '1', 0 };
-    static const WCHAR szZero[] = { '0', 0 };
     MSICOMPONENT *comp;
     UINT rc;
     MSIQUERY * view;
     MSICOMPONENT *comp;
     UINT rc;
     MSIQUERY * view;
@@ -2528,8 +2211,7 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
     {
         case -1: 
             {
     {
         case -1: 
             {
-                static const WCHAR szALLUSER[] = {'A','L','L','U','S','E','R','S',0};
-                LPWSTR all_users = msi_dup_property( package, szALLUSER );
+                LPWSTR all_users = msi_dup_property( package, szAllUsers );
                 if (all_users && all_users[0] == '1')
                 {
                     root_key = HKEY_LOCAL_MACHINE;
                 if (all_users && all_users[0] == '1')
                 {
                     root_key = HKEY_LOCAL_MACHINE;
@@ -2584,7 +2266,6 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
         value_data = parse_value(package, value, &type, &size); 
     else
     {
         value_data = parse_value(package, value, &type, &size); 
     else
     {
-        static const WCHAR szEmpty[] = {0};
         value_data = (LPSTR)strdupW(szEmpty);
         size = sizeof(szEmpty);
         type = REG_SZ;
         value_data = (LPSTR)strdupW(szEmpty);
         size = sizeof(szEmpty);
         type = REG_SZ;
@@ -3486,9 +3167,6 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
     MSIMEDIADISK *disk;
     MSISOURCELISTINFO *info;
 
     MSIMEDIADISK *disk;
     MSISOURCELISTINFO *info;
 
-    static const WCHAR szEmpty[] = {0};
-    static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0};
-
     r = RegCreateKeyW(hkey, szSourceList, &source);
     if (r != ERROR_SUCCESS)
         return r;
     r = RegCreateKeyW(hkey, szSourceList, &source);
     if (r != ERROR_SUCCESS)
         return r;
@@ -3687,8 +3365,6 @@ static UINT msi_publish_patch(MSIPACKAGE *package, HKEY prodkey, HKEY hudkey)
     LONG res;
     UINT r = ERROR_FUNCTION_FAILED;
 
     LONG res;
     UINT r = ERROR_FUNCTION_FAILED;
 
-    static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
-
     res = RegCreateKeyExW(prodkey, szPatches, 0, NULL, 0, KEY_ALL_ACCESS, NULL,
                           &patches, NULL);
     if (res != ERROR_SUCCESS)
     res = RegCreateKeyExW(prodkey, szPatches, 0, NULL, 0, KEY_ALL_ACCESS, NULL,
                           &patches, NULL);
     if (res != ERROR_SUCCESS)
@@ -4054,10 +3730,9 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
             size = strlenW(feature->Feature_Parent)*sizeof(WCHAR);
         if (!absent)
         {
             size = strlenW(feature->Feature_Parent)*sizeof(WCHAR);
         if (!absent)
         {
-            static const WCHAR emptyW[] = {0};
             size += sizeof(WCHAR);
             RegSetValueExW(hkey,feature->Feature,0,REG_SZ,
             size += sizeof(WCHAR);
             RegSetValueExW(hkey,feature->Feature,0,REG_SZ,
-                           (LPBYTE)(feature->Feature_Parent ? feature->Feature_Parent : emptyW),size);
+                           (LPBYTE)(feature->Feature_Parent ? feature->Feature_Parent : szEmpty),size);
         }
         else
         {
         }
         else
         {
@@ -4127,63 +3802,6 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package)
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
-static UINT msi_get_local_package_name( LPWSTR path )
-{
-    static const WCHAR szInstaller[] = {
-        '\\','I','n','s','t','a','l','l','e','r','\\',0};
-    static const WCHAR fmt[] = { '%','x','.','m','s','i',0};
-    DWORD time, len, i;
-    HANDLE handle;
-
-    time = GetTickCount();
-    GetWindowsDirectoryW( path, MAX_PATH );
-    lstrcatW( path, szInstaller );
-    CreateDirectoryW( path, NULL );
-
-    len = lstrlenW(path);
-    for (i=0; i<0x10000; i++)
-    {
-        snprintfW( &path[len], MAX_PATH - len, fmt, (time+i)&0xffff );
-        handle = CreateFileW( path, GENERIC_WRITE, 0, NULL,
-                              CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 );
-        if (handle != INVALID_HANDLE_VALUE)
-        {
-            CloseHandle(handle);
-            break;
-        }
-        if (GetLastError() != ERROR_FILE_EXISTS &&
-            GetLastError() != ERROR_SHARING_VIOLATION)
-            return ERROR_FUNCTION_FAILED;
-    }
-
-    return ERROR_SUCCESS;
-}
-
-static UINT msi_make_package_local( MSIPACKAGE *package, HKEY hkey )
-{
-    WCHAR packagefile[MAX_PATH];
-    UINT r;
-
-    r = msi_get_local_package_name( packagefile );
-    if (r != ERROR_SUCCESS)
-        return r;
-
-    TRACE("Copying to local package %s\n",debugstr_w(packagefile));
-
-    r = CopyFileW( package->db->path, packagefile, FALSE);
-
-    if (!r)
-    {
-        ERR("Unable to copy package (%s -> %s) (error %d)\n",
-            debugstr_w(package->db->path), debugstr_w(packagefile), GetLastError());
-        return ERROR_FUNCTION_FAILED;
-    }
-
-    msi_reg_set_val_str( hkey, INSTALLPROPERTY_LOCALPACKAGEW, packagefile );
-
-    return ERROR_SUCCESS;
-}
-
 static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey)
 {
     LPWSTR prop, val, key;
 static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey)
 {
     LPWSTR prop, val, key;
@@ -4315,7 +3933,9 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
     if (rc != ERROR_SUCCESS)
         goto done;
 
     if (rc != ERROR_SUCCESS)
         goto done;
 
-    msi_make_package_local(package, props);
+    msi_reg_set_val_str( props, INSTALLPROPERTY_LOCALPACKAGEW, package->db->localfile );
+    msi_free( package->db->localfile );
+    package->db->localfile = NULL;
 
     rc = msi_publish_install_properties(package, hkey);
     if (rc != ERROR_SUCCESS)
 
     rc = msi_publish_install_properties(package, hkey);
     if (rc != ERROR_SUCCESS)
@@ -4354,8 +3974,6 @@ static UINT msi_unpublish_product(MSIPACKAGE *package)
     BOOL full_uninstall = TRUE;
     MSIFEATURE *feature;
 
     BOOL full_uninstall = TRUE;
     MSIFEATURE *feature;
 
-    static const WCHAR szRemove[] = {'R','E','M','O','V','E',0};
-    static const WCHAR szAll[] = {'A','L','L',0};
     static const WCHAR szUpgradeCode[] =
         {'U','p','g','r','a','d','e','C','o','d','e',0};
 
     static const WCHAR szUpgradeCode[] =
         {'U','p','g','r','a','d','e','C','o','d','e',0};
 
@@ -5350,7 +4968,6 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param )
          'C','o','n','t','r','o','l','\\',
          'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
          'E','n','v','i','r','o','n','m','e','n','t',0};
          'C','o','n','t','r','o','l','\\',
          'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
          'E','n','v','i','r','o','n','m','e','n','t',0};
-    static const WCHAR semicolon[] = {';',0};
 
     name = MSI_RecordGetString(rec, 2);
     value = MSI_RecordGetString(rec, 3);
 
     name = MSI_RecordGetString(rec, 2);
     value = MSI_RecordGetString(rec, 3);
@@ -5420,7 +5037,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param )
             goto done;
         }
 
             goto done;
         }
 
-        size =  (lstrlenW(value) + 1 + size) * sizeof(WCHAR);
+        size += (lstrlenW(value) + 1) * sizeof(WCHAR);
         newval =  msi_alloc(size);
         ptr = newval;
         if (!newval)
         newval =  msi_alloc(size);
         ptr = newval;
         if (!newval)
@@ -5436,7 +5053,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param )
             if (flags & ENV_MOD_PREFIX)
             {
                 lstrcpyW(newval, value);
             if (flags & ENV_MOD_PREFIX)
             {
                 lstrcpyW(newval, value);
-                lstrcatW(newval, semicolon);
+                lstrcatW(newval, szSemiColon);
                 ptr = newval + lstrlenW(value) + 1;
             }
 
                 ptr = newval + lstrlenW(value) + 1;
             }
 
@@ -5444,7 +5061,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param )
 
             if (flags & ENV_MOD_APPEND)
             {
 
             if (flags & ENV_MOD_APPEND)
             {
-                lstrcatW(newval, semicolon);
+                lstrcatW(newval, szSemiColon);
                 lstrcatW(newval, value);
             }
         }
                 lstrcatW(newval, value);
             }
         }
@@ -5697,8 +5314,6 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
     DWORD size;
     BOOL ret, wildcards;
 
     DWORD size;
     BOOL ret, wildcards;
 
-    static const WCHAR backslash[] = {'\\',0};
-
     comp = get_loaded_component(package, MSI_RecordGetString(rec, 2));
     if (!comp || !comp->Enabled ||
         !(comp->Action & (INSTALLSTATE_LOCAL | INSTALLSTATE_SOURCE)))
     comp = get_loaded_component(package, MSI_RecordGetString(rec, 2));
     if (!comp || !comp->Enabled ||
         !(comp->Action & (INSTALLSTATE_LOCAL | INSTALLSTATE_SOURCE)))
@@ -5736,7 +5351,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
 
         lstrcpyW(source, sourcedir);
         if (source[lstrlenW(source) - 1] != '\\')
 
         lstrcpyW(source, sourcedir);
         if (source[lstrlenW(source) - 1] != '\\')
-            lstrcatW(source, backslash);
+            lstrcatW(source, szBackSlash);
         lstrcatW(source, sourcename);
     }
 
         lstrcatW(source, sourcename);
     }
 
@@ -5769,7 +5384,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
 
     lstrcpyW(dest, destdir);
     if (dest[lstrlenW(dest) - 1] != '\\')
 
     lstrcpyW(dest, destdir);
     if (dest[lstrlenW(dest) - 1] != '\\')
-        lstrcatW(dest, backslash);
+        lstrcatW(dest, szBackSlash);
 
     if (destname)
         lstrcatW(dest, destname);
 
     if (destname)
         lstrcatW(dest, destname);
@@ -6471,7 +6086,15 @@ static UINT ACTION_UnregisterTypeLibraries( MSIPACKAGE *package )
     return msi_unimplemented_action_stub( package, "UnregisterTypeLibraries", table );
 }
 
     return msi_unimplemented_action_stub( package, "UnregisterTypeLibraries", table );
 }
 
-static const struct _actions StandardActions[] = {
+typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*);
+
+static const struct
+{
+    const WCHAR *action;
+    UINT (*handler)(MSIPACKAGE *);
+}
+StandardActions[] =
+{
     { szAllocateRegistrySpace, ACTION_AllocateRegistrySpace },
     { szAppSearch, ACTION_AppSearch },
     { szBindImage, ACTION_BindImage },
     { szAllocateRegistrySpace, ACTION_AllocateRegistrySpace },
     { szAppSearch, ACTION_AppSearch },
     { szBindImage, ACTION_BindImage },
@@ -6599,3 +6222,207 @@ static BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action,
     }
     return ret;
 }
     }
     return ret;
 }
+
+UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script, BOOL force)
+{
+    UINT rc = ERROR_SUCCESS;
+    BOOL handled;
+
+    TRACE("Performing action (%s)\n", debugstr_w(action));
+
+    handled = ACTION_HandleStandardAction(package, action, &rc, force);
+
+    if (!handled)
+        handled = ACTION_HandleCustomAction(package, action, &rc, script, force);
+
+    if (!handled)
+    {
+        WARN("unhandled msi action %s\n", debugstr_w(action));
+        rc = ERROR_FUNCTION_NOT_CALLED;
+    }
+
+    return rc;
+}
+
+UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
+{
+    UINT rc = ERROR_SUCCESS;
+    BOOL handled = FALSE;
+
+    TRACE("Performing action (%s)\n", debugstr_w(action));
+
+    handled = ACTION_HandleStandardAction(package, action, &rc,TRUE);
+
+    if (!handled)
+        handled = ACTION_HandleCustomAction(package, action, &rc, script, FALSE);
+
+    if( !handled && ACTION_DialogBox(package, action) == ERROR_SUCCESS )
+        handled = TRUE;
+
+    if (!handled)
+    {
+        WARN("unhandled msi action %s\n", debugstr_w(action));
+        rc = ERROR_FUNCTION_NOT_CALLED;
+    }
+
+    return rc;
+}
+
+static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq)
+{
+    UINT rc = ERROR_SUCCESS;
+    MSIRECORD *row;
+
+    static const WCHAR ExecSeqQuery[] =
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+         '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e',
+         'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ',
+         '`','S','e','q','u','e','n','c','e','`',' ', '=',' ','%','i',0};
+    static const WCHAR UISeqQuery[] =
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+     '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e',
+     '`', ' ', 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',
+        ' ', '=',' ','%','i',0};
+
+    if (needs_ui_sequence(package))
+        row = MSI_QueryGetRecord(package->db, UISeqQuery, seq);
+    else
+        row = MSI_QueryGetRecord(package->db, ExecSeqQuery, seq);
+
+    if (row)
+    {
+        LPCWSTR action, cond;
+
+        TRACE("Running the actions\n");
+
+        /* check conditions */
+        cond = MSI_RecordGetString(row, 2);
+
+        /* this is a hack to skip errors in the condition code */
+        if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE)
+        {
+            msiobj_release(&row->hdr);
+            return ERROR_SUCCESS;
+        }
+
+        action = MSI_RecordGetString(row, 1);
+        if (!action)
+        {
+            ERR("failed to fetch action\n");
+            msiobj_release(&row->hdr);
+            return ERROR_FUNCTION_FAILED;
+        }
+
+        if (needs_ui_sequence(package))
+            rc = ACTION_PerformUIAction(package, action, -1);
+        else
+            rc = ACTION_PerformAction(package, action, -1, FALSE);
+
+        msiobj_release(&row->hdr);
+    }
+
+    return rc;
+}
+
+/****************************************************
+ * TOP level entry points
+ *****************************************************/
+
+UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
+                         LPCWSTR szCommandLine )
+{
+    UINT rc;
+    BOOL ui_exists;
+
+    static const WCHAR szAction[] = {'A','C','T','I','O','N',0};
+    static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0};
+
+    MSI_SetPropertyW(package, szAction, szInstall);
+
+    package->script->InWhatSequence = SEQUENCE_INSTALL;
+
+    if (szPackagePath)
+    {
+        LPWSTR p, dir;
+        LPCWSTR file;
+
+        dir = strdupW(szPackagePath);
+        p = strrchrW(dir, '\\');
+        if (p)
+        {
+            *(++p) = 0;
+            file = szPackagePath + (p - dir);
+        }
+        else
+        {
+            msi_free(dir);
+            dir = msi_alloc(MAX_PATH * sizeof(WCHAR));
+            GetCurrentDirectoryW(MAX_PATH, dir);
+            lstrcatW(dir, szBackSlash);
+            file = szPackagePath;
+        }
+
+        msi_free( package->PackagePath );
+        package->PackagePath = msi_alloc((lstrlenW(dir) + lstrlenW(file) + 1) * sizeof(WCHAR));
+        if (!package->PackagePath)
+        {
+            msi_free(dir);
+            return ERROR_OUTOFMEMORY;
+        }
+
+        lstrcpyW(package->PackagePath, dir);
+        lstrcatW(package->PackagePath, file);
+        msi_free(dir);
+
+        msi_set_sourcedir_props(package, FALSE);
+    }
+
+    msi_parse_command_line( package, szCommandLine, FALSE );
+
+    msi_apply_transforms( package );
+    msi_apply_patches( package );
+
+    if (!szCommandLine && msi_get_property_int( package, szInstalled, 0 ))
+    {
+        TRACE("setting reinstall property\n");
+        MSI_SetPropertyW( package, szReinstall, szAll );
+    }
+
+    /* properties may have been added by a transform */
+    msi_clone_properties( package );
+    msi_set_context( package );
+
+    if (needs_ui_sequence( package))
+    {
+        package->script->InWhatSequence |= SEQUENCE_UI;
+        rc = ACTION_ProcessUISequence(package);
+        ui_exists = ui_sequence_exists(package);
+        if (rc == ERROR_SUCCESS || !ui_exists)
+        {
+            package->script->InWhatSequence |= SEQUENCE_EXEC;
+            rc = ACTION_ProcessExecSequence(package, ui_exists);
+        }
+    }
+    else
+        rc = ACTION_ProcessExecSequence(package, FALSE);
+
+    package->script->CurrentlyScripting = FALSE;
+
+    /* process the ending type action */
+    if (rc == ERROR_SUCCESS)
+        ACTION_PerformActionSequence(package, -1);
+    else if (rc == ERROR_INSTALL_USEREXIT)
+        ACTION_PerformActionSequence(package, -2);
+    else if (rc == ERROR_INSTALL_SUSPEND)
+        ACTION_PerformActionSequence(package, -4);
+    else  /* failed */
+        ACTION_PerformActionSequence(package, -3);
+
+    /* finish up running custom actions */
+    ACTION_FinishCustomActions(package);
+
+    if (rc == ERROR_SUCCESS && package->need_reboot)
+        return ERROR_SUCCESS_REBOOT_REQUIRED;
+
+    return rc;
+}
index 9cc1592..4ef4087 100644 (file)
@@ -162,8 +162,6 @@ static LPWSTR app_search_file(LPWSTR path, MSISIGNATURE *sig)
     LPWSTR val = NULL;
     LPBYTE buffer;
 
     LPWSTR val = NULL;
     LPBYTE buffer;
 
-    static const WCHAR root[] = {'\\',0};
-
     if (!sig->File)
     {
         PathRemoveFileSpecW(path);
     if (!sig->File)
     {
         PathRemoveFileSpecW(path);
@@ -193,7 +191,7 @@ static LPWSTR app_search_file(LPWSTR path, MSISIGNATURE *sig)
     if (!GetFileVersionInfoW(path, 0, size, buffer))
         goto done;
 
     if (!GetFileVersionInfoW(path, 0, size, buffer))
         goto done;
 
-    if (!VerQueryValueW(buffer, root, (LPVOID)&info, &size) || !info)
+    if (!VerQueryValueW(buffer, szBackSlash, (LPVOID)&info, &size) || !info)
         goto done;
 
     if (sig->MinVersionLS || sig->MinVersionMS)
         goto done;
 
     if (sig->MinVersionLS || sig->MinVersionMS)
@@ -633,12 +631,11 @@ static UINT ACTION_FileVersionMatches(const MSISIGNATURE *sig, LPCWSTR filePath,
 
             if (buf)
             {
 
             if (buf)
             {
-                static const WCHAR rootW[] = { '\\',0 };
                 UINT versionLen;
                 LPVOID subBlock = NULL;
 
                 if (GetFileVersionInfoW(filePath, 0, size, buf))
                 UINT versionLen;
                 LPVOID subBlock = NULL;
 
                 if (GetFileVersionInfoW(filePath, 0, size, buf))
-                    VerQueryValueW(buf, rootW, &subBlock, &versionLen);
+                    VerQueryValueW(buf, szBackSlash, &subBlock, &versionLen);
                 if (subBlock)
                 {
                     VS_FIXEDFILEINFO *info = subBlock;
                 if (subBlock)
                 {
                     VS_FIXEDFILEINFO *info = subBlock;
@@ -742,8 +739,6 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
     WCHAR subpath[MAX_PATH];
     WCHAR *buf;
 
     WCHAR subpath[MAX_PATH];
     WCHAR *buf;
 
-    static const WCHAR dot[] = {'.',0};
-    static const WCHAR dotdot[] = {'.','.',0};
     static const WCHAR starDotStarW[] = { '*','.','*',0 };
 
     TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir),
     static const WCHAR starDotStarW[] = { '*','.','*',0 };
 
     TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir),
@@ -792,8 +787,8 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
         if (hFind != INVALID_HANDLE_VALUE)
         {
             if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
         if (hFind != INVALID_HANDLE_VALUE)
         {
             if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
-                lstrcmpW(findData.cFileName, dot) &&
-                lstrcmpW(findData.cFileName, dotdot))
+                lstrcmpW(findData.cFileName, szDot) &&
+                lstrcmpW(findData.cFileName, szDotDot))
             {
                 lstrcpyW(subpath, dir);
                 PathAppendW(subpath, findData.cFileName);
             {
                 lstrcpyW(subpath, dir);
                 PathAppendW(subpath, findData.cFileName);
@@ -804,8 +799,8 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
             while (rc == ERROR_SUCCESS && !*appValue &&
                    FindNextFileW(hFind, &findData) != 0)
             {
             while (rc == ERROR_SUCCESS && !*appValue &&
                    FindNextFileW(hFind, &findData) != 0)
             {
-                if (!lstrcmpW(findData.cFileName, dot) ||
-                    !lstrcmpW(findData.cFileName, dotdot))
+                if (!lstrcmpW(findData.cFileName, szDot) ||
+                    !lstrcmpW(findData.cFileName, szDotDot))
                     continue;
 
                 lstrcpyW(subpath, dir);
                     continue;
 
                 lstrcpyW(subpath, dir);
@@ -1079,7 +1074,6 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
     UINT r = ERROR_SUCCESS;
 
     static const WCHAR success[] = {'C','C','P','_','S','u','c','c','e','s','s',0};
     UINT r = ERROR_SUCCESS;
 
     static const WCHAR success[] = {'C','C','P','_','S','u','c','c','e','s','s',0};
-    static const WCHAR one[] = {'1',0};
 
     signature = MSI_RecordGetString(row, 1);
 
 
     signature = MSI_RecordGetString(row, 1);
 
@@ -1089,7 +1083,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
     if (value)
     {
         TRACE("Found signature %s\n", debugstr_w(signature));
     if (value)
     {
         TRACE("Found signature %s\n", debugstr_w(signature));
-        MSI_SetPropertyW(package, success, one);
+        MSI_SetPropertyW(package, success, szOne);
         msi_free(value);
         r = ERROR_NO_MORE_ITEMS;
     }
         msi_free(value);
         r = ERROR_NO_MORE_ITEMS;
     }
index 483d65c..6ca35b9 100644 (file)
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
-
-extern const WCHAR szRegisterClassInfo[];
-extern const WCHAR szRegisterProgIdInfo[];
-extern const WCHAR szRegisterExtensionInfo[];
-extern const WCHAR szRegisterMIMEInfo[];
-
-extern const WCHAR szUnregisterClassInfo[];
-extern const WCHAR szUnregisterExtensionInfo[];
-extern const WCHAR szUnregisterMIMEInfo[];
-extern const WCHAR szUnregisterProgIdInfo[];
-
 static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
 {
     LPCWSTR buffer;
 static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
 {
     LPCWSTR buffer;
@@ -798,7 +787,6 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
     static const WCHAR szProgID[] = { 'P','r','o','g','I','D',0 };
     static const WCHAR szVIProgID[] = { 'V','e','r','s','i','o','n','I','n','d','e','p','e','n','d','e','n','t','P','r','o','g','I','D',0 };
     static const WCHAR szAppID[] = { 'A','p','p','I','D',0 };
     static const WCHAR szProgID[] = { 'P','r','o','g','I','D',0 };
     static const WCHAR szVIProgID[] = { 'V','e','r','s','i','o','n','I','n','d','e','p','e','n','d','e','n','t','P','r','o','g','I','D',0 };
     static const WCHAR szAppID[] = { 'A','p','p','I','D',0 };
-    static const WCHAR szSpace[] = {' ',0};
     static const WCHAR szFileType_fmt[] = {'F','i','l','e','T','y','p','e','\\','%','s','\\','%','i',0};
     HKEY hkey,hkey2,hkey3;
     MSICLASS *cls;
     static const WCHAR szFileType_fmt[] = {'F','i','l','e','T','y','p','e','\\','%','s','\\','%','i',0};
     HKEY hkey,hkey2,hkey3;
     MSICLASS *cls;
@@ -1098,7 +1086,6 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
      strcpyW(command,advertise);
      if (verb->Argument)
      {
      strcpyW(command,advertise);
      if (verb->Argument)
      {
-         static const WCHAR szSpace[] = {' ',0};
          strcatW(command,szSpace);
          strcatW(command,verb->Argument);
      }
          strcatW(command,szSpace);
          strcatW(command,verb->Argument);
      }
index b8f01c1..a35bd98 100644 (file)
@@ -143,7 +143,6 @@ struct cond_str {
 static LPWSTR COND_GetString( const struct cond_str *str );
 static LPWSTR COND_GetLiteral( const struct cond_str *str );
 static int cond_lex( void *COND_lval, COND_input *info);
 static LPWSTR COND_GetString( const struct cond_str *str );
 static LPWSTR COND_GetLiteral( const struct cond_str *str );
 static int cond_lex( void *COND_lval, COND_input *info);
-static const WCHAR szEmpty[] = { 0 };
 
 static INT compare_int( INT a, INT operator, INT b );
 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
 
 static INT compare_int( INT a, INT operator, INT b );
 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
@@ -185,7 +184,7 @@ static BOOL num_from_prop( LPCWSTR p, INT *val )
 
 
 /* Line 189 of yacc.c  */
 
 
 /* Line 189 of yacc.c  */
-#line 189 "cond.tab.c"
+#line 188 "cond.tab.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -260,7 +259,7 @@ typedef union YYSTYPE
 {
 
 /* Line 214 of yacc.c  */
 {
 
 /* Line 214 of yacc.c  */
-#line 111 "cond.y"
+#line 110 "cond.y"
 
     struct cond_str str;
     LPWSTR    string;
 
     struct cond_str str;
     LPWSTR    string;
@@ -269,7 +268,7 @@ typedef union YYSTYPE
 
 
 /* Line 214 of yacc.c  */
 
 
 /* Line 214 of yacc.c  */
-#line 273 "cond.tab.c"
+#line 272 "cond.tab.c"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -281,7 +280,7 @@ typedef union YYSTYPE
 
 
 /* Line 264 of yacc.c  */
 
 
 /* Line 264 of yacc.c  */
-#line 285 "cond.tab.c"
+#line 284 "cond.tab.c"
 
 #ifdef short
 # undef short
 
 #ifdef short
 # undef short
@@ -585,12 +584,12 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   135,   135,   141,   148,   152,   156,   160,   164,   171,
-     175,   182,   186,   190,   195,   199,   208,   217,   221,   225,
-     229,   233,   238,   243,   251,   252,   253,   254,   255,   256,
-     257,   258,   259,   260,   261,   262,   263,   264,   265,   266,
-     267,   268,   272,   276,   283,   292,   296,   305,   314,   327,
-     339,   346,   360,   369
+       0,   134,   134,   140,   147,   151,   155,   159,   163,   170,
+     174,   181,   185,   189,   194,   198,   207,   216,   220,   224,
+     228,   232,   237,   242,   250,   251,   252,   253,   254,   255,
+     256,   257,   258,   259,   260,   261,   262,   263,   264,   265,
+     266,   267,   271,   275,   282,   291,   295,   304,   313,   326,
+     338,   345,   359,   368
 };
 #endif
 
 };
 #endif
 
@@ -1541,7 +1540,7 @@ yyreduce:
         case 2:
 
 /* Line 1455 of yacc.c  */
         case 2:
 
 /* Line 1455 of yacc.c  */
-#line 136 "cond.y"
+#line 135 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
             cond->result = (yyvsp[(1) - (1)].value);
     {
             COND_input* cond = (COND_input*) info;
             cond->result = (yyvsp[(1) - (1)].value);
@@ -1551,7 +1550,7 @@ yyreduce:
   case 3:
 
 /* Line 1455 of yacc.c  */
   case 3:
 
 /* Line 1455 of yacc.c  */
-#line 141 "cond.y"
+#line 140 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
             cond->result = MSICONDITION_NONE;
     {
             COND_input* cond = (COND_input*) info;
             cond->result = MSICONDITION_NONE;
@@ -1561,7 +1560,7 @@ yyreduce:
   case 4:
 
 /* Line 1455 of yacc.c  */
   case 4:
 
 /* Line 1455 of yacc.c  */
-#line 149 "cond.y"
+#line 148 "cond.y"
     {
             (yyval.value) = (yyvsp[(1) - (1)].value);
         ;}
     {
             (yyval.value) = (yyvsp[(1) - (1)].value);
         ;}
@@ -1570,7 +1569,7 @@ yyreduce:
   case 5:
 
 /* Line 1455 of yacc.c  */
   case 5:
 
 /* Line 1455 of yacc.c  */
-#line 153 "cond.y"
+#line 152 "cond.y"
     {
             (yyval.value) = (yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value);
         ;}
     {
             (yyval.value) = (yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value);
         ;}
@@ -1579,7 +1578,7 @@ yyreduce:
   case 6:
 
 /* Line 1455 of yacc.c  */
   case 6:
 
 /* Line 1455 of yacc.c  */
-#line 157 "cond.y"
+#line 156 "cond.y"
     {
             (yyval.value) = !(yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value);
         ;}
     {
             (yyval.value) = !(yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value);
         ;}
@@ -1588,7 +1587,7 @@ yyreduce:
   case 7:
 
 /* Line 1455 of yacc.c  */
   case 7:
 
 /* Line 1455 of yacc.c  */
-#line 161 "cond.y"
+#line 160 "cond.y"
     {
             (yyval.value) = ( (yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value) ) && !( (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value) );
         ;}
     {
             (yyval.value) = ( (yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value) ) && !( (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value) );
         ;}
@@ -1597,7 +1596,7 @@ yyreduce:
   case 8:
 
 /* Line 1455 of yacc.c  */
   case 8:
 
 /* Line 1455 of yacc.c  */
-#line 165 "cond.y"
+#line 164 "cond.y"
     {
             (yyval.value) = ( (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value) ) || ( !(yyvsp[(1) - (3)].value) && !(yyvsp[(3) - (3)].value) );
         ;}
     {
             (yyval.value) = ( (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value) ) || ( !(yyvsp[(1) - (3)].value) && !(yyvsp[(3) - (3)].value) );
         ;}
@@ -1606,7 +1605,7 @@ yyreduce:
   case 9:
 
 /* Line 1455 of yacc.c  */
   case 9:
 
 /* Line 1455 of yacc.c  */
-#line 172 "cond.y"
+#line 171 "cond.y"
     {
             (yyval.value) = (yyvsp[(1) - (1)].value);
         ;}
     {
             (yyval.value) = (yyvsp[(1) - (1)].value);
         ;}
@@ -1615,7 +1614,7 @@ yyreduce:
   case 10:
 
 /* Line 1455 of yacc.c  */
   case 10:
 
 /* Line 1455 of yacc.c  */
-#line 176 "cond.y"
+#line 175 "cond.y"
     {
             (yyval.value) = (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value);
         ;}
     {
             (yyval.value) = (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value);
         ;}
@@ -1624,7 +1623,7 @@ yyreduce:
   case 11:
 
 /* Line 1455 of yacc.c  */
   case 11:
 
 /* Line 1455 of yacc.c  */
-#line 183 "cond.y"
+#line 182 "cond.y"
     {
             (yyval.value) = (yyvsp[(2) - (2)].value) ? 0 : 1;
         ;}
     {
             (yyval.value) = (yyvsp[(2) - (2)].value) ? 0 : 1;
         ;}
@@ -1633,7 +1632,7 @@ yyreduce:
   case 12:
 
 /* Line 1455 of yacc.c  */
   case 12:
 
 /* Line 1455 of yacc.c  */
-#line 187 "cond.y"
+#line 186 "cond.y"
     {
             (yyval.value) = (yyvsp[(1) - (1)].value) ? 1 : 0;
         ;}
     {
             (yyval.value) = (yyvsp[(1) - (1)].value) ? 1 : 0;
         ;}
@@ -1642,7 +1641,7 @@ yyreduce:
   case 13:
 
 /* Line 1455 of yacc.c  */
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 191 "cond.y"
+#line 190 "cond.y"
     {
             (yyval.value) = ((yyvsp[(1) - (1)].string) && (yyvsp[(1) - (1)].string)[0]) ? 1 : 0;
             msi_free((yyvsp[(1) - (1)].string));
     {
             (yyval.value) = ((yyvsp[(1) - (1)].string) && (yyvsp[(1) - (1)].string)[0]) ? 1 : 0;
             msi_free((yyvsp[(1) - (1)].string));
@@ -1652,7 +1651,7 @@ yyreduce:
   case 14:
 
 /* Line 1455 of yacc.c  */
   case 14:
 
 /* Line 1455 of yacc.c  */
-#line 196 "cond.y"
+#line 195 "cond.y"
     {
             (yyval.value) = compare_int( (yyvsp[(1) - (3)].value), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].value) );
         ;}
     {
             (yyval.value) = compare_int( (yyvsp[(1) - (3)].value), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].value) );
         ;}
@@ -1661,7 +1660,7 @@ yyreduce:
   case 15:
 
 /* Line 1455 of yacc.c  */
   case 15:
 
 /* Line 1455 of yacc.c  */
-#line 200 "cond.y"
+#line 199 "cond.y"
     {
             int num;
             if (num_from_prop( (yyvsp[(1) - (3)].string), &num ))
     {
             int num;
             if (num_from_prop( (yyvsp[(1) - (3)].string), &num ))
@@ -1675,7 +1674,7 @@ yyreduce:
   case 16:
 
 /* Line 1455 of yacc.c  */
   case 16:
 
 /* Line 1455 of yacc.c  */
-#line 209 "cond.y"
+#line 208 "cond.y"
     {
             int num;
             if (num_from_prop( (yyvsp[(3) - (3)].string), &num ))
     {
             int num;
             if (num_from_prop( (yyvsp[(3) - (3)].string), &num ))
@@ -1689,7 +1688,7 @@ yyreduce:
   case 17:
 
 /* Line 1455 of yacc.c  */
   case 17:
 
 /* Line 1455 of yacc.c  */
-#line 218 "cond.y"
+#line 217 "cond.y"
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
         ;}
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
         ;}
@@ -1698,7 +1697,7 @@ yyreduce:
   case 18:
 
 /* Line 1455 of yacc.c  */
   case 18:
 
 /* Line 1455 of yacc.c  */
-#line 222 "cond.y"
+#line 221 "cond.y"
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
         ;}
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
         ;}
@@ -1707,7 +1706,7 @@ yyreduce:
   case 19:
 
 /* Line 1455 of yacc.c  */
   case 19:
 
 /* Line 1455 of yacc.c  */
-#line 226 "cond.y"
+#line 225 "cond.y"
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
         ;}
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
         ;}
@@ -1716,7 +1715,7 @@ yyreduce:
   case 20:
 
 /* Line 1455 of yacc.c  */
   case 20:
 
 /* Line 1455 of yacc.c  */
-#line 230 "cond.y"
+#line 229 "cond.y"
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), FALSE );
         ;}
     {
             (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), FALSE );
         ;}
@@ -1725,7 +1724,7 @@ yyreduce:
   case 21:
 
 /* Line 1455 of yacc.c  */
   case 21:
 
 /* Line 1455 of yacc.c  */
-#line 234 "cond.y"
+#line 233 "cond.y"
     {
             (yyval.value) = 0;
             msi_free((yyvsp[(1) - (3)].string));
     {
             (yyval.value) = 0;
             msi_free((yyvsp[(1) - (3)].string));
@@ -1735,7 +1734,7 @@ yyreduce:
   case 22:
 
 /* Line 1455 of yacc.c  */
   case 22:
 
 /* Line 1455 of yacc.c  */
-#line 239 "cond.y"
+#line 238 "cond.y"
     {
             (yyval.value) = 0;
             msi_free((yyvsp[(3) - (3)].string));
     {
             (yyval.value) = 0;
             msi_free((yyvsp[(3) - (3)].string));
@@ -1745,7 +1744,7 @@ yyreduce:
   case 23:
 
 /* Line 1455 of yacc.c  */
   case 23:
 
 /* Line 1455 of yacc.c  */
-#line 244 "cond.y"
+#line 243 "cond.y"
     {
             (yyval.value) = (yyvsp[(2) - (3)].value);
         ;}
     {
             (yyval.value) = (yyvsp[(2) - (3)].value);
         ;}
@@ -1754,133 +1753,133 @@ yyreduce:
   case 24:
 
 /* Line 1455 of yacc.c  */
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 251 "cond.y"
+#line 250 "cond.y"
     { (yyval.value) = COND_EQ; ;}
     break;
 
   case 25:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_EQ; ;}
     break;
 
   case 25:
 
 /* Line 1455 of yacc.c  */
-#line 252 "cond.y"
+#line 251 "cond.y"
     { (yyval.value) = COND_NE; ;}
     break;
 
   case 26:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_NE; ;}
     break;
 
   case 26:
 
 /* Line 1455 of yacc.c  */
-#line 253 "cond.y"
+#line 252 "cond.y"
     { (yyval.value) = COND_LT; ;}
     break;
 
   case 27:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_LT; ;}
     break;
 
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 254 "cond.y"
+#line 253 "cond.y"
     { (yyval.value) = COND_GT; ;}
     break;
 
   case 28:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_GT; ;}
     break;
 
   case 28:
 
 /* Line 1455 of yacc.c  */
-#line 255 "cond.y"
+#line 254 "cond.y"
     { (yyval.value) = COND_LE; ;}
     break;
 
   case 29:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_LE; ;}
     break;
 
   case 29:
 
 /* Line 1455 of yacc.c  */
-#line 256 "cond.y"
+#line 255 "cond.y"
     { (yyval.value) = COND_GE; ;}
     break;
 
   case 30:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_GE; ;}
     break;
 
   case 30:
 
 /* Line 1455 of yacc.c  */
-#line 257 "cond.y"
+#line 256 "cond.y"
     { (yyval.value) = COND_SS; ;}
     break;
 
   case 31:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_SS; ;}
     break;
 
   case 31:
 
 /* Line 1455 of yacc.c  */
-#line 258 "cond.y"
+#line 257 "cond.y"
     { (yyval.value) = COND_IEQ; ;}
     break;
 
   case 32:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_IEQ; ;}
     break;
 
   case 32:
 
 /* Line 1455 of yacc.c  */
-#line 259 "cond.y"
+#line 258 "cond.y"
     { (yyval.value) = COND_INE; ;}
     break;
 
   case 33:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_INE; ;}
     break;
 
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 260 "cond.y"
+#line 259 "cond.y"
     { (yyval.value) = COND_ILT; ;}
     break;
 
   case 34:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_ILT; ;}
     break;
 
   case 34:
 
 /* Line 1455 of yacc.c  */
-#line 261 "cond.y"
+#line 260 "cond.y"
     { (yyval.value) = COND_IGT; ;}
     break;
 
   case 35:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_IGT; ;}
     break;
 
   case 35:
 
 /* Line 1455 of yacc.c  */
-#line 262 "cond.y"
+#line 261 "cond.y"
     { (yyval.value) = COND_ILE; ;}
     break;
 
   case 36:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_ILE; ;}
     break;
 
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 263 "cond.y"
+#line 262 "cond.y"
     { (yyval.value) = COND_IGE; ;}
     break;
 
   case 37:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_IGE; ;}
     break;
 
   case 37:
 
 /* Line 1455 of yacc.c  */
-#line 264 "cond.y"
+#line 263 "cond.y"
     { (yyval.value) = COND_ISS; ;}
     break;
 
   case 38:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_ISS; ;}
     break;
 
   case 38:
 
 /* Line 1455 of yacc.c  */
-#line 265 "cond.y"
+#line 264 "cond.y"
     { (yyval.value) = COND_LHS; ;}
     break;
 
   case 39:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_LHS; ;}
     break;
 
   case 39:
 
 /* Line 1455 of yacc.c  */
-#line 266 "cond.y"
+#line 265 "cond.y"
     { (yyval.value) = COND_RHS; ;}
     break;
 
   case 40:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_RHS; ;}
     break;
 
   case 40:
 
 /* Line 1455 of yacc.c  */
-#line 267 "cond.y"
+#line 266 "cond.y"
     { (yyval.value) = COND_ILHS; ;}
     break;
 
   case 41:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_ILHS; ;}
     break;
 
   case 41:
 
 /* Line 1455 of yacc.c  */
-#line 268 "cond.y"
+#line 267 "cond.y"
     { (yyval.value) = COND_IRHS; ;}
     break;
 
   case 42:
 
 /* Line 1455 of yacc.c  */
     { (yyval.value) = COND_IRHS; ;}
     break;
 
   case 42:
 
 /* Line 1455 of yacc.c  */
-#line 273 "cond.y"
+#line 272 "cond.y"
     {
         (yyval.string) = (yyvsp[(1) - (1)].string);
     ;}
     {
         (yyval.string) = (yyvsp[(1) - (1)].string);
     ;}
@@ -1889,7 +1888,7 @@ yyreduce:
   case 43:
 
 /* Line 1455 of yacc.c  */
   case 43:
 
 /* Line 1455 of yacc.c  */
-#line 277 "cond.y"
+#line 276 "cond.y"
     {
         (yyval.string) = (yyvsp[(1) - (1)].string);
     ;}
     {
         (yyval.string) = (yyvsp[(1) - (1)].string);
     ;}
@@ -1898,7 +1897,7 @@ yyreduce:
   case 44:
 
 /* Line 1455 of yacc.c  */
   case 44:
 
 /* Line 1455 of yacc.c  */
-#line 284 "cond.y"
+#line 283 "cond.y"
     {
             (yyval.string) = COND_GetLiteral(&(yyvsp[(1) - (1)].str));
             if( !(yyval.string) )
     {
             (yyval.string) = COND_GetLiteral(&(yyvsp[(1) - (1)].str));
             if( !(yyval.string) )
@@ -1909,7 +1908,7 @@ yyreduce:
   case 45:
 
 /* Line 1455 of yacc.c  */
   case 45:
 
 /* Line 1455 of yacc.c  */
-#line 293 "cond.y"
+#line 292 "cond.y"
     {
             (yyval.value) = (yyvsp[(1) - (1)].value);
         ;}
     {
             (yyval.value) = (yyvsp[(1) - (1)].value);
         ;}
@@ -1918,7 +1917,7 @@ yyreduce:
   case 46:
 
 /* Line 1455 of yacc.c  */
   case 46:
 
 /* Line 1455 of yacc.c  */
-#line 297 "cond.y"
+#line 296 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
@@ -1932,7 +1931,7 @@ yyreduce:
   case 47:
 
 /* Line 1455 of yacc.c  */
   case 47:
 
 /* Line 1455 of yacc.c  */
-#line 306 "cond.y"
+#line 305 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
@@ -1946,7 +1945,7 @@ yyreduce:
   case 48:
 
 /* Line 1455 of yacc.c  */
   case 48:
 
 /* Line 1455 of yacc.c  */
-#line 315 "cond.y"
+#line 314 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
@@ -1964,7 +1963,7 @@ yyreduce:
   case 49:
 
 /* Line 1455 of yacc.c  */
   case 49:
 
 /* Line 1455 of yacc.c  */
-#line 328 "cond.y"
+#line 327 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
     {
             COND_input* cond = (COND_input*) info;
             INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
@@ -1978,7 +1977,7 @@ yyreduce:
   case 50:
 
 /* Line 1455 of yacc.c  */
   case 50:
 
 /* Line 1455 of yacc.c  */
-#line 340 "cond.y"
+#line 339 "cond.y"
     {
             COND_input* cond = (COND_input*) info;
 
     {
             COND_input* cond = (COND_input*) info;
 
@@ -1990,7 +1989,7 @@ yyreduce:
   case 51:
 
 /* Line 1455 of yacc.c  */
   case 51:
 
 /* Line 1455 of yacc.c  */
-#line 347 "cond.y"
+#line 346 "cond.y"
     {
             UINT len = GetEnvironmentVariableW( (yyvsp[(2) - (2)].string), NULL, 0 );
             (yyval.string) = NULL;
     {
             UINT len = GetEnvironmentVariableW( (yyvsp[(2) - (2)].string), NULL, 0 );
             (yyval.string) = NULL;
@@ -2006,7 +2005,7 @@ yyreduce:
   case 52:
 
 /* Line 1455 of yacc.c  */
   case 52:
 
 /* Line 1455 of yacc.c  */
-#line 361 "cond.y"
+#line 360 "cond.y"
     {
             (yyval.string) = COND_GetString(&(yyvsp[(1) - (1)].str));
             if( !(yyval.string) )
     {
             (yyval.string) = COND_GetString(&(yyvsp[(1) - (1)].str));
             if( !(yyval.string) )
@@ -2017,7 +2016,7 @@ yyreduce:
   case 53:
 
 /* Line 1455 of yacc.c  */
   case 53:
 
 /* Line 1455 of yacc.c  */
-#line 370 "cond.y"
+#line 369 "cond.y"
     {
             LPWSTR szNum = COND_GetString(&(yyvsp[(1) - (1)].str));
             if( !szNum )
     {
             LPWSTR szNum = COND_GetString(&(yyvsp[(1) - (1)].str));
             if( !szNum )
@@ -2030,7 +2029,7 @@ yyreduce:
 
 
 /* Line 1455 of yacc.c  */
 
 
 /* Line 1455 of yacc.c  */
-#line 2034 "cond.tab.c"
+#line 2033 "cond.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2242,7 +2241,7 @@ yyreturn:
 
 
 /* Line 1675 of yacc.c  */
 
 
 /* Line 1675 of yacc.c  */
-#line 379 "cond.y"
+#line 378 "cond.y"
 
 
 
 
 
 
index d6898bb..ebc6e23 100644 (file)
@@ -87,7 +87,7 @@ typedef union YYSTYPE
 {
 
 /* Line 1676 of yacc.c  */
 {
 
 /* Line 1676 of yacc.c  */
-#line 111 "cond.y"
+#line 110 "cond.y"
 
     struct cond_str str;
     LPWSTR    string;
 
     struct cond_str str;
     LPWSTR    string;
index 8831208..c2a1737 100644 (file)
@@ -64,7 +64,6 @@ struct cond_str {
 static LPWSTR COND_GetString( const struct cond_str *str );
 static LPWSTR COND_GetLiteral( const struct cond_str *str );
 static int cond_lex( void *COND_lval, COND_input *info);
 static LPWSTR COND_GetString( const struct cond_str *str );
 static LPWSTR COND_GetLiteral( const struct cond_str *str );
 static int cond_lex( void *COND_lval, COND_input *info);
-static const WCHAR szEmpty[] = { 0 };
 
 static INT compare_int( INT a, INT operator, INT b );
 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
 
 static INT compare_int( INT a, INT operator, INT b );
 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
index 5ac9c1b..508bf6b 100644 (file)
@@ -44,15 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
 static const WCHAR c_collen[] = {'C',':','\\',0};
 static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
 
 static const WCHAR c_collen[] = {'C',':','\\',0};
 static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
 
-
-static const WCHAR szActionData[] = {
-    'C','u','s','t','o','m','A','c','t','i','o','n','D','a','t','a',0
-};
-static const WCHAR ProdCode[] = {
-    'P','r','o','d','u','c','t','C','o','d','e',0
-};
-static const WCHAR UserSID[] = {'U','s','e','r','S','I','D',0};
-
 typedef struct tagMSIRUNNINGACTION
 {
     struct list entry;
 typedef struct tagMSIRUNNINGACTION
 {
     struct list entry;
@@ -172,17 +163,17 @@ static void set_deferred_action_props(MSIPACKAGE *package, LPWSTR deferred_data)
 
     end = strstrW(beg, sep);
     *end = '\0';
 
     end = strstrW(beg, sep);
     *end = '\0';
-    MSI_SetPropertyW(package, szActionData, beg);
+    MSI_SetPropertyW(package, szCustomActionData, beg);
     beg = end + 3;
 
     end = strstrW(beg, sep);
     *end = '\0';
     beg = end + 3;
 
     end = strstrW(beg, sep);
     *end = '\0';
-    MSI_SetPropertyW(package, UserSID, beg);
+    MSI_SetPropertyW(package, szUserSID, beg);
     beg = end + 3;
 
     end = strchrW(beg, ']');
     *end = '\0';
     beg = end + 3;
 
     end = strchrW(beg, ']');
     *end = '\0';
-    MSI_SetPropertyW(package, ProdCode, beg);
+    MSI_SetPropertyW(package, szProductCode, beg);
 }
 
 UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
 }
 
 UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
@@ -241,8 +232,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
         if (!execute)
         {
             LPWSTR actiondata = msi_dup_property(package, action);
         if (!execute)
         {
             LPWSTR actiondata = msi_dup_property(package, action);
-            LPWSTR usersid = msi_dup_property(package, UserSID);
-            LPWSTR prodcode = msi_dup_property(package, ProdCode);
+            LPWSTR usersid = msi_dup_property(package, szUserSID);
+            LPWSTR prodcode = msi_dup_property(package, szProductCode);
             LPWSTR deferred = msi_get_deferred_action(action, actiondata, usersid, prodcode);
 
             if (type & msidbCustomActionTypeCommit)
             LPWSTR deferred = msi_get_deferred_action(action, actiondata, usersid, prodcode);
 
             if (type & msidbCustomActionTypeCommit)
@@ -265,8 +256,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
         }
         else
         {
         }
         else
         {
-            static const WCHAR szBlank[] = {0};
-
             LPWSTR actiondata = msi_dup_property( package, action );
 
             switch (script)
             LPWSTR actiondata = msi_dup_property( package, action );
 
             switch (script)
@@ -287,9 +276,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
             if (deferred_data)
                 set_deferred_action_props(package, deferred_data);
             else if (actiondata)
             if (deferred_data)
                 set_deferred_action_props(package, deferred_data);
             else if (actiondata)
-                MSI_SetPropertyW(package,szActionData,actiondata);
+                MSI_SetPropertyW(package, szCustomActionData, actiondata);
             else
             else
-                MSI_SetPropertyW(package,szActionData,szBlank);
+                MSI_SetPropertyW(package, szCustomActionData, szEmpty);
 
             msi_free(actiondata);
         }
 
             msi_free(actiondata);
         }
@@ -383,7 +372,6 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
     MSIRECORD *row = 0;
     HANDLE file;
     CHAR buffer[1024];
     MSIRECORD *row = 0;
     HANDLE file;
     CHAR buffer[1024];
-    static const WCHAR f1[] = {'m','s','i',0};
     WCHAR fmt[MAX_PATH];
     DWORD sz = MAX_PATH;
     UINT r;
     WCHAR fmt[MAX_PATH];
     DWORD sz = MAX_PATH;
     UINT r;
@@ -391,7 +379,7 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
     if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS)
         GetTempPathW(MAX_PATH, fmt);
 
     if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS)
         GetTempPathW(MAX_PATH, fmt);
 
-    if (GetTempFileNameW(fmt, f1, 0, tmp_file) == 0)
+    if (GetTempFileNameW(fmt, szMsi, 0, tmp_file) == 0)
     {
         TRACE("Unable to create file\n");
         return ERROR_FUNCTION_FAILED;
     {
         TRACE("Unable to create file\n");
         return ERROR_FUNCTION_FAILED;
@@ -853,11 +841,9 @@ static UINT HANDLE_CustomType23(MSIPACKAGE *package, LPCWSTR source,
     DWORD size;
     UINT r;
 
     DWORD size;
     UINT r;
 
-    static const WCHAR backslash[] = {'\\',0};
-
     size = MAX_PATH;
     MSI_GetPropertyW(package, cszSourceDir, package_path, &size);
     size = MAX_PATH;
     MSI_GetPropertyW(package, cszSourceDir, package_path, &size);
-    lstrcatW(package_path, backslash);
+    lstrcatW(package_path, szBackSlash);
     lstrcatW(package_path, source);
 
     TRACE("Installing package %s concurrently\n", debugstr_w(package_path));
     lstrcatW(package_path, source);
 
     TRACE("Installing package %s concurrently\n", debugstr_w(package_path));
@@ -884,10 +870,7 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
           debugstr_w(tmp_file));
 
     if (!strchrW(tmp_file,'.'))
           debugstr_w(tmp_file));
 
     if (!strchrW(tmp_file,'.'))
-    {
-        static const WCHAR dot[]={'.',0};
-        strcatW(tmp_file,dot);
-    }
+        strcatW(tmp_file, szDot);
 
     info = do_msidbCustomActionTypeDll( package, type, tmp_file, target, action );
 
 
     info = do_msidbCustomActionTypeDll( package, type, tmp_file, target, action );
 
index 173657e..adbdb9d 100644 (file)
@@ -65,6 +65,11 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
         DeleteFileW( db->deletefile );
         msi_free( db->deletefile );
     }
         DeleteFileW( db->deletefile );
         msi_free( db->deletefile );
     }
+    if (db->localfile)
+    {
+        DeleteFileW( db->localfile );
+        msi_free( db->localfile );
+    }
 }
 
 UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
 }
 
 UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
@@ -78,7 +83,6 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
     BOOL created = FALSE;
     WCHAR path[MAX_PATH];
 
     BOOL created = FALSE;
     WCHAR path[MAX_PATH];
 
-    static const WCHAR backslash[] = {'\\',0};
     static const WCHAR szTables[]  = { '_','T','a','b','l','e','s',0 };
 
     TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) );
     static const WCHAR szTables[]  = { '_','T','a','b','l','e','s',0 };
 
     TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) );
@@ -177,7 +181,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
     if (!strchrW( save_path, '\\' ))
     {
         GetCurrentDirectoryW( MAX_PATH, path );
     if (!strchrW( save_path, '\\' ))
     {
         GetCurrentDirectoryW( MAX_PATH, path );
-        lstrcatW( path, backslash );
+        lstrcatW( path, szBackSlash );
         lstrcatW( path, save_path );
     }
     else
         lstrcatW( path, save_path );
     }
     else
@@ -192,8 +196,6 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
     db->mode = szMode;
     if (created)
         db->deletefile = strdupW( szDBPath );
     db->mode = szMode;
     if (created)
         db->deletefile = strdupW( szDBPath );
-    else
-        db->deletefile = NULL;
     list_init( &db->tables );
     list_init( &db->transforms );
 
     list_init( &db->tables );
     list_init( &db->transforms );
 
@@ -656,7 +658,6 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
     LPWSTR **records = NULL;
     LPWSTR **temp_records;
 
     LPWSTR **records = NULL;
     LPWSTR **temp_records;
 
-    static const WCHAR backslash[] = {'\\',0};
     static const WCHAR suminfo[] =
         {'_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0};
 
     static const WCHAR suminfo[] =
         {'_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0};
 
@@ -665,13 +666,13 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
     if( folder == NULL || file == NULL )
         return ERROR_INVALID_PARAMETER;
 
     if( folder == NULL || file == NULL )
         return ERROR_INVALID_PARAMETER;
 
-    len = lstrlenW(folder) + lstrlenW(backslash) + lstrlenW(file) + 1;
+    len = lstrlenW(folder) + lstrlenW(szBackSlash) + lstrlenW(file) + 1;
     path = msi_alloc( len * sizeof(WCHAR) );
     if (!path)
         return ERROR_OUTOFMEMORY;
 
     lstrcpyW( path, folder );
     path = msi_alloc( len * sizeof(WCHAR) );
     if (!path)
         return ERROR_OUTOFMEMORY;
 
     lstrcpyW( path, folder );
-    lstrcatW( path, backslash );
+    lstrcatW( path, szBackSlash );
     lstrcatW( path, file );
 
     data = msi_read_text_archive( path );
     lstrcatW( path, file );
 
     data = msi_read_text_archive( path );
@@ -878,7 +879,6 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
 {
     static const WCHAR query[] = {
         's','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','%','s',0 };
 {
     static const WCHAR query[] = {
         's','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','%','s',0 };
-    static const WCHAR szbs[] = { '\\', 0 };
     static const WCHAR forcecodepage[] = {
         '_','F','o','r','c','e','C','o','d','e','p','a','g','e',0 };
     MSIRECORD *rec = NULL;
     static const WCHAR forcecodepage[] = {
         '_','F','o','r','c','e','C','o','d','e','p','a','g','e',0 };
     MSIRECORD *rec = NULL;
@@ -899,7 +899,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
         return ERROR_OUTOFMEMORY;
 
     lstrcpyW( filename, folder );
         return ERROR_OUTOFMEMORY;
 
     lstrcpyW( filename, folder );
-    lstrcatW( filename, szbs );
+    lstrcatW( filename, szBackSlash );
     lstrcatW( filename, file );
 
     handle = CreateFileW( filename, GENERIC_READ | GENERIC_WRITE, 0,
     lstrcatW( filename, file );
 
     handle = CreateFileW( filename, GENERIC_READ | GENERIC_WRITE, 0,
@@ -1081,6 +1081,19 @@ typedef struct _tagMERGEDATA
     struct list *tabledata;
 } MERGEDATA;
 
     struct list *tabledata;
 } MERGEDATA;
 
+static BOOL merge_type_match(LPCWSTR type1, LPCWSTR type2)
+{
+    if (((type1[0] == 'l') || (type1[0] == 's')) &&
+        ((type2[0] == 'l') || (type2[0] == 's')))
+        return TRUE;
+
+    if (((type1[0] == 'L') || (type1[0] == 'S')) &&
+        ((type2[0] == 'L') || (type2[0] == 'S')))
+        return TRUE;
+
+    return !lstrcmpW(type1, type2);
+}
+
 static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview)
 {
     MSIRECORD *dbrec, *mergerec;
 static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview)
 {
     MSIRECORD *dbrec, *mergerec;
@@ -1126,7 +1139,7 @@ static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview)
         if (!MSI_RecordGetString(mergerec, i))
             break;
 
         if (!MSI_RecordGetString(mergerec, i))
             break;
 
-        if (lstrcmpW(MSI_RecordGetString(dbrec, i),
+        if (!merge_type_match(MSI_RecordGetString(dbrec, i),
                      MSI_RecordGetString(mergerec, i)))
         {
             r = ERROR_DATATYPE_MISMATCH;
                      MSI_RecordGetString(mergerec, i)))
         {
             r = ERROR_DATATYPE_MISMATCH;
@@ -1335,6 +1348,8 @@ static UINT merge_diff_row(MSIRECORD *rec, LPVOID param)
         }
         else if (r != ERROR_NO_MORE_ITEMS)
             goto done;
         }
         else if (r != ERROR_NO_MORE_ITEMS)
             goto done;
+
+        r = ERROR_SUCCESS;
     }
 
     mergerow = msi_alloc(sizeof(MERGEROW));
     }
 
     mergerow = msi_alloc(sizeof(MERGEROW));
index 88416e3..3f1b571 100644 (file)
@@ -495,7 +495,6 @@ static LPWSTR msi_create_tmp_path(void)
 {
     WCHAR tmp[MAX_PATH];
     LPWSTR path = NULL;
 {
     WCHAR tmp[MAX_PATH];
     LPWSTR path = NULL;
-    static const WCHAR prefix[] = { 'm','s','i',0 };
     DWORD len, r;
 
     r = GetTempPathW( MAX_PATH, tmp );
     DWORD len, r;
 
     r = GetTempPathW( MAX_PATH, tmp );
@@ -505,7 +504,7 @@ static LPWSTR msi_create_tmp_path(void)
     path = msi_alloc( len * sizeof (WCHAR) );
     if( path )
     {
     path = msi_alloc( len * sizeof (WCHAR) );
     if( path )
     {
-        r = GetTempFileNameW( tmp, prefix, 0, path );
+        r = GetTempFileNameW( tmp, szMsi, 0, path );
         if (!r)
         {
             msi_free( path );
         if (!r)
         {
             msi_free( path );
@@ -588,8 +587,6 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
     LPCWSTR font_text, text = NULL;
     LPWSTR font;
 
     LPCWSTR font_text, text = NULL;
     LPWSTR font;
 
-    static const WCHAR empty[] = {0};
-
     ctrl = msi_dialog_find_control( dialog, control );
     if (!ctrl)
         return;
     ctrl = msi_dialog_find_control( dialog, control );
     if (!ctrl)
         return;
@@ -597,7 +594,7 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
     {
         font_text = MSI_RecordGetString( rec , 1 );
         font = msi_dialog_get_style( font_text, &text );
     {
         font_text = MSI_RecordGetString( rec , 1 );
         font = msi_dialog_get_style( font_text, &text );
-        if (!text) text = empty;
+        if (!text) text = szEmpty;
         SetWindowTextW( ctrl->hwnd, text );
         msi_free( font );
         msi_dialog_check_messages( NULL );
         SetWindowTextW( ctrl->hwnd, text );
         msi_free( font );
         msi_dialog_check_messages( NULL );
@@ -2390,8 +2387,6 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c
     HANDLE file;
 
     static const WCHAR asterisk[] = {'*',0};
     HANDLE file;
 
     static const WCHAR asterisk[] = {'*',0};
-    static const WCHAR dot[] = {'.',0};
-    static const WCHAR dotdot[] = {'.','.',0};
 
     if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryList )))
         return;
 
     if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryList )))
         return;
@@ -2415,7 +2410,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c
         if ( wfd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
             continue;
 
         if ( wfd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
             continue;
 
-        if ( !lstrcmpW( wfd.cFileName, dot ) || !lstrcmpW( wfd.cFileName, dotdot ) )
+        if ( !lstrcmpW( wfd.cFileName, szDot ) || !lstrcmpW( wfd.cFileName, szDotDot ) )
             continue;
 
         item.mask = LVIF_TEXT;
             continue;
 
         item.mask = LVIF_TEXT;
@@ -2471,8 +2466,6 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog,
     LVITEMW item;
     int index;
 
     LVITEMW item;
     int index;
 
-    static const WCHAR backslash[] = {'\\',0};
-
     if (nmhdr->code != LVN_ITEMACTIVATE)
         return ERROR_SUCCESS;
 
     if (nmhdr->code != LVN_ITEMACTIVATE)
         return ERROR_SUCCESS;
 
@@ -2494,7 +2487,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog,
 
     lstrcpyW( new_path, path );
     lstrcatW( new_path, text );
 
     lstrcpyW( new_path, path );
     lstrcatW( new_path, text );
-    lstrcatW( new_path, backslash );
+    lstrcatW( new_path, szBackSlash );
 
     MSI_SetPropertyW( dialog->package, prop, new_path );
 
 
     MSI_SetPropertyW( dialog->package, prop, new_path );
 
@@ -2564,7 +2557,6 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
     LVCOLUMNW lvc;
     DWORD count = 0;
 
     LVCOLUMNW lvc;
     DWORD count = 0;
 
-    static const WCHAR zero[] = {'0',0};
     static const WCHAR negative[] = {'-',0};
 
     if (!text) return;
     static const WCHAR negative[] = {'-',0};
 
     if (!text) return;
@@ -2582,7 +2574,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
         begin += end - begin + 1;
 
         /* empty braces or '0' hides the column */ 
         begin += end - begin + 1;
 
         /* empty braces or '0' hides the column */ 
-        if ( !num[0] || !lstrcmpW( num, zero ) )
+        if ( !num[0] || !lstrcmpW( num, szZero ) )
         {
             count++;
             msi_free( num );
         {
             count++;
             msi_free( num );
@@ -3760,7 +3752,6 @@ UINT msi_spawn_error_dialog( MSIPACKAGE *package, LPWSTR error_dialog, LPWSTR er
     DWORD size = MAX_PATH;
     int res;
 
     DWORD size = MAX_PATH;
     int res;
 
-    static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
     static const WCHAR pn_prop[] = {'P','r','o','d','u','c','t','N','a','m','e',0};
     static const WCHAR title_fmt[] = {'%','s',' ','W','a','r','n','i','n','g',0};
     static const WCHAR error_abort[] = {'E','r','r','o','r','A','b','o','r','t',0};
     static const WCHAR pn_prop[] = {'P','r','o','d','u','c','t','N','a','m','e',0};
     static const WCHAR title_fmt[] = {'%','s',' ','W','a','r','n','i','n','g',0};
     static const WCHAR error_abort[] = {'E','r','r','o','r','A','b','o','r','t',0};
index a89d689..6275a95 100644 (file)
@@ -170,7 +170,6 @@ static UINT ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
 static UINT ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument, 
                                   msi_dialog* dialog)
 {
 static UINT ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument, 
                                   msi_dialog* dialog)
 {
-    static const WCHAR szAll[] = {'A','L','L',0};
     MSIFEATURE *feature = NULL;
 
     if (lstrcmpW(szAll,argument))
     MSIFEATURE *feature = NULL;
 
     if (lstrcmpW(szAll,argument))
@@ -190,7 +189,6 @@ static UINT ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument,
 static UINT ControlEvent_Remove(MSIPACKAGE* package, LPCWSTR argument, 
                                 msi_dialog* dialog)
 {
 static UINT ControlEvent_Remove(MSIPACKAGE* package, LPCWSTR argument, 
                                 msi_dialog* dialog)
 {
-    static const WCHAR szAll[] = {'A','L','L',0};
     MSIFEATURE *feature = NULL;
 
     if (lstrcmpW(szAll,argument))
     MSIFEATURE *feature = NULL;
 
     if (lstrcmpW(szAll,argument))
@@ -210,7 +208,6 @@ static UINT ControlEvent_Remove(MSIPACKAGE* package, LPCWSTR argument,
 static UINT ControlEvent_AddSource(MSIPACKAGE* package, LPCWSTR argument, 
                                    msi_dialog* dialog)
 {
 static UINT ControlEvent_AddSource(MSIPACKAGE* package, LPCWSTR argument, 
                                    msi_dialog* dialog)
 {
-    static const WCHAR szAll[] = {'A','L','L',0};
     MSIFEATURE *feature = NULL;
 
     if (lstrcmpW(szAll,argument))
     MSIFEATURE *feature = NULL;
 
     if (lstrcmpW(szAll,argument))
@@ -383,7 +380,6 @@ static UINT ControlEvent_DirectoryListUp(MSIPACKAGE *package, LPCWSTR argument,
 static UINT ControlEvent_ReinstallMode(MSIPACKAGE *package, LPCWSTR argument,
                                        msi_dialog *dialog)
 {
 static UINT ControlEvent_ReinstallMode(MSIPACKAGE *package, LPCWSTR argument,
                                        msi_dialog *dialog)
 {
-    static const WCHAR szReinstallMode[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
     return MSI_SetPropertyW( package, szReinstallMode, argument );
 }
 
     return MSI_SetPropertyW( package, szReinstallMode, argument );
 }
 
index d9cc0ff..d9470df 100644 (file)
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
-extern const WCHAR szInstallFiles[];
-extern const WCHAR szDuplicateFiles[];
-extern const WCHAR szMoveFiles[];
-extern const WCHAR szPatchFiles[];
-extern const WCHAR szRemoveDuplicateFiles[];
-extern const WCHAR szRemoveFiles[];
-
 static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action )
 {
     MSIRECORD *uirow;
 static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action )
 {
     MSIRECORD *uirow;
@@ -164,14 +157,12 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
     }
     if (gle == ERROR_SHARING_VIOLATION)
     {
     }
     if (gle == ERROR_SHARING_VIOLATION)
     {
-        static const WCHAR msiW[] = {'m','s','i',0};
-        static const WCHAR slashW[] = {'\\',0};
         WCHAR tmpfileW[MAX_PATH], *pathW, *p;
         DWORD len;
 
         TRACE("file in use, scheduling rename operation\n");
 
         WCHAR tmpfileW[MAX_PATH], *pathW, *p;
         DWORD len;
 
         TRACE("file in use, scheduling rename operation\n");
 
-        GetTempFileNameW(slashW, msiW, 0, tmpfileW);
+        GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW);
         len = strlenW(file->TargetPath) + strlenW(tmpfileW) + 1;
         if (!(pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
             return ERROR_OUTOFMEMORY;
         len = strlenW(file->TargetPath) + strlenW(tmpfileW) + 1;
         if (!(pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
             return ERROR_OUTOFMEMORY;
index 5cfb4af..8356923 100644 (file)
@@ -37,12 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
 static const WCHAR cszTargetDir[] = {'T','A','R','G','E','T','D','I','R',0};
 static const WCHAR cszDatabase[]={'D','A','T','A','B','A','S','E',0};
 
 static const WCHAR cszTargetDir[] = {'T','A','R','G','E','T','D','I','R',0};
 static const WCHAR cszDatabase[]={'D','A','T','A','B','A','S','E',0};
 
-const WCHAR cszSourceDir[] = {'S','o','u','r','c','e','D','i','r',0};
-const WCHAR cszSOURCEDIR[] = {'S','O','U','R','C','E','D','I','R',0};
-const WCHAR cszRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
-const WCHAR cszbs[]={'\\',0};
-const WCHAR szLocalSid[] = {'S','-','1','-','5','-','1','8',0};
-
 LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
 {
     LPWSTR SystemFolder, dest, FilePath;
 LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
 {
     LPWSTR SystemFolder, dest, FilePath;
@@ -724,7 +718,7 @@ LPWSTR build_directory_name(DWORD count, ...)
             continue;
         strcatW(dir, str);
         if( ((i+1)!=count) && dir[strlenW(dir)-1]!='\\')
             continue;
         strcatW(dir, str);
         if( ((i+1)!=count) && dir[strlenW(dir)-1]!='\\')
-            strcatW(dir, cszbs);
+            strcatW(dir, szBackSlash);
     }
     return dir;
 }
     }
     return dir;
 }
index 83f4698..06f14e0 100644 (file)
@@ -75,7 +75,6 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
     LPWSTR source_dir;
     UINT r = ERROR_SUCCESS;
 
     LPWSTR source_dir;
     UINT r = ERROR_SUCCESS;
 
-    static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
     static const WCHAR error_prop[] = {'E','r','r','o','r','D','i','a','l','o','g',0};
 
     if ((msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) ==
     static const WCHAR error_prop[] = {'E','r','r','o','r','D','i','a','l','o','g',0};
 
     if ((msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) ==
@@ -356,14 +355,12 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
         }
         if (err == ERROR_SHARING_VIOLATION)
         {
         }
         if (err == ERROR_SHARING_VIOLATION)
         {
-            static const WCHAR msiW[] = {'m','s','i',0};
-            static const WCHAR slashW[] = {'\\',0};
             WCHAR tmpfileW[MAX_PATH], *tmppathW, *p;
             DWORD len;
 
             TRACE("file in use, scheduling rename operation\n");
 
             WCHAR tmpfileW[MAX_PATH], *tmppathW, *p;
             DWORD len;
 
             TRACE("file in use, scheduling rename operation\n");
 
-            GetTempFileNameW(slashW, msiW, 0, tmpfileW);
+            GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW);
             len = strlenW(path) + strlenW(tmpfileW) + 1;
             if (!(tmppathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
                 return ERROR_OUTOFMEMORY;
             len = strlenW(path) + strlenW(tmpfileW) + 1;
             if (!(tmppathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
                 return ERROR_OUTOFMEMORY;
index 2a66d60..14f8f13 100644 (file)
@@ -264,8 +264,6 @@ UINT WINAPI MsiReinstallProductA(LPCSTR szProduct, DWORD dwReinstallMode)
 
 UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode)
 {
 
 UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode)
 {
-    static const WCHAR szAll[] = {'A','L','L',0};
-
     TRACE("%s %08x\n", debugstr_w(szProduct), dwReinstallMode);
 
     return MsiReinstallFeatureW(szProduct, szAll, dwReinstallMode);
     TRACE("%s %08x\n", debugstr_w(szProduct), dwReinstallMode);
 
     return MsiReinstallFeatureW(szProduct, szAll, dwReinstallMode);
@@ -311,7 +309,6 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
     LPWSTR beg, end;
     LPWSTR cmd = NULL, codes = NULL;
 
     LPWSTR beg, end;
     LPWSTR cmd = NULL, codes = NULL;
 
-    static const WCHAR space[] = {' ',0};
     static const WCHAR patcheq[] = {'P','A','T','C','H','=',0};
     static WCHAR empty[] = {0};
 
     static const WCHAR patcheq[] = {'P','A','T','C','H','=',0};
     static WCHAR empty[] = {0};
 
@@ -361,7 +358,7 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
     }
 
     lstrcpyW(cmd, cmd_ptr);
     }
 
     lstrcpyW(cmd, cmd_ptr);
-    if (szCommandLine) lstrcatW(cmd, space);
+    if (szCommandLine) lstrcatW(cmd, szSpace);
     lstrcatW(cmd, patcheq);
     lstrcatW(cmd, szPatchPackage);
 
     lstrcatW(cmd, patcheq);
     lstrcatW(cmd, szPatchPackage);
 
@@ -1216,9 +1213,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
     DWORD type;
     UINT r = ERROR_UNKNOWN_PRODUCT;
 
     DWORD type;
     UINT r = ERROR_UNKNOWN_PRODUCT;
 
-    static const WCHAR one[] = {'1',0};
     static const WCHAR five[] = {'5',0};
     static const WCHAR five[] = {'5',0};
-    static const WCHAR empty[] = {0};
     static const WCHAR displayname[] = {
         'D','i','s','p','l','a','y','N','a','m','e',0};
     static const WCHAR displayversion[] = {
     static const WCHAR displayname[] = {
         'D','i','s','p','l','a','y','N','a','m','e',0};
     static const WCHAR displayversion[] = {
@@ -1315,7 +1310,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
 
         val = msi_reg_get_value(props, szProperty, &type);
         if (!val)
 
         val = msi_reg_get_value(props, szProperty, &type);
         if (!val)
-            val = strdupW(empty);
+            val = strdupW(szEmpty);
 
         r = msi_copy_outval(val, szValue, pcchValue);
     }
 
         r = msi_copy_outval(val, szValue, pcchValue);
     }
@@ -1340,7 +1335,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
 
         val = msi_reg_get_value(hkey, szProperty, &type);
         if (!val)
 
         val = msi_reg_get_value(hkey, szProperty, &type);
         if (!val)
-            val = strdupW(empty);
+            val = strdupW(szEmpty);
 
         r = msi_copy_outval(val, szValue, pcchValue);
     }
 
         r = msi_copy_outval(val, szValue, pcchValue);
     }
@@ -1358,7 +1353,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
                 val = strdupW(five);
             }
             else
                 val = strdupW(five);
             }
             else
-                val = strdupW(one);
+                val = strdupW(szOne);
 
             r = msi_copy_outval(val, szValue, pcchValue);
             goto done;
 
             r = msi_copy_outval(val, szValue, pcchValue);
             goto done;
@@ -1372,7 +1367,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
         }
 
         if (prod || managed)
         }
 
         if (prod || managed)
-            val = strdupW(one);
+            val = strdupW(szOne);
         else
             goto done;
 
         else
             goto done;
 
@@ -1384,7 +1379,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
             goto done;
 
         /* FIXME */
             goto done;
 
         /* FIXME */
-        val = strdupW(empty);
+        val = strdupW(szEmpty);
         r = msi_copy_outval(val, szValue, pcchValue);
     }
     else
         r = msi_copy_outval(val, szValue, pcchValue);
     }
     else
@@ -1482,9 +1477,6 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
     DWORD len;
     LONG res;
 
     DWORD len;
     LONG res;
 
-    static const WCHAR szEmpty[] = {0};
-    static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
-    static const WCHAR szInstalled[] = {'I','n','s','t','a','l','l','e','d',0};
     static const WCHAR szManagedPackage[] = {'M','a','n','a','g','e','d',
         'L','o','c','a','l','P','a','c','k','a','g','e',0};
 
     static const WCHAR szManagedPackage[] = {'M','a','n','a','g','e','d',
         'L','o','c','a','l','P','a','c','k','a','g','e',0};
 
@@ -2971,8 +2963,6 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
     LPCWSTR orgptr;
     UINT r;
 
     LPCWSTR orgptr;
     UINT r;
 
-    static const WCHAR szEmpty[] = {0};
-
     TRACE("%s %p %p %p %p %p %p\n", debugstr_w(szProduct), lpUserNameBuf,
           pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
           pcchSerialBuf);
     TRACE("%s %p %p %p %p %p %p\n", debugstr_w(szProduct), lpUserNameBuf,
           pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
           pcchSerialBuf);
@@ -3385,10 +3375,6 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
     WCHAR filename[MAX_PATH];
     static const WCHAR szLogVerbose[] = {
         ' ','L','O','G','V','E','R','B','O','S','E',0 };
     WCHAR filename[MAX_PATH];
     static const WCHAR szLogVerbose[] = {
         ' ','L','O','G','V','E','R','B','O','S','E',0 };
-    static const WCHAR szInstalled[] = { 'I','n','s','t','a','l','l','e','d',0};
-    static const WCHAR szReinstall[] = {'R','E','I','N','S','T','A','L','L',0};
-    static const WCHAR szReinstallMode[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
-    static const WCHAR szOne[] = {'1',0};
     WCHAR reinstallmode[11];
     LPWSTR ptr;
     DWORD sz;
     WCHAR reinstallmode[11];
     LPWSTR ptr;
     DWORD sz;
index 6cee52a..7307621 100644 (file)
@@ -36,5 +36,4 @@ STRINGTABLE DISCARDABLE
        14 "Feature von:"
        15 "Wählen Sie das Verzeichnis aus, dass %s enthält."
 }
        14 "Feature von:"
        15 "Wählen Sie das Verzeichnis aus, dass %s enthält."
 }
-
 #pragma code_page(default)
 #pragma code_page(default)
index 71c3b69..9692b64 100644 (file)
@@ -76,6 +76,7 @@ typedef struct tagMSIDATABASE
     UINT bytes_per_strref;
     LPWSTR path;
     LPWSTR deletefile;
     UINT bytes_per_strref;
     LPWSTR path;
     LPWSTR deletefile;
+    LPWSTR localfile;
     LPCWSTR mode;
     struct list tables;
     struct list transforms;
     LPCWSTR mode;
     struct list tables;
     struct list transforms;
@@ -1029,12 +1030,44 @@ extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR f
 extern void ui_progress(MSIPACKAGE *, int, int, int, int);
 extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
 
 extern void ui_progress(MSIPACKAGE *, int, int, int, int);
 extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
 
-/* string consts use a number of places  and defined in helpers.c*/
-extern const WCHAR cszSourceDir[];
-extern const WCHAR cszSOURCEDIR[];
-extern const WCHAR cszRootDrive[];
-extern const WCHAR cszbs[];
-extern const WCHAR szLocalSid[];
+/* common strings */
+static const WCHAR cszSourceDir[] = {'S','o','u','r','c','e','D','i','r',0};
+static const WCHAR cszSOURCEDIR[] = {'S','O','U','R','C','E','D','I','R',0};
+static const WCHAR cszRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
+static const WCHAR szLocalSid[] = {'S','-','1','-','5','-','1','8',0};
+static const WCHAR szEmpty[] = {0};
+static const WCHAR szAll[] = {'A','L','L',0};
+static const WCHAR szOne[] = {'1',0};
+static const WCHAR szZero[] = {'0',0};
+static const WCHAR szSpace[] = {' ',0};
+static const WCHAR szBackSlash[] = {'\\',0};
+static const WCHAR szForwardSlash[] = {'/',0};
+static const WCHAR szDot[] = {'.',0};
+static const WCHAR szDotDot[] = {'.','.',0};
+static const WCHAR szSemiColon[] = {';',0};
+static const WCHAR szPreselected[] = {'P','r','e','s','e','l','e','c','t','e','d',0};
+static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
+static const WCHAR szState[] = {'S','t','a','t','e',0};
+static const WCHAR szMsi[] = {'m','s','i',0};
+static const WCHAR szPatch[] = {'P','A','T','C','H',0};
+static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0};
+static const WCHAR szInstalled[] = {'I','n','s','t','a','l','l','e','d',0};
+static const WCHAR szReinstall[] = {'R','E','I','N','S','T','A','L','L',0};
+static const WCHAR szReinstallMode[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
+static const WCHAR szRemove[] = {'R','E','M','O','V','E',0};
+static const WCHAR szUserSID[] = {'U','s','e','r','S','I','D',0};
+static const WCHAR szProductCode[] = {'P','r','o','d','u','c','t','C','o','d','e',0};
+static const WCHAR szRegisterClassInfo[] = {'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
+static const WCHAR szRegisterProgIdInfo[] = {'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
+static const WCHAR szRegisterExtensionInfo[] = {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
+static const WCHAR szRegisterMIMEInfo[] = {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
+static const WCHAR szDuplicateFiles[] = {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
+static const WCHAR szInstallFiles[] = {'I','n','s','t','a','l','l','F','i','l','e','s',0};
+static const WCHAR szRemoveFiles[] = {'R','e','m','o','v','e','F','i','l','e','s',0};
+static const WCHAR szFindRelatedProducts[] = {'F','i','n','d','R','e','l','a','t','e','d','P','r','o','d','u','c','t','s',0};
+static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0};
+static const WCHAR szCustomActionData[] = {'C','u','s','t','o','m','A','c','t','i','o','n','D','a','t','a',0};
+static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
 
 /* memory allocation macro functions */
 static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
 
 /* memory allocation macro functions */
 static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
index 5a46f9b..b973382 100644 (file)
@@ -126,9 +126,7 @@ UINT MSI_DatabaseOpenViewW(MSIDATABASE *db,
         return ERROR_FUNCTION_FAILED;
 
     msiobj_addref( &db->hdr );
         return ERROR_FUNCTION_FAILED;
 
     msiobj_addref( &db->hdr );
-    query->row = 0;
     query->db = db;
     query->db = db;
-    query->view = NULL;
     list_init( &query->mem );
 
     r = MSI_ParseSQL( db, szQuery, &query->view, &query->mem );
     list_init( &query->mem );
 
     r = MSI_ParseSQL( db, szQuery, &query->view, &query->mem );
index f74bf05..13091d9 100644 (file)
@@ -150,9 +150,6 @@ UINT msi_clone_properties(MSIPACKAGE *package)
  */
 static UINT set_installed_prop( MSIPACKAGE *package )
 {
  */
 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;
 
     HKEY hkey = 0;
     UINT r;
 
@@ -160,7 +157,7 @@ static UINT set_installed_prop( MSIPACKAGE *package )
     if (r == ERROR_SUCCESS)
     {
         RegCloseKey( hkey );
     if (r == ERROR_SUCCESS)
     {
         RegCloseKey( hkey );
-        MSI_SetPropertyW( package, szInstalled, val );
+        MSI_SetPropertyW( package, szInstalled, szOne );
     }
 
     return r;
     }
 
     return r;
@@ -175,8 +172,6 @@ static UINT set_user_sid_prop( MSIPACKAGE *package )
     PSID psid = NULL;
     UINT r = ERROR_FUNCTION_FAILED;
 
     PSID psid = NULL;
     UINT r = ERROR_FUNCTION_FAILED;
 
-    static const WCHAR user_sid[] = {'U','s','e','r','S','I','D',0};
-
     size = 0;
     GetUserNameW( NULL, &size );
 
     size = 0;
     GetUserNameW( NULL, &size );
 
@@ -205,7 +200,7 @@ static UINT set_user_sid_prop( MSIPACKAGE *package )
     if (!ConvertSidToStringSidW( psid, &sid_str ))
         goto done;
 
     if (!ConvertSidToStringSidW( psid, &sid_str ))
         goto done;
 
-    r = MSI_SetPropertyW( package, user_sid, sid_str );
+    r = MSI_SetPropertyW( package, szUserSID, sid_str );
 
 done:
     LocalFree( sid_str );
 
 done:
     LocalFree( sid_str );
@@ -226,7 +221,6 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package)
     WCHAR name[MAX_PATH];
     WCHAR windir[MAX_PATH];
 
     WCHAR name[MAX_PATH];
     WCHAR windir[MAX_PATH];
 
-    static const WCHAR backslash[] = {'\\',0};
     static const WCHAR fusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
     static const WCHAR sub[] = {
         'S','o','f','t','w','a','r','e','\\',
     static const WCHAR fusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
     static const WCHAR sub[] = {
         'S','o','f','t','w','a','r','e','\\',
@@ -265,10 +259,10 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package)
             }
 
             lstrcpyW(check, windir);
             }
 
             lstrcpyW(check, windir);
-            lstrcatW(check, backslash);
+            lstrcatW(check, szBackSlash);
             lstrcatW(check, subdir);
             lstrcatW(check, name);
             lstrcatW(check, subdir);
             lstrcatW(check, name);
-            lstrcatW(check, backslash);
+            lstrcatW(check, szBackSlash);
             lstrcatW(check, fusion);
 
             if(GetFileAttributesW(check) != INVALID_FILE_ATTRIBUTES)
             lstrcatW(check, fusion);
 
             if(GetFileAttributesW(check) != INVALID_FILE_ATTRIBUTES)
@@ -360,7 +354,6 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     SYSTEMTIME systemtime;
     LANGID langid;
 
     SYSTEMTIME systemtime;
     LANGID langid;
 
-    static const WCHAR cszbs[]={'\\',0};
     static const WCHAR CFF[] = 
 {'C','o','m','m','o','n','F','i','l','e','s','F','o','l','d','e','r',0};
     static const WCHAR PFF[] = 
     static const WCHAR CFF[] = 
 {'C','o','m','m','o','n','F','i','l','e','s','F','o','l','d','e','r',0};
     static const WCHAR PFF[] = 
@@ -407,8 +400,6 @@ static VOID set_installer_properties(MSIPACKAGE *package)
 {'A','d','m','i','n','U','s','e','r',0};
     static const WCHAR szPriv[] =
 {'P','r','i','v','i','l','e','g','e','d',0};
 {'A','d','m','i','n','U','s','e','r',0};
     static const WCHAR szPriv[] =
 {'P','r','i','v','i','l','e','g','e','d',0};
-    static const WCHAR szOne[] =
-{'1',0};
     static const WCHAR v9x[] = { 'V','e','r','s','i','o','n','9','X',0 };
     static const WCHAR vNT[] = { 'V','e','r','s','i','o','n','N','T',0 };
     static const WCHAR szMsiNTProductType[] = { 'M','s','i','N','T','P','r','o','d','u','c','t','T','y','p','e',0 };
     static const WCHAR v9x[] = { 'V','e','r','s','i','o','n','9','X',0 };
     static const WCHAR vNT[] = { 'V','e','r','s','i','o','n','N','T',0 };
     static const WCHAR szMsiNTProductType[] = { 'M','s','i','N','T','P','r','o','d','u','c','t','T','y','p','e',0 };
@@ -465,76 +456,76 @@ static VOID set_installer_properties(MSIPACKAGE *package)
      */
 
     SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth);
      */
 
     SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES_COMMON,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, CFF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES,NULL,0,pth);
     MSI_SetPropertyW(package, CFF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_PROGRAM_FILES,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, PFF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_COMMON_APPDATA,NULL,0,pth);
     MSI_SetPropertyW(package, PFF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_COMMON_APPDATA,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, CADF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_FAVORITES,NULL,0,pth);
     MSI_SetPropertyW(package, CADF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_FAVORITES,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, FaF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_FONTS,NULL,0,pth);
     MSI_SetPropertyW(package, FaF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_FONTS,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, FoF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_SENDTO,NULL,0,pth);
     MSI_SetPropertyW(package, FoF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_SENDTO,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, SendTF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_STARTMENU,NULL,0,pth);
     MSI_SetPropertyW(package, SendTF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_STARTMENU,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, SMF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_STARTUP,NULL,0,pth);
     MSI_SetPropertyW(package, SMF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_STARTUP,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, StF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_TEMPLATES,NULL,0,pth);
     MSI_SetPropertyW(package, StF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_TEMPLATES,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, TemplF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_DESKTOP,NULL,0,pth);
     MSI_SetPropertyW(package, TemplF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_DESKTOP,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, DF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_PROGRAMS,NULL,0,pth);
     MSI_SetPropertyW(package, DF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_PROGRAMS,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, PMF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_ADMINTOOLS,NULL,0,pth);
     MSI_SetPropertyW(package, PMF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_ADMINTOOLS,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, ATF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_APPDATA,NULL,0,pth);
     MSI_SetPropertyW(package, ATF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_APPDATA,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, ADF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_SYSTEM,NULL,0,pth);
     MSI_SetPropertyW(package, ADF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_SYSTEM,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, SF, pth);
     MSI_SetPropertyW(package, SF16, pth);
 
     SHGetFolderPathW(NULL,CSIDL_LOCAL_APPDATA,NULL,0,pth);
     MSI_SetPropertyW(package, SF, pth);
     MSI_SetPropertyW(package, SF16, pth);
 
     SHGetFolderPathW(NULL,CSIDL_LOCAL_APPDATA,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, LADF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_MYPICTURES,NULL,0,pth);
     MSI_SetPropertyW(package, LADF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_MYPICTURES,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, MPF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_PERSONAL,NULL,0,pth);
     MSI_SetPropertyW(package, MPF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_PERSONAL,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, PF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_WINDOWS,NULL,0,pth);
     MSI_SetPropertyW(package, PF, pth);
 
     SHGetFolderPathW(NULL,CSIDL_WINDOWS,NULL,0,pth);
-    strcatW(pth,cszbs);
+    strcatW(pth, szBackSlash);
     MSI_SetPropertyW(package, WF, pth);
     
     /* Physical Memory is specified in MB. Using total amount. */
     MSI_SetPropertyW(package, WF, pth);
     
     /* Physical Memory is specified in MB. Using total amount. */
@@ -753,15 +744,6 @@ static MSIPACKAGE *msi_alloc_package( void )
         list_init( &package->RunningActions );
         list_init( &package->sourcelist_info );
         list_init( &package->sourcelist_media );
         list_init( &package->RunningActions );
         list_init( &package->sourcelist_info );
         list_init( &package->sourcelist_media );
-
-        package->patch = NULL;
-        package->ActionFormat = NULL;
-        package->LastAction = NULL;
-        package->dialog = NULL;
-        package->next_dialog = NULL;
-        package->scheduled_action_running = FALSE;
-        package->commit_action_running = FALSE;
-        package->rollback_action_running = FALSE;
     }
 
     return package;
     }
 
     return package;
@@ -788,8 +770,6 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
 {
     static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 };
     static const WCHAR szpi[] = {'%','i',0};
 {
     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;
     WCHAR uilevel[10];
     UINT r;
     MSIPACKAGE *package;
     WCHAR uilevel[10];
     UINT r;
@@ -843,10 +823,9 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
 static LPCWSTR copy_package_to_temp( LPCWSTR szPackage, LPWSTR filename )
 {
     WCHAR path[MAX_PATH];
 static LPCWSTR copy_package_to_temp( LPCWSTR szPackage, LPWSTR filename )
 {
     WCHAR path[MAX_PATH];
-    static const WCHAR szMSI[] = {'m','s','i',0};
 
     GetTempPathW( MAX_PATH, path );
 
     GetTempPathW( MAX_PATH, path );
-    GetTempFileNameW( path, szMSI, 0, filename );
+    GetTempFileNameW( path, szMsi, 0, filename );
 
     if( !CopyFileW( szPackage, filename, FALSE ) )
     {
 
     if( !CopyFileW( szPackage, filename, FALSE ) )
     {
@@ -891,6 +870,38 @@ LPCWSTR msi_download_file( LPCWSTR szUrl, LPWSTR filename )
     return filename;
 }
 
     return filename;
 }
 
+static UINT msi_get_local_package_name( LPWSTR path )
+{
+    static const WCHAR szInstaller[] = {
+        '\\','I','n','s','t','a','l','l','e','r','\\',0};
+    static const WCHAR fmt[] = { '%','x','.','m','s','i',0};
+    DWORD time, len, i;
+    HANDLE handle;
+
+    time = GetTickCount();
+    GetWindowsDirectoryW( path, MAX_PATH );
+    strcatW( path, szInstaller );
+    CreateDirectoryW( path, NULL );
+
+    len = strlenW(path);
+    for (i = 0; i < 0x10000; i++)
+    {
+        snprintfW( &path[len], MAX_PATH - len, fmt, (time + i)&0xffff );
+        handle = CreateFileW( path, GENERIC_WRITE, 0, NULL,
+                              CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 );
+        if (handle != INVALID_HANDLE_VALUE)
+        {
+            CloseHandle(handle);
+            break;
+        }
+        if (GetLastError() != ERROR_FILE_EXISTS &&
+            GetLastError() != ERROR_SHARING_VIOLATION)
+            return ERROR_FUNCTION_FAILED;
+    }
+
+    return ERROR_SUCCESS;
+}
+
 UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
 {
     static const WCHAR OriginalDatabase[] =
 UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
 {
     static const WCHAR OriginalDatabase[] =
@@ -901,7 +912,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
     MSIHANDLE handle;
     LPWSTR ptr, base_url = NULL;
     UINT r;
     MSIHANDLE handle;
     LPWSTR ptr, base_url = NULL;
     UINT r;
-    WCHAR temppath[MAX_PATH];
+    WCHAR temppath[MAX_PATH], localfile[MAX_PATH];
     LPCWSTR file = szPackage;
 
     TRACE("%s %p\n", debugstr_w(szPackage), pPackage);
     LPCWSTR file = szPackage;
 
     TRACE("%s %p\n", debugstr_w(szPackage), pPackage);
@@ -929,6 +940,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
         if ( UrlIsW( szPackage, URLIS_URL ) )
         {
             file = msi_download_file( szPackage, temppath );
         if ( UrlIsW( szPackage, URLIS_URL ) )
         {
             file = msi_download_file( szPackage, temppath );
+            if ( file != szPackage )
+                file = copy_package_to_temp( file, temppath );
 
             base_url = strdupW( szPackage );
             if ( !base_url )
 
             base_url = strdupW( szPackage );
             if ( !base_url )
@@ -940,7 +953,24 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
         else
             file = copy_package_to_temp( szPackage, temppath );
 
         else
             file = copy_package_to_temp( szPackage, temppath );
 
-        r = MSI_OpenDatabaseW( file, MSIDBOPEN_READONLY, &db );
+        r = msi_get_local_package_name( localfile );
+        if (r != ERROR_SUCCESS)
+            return r;
+
+        TRACE("Copying to local package %s\n", debugstr_w(localfile));
+
+        if (!CopyFileW( file, localfile, FALSE ))
+        {
+            ERR("Unable to copy package (%s -> %s) (error %u)\n",
+                debugstr_w(file), debugstr_w(localfile), GetLastError());
+            return GetLastError();
+        }
+
+        /* transforms that add binary streams require that we open the database
+         * read/write, which is safe because we always create a copy that is thrown
+         * away when we're done.
+         */
+        r = MSI_OpenDatabaseW( file, MSIDBOPEN_DIRECT, &db );
         if( r != ERROR_SUCCESS )
         {
             if (file != szPackage)
         if( r != ERROR_SUCCESS )
         {
             if (file != szPackage)
@@ -951,6 +981,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
 
             return r;
         }
 
             return r;
         }
+
+        db->localfile = strdupW( localfile );
     }
 
     package = MSI_CreatePackage( db, base_url );
     }
 
     package = MSI_CreatePackage( db, base_url );
@@ -981,6 +1013,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
         MSI_SetPropertyW( package, OriginalDatabase, fullpath );
     }
 
         MSI_SetPropertyW( package, OriginalDatabase, fullpath );
     }
 
+    package->script = msi_alloc_zero( sizeof(MSISCRIPT) );
     *pPackage = package;
 
     return ERROR_SUCCESS;
     *pPackage = package;
 
     return ERROR_SUCCESS;
@@ -1148,7 +1181,6 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
             LPWSTR tmp;
             WCHAR number[3];
             static const WCHAR format[] = { '%','i',':',' ',0};
             LPWSTR tmp;
             WCHAR number[3];
             static const WCHAR format[] = { '%','i',':',' ',0};
-            static const WCHAR space[] = { ' ',0};
             sz = 0;
             MSI_RecordGetStringW(record,i,NULL,&sz);
             sz+=4;
             sz = 0;
             MSI_RecordGetStringW(record,i,NULL,&sz);
             sz+=4;
@@ -1165,7 +1197,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
             }
             strcatW(message,tmp);
             if (msg_field > 1)
             }
             strcatW(message,tmp);
             if (msg_field > 1)
-                strcatW(message,space);
+                strcatW(message, szSpace);
 
             msi_free(tmp);
         }
 
             msi_free(tmp);
         }
@@ -1526,7 +1558,6 @@ int msi_get_property_int(MSIPACKAGE *package, LPCWSTR prop, int def)
 static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
                              awstring *szValueBuf, LPDWORD pchValueBuf )
 {
 static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
                              awstring *szValueBuf, LPDWORD pchValueBuf )
 {
-    static const WCHAR empty[] = {0};
     MSIPACKAGE *package;
     MSIRECORD *row = NULL;
     UINT r = ERROR_FUNCTION_FAILED;
     MSIPACKAGE *package;
     MSIRECORD *row = NULL;
     UINT r = ERROR_FUNCTION_FAILED;
@@ -1602,7 +1633,7 @@ done:
         val = MSI_RecordGetString( row, 1 );
 
     if (!val)
         val = MSI_RecordGetString( row, 1 );
 
     if (!val)
-        val = empty;
+        val = szEmpty;
 
     r = msi_strcpy_to_awstring( val, szValueBuf, pchValueBuf );
 
 
     r = msi_strcpy_to_awstring( val, szValueBuf, pchValueBuf );
 
index a2b3f32..458e4a1 100644 (file)
@@ -54,7 +54,6 @@ static MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE *db )
         if( preview )
         {
             preview->package = package;
         if( preview )
         {
             preview->package = package;
-            preview->dialog = 0;
             msiobj_addref( &package->hdr );
         }
         msiobj_release( &package->hdr );
             msiobj_addref( &package->hdr );
         }
         msiobj_release( &package->hdr );
index f22c01f..1cbdcc9 100644 (file)
@@ -416,9 +416,8 @@ DWORD msi_version_str_to_dword(LPCWSTR p)
 
 LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value )
 {
 
 LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value )
 {
-    static const WCHAR emptyW[] = {0};
     DWORD len;
     DWORD len;
-    if (!value) value = emptyW;
+    if (!value) value = szEmpty;
     len = (lstrlenW(value) + 1) * sizeof (WCHAR);
     return RegSetValueExW( hkey, name, 0, REG_SZ, (const BYTE *)value, len );
 }
     len = (lstrlenW(value) + 1) * sizeof (WCHAR);
     return RegSetValueExW( hkey, name, 0, REG_SZ, (const BYTE *)value, len );
 }
@@ -1779,9 +1778,6 @@ static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid,
     LONG res;
     UINT r = ERROR_NO_MORE_ITEMS;
 
     LONG res;
     UINT r = ERROR_NO_MORE_ITEMS;
 
-    static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
-    static const WCHAR szState[] = {'S','t','a','t','e',0};
-
     *state = MSIPATCHSTATE_INVALID;
 
     r = MSIREG_OpenUserDataProductKey(prodcode, context,
     *state = MSIPATCHSTATE_INVALID;
 
     r = MSIREG_OpenUserDataProductKey(prodcode, context,
@@ -1830,10 +1826,6 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
     LONG res;
     UINT temp, r = ERROR_NO_MORE_ITEMS;
 
     LONG res;
     UINT temp, r = ERROR_NO_MORE_ITEMS;
 
-    static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
-    static const WCHAR szState[] = {'S','t','a','t','e',0};
-    static const WCHAR szEmpty[] = {0};
-
     if (MSIREG_OpenProductKey(prodcode, usersid, context,
                               &prod, FALSE) != ERROR_SUCCESS)
         return ERROR_NO_MORE_ITEMS;
     if (MSIREG_OpenProductKey(prodcode, usersid, context,
                               &prod, FALSE) != ERROR_SUCCESS)
         return ERROR_NO_MORE_ITEMS;
index df5905d..0e752f5 100644 (file)
@@ -57,7 +57,6 @@ static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions,
 {
     HKEY rootkey = 0; 
     UINT rc = ERROR_FUNCTION_FAILED;
 {
     HKEY rootkey = 0; 
     UINT rc = ERROR_FUNCTION_FAILED;
-    static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0};
 
     if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
 
     if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
@@ -1096,9 +1095,6 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
     DWORD index;
 
     static const WCHAR fmt[] = {'%','i',0};
     DWORD index;
 
     static const WCHAR fmt[] = {'%','i',0};
-    static const WCHAR one[] = {'1',0};
-    static const WCHAR backslash[] = {'\\',0};
-    static const WCHAR forwardslash[] = {'/',0};
 
     TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
           dwContext, dwOptions, debugstr_w(szSource), dwIndex);
 
     TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
           dwContext, dwOptions, debugstr_w(szSource), dwIndex);
@@ -1138,7 +1134,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
         return ERROR_FUNCTION_FAILED;
     }
 
         return ERROR_FUNCTION_FAILED;
     }
 
-    postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? backslash : forwardslash;
+    postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? szBackSlash : szForwardSlash;
     if (szSource[lstrlenW(szSource) - 1] == *postfix)
         source = strdupW(szSource);
     else
     if (szSource[lstrlenW(szSource) - 1] == *postfix)
         source = strdupW(szSource);
     else
@@ -1158,7 +1154,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
 
     if (count == 0)
     {
 
     if (count == 0)
     {
-        rc = RegSetValueExW(typekey, one, 0, REG_EXPAND_SZ, (LPBYTE)source, size);
+        rc = RegSetValueExW(typekey, szOne, 0, REG_EXPAND_SZ, (LPBYTE)source, size);
         goto done;
     }
     else if (dwIndex > count || dwIndex == 0)
         goto done;
     }
     else if (dwIndex > count || dwIndex == 0)
@@ -1248,7 +1244,6 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
     DWORD size;
 
     static const WCHAR fmt[] = {'%','i',0};
     DWORD size;
 
     static const WCHAR fmt[] = {'%','i',0};
-    static const WCHAR semicolon[] = {';',0};
 
     TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
             debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
 
     TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
             debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
@@ -1289,7 +1284,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
     *buffer = '\0';
 
     if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel);
     *buffer = '\0';
 
     if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel);
-    lstrcatW(buffer, semicolon);
+    lstrcatW(buffer, szSemiColon);
     if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt);
 
     RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
     if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt);
 
     RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
index 97b1099..e5b5cc2 100644 (file)
@@ -314,9 +314,8 @@ int msi_addstringW( string_table *st, UINT n, const WCHAR *data, int len, UINT r
 /* find the string identified by an id - return null if there's none */
 const WCHAR *msi_string_lookup_id( const string_table *st, UINT id )
 {
 /* find the string identified by an id - return null if there's none */
 const WCHAR *msi_string_lookup_id( const string_table *st, UINT id )
 {
-    static const WCHAR zero[] = { 0 };
     if( id == 0 )
     if( id == 0 )
-        return zero;
+        return szEmpty;
 
     if( id >= st->maxcount )
         return NULL;
 
     if( id >= st->maxcount )
         return NULL;
index ef16665..df35c4d 100644 (file)
@@ -443,7 +443,6 @@ MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount )
     if( !si )
         return si;
 
     if( !si )
         return si;
 
-    memset( si->property, 0, sizeof si->property );
     si->update_count = uiUpdateCount;
     IStorage_AddRef( stg );
     si->storage = stg;
     si->update_count = uiUpdateCount;
     IStorage_AddRef( stg );
     si->storage = stg;
@@ -608,9 +607,8 @@ static UINT get_prop( MSIHANDLE handle, UINT uiProperty, UINT *puiDataType,
 
             if( str->unicode )
             {
 
             if( str->unicode )
             {
-                len = MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1,
-                                           str->str.w, *pcchValueBuf );
-                len--;
+                len = MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1, NULL, 0 ) - 1;
+                MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1, str->str.w, *pcchValueBuf );
             }
             else
             {
             }
             else
             {
index 86cd4be..35f7979 100644 (file)
@@ -121,7 +121,6 @@ static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo,
 static UINT get_tablecolumns( MSIDATABASE *db,
        LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz);
 static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count );
 static UINT get_tablecolumns( MSIDATABASE *db,
        LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz);
 static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count );
-static UINT table_find_insert_idx (MSIVIEW *view, LPCWSTR name, INT *pidx);
 
 static inline UINT bytes_per_column( MSIDATABASE *db, const MSICOLUMNINFO *col )
 {
 
 static inline UINT bytes_per_column( MSIDATABASE *db, const MSICOLUMNINFO *col )
 {
@@ -627,7 +626,6 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
     column_info *col;
     MSITABLE *table;
     UINT i;
     column_info *col;
     MSITABLE *table;
     UINT i;
-    INT idx;
 
     /* only add tables that don't exist already */
     if( TABLE_Exists(db, name ) )
 
     /* only add tables that don't exist already */
     if( TABLE_Exists(db, name ) )
@@ -693,11 +691,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
     if( r )
         goto err;
 
     if( r )
         goto err;
 
-    r = table_find_insert_idx (tv, name, &idx);
-    if (r != ERROR_SUCCESS)
-       idx = -1;
-
-    r = tv->ops->insert_row( tv, rec, idx, persistent == MSICONDITION_FALSE );
+    r = tv->ops->insert_row( tv, rec, -1, persistent == MSICONDITION_FALSE );
     TRACE("insert_row returned %x\n", r);
     if( r )
         goto err;
     TRACE("insert_row returned %x\n", r);
     if( r )
         goto err;
@@ -747,11 +741,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
             if( r )
                 goto err;
 
             if( r )
                 goto err;
 
-            r = table_find_insert_idx (tv, name, &idx);
-            if (r != ERROR_SUCCESS)
-                idx = -1;
-
-            r = tv->ops->insert_row( tv, rec, idx, FALSE );
+            r = tv->ops->insert_row( tv, rec, -1, FALSE );
             if( r )
                 goto err;
 
             if( r )
                 goto err;
 
@@ -1189,8 +1179,6 @@ static UINT msi_stream_name( const MSITABLEVIEW *tv, UINT row, LPWSTR *pstname )
         type = tv->columns[i].type;
         if ( type & MSITYPE_KEY )
         {
         type = tv->columns[i].type;
         if ( type & MSITYPE_KEY )
         {
-            static const WCHAR szDot[] = { '.', 0 };
-
             r = TABLE_fetch_int( view, row, i+1, &ival );
             if ( r != ERROR_SUCCESS )
                 goto err;
             r = TABLE_fetch_int( view, row, i+1, &ival );
             if ( r != ERROR_SUCCESS )
                 goto err;
@@ -1370,6 +1358,48 @@ err:
     return r;
 }
 
     return r;
 }
 
+static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT iField, UINT *pvalue )
+{
+    MSICOLUMNINFO columninfo;
+    UINT r;
+
+    if ( (iField <= 0) ||
+         (iField > tv->num_cols) ||
+          MSI_RecordIsNull( rec, iField ) )
+        return ERROR_FUNCTION_FAILED;
+
+    columninfo = tv->columns[ iField - 1 ];
+
+    if ( MSITYPE_IS_BINARY(columninfo.type) )
+    {
+        *pvalue = 1; /* refers to the first key column */
+    }
+    else if ( columninfo.type & MSITYPE_STRING )
+    {
+        LPCWSTR sval = MSI_RecordGetString( rec, iField );
+
+        r = msi_string2idW(tv->db->strings, sval, pvalue);
+        if (r != ERROR_SUCCESS)
+           return ERROR_NOT_FOUND;
+    }
+    else if ( 2 == bytes_per_column( tv->db, &columninfo ) )
+    {
+        *pvalue = 0x8000 + MSI_RecordGetInteger( rec, iField );
+        if ( *pvalue & 0xffff0000 )
+        {
+            ERR("field %u value %d out of range\n", iField, *pvalue - 0x8000);
+            return ERROR_FUNCTION_FAILED;
+        }
+    }
+    else
+    {
+        INT ival = MSI_RecordGetInteger( rec, iField );
+        *pvalue = ival ^ 0x80000000;
+    }
+
+    return ERROR_SUCCESS;
+}
+
 static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask )
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
 static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask )
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
@@ -1397,11 +1427,15 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
         val = 0;
         if ( !MSI_RecordIsNull( rec, i + 1 ) )
         {
         val = 0;
         if ( !MSI_RecordIsNull( rec, i + 1 ) )
         {
+            r = get_table_value_from_record (tv, rec, i + 1, &val);
             if ( MSITYPE_IS_BINARY(tv->columns[ i ].type) )
             {
                 IStream *stm;
                 LPWSTR stname;
 
             if ( MSITYPE_IS_BINARY(tv->columns[ i ].type) )
             {
                 IStream *stm;
                 LPWSTR stname;
 
+                if ( r != ERROR_SUCCESS )
+                    return ERROR_FUNCTION_FAILED;
+
                 r = MSI_RecordGetIStream( rec, i + 1, &stm );
                 if ( r != ERROR_SUCCESS )
                     return r;
                 r = MSI_RecordGetIStream( rec, i + 1, &stm );
                 if ( r != ERROR_SUCCESS )
                     return r;
@@ -1419,38 +1453,29 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
 
                 if ( r != ERROR_SUCCESS )
                     return r;
 
                 if ( r != ERROR_SUCCESS )
                     return r;
-
-                val = 1; /* refers to the first key column */
             }
             else if ( tv->columns[i].type & MSITYPE_STRING )
             {
             }
             else if ( tv->columns[i].type & MSITYPE_STRING )
             {
-                LPCWSTR sval = MSI_RecordGetString( rec, i + 1 );
-                UINT ival, x;
+                UINT x;
 
 
-                r = msi_string2idW(tv->db->strings, sval, &ival);
-                if (r == ERROR_SUCCESS)
+                if ( r != ERROR_SUCCESS )
                 {
                 {
-                    TABLE_fetch_int(&tv->view, row, i + 1, &x);
-                    if (ival == x)
-                        continue;
-                }
+                    LPCWSTR sval = MSI_RecordGetString( rec, i + 1 );
+                    val = msi_addstringW( tv->db->strings, 0, sval, -1, 1,
+                      persistent ? StringPersistent : StringNonPersistent );
 
 
-                val = msi_addstringW( tv->db->strings, 0, sval, -1, 1,
-                                      persistent ? StringPersistent : StringNonPersistent );
-            }
-            else if ( 2 == bytes_per_column( tv->db, &tv->columns[ i ] ) )
-            {
-                val = 0x8000 + MSI_RecordGetInteger( rec, i + 1 );
-                if ( val & 0xffff0000 )
+                }
+                else
                 {
                 {
-                    ERR("field %u value %d out of range\n", i+1, val - 0x8000 );
-                    return ERROR_FUNCTION_FAILED;
+                    TABLE_fetch_int(&tv->view, row, i + 1, &x);
+                    if (val == x)
+                        continue;
                 }
             }
             else
             {
                 }
             }
             else
             {
-                INT ival = MSI_RecordGetInteger( rec, i + 1 );
-                val = ival ^ 0x80000000;
+                if ( r != ERROR_SUCCESS )
+                    return ERROR_FUNCTION_FAILED;
             }
         }
 
             }
         }
 
@@ -1622,6 +1647,41 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec )
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
+static UINT find_insert_index( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *pidx )
+{
+    UINT r, idx, j, ivalue, x;
+
+    TRACE("%p %p %p\n", tv, rec, pidx);
+
+    for (idx = 0; idx < tv->table->row_count; idx++)
+    {
+        for (j = 0; j < tv->num_cols; j++ )
+        {
+            r = get_table_value_from_record (tv, rec, j+1, &ivalue);
+            if (r != ERROR_SUCCESS)
+                break;
+
+            r = TABLE_fetch_int(&tv->view, idx, j + 1, &x);
+            if (r != ERROR_SUCCESS)
+                return r;
+
+            if (ivalue > x)
+                break;
+            else if (ivalue == x)
+                continue;
+            else {
+                TRACE("Found %d.\n", idx);
+                *pidx = idx;
+                return ERROR_SUCCESS;
+            }
+        }
+    }
+
+    TRACE("Found %d.\n", idx);
+    *pidx = idx;
+    return ERROR_SUCCESS;
+}
+
 static UINT TABLE_insert_row( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary )
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
 static UINT TABLE_insert_row( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary )
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
@@ -1634,6 +1694,13 @@ static UINT TABLE_insert_row( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row,
     if( r != ERROR_SUCCESS )
         return ERROR_FUNCTION_FAILED;
 
     if( r != ERROR_SUCCESS )
         return ERROR_FUNCTION_FAILED;
 
+    if (row == -1)
+    {
+        r = find_insert_index(tv, rec, &row);
+        if( r != ERROR_SUCCESS )
+            return ERROR_FUNCTION_FAILED;
+    }
+
     r = table_create_new_row( view, &row, temporary );
     TRACE("insert_row returned %08x\n", r);
     if( r != ERROR_SUCCESS )
     r = table_create_new_row( view, &row, temporary );
     TRACE("insert_row returned %08x\n", r);
     if( r != ERROR_SUCCESS )
@@ -2377,7 +2444,6 @@ static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes)
 
 static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR *pstname )
 {
 
 static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR *pstname )
 {
-    static const WCHAR szDot[] = { '.', 0 };
     LPWSTR stname = NULL, sval, p;
     DWORD len;
     UINT i, r;
     LPWSTR stname = NULL, sval, p;
     DWORD len;
     UINT i, r;
@@ -2957,29 +3023,3 @@ void msi_free_transforms( MSIDATABASE *db )
         msi_free( t );
     }
 }
         msi_free( t );
     }
 }
-
-static UINT table_find_insert_idx (MSIVIEW *view, LPCWSTR name, INT *pidx)
-{
-    UINT r, name_id, row_id;
-    INT idx;
-    MSITABLEVIEW *tv = (MSITABLEVIEW *)view;
-
-    TRACE ("%p %s\n", view, debugstr_w(name));
-
-    r = msi_string2idW(tv->db->strings, name, &name_id);
-    if (r != ERROR_SUCCESS)
-    {
-        *pidx = -1;
-        return r;
-    }
-
-    for( idx = 0; idx < tv->table->row_count; idx++ )
-    {
-        r = TABLE_fetch_int( &tv->view, idx, 1, &row_id );
-        if (row_id > name_id)
-            break;
-    }
-
-    *pidx = idx;
-    return ERROR_SUCCESS;
-}
index 9f522c3..6d5f4cf 100644 (file)
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
-extern const WCHAR szFindRelatedProducts[];
-extern const WCHAR szMigrateFeatureStates[];
-extern const WCHAR szRemoveExistingProducts[];
-
 static BOOL check_language(DWORD lang1, LPCWSTR lang2, DWORD attributes)
 {
     DWORD langdword;
 static BOOL check_language(DWORD lang1, LPCWSTR lang2, DWORD attributes)
 {
     DWORD langdword;
@@ -65,7 +61,6 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
     LPWSTR prop;
     LPWSTR newprop;
     DWORD len;
     LPWSTR prop;
     LPWSTR newprop;
     DWORD len;
-    static const WCHAR separator[] = {';',0};
 
     prop = msi_dup_property(package, action_property );
     if (prop)
 
     prop = msi_dup_property(package, action_property );
     if (prop)
@@ -86,7 +81,7 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
     if (prop)
     {
         strcpyW(newprop,prop);
     if (prop)
     {
         strcpyW(newprop,prop);
-        strcatW(newprop,separator);
+        strcatW(newprop,szSemiColon);
     }
     else
         newprop[0] = 0;
     }
     else
         newprop[0] = 0;