Commit fefe108e authored by Stefan Rentsch's avatar Stefan Rentsch Committed by Alexandre Julliard

wbemprox: Provide more accurate system information.

This re-uses existing functions from Win32_ComputerSystemProduct to provide more accurate values, which are helpful to system overview applications. > wmic.exe computersystem GET Manufacturer
parent a6063f83
...@@ -1625,20 +1625,52 @@ static WCHAR *get_username(void) ...@@ -1625,20 +1625,52 @@ static WCHAR *get_username(void)
return ret; return ret;
} }
static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len )
{
const struct smbios_header *hdr;
const struct smbios_system *system;
UINT offset;
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len ))) return NULL;
system = (const struct smbios_system *)hdr;
offset = (const char *)system - buf + system->hdr.length;
return get_smbios_string( id, buf, offset, len );
}
static WCHAR *get_compsysproduct_name( const char *buf, UINT len )
{
WCHAR *ret = get_compsysproduct_string( 2, buf, len );
if (!ret) return wcsdup( L"Wine" );
return ret;
}
static WCHAR *get_compsysproduct_vendor( const char *buf, UINT len )
{
WCHAR *ret = get_compsysproduct_string( 1, buf, len );
if (!ret) return wcsdup( L"The Wine Project" );
return ret;
}
static enum fill_status fill_compsys( struct table *table, const struct expr *cond ) static enum fill_status fill_compsys( struct table *table, const struct expr *cond )
{ {
struct record_computersystem *rec; struct record_computersystem *rec;
enum fill_status status = FILL_STATUS_UNFILTERED; enum fill_status status = FILL_STATUS_UNFILTERED;
UINT row = 0; UINT row = 0, len;
char *buf;
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
if (!(buf = malloc( len ))) return FILL_STATUS_FAILED;
GetSystemFirmwareTable( RSMB, 0, buf, len );
rec = (struct record_computersystem *)table->data; rec = (struct record_computersystem *)table->data;
rec->description = L"AT/AT COMPATIBLE"; rec->description = L"AT/AT COMPATIBLE";
rec->domain = L"WORKGROUP"; rec->domain = L"WORKGROUP";
rec->domainrole = 0; /* standalone workstation */ rec->domainrole = 0; /* standalone workstation */
rec->manufacturer = L"The Wine Project"; rec->manufacturer = get_compsysproduct_vendor( buf, len );
rec->model = L"Wine"; rec->model = get_compsysproduct_name( buf, len );
rec->name = get_computername(); rec->name = get_computername();
rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors ); rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors );
rec->systemtype = get_systemtype(); rec->systemtype = get_systemtype();
...@@ -1647,24 +1679,13 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co ...@@ -1647,24 +1679,13 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co
if (!match_row( table, row, cond, &status )) free_row_values( table, row ); if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++; else row++;
free( buf );
TRACE("created %u rows\n", row); TRACE("created %u rows\n", row);
table->num_rows = row; table->num_rows = row;
return status; return status;
} }
static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len )
{
const struct smbios_header *hdr;
const struct smbios_system *system;
UINT offset;
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len ))) return NULL;
system = (const struct smbios_system *)hdr;
offset = (const char *)system - buf + system->hdr.length;
return get_smbios_string( id, buf, offset, len );
}
static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len ) static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len )
{ {
WCHAR *ret = get_compsysproduct_string( 4, buf, len ); WCHAR *ret = get_compsysproduct_string( 4, buf, len );
...@@ -1672,13 +1693,6 @@ static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len ) ...@@ -1672,13 +1693,6 @@ static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len )
return ret; return ret;
} }
static WCHAR *get_compsysproduct_name( const char *buf, UINT len )
{
WCHAR *ret = get_compsysproduct_string( 2, buf, len );
if (!ret) return wcsdup( L"Wine" );
return ret;
}
static WCHAR *get_compsysproduct_uuid( const char *buf, UINT len ) static WCHAR *get_compsysproduct_uuid( const char *buf, UINT len )
{ {
static const BYTE none[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; static const BYTE none[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
...@@ -1700,13 +1714,6 @@ done: ...@@ -1700,13 +1714,6 @@ done:
return ret; return ret;
} }
static WCHAR *get_compsysproduct_vendor( const char *buf, UINT len )
{
WCHAR *ret = get_compsysproduct_string( 1, buf, len );
if (!ret) return wcsdup( L"The Wine Project" );
return ret;
}
static WCHAR *get_compsysproduct_version( const char *buf, UINT len ) static WCHAR *get_compsysproduct_version( const char *buf, UINT len )
{ {
WCHAR *ret = get_compsysproduct_string( 3, buf, len ); WCHAR *ret = get_compsysproduct_string( 3, buf, len );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment