msi: Set the ComputerName property.

This commit is contained in:
Hans Leidekker 2011-11-01 11:07:45 +01:00 committed by Alexandre Julliard
parent 936c14f87f
commit 5266f34c3c
2 changed files with 19 additions and 4 deletions

View File

@ -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 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 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 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: * Other things that probably should be set:
* *
* ComputerName VirtualMemory * VirtualMemory ShellAdvSupport DefaultUIFont PackagecodeChanging
* ShellAdvSupport DefaultUIFont PackagecodeChanging * CaptionHeight BorderTop BorderSide TextHeight RedirectedDllSupport
* CaptionHeight BorderTop BorderSide TextHeight
* RedirectedDllSupport
*/ */
SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, pth); SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, pth);
@ -1014,6 +1013,17 @@ static VOID set_installer_properties(MSIPACKAGE *package)
msi_free( username ); 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 ) static UINT msi_load_summary_properties( MSIPACKAGE *package )

View File

@ -10103,6 +10103,11 @@ static void test_installprops(void)
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("PackageCode = %s\n", buf); 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(); langid = GetUserDefaultLangID();
sprintf(path, "%d", langid); sprintf(path, "%d", langid);