Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=52887 Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com --- dlls/wbemprox/builtin.c | 23 +++++++++++++++++++++++ dlls/wbemprox/tests/query.c | 1 + 2 files changed, 24 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 9bfca994fbc..9f6b6f0efbe 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 }, @@ -678,6 +679,7 @@ struct record_operatingsystem UINT16 ostype; int primary; UINT32 producttype; + const WCHAR *registereduser; const WCHAR *serialnumber; UINT16 servicepackmajor; UINT16 servicepackminor; @@ -3592,6 +3594,26 @@ static DWORD get_operatingsystemsku(void) GetProductInfo( 6, 0, 0, 0, &ret ); return ret; } +static WCHAR *get_registereduser(void) +{ + 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"RegisteredOwner", NULL, &type, NULL, &size ) && type == REG_SZ && + (ret = malloc( size + sizeof(WCHAR) ))) + { + size += sizeof(WCHAR); + if (RegQueryValueExW( hkey, L"RegisteredOwner", NULL, NULL, (BYTE *)ret, &size )) + { + free( ret ); + ret = NULL; + } + } + if (hkey) RegCloseKey( hkey ); + return ret; +} static INT16 get_currenttimezone(void) { TIME_ZONE_INFORMATION info; @@ -3636,6 +3658,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 6d287a4ca78..e4a8a8d361b 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 );