Louis Lenders : wbemprox: Add Organization property to Win32_Operatingsystem.
Alexandre Julliard
julliard at winehq.org
Thu Apr 28 16:15:31 CDT 2022
Module: wine
Branch: master
Commit: b901f9ca6c803c52b889e21705fc1a37cbbd00cd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b901f9ca6c803c52b889e21705fc1a37cbbd00cd
Author: Louis Lenders <xerox.xerox2000x at gmail.com>
Date: Thu Apr 28 12:43:21 2022 +0200
wbemprox: Add Organization property to Win32_Operatingsystem.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52887
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wbemprox/builtin.c | 52 +++++++++++++++++++++++++++------------------
dlls/wbemprox/tests/query.c | 1 +
2 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 5c53aae8d3b..ba3e728c8c5 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -244,6 +244,7 @@ static const struct column col_operatingsystem[] =
{ L"Manufacturer", CIM_STRING },
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"OperatingSystemSKU", CIM_UINT32 },
+ { L"Organization", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"OSArchitecture", CIM_STRING },
{ L"OSLanguage", CIM_UINT32 },
{ L"OSProductSuite", CIM_UINT32 },
@@ -677,6 +678,7 @@ struct record_operatingsystem
const WCHAR *manufacturer;
const WCHAR *name;
UINT32 operatingsystemsku;
+ const WCHAR *organization;
const WCHAR *osarchitecture;
UINT32 oslanguage;
UINT32 osproductsuite;
@@ -3515,6 +3517,34 @@ static WCHAR *get_locale(void)
if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, ret, 5 );
return ret;
}
+
+static WCHAR *get_reg_str( HKEY root, const WCHAR *path, const WCHAR *value )
+{
+ HKEY hkey = 0;
+ DWORD size, type;
+ WCHAR *ret = NULL;
+
+ if (!RegOpenKeyExW( root, path, 0, KEY_READ, &hkey ) &&
+ !RegQueryValueExW( hkey, value, NULL, &type, NULL, &size ) && type == REG_SZ &&
+ (ret = malloc( size + sizeof(WCHAR) )))
+ {
+ size += sizeof(WCHAR);
+ if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)ret, &size ))
+ {
+ free( ret );
+ ret = NULL;
+ }
+ }
+ if (hkey) RegCloseKey( hkey );
+ return ret;
+}
+
+static WCHAR *get_organization(void)
+{
+ return get_reg_str( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
+ L"RegisteredOrganization" );
+}
+
static WCHAR *get_osbuildnumber( OSVERSIONINFOEXW *ver )
{
WCHAR *ret = malloc( 11 * sizeof(WCHAR) );
@@ -3574,27 +3604,6 @@ static WCHAR *get_osname( const WCHAR *caption )
return ret;
}
-static WCHAR *get_reg_str( HKEY root, const WCHAR *path, const WCHAR *value )
-{
- HKEY hkey = 0;
- DWORD size, type;
- WCHAR *ret = NULL;
-
- if (!RegOpenKeyExW( root, path, 0, KEY_READ, &hkey ) &&
- !RegQueryValueExW( hkey, value, NULL, &type, NULL, &size ) && type == REG_SZ &&
- (ret = malloc( size + sizeof(WCHAR) )))
- {
- size += sizeof(WCHAR);
- if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)ret, &size ))
- {
- free( ret );
- ret = NULL;
- }
- }
- if (hkey) RegCloseKey( hkey );
- return ret;
-}
-
static WCHAR *get_osserialnumber(void)
{
WCHAR *ret = get_reg_str( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", L"ProductId" );
@@ -3658,6 +3667,7 @@ static enum fill_status fill_operatingsystem( struct table *table, const struct
rec->manufacturer = L"The Wine Project";
rec->name = get_osname( rec->caption );
rec->operatingsystemsku = get_operatingsystemsku();
+ rec->organization = get_organization();
rec->osarchitecture = get_osarchitecture();
rec->oslanguage = GetSystemDefaultLangID();
rec->osproductsuite = 2461140; /* Windows XP Professional */
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 7cca770ffc7..b31506a12d6 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1428,6 +1428,7 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
check_property( obj, L"CSName", VT_BSTR, CIM_STRING );
check_property( obj, L"CurrentTimeZone", VT_I2, CIM_SINT16 );
check_property( obj, L"Manufacturer", VT_BSTR, CIM_STRING );
+ check_property( obj, L"Organization", VT_BSTR, CIM_STRING );
check_property( obj, L"OSType", VT_I4, CIM_UINT16 );
check_property( obj, L"ProductType", VT_I4, CIM_UINT32 );
check_property( obj, L"RegisteredUser", VT_BSTR, CIM_STRING );
More information about the wine-cvs
mailing list