mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-07 05:24:06 +00:00
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
This commit is contained in:
parent
a6063f8367
commit
fefe108e20
|
@ -1625,33 +1625,6 @@ static WCHAR *get_username(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum fill_status fill_compsys( struct table *table, const struct expr *cond )
|
|
||||||
{
|
|
||||||
struct record_computersystem *rec;
|
|
||||||
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
||||||
UINT row = 0;
|
|
||||||
|
|
||||||
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
||||||
|
|
||||||
rec = (struct record_computersystem *)table->data;
|
|
||||||
rec->description = L"AT/AT COMPATIBLE";
|
|
||||||
rec->domain = L"WORKGROUP";
|
|
||||||
rec->domainrole = 0; /* standalone workstation */
|
|
||||||
rec->manufacturer = L"The Wine Project";
|
|
||||||
rec->model = L"Wine";
|
|
||||||
rec->name = get_computername();
|
|
||||||
rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors );
|
|
||||||
rec->systemtype = get_systemtype();
|
|
||||||
rec->total_physical_memory = get_total_physical_memory();
|
|
||||||
rec->username = get_username();
|
|
||||||
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
||||||
else row++;
|
|
||||||
|
|
||||||
TRACE("created %u rows\n", row);
|
|
||||||
table->num_rows = row;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len )
|
static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len )
|
||||||
{
|
{
|
||||||
const struct smbios_header *hdr;
|
const struct smbios_header *hdr;
|
||||||
|
@ -1665,13 +1638,6 @@ static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len )
|
||||||
return get_smbios_string( id, buf, offset, len );
|
return get_smbios_string( id, buf, offset, len );
|
||||||
}
|
}
|
||||||
|
|
||||||
static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len )
|
|
||||||
{
|
|
||||||
WCHAR *ret = get_compsysproduct_string( 4, buf, len );
|
|
||||||
if (!ret) return wcsdup( L"0" );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static WCHAR *get_compsysproduct_name( const char *buf, UINT len )
|
static WCHAR *get_compsysproduct_name( const char *buf, UINT len )
|
||||||
{
|
{
|
||||||
WCHAR *ret = get_compsysproduct_string( 2, buf, len );
|
WCHAR *ret = get_compsysproduct_string( 2, buf, len );
|
||||||
|
@ -1679,6 +1645,54 @@ static WCHAR *get_compsysproduct_name( const char *buf, UINT len )
|
||||||
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 enum fill_status fill_compsys( struct table *table, const struct expr *cond )
|
||||||
|
{
|
||||||
|
struct record_computersystem *rec;
|
||||||
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
||||||
|
UINT row = 0, len;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
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->description = L"AT/AT COMPATIBLE";
|
||||||
|
rec->domain = L"WORKGROUP";
|
||||||
|
rec->domainrole = 0; /* standalone workstation */
|
||||||
|
rec->manufacturer = get_compsysproduct_vendor( buf, len );
|
||||||
|
rec->model = get_compsysproduct_name( buf, len );
|
||||||
|
rec->name = get_computername();
|
||||||
|
rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors );
|
||||||
|
rec->systemtype = get_systemtype();
|
||||||
|
rec->total_physical_memory = get_total_physical_memory();
|
||||||
|
rec->username = get_username();
|
||||||
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
||||||
|
else row++;
|
||||||
|
|
||||||
|
free( buf );
|
||||||
|
|
||||||
|
TRACE("created %u rows\n", row);
|
||||||
|
table->num_rows = row;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len )
|
||||||
|
{
|
||||||
|
WCHAR *ret = get_compsysproduct_string( 4, buf, len );
|
||||||
|
if (!ret) return wcsdup( L"0" );
|
||||||
|
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:
|
||||||
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 );
|
||||||
|
|
Loading…
Reference in a new issue