Hans Leidekker : msi: Set the ComputerName property.
Alexandre Julliard
julliard at winehq.org
Tue Nov 1 13:23:24 CDT 2011
Module: wine
Branch: master
Commit: 5266f34c3c36518459e4dfe380fe6fc8e5db853c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5266f34c3c36518459e4dfe380fe6fc8e5db853c
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Nov 1 11:07:45 2011 +0100
msi: Set the ComputerName property.
---
dlls/msi/package.c | 18 ++++++++++++++----
dlls/msi/tests/package.c | 5 +++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 8ec6889..c265cca 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -751,14 +751,13 @@ static VOID set_installer_properties(MSIPACKAGE *package)
static const WCHAR szNetHoodFolder[] = {'N','e','t','H','o','o','d','F','o','l','d','e','r',0};
static const WCHAR szPrintHoodFolder[] = {'P','r','i','n','t','H','o','o','d','F','o','l','d','e','r',0};
static const WCHAR szRecentFolder[] = {'R','e','c','e','n','t','F','o','l','d','e','r',0};
+ static const WCHAR szComputerName[] = {'C','o','m','p','u','t','e','r','N','a','m','e',0};
/*
* Other things that probably should be set:
*
- * ComputerName VirtualMemory
- * ShellAdvSupport DefaultUIFont PackagecodeChanging
- * CaptionHeight BorderTop BorderSide TextHeight
- * RedirectedDllSupport
+ * VirtualMemory ShellAdvSupport DefaultUIFont PackagecodeChanging
+ * CaptionHeight BorderTop BorderSide TextHeight RedirectedDllSupport
*/
SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, pth);
@@ -1014,6 +1013,17 @@ static VOID set_installer_properties(MSIPACKAGE *package)
msi_free( username );
}
}
+ len = 0;
+ if (!GetComputerNameW( NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ {
+ WCHAR *computername;
+ if ((computername = msi_alloc( len * sizeof(WCHAR) )))
+ {
+ if (GetComputerNameW( computername, &len ))
+ msi_set_property( package->db, szComputerName, computername );
+ msi_free( computername );
+ }
+ }
}
static UINT msi_load_summary_properties( MSIPACKAGE *package )
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 04c3fe7..9fae1d9 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -10103,6 +10103,11 @@ static void test_installprops(void)
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("PackageCode = %s\n", buf);
+ size = MAX_PATH;
+ r = MsiGetProperty(hpkg, "ComputerName", buf, &size);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
+ trace("ComputerName = %s\n", buf);
+
langid = GetUserDefaultLangID();
sprintf(path, "%d", langid);
More information about the wine-cvs
mailing list