James Hawkins : msi: Set the UserLanguageID property.

Alexandre Julliard julliard at winehq.org
Mon Feb 18 08:50:36 CST 2008


Module: wine
Branch: master
Commit: 8412a1363bafd32c75411f98242a28ea14681c7e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8412a1363bafd32c75411f98242a28ea14681c7e

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Sun Feb 17 14:11:07 2008 -0600

msi: Set the UserLanguageID property.

---

 dlls/msi/package.c       |   19 +++++++++++++------
 dlls/msi/tests/package.c |    9 +++++++++
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index a8d33e0..685a28d 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -352,6 +352,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     LONG res;
     SYSTEM_INFO sys_info;
     SYSTEMTIME systemtime;
+    LANGID langid;
 
     static const WCHAR cszbs[]={'\\',0};
     static const WCHAR CFF[] = 
@@ -420,7 +421,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0};
     static const WCHAR szScreenY[] = {'S','c','r','e','e','n','Y',0};
     static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0};
-    static const WCHAR szScreenFormat[] = {'%','d',0};
+    static const WCHAR szIntFormat[] = {'%','d',0};
     static const WCHAR szIntel[] = { 'I','n','t','e','l',0 };
     static const WCHAR szAllUsers[] = { 'A','L','L','U','S','E','R','S',0 };
     static const WCHAR szCurrentVersion[] = {
@@ -437,6 +438,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     static const WCHAR szCOMPANYNAME[] = {'C','O','M','P','A','N','Y','N','A','M','E',0};
     static const WCHAR szDate[] = {'D','a','t','e',0};
     static const WCHAR szTime[] = {'T','i','m','e',0};
+    static const WCHAR szUserLangID[] = {'U','s','e','r','L','a','n','g','u','a','g','e','I','D',0};
 
     /*
      * Other things that probably should be set:
@@ -523,7 +525,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     /* Physical Memory is specified in MB. Using total amount. */
     msex.dwLength = sizeof(msex);
     GlobalMemoryStatusEx( &msex );
-    sprintfW( bufstr, szScreenFormat, (int)(msex.ullTotalPhys/1024/1024));
+    sprintfW( bufstr, szIntFormat, (int)(msex.ullTotalPhys/1024/1024));
     MSI_SetPropertyW(package, szPhysicalMemory, bufstr);
 
     SHGetFolderPathW(NULL,CSIDL_WINDOWS,NULL,0,pth);
@@ -570,17 +572,17 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     GetSystemInfo( &sys_info );
     if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
     {
-        sprintfW( bufstr, szScreenFormat, sys_info.wProcessorLevel );
+        sprintfW( bufstr, szIntFormat, sys_info.wProcessorLevel );
         MSI_SetPropertyW( package, szIntel, bufstr );
     }
 
     /* Screen properties. */
     dc = GetDC(0);
-    sprintfW( bufstr, szScreenFormat, GetDeviceCaps( dc, HORZRES ) );
+    sprintfW( bufstr, szIntFormat, GetDeviceCaps( dc, HORZRES ) );
     MSI_SetPropertyW( package, szScreenX, bufstr );
-    sprintfW( bufstr, szScreenFormat, GetDeviceCaps( dc, VERTRES ));
+    sprintfW( bufstr, szIntFormat, GetDeviceCaps( dc, VERTRES ));
     MSI_SetPropertyW( package, szScreenY, bufstr );
-    sprintfW( bufstr, szScreenFormat, GetDeviceCaps( dc, BITSPIXEL ));
+    sprintfW( bufstr, szIntFormat, GetDeviceCaps( dc, BITSPIXEL ));
     MSI_SetPropertyW( package, szColorBits, bufstr );
     ReleaseDC(0, dc);
 
@@ -628,6 +630,11 @@ static VOID set_installer_properties(MSIPACKAGE *package)
 
     set_msi_assembly_prop( package );
 
+    langid = GetUserDefaultLangID();
+    sprintfW(bufstr, szIntFormat, langid);
+
+    MSI_SetPropertyW( package, szUserLangID, bufstr );
+
     msi_free( check );
     CloseHandle( hkey );
 }
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index dc0e31e..9d1f8b8 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -4697,6 +4697,7 @@ static void test_installprops(void)
     CHAR path[MAX_PATH];
     CHAR buf[MAX_PATH];
     DWORD size, type;
+    LANGID langid;
     HKEY hkey;
     UINT r;
 
@@ -4762,6 +4763,14 @@ static void test_installprops(void)
     ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
     trace("PackageCode = %s\n", buf);
 
+    langid = GetUserDefaultLangID();
+    sprintf(path, "%d", langid);
+
+    size = MAX_PATH;
+    r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
+    ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
+    ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
+
     CloseHandle(hkey);
     MsiCloseHandle(hpkg);
     DeleteFile(msifile);




More information about the wine-cvs mailing list