sync msi with wine 1.1.34
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 6 Dec 2009 14:55:00 +0000 (14:55 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 6 Dec 2009 14:55:00 +0000 (14:55 +0000)
svn path=/trunk/; revision=44440

reactos/dll/win32/msi/action.c
reactos/dll/win32/msi/automation.c
reactos/dll/win32/msi/install.c
reactos/dll/win32/msi/package.c
reactos/dll/win32/msi/select.c
reactos/dll/win32/msi/storages.c
reactos/dll/win32/msi/streams.c
reactos/dll/win32/msi/table.c
reactos/include/psdk/msiquery.h

index 3a11c61..0755f42 100644 (file)
@@ -716,7 +716,6 @@ static UINT msi_set_context(MSIPACKAGE *package)
             package->Context = MSIINSTALLCONTEXT_MACHINE;
     }
 
-    MSI_SetPropertyW(package, szAllUsers, szOne);
     return ERROR_SUCCESS;
 }
 
index b443257..3b6dd2d 100644 (file)
@@ -1498,7 +1498,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT
         case REG_EXPAND_SZ:
             if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
                 ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError());
-            else if (!(szNewString = msi_alloc(dwNewSize)))
+            else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR))))
                 ERR("Out of memory\n");
             else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
                 ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError());
index 1a535eb..b1d741a 100644 (file)
@@ -717,19 +717,10 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
 /***********************************************************************
  *           MsiSetMode    (MSI.@)
  */
-BOOL WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
+UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
 {
-    switch (iRunMode)
-    {
-    case MSIRUNMODE_RESERVED11:
-    case MSIRUNMODE_WINDOWS9X:
-    case MSIRUNMODE_RESERVED14:
-    case MSIRUNMODE_RESERVED15:
-        return FALSE;
-    default:
-        FIXME("%d %d %d\n", hInstall, iRunMode, fState);
-    }
-    return TRUE;
+    FIXME("%d %d %d\n", hInstall, iRunMode, fState);
+    return ERROR_SUCCESS;
 }
 
 /***********************************************************************
index 87f1092..574289f 100644 (file)
@@ -345,7 +345,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     WCHAR *ptr;
     OSVERSIONINFOEXW OSVersion;
     MEMORYSTATUSEX msex;
-    DWORD verval;
+    DWORD verval, len;
     WCHAR verstr[10], bufstr[20];
     HDC dc;
     HKEY hkey;
@@ -445,11 +445,12 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     static const WCHAR szUserLangID[] = {'U','s','e','r','L','a','n','g','u','a','g','e','I','D',0};
     static const WCHAR szSystemLangID[] = {'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0};
     static const WCHAR szProductState[] = {'P','r','o','d','u','c','t','S','t','a','t','e',0};
+    static const WCHAR szLogonUser[] = {'L','o','g','o','n','U','s','e','r',0};
 
     /*
      * Other things that probably should be set:
      *
-     * ComputerName LogonUser VirtualMemory
+     * ComputerName VirtualMemory
      * ShellAdvSupport DefaultUIFont PackagecodeChanging
      * CaptionHeight BorderTop BorderSide TextHeight
      * RedirectedDllSupport
@@ -653,6 +654,18 @@ static VOID set_installer_properties(MSIPACKAGE *package)
 
     sprintfW(bufstr, szIntFormat, MsiQueryProductStateW(package->ProductCode));
     MSI_SetPropertyW( package, szProductState, bufstr );
+
+    len = 0;
+    if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_MORE_DATA)
+    {
+        WCHAR *username;
+        if ((username = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
+        {
+            if (GetUserNameW( username, &len ))
+                MSI_SetPropertyW( package, szLogonUser, username );
+            HeapFree( GetProcessHeap(), 0, username );
+        }
+    }
 }
 
 static UINT msi_load_summary_properties( MSIPACKAGE *package )
index c4b9e80..f6b5dae 100644 (file)
@@ -368,12 +368,14 @@ static const MSIVIEWOPS select_ops =
     NULL,
 };
 
-static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name )
+static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name,
+                              LPCWSTR table_name )
 {
     UINT r, n=0;
     MSIVIEW *table;
 
-    TRACE("%p adding %s\n", sv, debugstr_w( name ) );
+    TRACE("%p adding %s.%s\n", sv, debugstr_w( table_name ),
+          debugstr_w( name ));
 
     if( sv->view.ops != &select_ops )
         return ERROR_FUNCTION_FAILED;
@@ -389,7 +391,7 @@ static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name )
     if( sv->num_cols >= sv->max_cols )
         return ERROR_FUNCTION_FAILED;
 
-    r = VIEW_find_column( table, name, NULL, &n );
+    r = VIEW_find_column( table, name, table_name, &n );
     if( r != ERROR_SUCCESS )
         return r;
 
@@ -433,7 +435,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
 
     while( columns )
     {
-        r = SELECT_AddColumn( sv, columns->column );
+        r = SELECT_AddColumn( sv, columns->column, columns->table );
         if( r )
             break;
         columns = columns->next;
index 005bcdb..844db8d 100644 (file)
@@ -296,6 +296,7 @@ static UINT STORAGES_get_column_info(struct tagMSIVIEW *view, UINT n,
 
     static const WCHAR Name[] = {'N','a','m','e',0};
     static const WCHAR Data[] = {'D','a','t','a',0};
+    static const WCHAR _Storages[] = {'_','S','t','o','r','a','g','e','s',0};
 
     TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary,
           table_name);
@@ -322,6 +323,16 @@ static UINT STORAGES_get_column_info(struct tagMSIVIEW *view, UINT n,
         if (!*name) return ERROR_FUNCTION_FAILED;
     }
 
+    if (table_name)
+    {
+        *table_name = strdupW(_Storages);
+        if (!*table_name)
+        {
+            msi_free(name);
+            return ERROR_FUNCTION_FAILED;
+        }
+    }
+
     if (temporary)
         *temporary = FALSE;
 
index 23ae971..faa27c8 100644 (file)
@@ -262,6 +262,7 @@ static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, UINT n,
 
     static const WCHAR Name[] = {'N','a','m','e',0};
     static const WCHAR Data[] = {'D','a','t','a',0};
+    static const WCHAR _Streams[] = {'_','S','t','r','e','a','m','s',0};
 
     TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary,
           table_name);
@@ -288,6 +289,16 @@ static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, UINT n,
         if (!*name) return ERROR_FUNCTION_FAILED;
     }
 
+    if (table_name)
+    {
+        *table_name = strdupW(_Streams);
+        if (!*table_name)
+        {
+            msi_free(name);
+            return ERROR_FUNCTION_FAILED;
+        }
+    }
+
     if (temporary)
         *temporary = FALSE;
 
index 33d1fce..fa32a04 100644 (file)
@@ -1201,7 +1201,7 @@ static UINT msi_stream_name( const MSITABLEVIEW *tv, UINT row, LPWSTR *pstname )
                 switch( n )
                 {
                 case 2:
-                    sprintfW( number, fmt, ival^0x8000 );
+                    sprintfW( number, fmt, ival-0x8000 );
                     break;
                 case 4:
                     sprintfW( number, fmt, ival^0x80000000 );
@@ -2573,7 +2573,7 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string
             case 2:
                 val = read_raw_int(rawdata, ofs, n);
                 if (val)
-                    MSI_RecordSetInteger( rec, i+1, val^0x8000 );
+                    MSI_RecordSetInteger( rec, i+1, val-0x8000 );
                 TRACE(" field %d [0x%04x]\n", i+1, val );
                 break;
             case 4:
index 6a1bfa4..2ea8320 100644 (file)
@@ -301,7 +301,7 @@ UINT WINAPI MsiSummaryInfoGetPropertyCount(MSIHANDLE,PUINT);
 
 UINT WINAPI MsiEnableUIPreview(MSIHANDLE, MSIHANDLE*);
 BOOL WINAPI MsiGetMode(MSIHANDLE, MSIRUNMODE);
-BOOL WINAPI MsiSetMode(MSIHANDLE, MSIRUNMODE, BOOL);
+UINT WINAPI MsiSetMode(MSIHANDLE, MSIRUNMODE, BOOL);
 
 UINT WINAPI MsiViewModify(MSIHANDLE, MSIMODIFY, MSIHANDLE);