Louis Lenders : wbemprox: Add RegisterdUser property to Win32_Operatingsystem.
Alexandre Julliard
julliard at winehq.org
Thu Apr 28 16:15:31 CDT 2022
Module: wine
Branch: master
Commit: ef3df0e7e92ab6bc6ac5273a25de5fa760e8a74a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ef3df0e7e92ab6bc6ac5273a25de5fa760e8a74a
Author: Louis Lenders <xerox.xerox2000x at gmail.com>
Date: Thu Apr 28 12:43:20 2022 +0200
wbemprox: Add RegisterdUser 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 | 27 ++++++++++++++++++++++-----
dlls/wbemprox/tests/query.c | 1 +
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 93b26c23dd3..5c53aae8d3b 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -250,6 +250,7 @@ static const struct column col_operatingsystem[] =
{ L"OSType", CIM_UINT16 },
{ L"Primary", CIM_BOOLEAN },
{ L"ProductType", CIM_UINT32 },
+ { L"RegisteredUser", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"SerialNumber", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"ServicePackMajorVersion", CIM_UINT16 },
{ L"ServicePackMinorVersion", CIM_UINT16 },
@@ -682,6 +683,7 @@ struct record_operatingsystem
UINT16 ostype;
int primary;
UINT32 producttype;
+ const WCHAR *registereduser;
const WCHAR *serialnumber;
UINT16 servicepackmajor;
UINT16 servicepackminor;
@@ -3571,27 +3573,35 @@ static WCHAR *get_osname( const WCHAR *caption )
memcpy( ret + len, partitionW, sizeof(partitionW) );
return ret;
}
-static WCHAR *get_osserialnumber(void)
+
+static WCHAR *get_reg_str( HKEY root, const WCHAR *path, const WCHAR *value )
{
HKEY hkey = 0;
DWORD size, type;
WCHAR *ret = NULL;
- if (!RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hkey ) &&
- !RegQueryValueExW( hkey, L"ProductId", NULL, &type, NULL, &size ) && type == REG_SZ &&
+ 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, L"ProductId", NULL, NULL, (BYTE *)ret, &size ))
+ if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)ret, &size ))
{
free( ret );
ret = NULL;
}
}
if (hkey) RegCloseKey( hkey );
- if (!ret) return wcsdup( L"12345-OEM-1234567-12345" );
return ret;
}
+
+static WCHAR *get_osserialnumber(void)
+{
+ WCHAR *ret = get_reg_str( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", L"ProductId" );
+ if (!ret) ret = wcsdup( L"12345-OEM-1234567-12345" );
+ return ret;
+}
+
static WCHAR *get_osversion( OSVERSIONINFOEXW *ver )
{
WCHAR *ret = malloc( 33 * sizeof(WCHAR) );
@@ -3604,6 +3614,12 @@ static DWORD get_operatingsystemsku(void)
GetProductInfo( 6, 0, 0, 0, &ret );
return ret;
}
+
+static WCHAR *get_registereduser(void)
+{
+ return get_reg_str( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", L"RegisteredOwner" );
+}
+
static INT16 get_currenttimezone(void)
{
TIME_ZONE_INFORMATION info;
@@ -3648,6 +3664,7 @@ static enum fill_status fill_operatingsystem( struct table *table, const struct
rec->ostype = 18; /* WINNT */
rec->primary = -1;
rec->producttype = 1;
+ rec->registereduser = get_registereduser();
rec->serialnumber = get_osserialnumber();
rec->servicepackmajor = ver.wServicePackMajor;
rec->servicepackminor = ver.wServicePackMinor;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 865d1b6136a..7cca770ffc7 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1430,6 +1430,7 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
check_property( obj, L"Manufacturer", 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 );
check_property( obj, L"ServicePackMajorVersion", VT_I4, CIM_UINT16 );
check_property( obj, L"ServicePackMinorVersion", VT_I4, CIM_UINT16 );
check_property( obj, L"SuiteMask", VT_I4, CIM_UINT32 );
More information about the wine-cvs
mailing list