wbemprox: Zero-initialize table data.

This commit is contained in:
Hans Leidekker 2024-03-28 10:20:37 +01:00 committed by Alexandre Julliard
parent 7c969b0589
commit ca89965a2e

View file

@ -504,7 +504,7 @@ static const struct column col_videocontroller[] =
{ L"Monochrome", CIM_BOOLEAN },
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"NumberOfColorPlanes", CIM_UINT16 },
{ L"NumberofVideoPages", CIM_UINT32 },
{ L"NumberOfVideoPages", CIM_UINT32 },
{ L"PNPDeviceID", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"PowerManagementCapabilities", CIM_UINT16|CIM_FLAG_ARRAY },
{ L"PowerManagementSupported", CIM_BOOLEAN },
@ -1193,7 +1193,7 @@ static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
{
if (!table->num_rows_allocated)
{
if (!(table->data = malloc( row_count * row_size ))) return FALSE;
if (!(table->data = calloc( row_count, row_size ))) return FALSE;
table->num_rows_allocated = row_count;
return TRUE;
}
@ -1202,6 +1202,7 @@ static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
BYTE *data;
UINT count = max( row_count, table->num_rows_allocated * 2 );
if (!(data = realloc( table->data, count * row_size ))) return FALSE;
memset( data + table->num_rows_allocated * row_size, 0, (count - table->num_rows_allocated) * row_size );
table->data = data;
table->num_rows_allocated = count;
}
@ -1537,11 +1538,9 @@ static enum fill_status fill_bios( struct table *table, const struct expr *cond
GetSystemFirmwareTable( RSMB, 0, buf, len );
rec = (struct record_bios *)table->data;
rec->currentlanguage = NULL;
rec->description = L"Default System BIOS";
rec->ecmajorversion = get_bios_ec_firmware_major_release( buf, len );
rec->ecminorversion = get_bios_ec_firmware_minor_release( buf, len );
rec->identificationcode = NULL;
rec->manufacturer = get_bios_manufacturer( buf, len );
rec->name = L"Default System BIOS";
rec->releasedate = get_bios_releasedate( buf, len );
@ -1757,8 +1756,6 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co
rec = (struct record_computersystem *)table->data;
rec->description = L"AT/AT COMPATIBLE";
rec->domain = L"WORKGROUP";
rec->domainrole = 0; /* standalone workstation */
rec->hypervisorpresent = 0;
rec->manufacturer = get_compsysproduct_vendor( buf, len );
rec->model = get_compsysproduct_name( buf, len );
rec->name = get_computername();
@ -1827,7 +1824,6 @@ static enum fill_status fill_compsysproduct( struct table *table, const struct e
rec = (struct record_computersystemproduct *)table->data;
rec->identifyingnumber = get_compsysproduct_identifyingnumber( buf, len );
rec->name = get_compsysproduct_name( buf, len );
rec->skunumber = NULL;
rec->uuid = get_compsysproduct_uuid( buf, len );
rec->vendor = get_compsysproduct_vendor( buf, len );
rec->version = get_compsysproduct_version( buf, len );
@ -2580,11 +2576,9 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex
swprintf( device_id, ARRAY_SIZE( device_id ), L"Disk #%u, Partition #0", index );
rec->device_id = wcsdup( device_id );
rec->diskindex = index++;
rec->index = 0;
rec->pnpdevice_id = wcsdup( device_id );
get_freespace( root, &size );
rec->size = size;
rec->startingoffset = 0;
rec->type = get_filesystem( root );
if (!match_row( table, row, cond, &status ))
{
@ -2960,7 +2954,6 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
rec->interface_index = aa->IfIndex;
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
rec->manufacturer = L"The Wine Project";
rec->netconnection_id = NULL; /* FIXME Windows seems to fill this when it's connected and in use */
rec->name = wcsdup( aa->FriendlyName );
rec->netenabled = connection_status ? -1 : 0;
rec->netconnection_status = connection_status;
@ -3316,7 +3309,6 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co
rec->local = -1;
rec->location = wcsdup( info[i].pLocation );
rec->name = wcsdup( info[i].pPrinterName );
rec->network = 0;
rec->portname = wcsdup( info[i].pPortName );
if (!match_row( table, i, cond, &status ))
{
@ -3373,7 +3365,6 @@ static enum fill_status fill_process( struct table *table, const struct expr *co
rec->process_id = entry.th32ProcessID;
rec->pprocess_id = entry.th32ParentProcessID;
rec->thread_count = entry.cntThreads;
rec->workingsetsize = 0;
/* methods */
rec->create = process_create;
rec->get_owner = process_get_owner;
@ -3568,7 +3559,6 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
rec->processor_id = wcsdup( processor_id );
rec->processortype = 3; /* central processor */
rec->revision = get_processor_revision();
rec->unique_id = NULL;
rec->version = wcsdup( version );
if (!match_row( table, i, cond, &status ))
{
@ -4265,16 +4255,13 @@ static enum fill_status fill_videocontroller( struct table *table, const struct
}
rec = (struct record_videocontroller *)table->data;
memset( rec, 0, sizeof(*rec) );
rec->adapter_compatibility = L"(Standard display types)";
rec->adapter_dactype = L"Integrated RAMDAC";
rec->adapter_ram = vidmem;
rec->availability = 3; /* Running or Full Power */
rec->caption = wcsdup( name );
rec->config_errorcode = 0; /* no error */
rec->current_bitsperpixel = get_bitsperpixel( &hres, &vres );
rec->current_horizontalres = hres;
rec->current_refreshrate = 0; /* default refresh rate */
rec->current_scanmode = 2; /* Unknown */
rec->current_verticalres = vres;
rec->description = wcsdup( name );