ReactOS 0.4.15-dev-5895-g2687c1b
builtin.c File Reference
#include <stdarg.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winsock2.h"
#include "ws2tcpip.h"
#include "initguid.h"
#include "wbemcli.h"
#include "wbemprov.h"
#include "iphlpapi.h"
#include "netioapi.h"
#include "tlhelp32.h"
#include "d3d10.h"
#include "winternl.h"
#include "winioctl.h"
#include "winsvc.h"
#include "winver.h"
#include "sddl.h"
#include "ntsecapi.h"
#include "winspool.h"
#include "setupapi.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "wbemprox_private.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for builtin.c:

Go to the source code of this file.

Classes

struct  record_associator
 
struct  record_baseboard
 
struct  record_bios
 
struct  record_cdromdrive
 
struct  record_computersystem
 
struct  record_computersystemproduct
 
struct  record_datafile
 
struct  record_desktopmonitor
 
struct  record_directory
 
struct  record_diskdrive
 
struct  record_diskdrivetodiskpartition
 
struct  record_diskpartition
 
struct  record_displaycontrollerconfig
 
struct  record_ip4routetable
 
struct  record_logicaldisk
 
struct  record_logicaldisktopartition
 
struct  record_networkadapter
 
struct  record_networkadapterconfig
 
struct  record_operatingsystem
 
struct  record_param
 
struct  record_physicalmedia
 
struct  record_physicalmemory
 
struct  record_pnpentity
 
struct  record_printer
 
struct  record_process
 
struct  record_processor
 
struct  record_qualifier
 
struct  record_quickfixengineering
 
struct  record_service
 
struct  record_sid
 
struct  record_sounddevice
 
struct  record_stdregprov
 
struct  record_systemsecurity
 
struct  record_systemenclosure
 
struct  record_videocontroller
 
struct  record_winsat
 
struct  smbios_prologue
 
struct  smbios_header
 
struct  smbios_baseboard
 
struct  smbios_bios
 
struct  smbios_chassis
 
struct  smbios_system
 
struct  dirstack
 
struct  association
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define WIN32_NO_STATUS
 
#define FLAVOR_ID
 
#define RSMB   (('R' << 24) | ('S' << 16) | ('M' << 8) | 'B')
 
#define HW_VENDOR_AMD   0x1002
 
#define HW_VENDOR_NVIDIA   0x10de
 
#define HW_VENDOR_VMWARE   0x15ad
 
#define HW_VENDOR_INTEL   0x8086
 
#define C(c)   sizeof(c)/sizeof(c[0]), c
 
#define D(d)   sizeof(d)/sizeof(d[0]), 0, (BYTE *)d
 

Enumerations

enum  smbios_type { SMBIOS_TYPE_BIOS , SMBIOS_TYPE_SYSTEM , SMBIOS_TYPE_BASEBOARD , SMBIOS_TYPE_CHASSIS }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wbemprox)
 
static BOOL match_row (const struct table *table, UINT row, const struct expr *cond, enum fill_status *status)
 
static BOOL resize_table (struct table *table, UINT row_count, UINT row_size)
 
static const struct smbios_headerfind_smbios_entry (enum smbios_type type, const char *buf, UINT len)
 
static WCHARget_smbios_string (BYTE id, const char *buf, UINT offset, UINT buflen)
 
static WCHARget_baseboard_string (BYTE id, const char *buf, UINT len)
 
static WCHARget_baseboard_manufacturer (const char *buf, UINT len)
 
static WCHARget_baseboard_product (const char *buf, UINT len)
 
static WCHARget_baseboard_serialnumber (const char *buf, UINT len)
 
static WCHARget_baseboard_version (const char *buf, UINT len)
 
static enum fill_status fill_baseboard (struct table *table, const struct expr *cond)
 
static UINT16 get_bios_smbiosmajorversion (const char *buf, UINT len)
 
static UINT16 get_bios_smbiosminorversion (const char *buf, UINT len)
 
static WCHARget_bios_string (BYTE id, const char *buf, UINT len)
 
static WCHARget_bios_manufacturer (const char *buf, UINT len)
 
static WCHARconvert_bios_date (const WCHAR *str)
 
static WCHARget_bios_releasedate (const char *buf, UINT len)
 
static WCHARget_bios_smbiosbiosversion (const char *buf, UINT len)
 
static enum fill_status fill_bios (struct table *table, const struct expr *cond)
 
static enum fill_status fill_cdromdrive (struct table *table, const struct expr *cond)
 
static UINT get_processor_count (void)
 
static UINT get_logical_processor_count (UINT *num_physical, UINT *num_packages)
 
static UINT64 get_total_physical_memory (void)
 
static UINT64 get_available_physical_memory (void)
 
static WCHARget_computername (void)
 
static WCHARget_username (void)
 
static enum fill_status fill_compsys (struct table *table, const struct expr *cond)
 
static WCHARget_compsysproduct_string (BYTE id, const char *buf, UINT len)
 
static WCHARget_compsysproduct_identifyingnumber (const char *buf, UINT len)
 
static WCHARget_compsysproduct_name (const char *buf, UINT len)
 
static WCHARget_compsysproduct_uuid (const char *buf, UINT len)
 
static WCHARget_compsysproduct_vendor (const char *buf, UINT len)
 
static WCHARget_compsysproduct_version (const char *buf, UINT len)
 
static enum fill_status fill_compsysproduct (struct table *table, const struct expr *cond)
 
static struct dirstackalloc_dirstack (UINT size)
 
static void clear_dirstack (struct dirstack *dirstack)
 
static void free_dirstack (struct dirstack *dirstack)
 
static BOOL push_dir (struct dirstack *dirstack, WCHAR *dir, UINT len)
 
static WCHARpop_dir (struct dirstack *dirstack, UINT *len)
 
static const WCHARpeek_dir (struct dirstack *dirstack)
 
static WCHARbuild_glob (WCHAR drive, const WCHAR *path, UINT len)
 
static WCHARbuild_name (WCHAR drive, const WCHAR *path)
 
static WCHARbuild_dirname (const WCHAR *path, UINT *ret_len)
 
static BOOL seen_dir (struct dirstack *dirstack, const WCHAR *path)
 
static UINT seed_dirs (struct dirstack *dirstack, const struct expr *cond, WCHAR root, UINT *count)
 
static WCHARappend_path (const WCHAR *path, const WCHAR *segment, UINT *len)
 
static WCHARget_file_version (const WCHAR *filename)
 
static enum fill_status fill_datafile (struct table *table, const struct expr *cond)
 
static UINT32 get_pixelsperxlogicalinch (void)
 
static enum fill_status fill_desktopmonitor (struct table *table, const struct expr *cond)
 
static enum fill_status fill_directory (struct table *table, const struct expr *cond)
 
static UINT64 get_freespace (const WCHAR *dir, UINT64 *disksize)
 
static enum fill_status fill_diskdrive (struct table *table, const struct expr *cond)
 
static void free_assocations (struct association *assoc, UINT count)
 
static struct associationget_diskdrivetodiskpartition_pairs (UINT *count)
 
static enum fill_status fill_diskdrivetodiskpartition (struct table *table, const struct expr *cond)
 
static WCHARget_filesystem (const WCHAR *root)
 
static enum fill_status fill_diskpartition (struct table *table, const struct expr *cond)
 
static UINT32 get_bitsperpixel (UINT *hres, UINT *vres)
 
static enum fill_status fill_displaycontrollerconfig (struct table *table, const struct expr *cond)
 
static WCHARget_ip4_string (DWORD addr)
 
static enum fill_status fill_ip4routetable (struct table *table, const struct expr *cond)
 
static WCHARget_volumename (const WCHAR *root)
 
static WCHARget_volumeserialnumber (const WCHAR *root)
 
static enum fill_status fill_logicaldisk (struct table *table, const struct expr *cond)
 
static struct associationget_logicaldisktopartition_pairs (UINT *count)
 
static enum fill_status fill_logicaldisktopartition (struct table *table, const struct expr *cond)
 
static UINT16 get_connection_status (IF_OPER_STATUS status)
 
static WCHARget_mac_address (const BYTE *addr, DWORD len)
 
static const WCHARget_adaptertype (DWORD type, int *id, int *physical)
 
static enum fill_status fill_networkadapter (struct table *table, const struct expr *cond)
 
static WCHARget_dnshostname (IP_ADAPTER_UNICAST_ADDRESS *addr)
 
static struct arrayget_defaultipgateway (IP_ADAPTER_GATEWAY_ADDRESS *list)
 
static struct arrayget_dnsserversearchorder (IP_ADAPTER_DNS_SERVER_ADDRESS *list)
 
static struct arrayget_ipaddress (IP_ADAPTER_UNICAST_ADDRESS_LH *list)
 
static struct arrayget_ipsubnet (IP_ADAPTER_UNICAST_ADDRESS_LH *list)
 
static WCHARget_settingid (UINT32 index)
 
static enum fill_status fill_networkadapterconfig (struct table *table, const struct expr *cond)
 
static enum fill_status fill_physicalmemory (struct table *table, const struct expr *cond)
 
static enum fill_status fill_pnpentity (struct table *table, const struct expr *cond)
 
static enum fill_status fill_printer (struct table *table, const struct expr *cond)
 
static WCHARget_cmdline (DWORD process_id)
 
static enum fill_status fill_process (struct table *table, const struct expr *cond)
 
void do_cpuid (unsigned int ax, unsigned int *p)
 
static unsigned int get_processor_model (unsigned int reg0, unsigned int *stepping, unsigned int *family)
 
static void regs_to_str (unsigned int *regs, unsigned int len, WCHAR *buffer)
 
static void get_processor_manufacturer (WCHAR *manufacturer, UINT len)
 
static const WCHARget_osarchitecture (void)
 
static void get_processor_caption (WCHAR *caption, UINT len)
 
static void get_processor_version (WCHAR *version, UINT len)
 
static UINT16 get_processor_revision (void)
 
static void get_processor_id (WCHAR *processor_id, UINT len)
 
static void get_processor_name (WCHAR *name)
 
static UINT get_processor_currentclockspeed (UINT index)
 
static UINT get_processor_maxclockspeed (UINT index)
 
static enum fill_status fill_processor (struct table *table, const struct expr *cond)
 
static WCHARget_lastbootuptime (void)
 
static WCHARget_localdatetime (void)
 
static WCHARget_systemdirectory (void)
 
static WCHARget_systemdrive (void)
 
static WCHARget_codeset (void)
 
static WCHARget_countrycode (void)
 
static WCHARget_locale (void)
 
static WCHARget_osbuildnumber (OSVERSIONINFOEXW *ver)
 
static WCHARget_oscaption (OSVERSIONINFOEXW *ver)
 
static WCHARget_osname (const WCHAR *caption)
 
static WCHARget_osversion (OSVERSIONINFOEXW *ver)
 
static DWORD get_operatingsystemsku (void)
 
static INT16 get_currenttimezone (void)
 
static enum fill_status fill_operatingsystem (struct table *table, const struct expr *cond)
 
static const WCHARget_service_type (DWORD type)
 
static const WCHARget_service_state (DWORD state)
 
static const WCHARget_service_startmode (DWORD mode)
 
static QUERY_SERVICE_CONFIGWquery_service_config (SC_HANDLE manager, const WCHAR *name)
 
static enum fill_status fill_service (struct table *table, const struct expr *cond)
 
static WCHARget_accountname (LSA_TRANSLATED_NAME *name)
 
static struct arrayget_binaryrepresentation (PSID sid, UINT len)
 
static WCHARget_referenceddomainname (LSA_REFERENCED_DOMAIN_LIST *domain)
 
static const WCHARfind_sid_str (const struct expr *cond)
 
static enum fill_status fill_sid (struct table *table, const struct expr *cond)
 
static WCHARget_systemenclosure_string (BYTE id, const char *buf, UINT len)
 
static WCHARget_systemenclosure_manufacturer (const char *buf, UINT len)
 
static int get_systemenclosure_lockpresent (const char *buf, UINT len)
 
static struct arraydup_array (const struct array *src)
 
static struct arrayget_systemenclosure_chassistypes (const char *buf, UINT len)
 
static enum fill_status fill_systemenclosure (struct table *table, const struct expr *cond)
 
static WCHARget_pnpdeviceid (DXGI_ADAPTER_DESC *desc)
 
static const WCHARget_installeddriver (UINT vendorid)
 
static enum fill_status fill_videocontroller (struct table *table, const struct expr *cond)
 
void init_table_list (void)
 

Variables

static const WCHAR class_associatorsW []
 
static const WCHAR class_baseboardW []
 
static const WCHAR class_biosW []
 
static const WCHAR class_cdromdriveW []
 
static const WCHAR class_compsysW []
 
static const WCHAR class_compsysproductW []
 
static const WCHAR class_datafileW []
 
static const WCHAR class_desktopmonitorW []
 
static const WCHAR class_directoryW []
 
static const WCHAR class_diskdriveW []
 
static const WCHAR class_diskdrivetodiskpartitionW []
 
static const WCHAR class_diskpartitionW []
 
static const WCHAR class_displaycontrollerconfigW []
 
static const WCHAR class_ip4routetableW []
 
static const WCHAR class_logicaldiskW []
 
static const WCHAR class_logicaldisk2W []
 
static const WCHAR class_logicaldisktopartitionW []
 
static const WCHAR class_networkadapterW []
 
static const WCHAR class_networkadapterconfigW []
 
static const WCHAR class_operatingsystemW []
 
static const WCHAR class_paramsW []
 
static const WCHAR class_physicalmediaW []
 
static const WCHAR class_physicalmemoryW []
 
static const WCHAR class_pnpentityW []
 
static const WCHAR class_printerW []
 
static const WCHAR class_process_getowner_outW []
 
static const WCHAR class_processorW []
 
static const WCHAR class_processor2W []
 
static const WCHAR class_qualifiersW []
 
static const WCHAR class_quickfixengineeringW []
 
static const WCHAR class_sidW []
 
static const WCHAR class_sounddeviceW []
 
static const WCHAR class_systemenclosureW []
 
static const WCHAR class_videocontrollerW []
 
static const WCHAR class_winsatW []
 
static const WCHAR prop_accountnameW []
 
static const WCHAR prop_acceptpauseW []
 
static const WCHAR prop_acceptstopW []
 
static const WCHAR prop_accessmaskW []
 
static const WCHAR prop_adapterdactypeW []
 
static const WCHAR prop_adapterramW []
 
static const WCHAR prop_adaptertypeW []
 
static const WCHAR prop_adaptertypeidW []
 
static const WCHAR prop_addresswidthW []
 
static const WCHAR prop_antecedentW []
 
static const WCHAR prop_architectureW []
 
static const WCHAR prop_assocclassW []
 
static const WCHAR prop_associatorW []
 
static const WCHAR prop_attributesW []
 
static const WCHAR prop_availabilityW []
 
static const WCHAR prop_binaryrepresentationW []
 
static const WCHAR prop_bitsperpixelW []
 
static const WCHAR prop_boolvalueW []
 
static const WCHAR prop_bootableW []
 
static const WCHAR prop_bootpartitionW []
 
static const WCHAR prop_buildnumberW []
 
static const WCHAR prop_capacityW []
 
static const WCHAR prop_captionW []
 
static const WCHAR prop_chassistypesW []
 
static const WCHAR prop_classW []
 
static const WCHAR prop_codesetW []
 
static const WCHAR prop_commandlineW []
 
static const WCHAR prop_configmanagererrorcodeW []
 
static const WCHAR prop_configuredclockspeedW []
 
static const WCHAR prop_countrycodeW []
 
static const WCHAR prop_cpuscoreW []
 
static const WCHAR prop_cpustatusW []
 
static const WCHAR prop_csdversionW []
 
static const WCHAR prop_csnameW []
 
static const WCHAR prop_currentbitsperpixelW []
 
static const WCHAR prop_currentclockspeedW []
 
static const WCHAR prop_currenthorizontalresW []
 
static const WCHAR prop_currentlanguageW []
 
static const WCHAR prop_currentrefreshrateW []
 
static const WCHAR prop_currentscanmodeW []
 
static const WCHAR prop_currenttimezoneW []
 
static const WCHAR prop_currentverticalresW []
 
static const WCHAR prop_d3dscoreW []
 
static const WCHAR prop_datawidthW []
 
static const WCHAR prop_defaultipgatewayW []
 
static const WCHAR prop_defaultvalueW []
 
static const WCHAR prop_dependentW []
 
static const WCHAR prop_descriptionW []
 
static const WCHAR prop_destinationW []
 
static const WCHAR prop_deviceidW []
 
static const WCHAR prop_devicelocatorW []
 
static const WCHAR prop_dhcpenabledW []
 
static const WCHAR prop_directionW []
 
static const WCHAR prop_diskscoreW []
 
static const WCHAR prop_displaynameW []
 
static const WCHAR prop_diskindexW []
 
static const WCHAR prop_dnshostnameW []
 
static const WCHAR prop_dnsserversearchorderW []
 
static const WCHAR prop_domainW []
 
static const WCHAR prop_domainroleW []
 
static const WCHAR prop_driveW []
 
static const WCHAR prop_driverdateW []
 
static const WCHAR prop_drivernameW []
 
static const WCHAR prop_driverversionW []
 
static const WCHAR prop_drivetypeW []
 
static const WCHAR prop_familyW []
 
static const WCHAR prop_filesystemW []
 
static const WCHAR prop_flavorW []
 
static const WCHAR prop_freespaceW []
 
static const WCHAR prop_freephysicalmemoryW []
 
static const WCHAR prop_handleW []
 
static const WCHAR prop_graphicsscoreW []
 
static const WCHAR prop_horizontalresolutionW []
 
static const WCHAR prop_hotfixidW []
 
static const WCHAR prop_idW []
 
static const WCHAR prop_identificationcodeW []
 
static const WCHAR prop_identifyingnumberW []
 
static const WCHAR prop_indexW []
 
static const WCHAR prop_installdateW []
 
static const WCHAR prop_installeddisplaydriversW []
 
static const WCHAR prop_interfaceindexW []
 
static const WCHAR prop_interfacetypeW []
 
static const WCHAR prop_intvalueW []
 
static const WCHAR prop_ipaddressW []
 
static const WCHAR prop_ipconnectionmetricW []
 
static const WCHAR prop_ipenabledW []
 
static const WCHAR prop_ipsubnet []
 
static const WCHAR prop_lastbootuptimeW []
 
static const WCHAR prop_levelW []
 
static const WCHAR prop_localW []
 
static const WCHAR prop_localdatetimeW []
 
static const WCHAR prop_localeW []
 
static const WCHAR prop_locationW []
 
static const WCHAR prop_lockpresentW []
 
static const WCHAR prop_macaddressW []
 
static const WCHAR prop_manufacturerW []
 
static const WCHAR prop_maxclockspeedW []
 
static const WCHAR prop_mediatypeW []
 
static const WCHAR prop_memberW []
 
static const WCHAR prop_memoryscoreW []
 
static const WCHAR prop_memorytypeW []
 
static const WCHAR prop_methodW []
 
static const WCHAR prop_modelW []
 
static const WCHAR prop_netconnectionstatusW []
 
static const WCHAR prop_networkW []
 
static const WCHAR prop_nexthopW []
 
static const WCHAR prop_numcoresW []
 
static const WCHAR prop_numlogicalprocessorsW []
 
static const WCHAR prop_numprocessorsW []
 
static const WCHAR prop_operatingsystemskuW []
 
static const WCHAR prop_osarchitectureW []
 
static const WCHAR prop_oslanguageW []
 
static const WCHAR prop_osproductsuiteW []
 
static const WCHAR prop_ostypeW []
 
static const WCHAR prop_parameterW []
 
static const WCHAR prop_partnumberW []
 
static const WCHAR prop_physicaladapterW []
 
static const WCHAR prop_pixelsperxlogicalinchW []
 
static const WCHAR prop_pnpdeviceidW []
 
static const WCHAR prop_portnameW []
 
static const WCHAR prop_pprocessidW []
 
static const WCHAR prop_primaryW []
 
static const WCHAR prop_processidW []
 
static const WCHAR prop_processoridW []
 
static const WCHAR prop_processortypeW []
 
static const WCHAR prop_productW []
 
static const WCHAR prop_productnameW []
 
static const WCHAR prop_referenceddomainnameW []
 
static const WCHAR prop_releasedateW []
 
static const WCHAR prop_revisionW []
 
static const WCHAR prop_serialnumberW []
 
static const WCHAR prop_servicepackmajorW []
 
static const WCHAR prop_servicepackminorW []
 
static const WCHAR prop_servicetypeW []
 
static const WCHAR prop_settingidW []
 
static const WCHAR prop_skunumberW []
 
static const WCHAR prop_smbiosbiosversionW []
 
static const WCHAR prop_smbiosmajorversionW []
 
static const WCHAR prop_smbiosminorversionW []
 
static const WCHAR prop_startmodeW []
 
static const WCHAR prop_sidW []
 
static const WCHAR prop_sidlengthW []
 
static const WCHAR prop_sizeW []
 
static const WCHAR prop_speedW []
 
static const WCHAR prop_startingoffsetW []
 
static const WCHAR prop_stateW []
 
static const WCHAR prop_statusW []
 
static const WCHAR prop_statusinfoW []
 
static const WCHAR prop_strvalueW []
 
static const WCHAR prop_suitemaskW []
 
static const WCHAR prop_systemdirectoryW []
 
static const WCHAR prop_systemdriveW []
 
static const WCHAR prop_systemnameW []
 
static const WCHAR prop_tagW []
 
static const WCHAR prop_threadcountW []
 
static const WCHAR prop_timetakenW []
 
static const WCHAR prop_totalphysicalmemoryW []
 
static const WCHAR prop_totalvirtualmemorysizeW []
 
static const WCHAR prop_totalvisiblememorysizeW []
 
static const WCHAR prop_typeW []
 
static const WCHAR prop_uniqueidW []
 
static const WCHAR prop_usernameW []
 
static const WCHAR prop_uuidW []
 
static const WCHAR prop_vendorW []
 
static const WCHAR prop_versionW []
 
static const WCHAR prop_verticalresolutionW []
 
static const WCHAR prop_videoarchitectureW []
 
static const WCHAR prop_videomemorytypeW []
 
static const WCHAR prop_videomodedescriptionW []
 
static const WCHAR prop_videoprocessorW []
 
static const WCHAR prop_volumenameW []
 
static const WCHAR prop_volumeserialnumberW []
 
static const WCHAR prop_winsatassessmentstateW []
 
static const WCHAR prop_winsprlevelW []
 
static const WCHAR prop_workingsetsizeW []
 
static const struct column col_associator []
 
static const struct column col_baseboard []
 
static const struct column col_bios []
 
static const struct column col_cdromdrive []
 
static const struct column col_compsys []
 
static const struct column col_compsysproduct []
 
static const struct column col_datafile []
 
static const struct column col_desktopmonitor []
 
static const struct column col_directory []
 
static const struct column col_diskdrive []
 
static const struct column col_diskdrivetodiskpartition []
 
static const struct column col_diskpartition []
 
static const struct column col_displaycontrollerconfig []
 
static const struct column col_ip4routetable []
 
static const struct column col_logicaldisk []
 
static const struct column col_logicaldisktopartition []
 
static const struct column col_networkadapter []
 
static const struct column col_networkadapterconfig []
 
static const struct column col_operatingsystem []
 
static const struct column col_param []
 
static const struct column col_physicalmedia []
 
static const struct column col_physicalmemory []
 
static const struct column col_pnpentity []
 
static const struct column col_printer []
 
static const struct column col_process []
 
static const struct column col_processor []
 
static const struct column col_qualifier []
 
static const struct column col_quickfixengineering []
 
static const struct column col_service []
 
static const struct column col_sid []
 
static const struct column col_sounddevice []
 
static const struct column col_stdregprov []
 
static const struct column col_systemenclosure []
 
static const struct column col_systemsecurity []
 
static const struct column col_videocontroller []
 
static const struct column col_winsat []
 
static const WCHAR baseboard_manufacturerW []
 
static const WCHAR baseboard_serialnumberW []
 
static const WCHAR baseboard_tagW []
 
static const WCHAR baseboard_versionW []
 
static const WCHAR bios_descriptionW []
 
static const WCHAR bios_manufacturerW []
 
static const WCHAR bios_releasedateW []
 
static const WCHAR bios_serialnumberW []
 
static const WCHAR bios_smbiosbiosversionW []
 
static const WCHAR bios_versionW []
 
static const WCHAR cdromdrive_mediatypeW []
 
static const WCHAR cdromdrive_nameW []
 
static const WCHAR cdromdrive_pnpdeviceidW []
 
static const WCHAR compsys_descriptionW []
 
static const WCHAR compsys_domainW []
 
static const WCHAR compsys_manufacturerW []
 
static const WCHAR compsys_modelW []
 
static const WCHAR compsysproduct_identifyingnumberW []
 
static const WCHAR compsysproduct_nameW []
 
static const WCHAR compsysproduct_uuidW []
 
static const WCHAR compsysproduct_vendorW []
 
static const WCHAR compsysproduct_versionW []
 
static const WCHAR diskdrive_interfacetypeW []
 
static const WCHAR diskdrive_manufacturerW []
 
static const WCHAR diskdrive_mediatype_fixedW []
 
static const WCHAR diskdrive_mediatype_removableW []
 
static const WCHAR diskdrive_modelW []
 
static const WCHAR diskdrive_pnpdeviceidW []
 
static const WCHAR diskdrive_serialW []
 
static const WCHAR networkadapter_pnpdeviceidW []
 
static const WCHAR os_32bitW []
 
static const WCHAR os_64bitW []
 
static const WCHAR os_installdateW []
 
static const WCHAR os_serialnumberW []
 
static const WCHAR physicalmedia_tagW []
 
static const WCHAR quickfixengineering_captionW []
 
static const WCHAR quickfixengineering_hotfixidW []
 
static const WCHAR sounddevice_productnameW []
 
static const WCHAR systemenclosure_systemenclosureW []
 
static const WCHAR systemenclosure_tagW []
 
static const WCHAR systemenclosure_manufacturerW []
 
static const WCHAR videocontroller_dactypeW []
 
static const WCHAR videocontroller_deviceidW []
 
static const WCHAR videocontroller_driverdateW []
 
static const WCHAR videocontroller_driverversionW []
 
static const WCHAR videocontroller_statusW []
 
static const WCHAR winsat_timetakenW []
 
static const struct record_associator data_associator []
 
static const struct record_param data_param []
 
static const struct record_physicalmedia data_physicalmedia []
 
static const struct record_qualifier data_qualifier []
 
static const struct record_quickfixengineering data_quickfixengineering []
 
static const struct record_sounddevice data_sounddevice []
 
static const struct record_stdregprov data_stdregprov []
 
static UINT16 systemenclosure_chassistypes []
 
static const struct array systemenclosure_chassistypes_array
 
static const struct record_systemsecurity data_systemsecurity []
 
static const struct record_winsat data_winsat []
 
static struct table builtin_classes []
 

Macro Definition Documentation

◆ C

#define C (   c)    sizeof(c)/sizeof(c[0]), c

Definition at line 4556 of file builtin.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file builtin.c.

◆ D

#define D (   d)    sizeof(d)/sizeof(d[0]), 0, (BYTE *)d

Definition at line 4557 of file builtin.c.

◆ FLAVOR_ID

#define FLAVOR_ID
Value:

Definition at line 1399 of file builtin.c.

◆ HW_VENDOR_AMD

#define HW_VENDOR_AMD   0x1002

Definition at line 4464 of file builtin.c.

◆ HW_VENDOR_INTEL

#define HW_VENDOR_INTEL   0x8086

Definition at line 4467 of file builtin.c.

◆ HW_VENDOR_NVIDIA

#define HW_VENDOR_NVIDIA   0x10de

Definition at line 4465 of file builtin.c.

◆ HW_VENDOR_VMWARE

#define HW_VENDOR_VMWARE   0x15ad

Definition at line 4466 of file builtin.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 21 of file builtin.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 20 of file builtin.c.

◆ RSMB

#define RSMB   (('R' << 24) | ('S' << 16) | ('M' << 8) | 'B')

Definition at line 1547 of file builtin.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 29 of file builtin.c.

Enumeration Type Documentation

◆ smbios_type

Enumerator
SMBIOS_TYPE_BIOS 
SMBIOS_TYPE_SYSTEM 
SMBIOS_TYPE_BASEBOARD 
SMBIOS_TYPE_CHASSIS 

Definition at line 1491 of file builtin.c.

1492{
1497};
@ SMBIOS_TYPE_CHASSIS
Definition: builtin.c:1496
@ SMBIOS_TYPE_SYSTEM
Definition: builtin.c:1494
@ SMBIOS_TYPE_BIOS
Definition: builtin.c:1493
@ SMBIOS_TYPE_BASEBOARD
Definition: builtin.c:1495

Function Documentation

◆ alloc_dirstack()

static struct dirstack * alloc_dirstack ( UINT  size)
static

Definition at line 2103 of file builtin.c.

2104{
2105 struct dirstack *dirstack;
2106
2107 if (!(dirstack = heap_alloc( sizeof(*dirstack) ))) return NULL;
2108 if (!(dirstack->dirs = heap_alloc( sizeof(WCHAR *) * size )))
2109 {
2111 return NULL;
2112 }
2113 if (!(dirstack->len_dirs = heap_alloc( sizeof(UINT) * size )))
2114 {
2117 return NULL;
2118 }
2119 dirstack->num_dirs = 0;
2121 return dirstack;
2122}
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define NULL
Definition: types.h:112
GLsizeiptr size
Definition: glext.h:5919
unsigned int UINT
Definition: ndis.h:50
UINT num_allocated
Definition: builtin.c:2100
UINT * len_dirs
Definition: builtin.c:2098
UINT num_dirs
Definition: builtin.c:2099
WCHAR ** dirs
Definition: builtin.c:2097
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by fill_datafile(), and fill_directory().

◆ append_path()

static WCHAR * append_path ( const WCHAR path,
const WCHAR segment,
UINT len 
)
static

Definition at line 2317 of file builtin.c.

2318{
2319 UINT len_path = 0, len_segment = lstrlenW( segment );
2320 WCHAR *ret;
2321
2322 *len = 0;
2323 if (path) len_path = lstrlenW( path );
2324 if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
2325 if (path && len_path)
2326 {
2327 memcpy( ret, path, len_path * sizeof(WCHAR) );
2328 ret[len_path] = '\\';
2329 *len += len_path + 1;
2330 }
2331 memcpy( ret + *len, segment, len_segment * sizeof(WCHAR) );
2332 *len += len_segment;
2333 ret[*len] = 0;
2334 return ret;
2335}
#define lstrlenW
Definition: compat.h:750
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int ret

Referenced by fill_datafile(), and fill_directory().

◆ build_dirname()

static WCHAR * build_dirname ( const WCHAR path,
UINT ret_len 
)
static

Definition at line 2230 of file builtin.c.

2231{
2232 const WCHAR *p = path, *start;
2233 UINT len, i;
2234 WCHAR *ret;
2235
2236 if (!iswalpha( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
2237 start = path + 4;
2238 len = lstrlenW( start );
2239 p = start + len - 1;
2240 if (*p == '\\') return NULL;
2241
2242 while (p >= start && *p != '\\') { len--; p--; };
2243 while (p >= start && *p == '\\') { len--; p--; };
2244
2245 if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
2246 for (i = 0, p = start; p < start + len; p++)
2247 {
2248 if (p[0] == '\\' && p[1] == '\\')
2249 {
2250 ret[i++] = '\\';
2251 p++;
2252 }
2253 else ret[i++] = *p;
2254 }
2255 ret[i] = 0;
2256 *ret_len = i;
2257 return ret;
2258}
GLuint start
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define iswalpha(_c)
Definition: ctype.h:664
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
Definition: process.c:79

Referenced by seed_dirs().

◆ build_glob()

static WCHAR * build_glob ( WCHAR  drive,
const WCHAR path,
UINT  len 
)
static

Definition at line 2181 of file builtin.c.

2182{
2183 UINT i = 0;
2184 WCHAR *ret;
2185
2186 if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
2187 ret[i++] = drive;
2188 ret[i++] = ':';
2189 ret[i++] = '\\';
2190 if (path && len)
2191 {
2192 memcpy( ret + i, path, len * sizeof(WCHAR) );
2193 i += len;
2194 ret[i++] = '\\';
2195 }
2196 ret[i++] = '*';
2197 ret[i] = 0;
2198 return ret;
2199}

Referenced by fill_datafile(), and fill_directory().

◆ build_name()

static WCHAR * build_name ( WCHAR  drive,
const WCHAR path 
)
static

Definition at line 2201 of file builtin.c.

2202{
2203 UINT i = 0, len = 0;
2204 const WCHAR *p;
2205 WCHAR *ret;
2206
2207 for (p = path; *p; p++)
2208 {
2209 if (*p == '\\') len += 2;
2210 else len++;
2211 };
2212 if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
2213 ret[i++] = drive;
2214 ret[i++] = ':';
2215 ret[i++] = '\\';
2216 ret[i++] = '\\';
2217 for (p = path; *p; p++)
2218 {
2219 if (*p != '\\') ret[i++] = *p;
2220 else
2221 {
2222 ret[i++] = '\\';
2223 ret[i++] = '\\';
2224 }
2225 }
2226 ret[i] = 0;
2227 return ret;
2228}

Referenced by fill_datafile(), and fill_directory().

◆ clear_dirstack()

static void clear_dirstack ( struct dirstack dirstack)
static

Definition at line 2124 of file builtin.c.

2125{
2126 UINT i;
2127 for (i = 0; i < dirstack->num_dirs; i++) heap_free( dirstack->dirs[i] );
2128 dirstack->num_dirs = 0;
2129}

Referenced by fill_datafile(), fill_directory(), and free_dirstack().

◆ convert_bios_date()

static WCHAR * convert_bios_date ( const WCHAR str)
static

Definition at line 1711 of file builtin.c.

1712{
1713 static const WCHAR fmtW[] =
1714 {'%','0','4','u','%','0','2','u','%','0','2','u','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
1715 UINT year, month, day, len = lstrlenW( str );
1716 const WCHAR *p = str, *q;
1717 WCHAR *ret;
1718
1719 while (len && iswspace( *p )) { p++; len--; }
1720 while (len && iswspace( p[len - 1] )) { len--; }
1721
1722 q = p;
1723 while (len && iswdigit( *q )) { q++; len--; };
1724 if (q - p != 2 || !len || *q != '/') return NULL;
1725 month = (p[0] - '0') * 10 + p[1] - '0';
1726
1727 p = ++q; len--;
1728 while (len && iswdigit( *q )) { q++; len--; };
1729 if (q - p != 2 || !len || *q != '/') return NULL;
1730 day = (p[0] - '0') * 10 + p[1] - '0';
1731
1732 p = ++q; len--;
1733 while (len && iswdigit( *q )) { q++; len--; };
1734 if (q - p == 4) year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + p[3] - '0';
1735 else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0';
1736 else return NULL;
1737
1738 if (!(ret = heap_alloc( sizeof(fmtW) ))) return NULL;
1739 swprintf( ret, fmtW, year, month, day );
1740 return ret;
1741}
static DOUBLE day(DOUBLE time)
Definition: date.c:117
static const WCHAR month[12][4]
Definition: session.c:2150
#define swprintf
Definition: precomp.h:40
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define iswspace(_c)
Definition: ctype.h:669
#define iswdigit(_c)
Definition: ctype.h:667
const WCHAR * str

Referenced by get_bios_releasedate().

◆ do_cpuid()

void do_cpuid ( unsigned int  ax,
unsigned int p 
)

Definition at line 3649 of file builtin.c.

3650{
3651 FIXME("\n");
3652}
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by get_processor_caption(), get_processor_id(), get_processor_manufacturer(), get_processor_name(), get_processor_revision(), and get_processor_version().

◆ dup_array()

static struct array * dup_array ( const struct array src)
static

Definition at line 4375 of file builtin.c.

4376{
4377 struct array *dst;
4378 if (!(dst = heap_alloc( sizeof(*dst) ))) return NULL;
4379 if (!(dst->ptr = heap_alloc( src->count * src->elem_size )))
4380 {
4381 heap_free( dst );
4382 return NULL;
4383 }
4384 memcpy( dst->ptr, src->ptr, src->count * src->elem_size );
4385 dst->elem_size = src->elem_size;
4386 dst->count = src->count;
4387 return dst;
4388}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by get_systemenclosure_chassistypes().

◆ fill_baseboard()

static enum fill_status fill_baseboard ( struct table table,
const struct expr cond 
)
static

Definition at line 1646 of file builtin.c.

1647{
1648 struct record_baseboard *rec;
1650 UINT row = 0, len;
1651 char *buf;
1652
1653 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1654
1655 len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
1656 if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
1658
1659 rec = (struct record_baseboard *)table->data;
1661 rec->model = baseboard_tagW;
1662 rec->name = baseboard_tagW;
1665 rec->tag = baseboard_tagW;
1667 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
1668 else row++;
1669
1670 heap_free( buf );
1671
1672 TRACE("created %u rows\n", row);
1673 table->num_rows = row;
1674 return status;
1675}
static WCHAR * get_baseboard_manufacturer(const char *buf, UINT len)
Definition: builtin.c:1618
static BOOL match_row(const struct table *table, UINT row, const struct expr *cond, enum fill_status *status)
Definition: builtin.c:1443
static WCHAR * get_baseboard_product(const char *buf, UINT len)
Definition: builtin.c:1625
static WCHAR * get_baseboard_serialnumber(const char *buf, UINT len)
Definition: builtin.c:1632
static BOOL resize_table(struct table *table, UINT row_count, UINT row_size)
Definition: builtin.c:1462
static WCHAR * get_baseboard_version(const char *buf, UINT len)
Definition: builtin.c:1639
#define RSMB
Definition: builtin.c:1547
static const WCHAR baseboard_tagW[]
Definition: builtin.c:886
UINT WINAPI GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature, IN DWORD FirmwareTableID, OUT PVOID pFirmwareTableBuffer, IN DWORD BufferSize)
Definition: sysinfo.c:548
void free_row_values(const struct table *table, UINT row)
Definition: table.c:292
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRACE(s)
Definition: solgame.cpp:4
const WCHAR * model
Definition: builtin.c:993
const WCHAR * manufacturer
Definition: builtin.c:992
const WCHAR * tag
Definition: builtin.c:997
const WCHAR * version
Definition: builtin.c:998
const WCHAR * serialnumber
Definition: builtin.c:996
const WCHAR * name
Definition: builtin.c:994
const WCHAR * product
Definition: builtin.c:995
Definition: ps.c:97
UINT num_rows
BYTE * data
fill_status
@ FILL_STATUS_UNFILTERED
@ FILL_STATUS_FAILED

◆ fill_bios()

static enum fill_status fill_bios ( struct table table,
const struct expr cond 
)
static

Definition at line 1758 of file builtin.c.

1759{
1760 struct record_bios *rec;
1762 UINT row = 0, len;
1763 char *buf;
1764
1765 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1766
1767 len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
1768 if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
1770
1771 rec = (struct record_bios *)table->data;
1772 rec->currentlanguage = NULL;
1774 rec->identificationcode = NULL;
1776 rec->name = bios_descriptionW;
1782 rec->version = bios_versionW;
1783 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
1784 else row++;
1785
1786 heap_free( buf );
1787
1788 TRACE("created %u rows\n", row);
1789 table->num_rows = row;
1790 return status;
1791}
static WCHAR * get_bios_smbiosbiosversion(const char *buf, UINT len)
Definition: builtin.c:1751
static const WCHAR bios_versionW[]
Definition: builtin.c:900
static const WCHAR bios_descriptionW[]
Definition: builtin.c:890
static UINT16 get_bios_smbiosmajorversion(const char *buf, UINT len)
Definition: builtin.c:1677
static WCHAR * get_bios_manufacturer(const char *buf, UINT len)
Definition: builtin.c:1704
static UINT16 get_bios_smbiosminorversion(const char *buf, UINT len)
Definition: builtin.c:1684
static const WCHAR bios_serialnumberW[]
Definition: builtin.c:896
static WCHAR * get_bios_releasedate(const char *buf, UINT len)
Definition: builtin.c:1743
UINT16 smbiosmajorversion
Definition: builtin.c:1010
const WCHAR * currentlanguage
Definition: builtin.c:1002
const WCHAR * serialnumber
Definition: builtin.c:1008
const WCHAR * name
Definition: builtin.c:1006
const WCHAR * releasedate
Definition: builtin.c:1007
const WCHAR * version
Definition: builtin.c:1012
const WCHAR * identificationcode
Definition: builtin.c:1004
const WCHAR * smbiosbiosversion
Definition: builtin.c:1009
UINT16 smbiosminorversion
Definition: builtin.c:1011
const WCHAR * description
Definition: builtin.c:1003
const WCHAR * manufacturer
Definition: builtin.c:1005

◆ fill_cdromdrive()

static enum fill_status fill_cdromdrive ( struct table table,
const struct expr cond 
)
static

Definition at line 1793 of file builtin.c.

1794{
1795 static const WCHAR fmtW[] = {'%','c',':',0};
1796 WCHAR drive[3], root[] = {'A',':','\\',0};
1797 struct record_cdromdrive *rec;
1798 UINT i, row = 0, offset = 0;
1799 DWORD drives = GetLogicalDrives();
1801
1802 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1803
1804 for (i = 0; i < 26; i++)
1805 {
1806 if (drives & (1 << i))
1807 {
1808 root[0] = 'A' + i;
1809 if (GetDriveTypeW( root ) != DRIVE_CDROM)
1810 continue;
1811
1812 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1813
1814 rec = (struct record_cdromdrive *)(table->data + offset);
1816 swprintf( drive, fmtW, 'A' + i );
1817 rec->drive = heap_strdupW( drive );
1819 rec->name = cdromdrive_nameW;
1821 if (!match_row( table, row, cond, &status ))
1822 {
1824 continue;
1825 }
1826 offset += sizeof(*rec);
1827 row++;
1828 }
1829 }
1830 TRACE("created %u rows\n", row);
1831 table->num_rows = row;
1832 return status;
1833}
static const WCHAR cdromdrive_mediatypeW[]
Definition: builtin.c:902
static const WCHAR cdromdrive_pnpdeviceidW[]
Definition: builtin.c:906
static const WCHAR cdromdrive_nameW[]
Definition: builtin.c:904
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
unsigned long DWORD
Definition: ntddk_ex.h:95
GLintptr offset
Definition: glext.h:5920
#define DRIVE_CDROM
Definition: machpc98.h:115
const WCHAR * drive
Definition: builtin.c:1017
const WCHAR * name
Definition: builtin.c:1019
const WCHAR * device_id
Definition: builtin.c:1016
const WCHAR * pnpdevice_id
Definition: builtin.c:1020
const WCHAR * mediatype
Definition: builtin.c:1018
DWORD WINAPI GetLogicalDrives(void)
Definition: disk.c:110

◆ fill_compsys()

static enum fill_status fill_compsys ( struct table table,
const struct expr cond 
)
static

Definition at line 1968 of file builtin.c.

1969{
1970 struct record_computersystem *rec;
1972 UINT row = 0;
1973
1974 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1975
1976 rec = (struct record_computersystem *)table->data;
1978 rec->domain = compsys_domainW;
1979 rec->domainrole = 0; /* standalone workstation */
1981 rec->model = compsys_modelW;
1982 rec->name = get_computername();
1983#ifdef __REACTOS__
1986#else
1988#endif
1990 rec->username = get_username();
1991 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
1992 else row++;
1993
1994 TRACE("created %u rows\n", row);
1995 table->num_rows = row;
1996 return status;
1997}
static WCHAR * get_username(void)
Definition: builtin.c:1950
static const WCHAR compsys_modelW[]
Definition: builtin.c:917
static UINT get_logical_processor_count(UINT *num_physical, UINT *num_packages)
Definition: builtin.c:1878
static UINT64 get_total_physical_memory(void)
Definition: builtin.c:1922
static const WCHAR compsys_manufacturerW[]
Definition: builtin.c:915
static UINT get_processor_count(void)
Definition: builtin.c:1835
static WCHAR * get_computername(void)
Definition: builtin.c:1940
static const WCHAR compsys_domainW[]
Definition: builtin.c:913
static const WCHAR compsys_descriptionW[]
Definition: builtin.c:911
const WCHAR * description
Definition: builtin.c:1024
const WCHAR * manufacturer
Definition: builtin.c:1027
const WCHAR * domain
Definition: builtin.c:1025
UINT32 num_logical_processors
Definition: builtin.c:1030
const WCHAR * model
Definition: builtin.c:1028
const WCHAR * name
Definition: builtin.c:1029
const WCHAR * username
Definition: builtin.c:1033
UINT64 total_physical_memory
Definition: builtin.c:1032

◆ fill_compsysproduct()

static enum fill_status fill_compsysproduct ( struct table table,
const struct expr cond 
)
static

Definition at line 2065 of file builtin.c.

2066{
2067 struct record_computersystemproduct *rec;
2069 UINT row = 0, len;
2070 char *buf;
2071
2072 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2073
2074 len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
2075 if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
2077
2078 rec = (struct record_computersystemproduct *)table->data;
2081 rec->skunumber = NULL;
2085 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2086 else row++;
2087
2088 heap_free( buf );
2089
2090 TRACE("created %u rows\n", row);
2091 table->num_rows = row;
2092 return status;
2093}
static WCHAR * get_compsysproduct_name(const char *buf, UINT len)
Definition: builtin.c:2019
static WCHAR * get_compsysproduct_vendor(const char *buf, UINT len)
Definition: builtin.c:2051
static WCHAR * get_compsysproduct_version(const char *buf, UINT len)
Definition: builtin.c:2058
static WCHAR * get_compsysproduct_identifyingnumber(const char *buf, UINT len)
Definition: builtin.c:2012
static WCHAR * get_compsysproduct_uuid(const char *buf, UINT len)
Definition: builtin.c:2026
const WCHAR * identifyingnumber
Definition: builtin.c:1037

◆ fill_datafile()

static enum fill_status fill_datafile ( struct table table,
const struct expr cond 
)
static

Definition at line 2364 of file builtin.c.

2365{
2366 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
2367 struct record_datafile *rec;
2368 UINT i, len, row = 0, offset = 0, num_expected_rows;
2369 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
2370 DWORD drives = GetLogicalDrives();
2372 HANDLE handle;
2373 struct dirstack *dirstack;
2375
2376 if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
2377
2379
2380 for (i = 0; i < 26; i++)
2381 {
2382 if (!(drives & (1 << i))) continue;
2383
2384 root[0] = 'A' + i;
2385 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
2386
2387 num_expected_rows = 0;
2388 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
2389
2390 for (;;)
2391 {
2392 heap_free( glob );
2393 heap_free( path );
2394 path = pop_dir( dirstack, &len );
2395 if (!(glob = build_glob( root[0], path, len )))
2396 {
2398 goto done;
2399 }
2401 {
2402 do
2403 {
2404 if (!resize_table( table, row + 1, sizeof(*rec) ))
2405 {
2407 FindClose( handle );
2408 goto done;
2409 }
2410 if (!wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW )) continue;
2411
2412 if (!(new_path = append_path( path, data.cFileName, &len )))
2413 {
2415 FindClose( handle );
2416 goto done;
2417 }
2418
2419 if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
2420 {
2421 if (push_dir( dirstack, new_path, len )) continue;
2422 heap_free( new_path );
2423 FindClose( handle );
2425 goto done;
2426 }
2427 rec = (struct record_datafile *)(table->data + offset);
2428 rec->name = build_name( root[0], new_path );
2429 rec->version = get_file_version( rec->name );
2430 heap_free( new_path );
2431 if (!match_row( table, row, cond, &status ))
2432 {
2434 continue;
2435 }
2436 else if (num_expected_rows && row == num_expected_rows - 1)
2437 {
2438 row++;
2439 FindClose( handle );
2441 goto done;
2442 }
2443 offset += sizeof(*rec);
2444 row++;
2445 }
2446 while (FindNextFileW( handle, &data ));
2447 FindClose( handle );
2448 }
2449 if (!peek_dir( dirstack )) break;
2450 }
2451 }
2452
2453done:
2455 heap_free( glob );
2456 heap_free( path );
2457
2458 TRACE("created %u rows\n", row);
2459 table->num_rows = row;
2460 return status;
2461}
static WCHAR * get_file_version(const WCHAR *filename)
Definition: builtin.c:2337
static UINT seed_dirs(struct dirstack *dirstack, const struct expr *cond, WCHAR root, UINT *count)
Definition: builtin.c:2268
static const WCHAR * peek_dir(struct dirstack *dirstack)
Definition: builtin.c:2175
static BOOL push_dir(struct dirstack *dirstack, WCHAR *dir, UINT len)
Definition: builtin.c:2139
static struct dirstack * alloc_dirstack(UINT size)
Definition: builtin.c:2103
static void free_dirstack(struct dirstack *dirstack)
Definition: builtin.c:2131
static WCHAR * build_name(WCHAR drive, const WCHAR *path)
Definition: builtin.c:2201
static WCHAR * build_glob(WCHAR drive, const WCHAR *path, UINT len)
Definition: builtin.c:2181
static WCHAR * append_path(const WCHAR *path, const WCHAR *segment, UINT *len)
Definition: builtin.c:2317
static void clear_dirstack(struct dirstack *dirstack)
Definition: builtin.c:2124
static WCHAR * pop_dir(struct dirstack *dirstack, UINT *len)
Definition: builtin.c:2163
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
char ** glob(const char *v)
Definition: fake.c:36
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const WCHAR dotdotW[]
Definition: directory.c:81
static const WCHAR dotW[]
Definition: directory.c:80
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
const WCHAR * name
Definition: builtin.c:1046
const WCHAR * version
Definition: builtin.c:1047
@ FILL_STATUS_FILTERED
#define DRIVE_FIXED
Definition: winbase.h:252

◆ fill_desktopmonitor()

static enum fill_status fill_desktopmonitor ( struct table table,
const struct expr cond 
)
static

Definition at line 2474 of file builtin.c.

2475{
2476 struct record_desktopmonitor *rec;
2478 UINT row = 0;
2479
2480 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2481
2482 rec = (struct record_desktopmonitor *)table->data;
2484
2485 if (match_row( table, row, cond, &status )) row++;
2486
2487 TRACE("created %u rows\n", row);
2488 table->num_rows = row;
2489 return status;
2490}
static UINT32 get_pixelsperxlogicalinch(void)
Definition: builtin.c:2463
UINT32 pixelsperxlogicalinch
Definition: builtin.c:1051

◆ fill_directory()

static enum fill_status fill_directory ( struct table table,
const struct expr cond 
)
static

Definition at line 2492 of file builtin.c.

2493{
2494 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
2495 struct record_directory *rec;
2496 UINT i, len, row = 0, offset = 0, num_expected_rows;
2497 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
2498 DWORD drives = GetLogicalDrives();
2500 HANDLE handle;
2501 struct dirstack *dirstack;
2503
2504 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
2505
2507
2508 for (i = 0; i < 26; i++)
2509 {
2510 if (!(drives & (1 << i))) continue;
2511
2512 root[0] = 'A' + i;
2513 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
2514
2515 num_expected_rows = 0;
2516 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
2517
2518 for (;;)
2519 {
2520 heap_free( glob );
2521 heap_free( path );
2522 path = pop_dir( dirstack, &len );
2523 if (!(glob = build_glob( root[0], path, len )))
2524 {
2526 goto done;
2527 }
2529 {
2530 do
2531 {
2532 if (!resize_table( table, row + 1, sizeof(*rec) ))
2533 {
2534 FindClose( handle );
2536 goto done;
2537 }
2538 if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
2539 !wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW ))
2540 continue;
2541
2542 if (!(new_path = append_path( path, data.cFileName, &len )))
2543 {
2544 FindClose( handle );
2546 goto done;
2547 }
2548
2549 if (!(push_dir( dirstack, new_path, len )))
2550 {
2551 heap_free( new_path );
2552 FindClose( handle );
2554 goto done;
2555 }
2556 rec = (struct record_directory *)(table->data + offset);
2558 rec->name = build_name( root[0], new_path );
2559 heap_free( new_path );
2560 if (!match_row( table, row, cond, &status ))
2561 {
2563 continue;
2564 }
2565 else if (num_expected_rows && row == num_expected_rows - 1)
2566 {
2567 row++;
2568 FindClose( handle );
2570 goto done;
2571 }
2572 offset += sizeof(*rec);
2573 row++;
2574 }
2575 while (FindNextFileW( handle, &data ));
2576 FindClose( handle );
2577 }
2578 if (!peek_dir( dirstack )) break;
2579 }
2580 }
2581
2582done:
2584 heap_free( glob );
2585 heap_free( path );
2586
2587 TRACE("created %u rows\n", row);
2588 table->num_rows = row;
2589 return status;
2590}
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
UINT32 accessmask
Definition: builtin.c:1055
const WCHAR * name
Definition: builtin.c:1056

◆ fill_diskdrive()

static enum fill_status fill_diskdrive ( struct table table,
const struct expr cond 
)
static

Definition at line 2614 of file builtin.c.

2615{
2616 static const WCHAR fmtW[] =
2617 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
2618 WCHAR device_id[ARRAY_SIZE( fmtW ) + 10], root[] = {'A',':','\\',0};
2619 struct record_diskdrive *rec;
2620 UINT i, row = 0, offset = 0, index = 0, type;
2621 UINT64 size = 1024 * 1024 * 1024;
2622 DWORD drives = GetLogicalDrives();
2624
2625 if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED;
2626
2627 for (i = 0; i < 26; i++)
2628 {
2629 if (drives & (1 << i))
2630 {
2631 root[0] = 'A' + i;
2632 type = GetDriveTypeW( root );
2633 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
2634 continue;
2635
2636 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2637
2638 rec = (struct record_diskdrive *)(table->data + offset);
2639 swprintf( device_id, fmtW, index );
2641 rec->index = index++;
2645 rec->model = diskdrive_modelW;
2648 get_freespace( root, &size );
2649 rec->size = size;
2650 if (!match_row( table, row, cond, &status ))
2651 {
2653 continue;
2654 }
2655 offset += sizeof(*rec);
2656 row++;
2657 }
2658 }
2659 TRACE("created %u rows\n", row);
2660 table->num_rows = row;
2661 return status;
2662}
unsigned long long UINT64
#define ARRAY_SIZE(A)
Definition: main.h:33
static const WCHAR diskdrive_serialW[]
Definition: builtin.c:942
static const WCHAR diskdrive_modelW[]
Definition: builtin.c:938
static const WCHAR diskdrive_mediatype_removableW[]
Definition: builtin.c:936
static UINT64 get_freespace(const WCHAR *dir, UINT64 *disksize)
Definition: builtin.c:2592
static const WCHAR diskdrive_interfacetypeW[]
Definition: builtin.c:930
static const WCHAR diskdrive_mediatype_fixedW[]
Definition: builtin.c:934
static const WCHAR diskdrive_pnpdeviceidW[]
Definition: builtin.c:940
static const WCHAR diskdrive_manufacturerW[]
Definition: builtin.c:932
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
const WCHAR * device_id
Definition: builtin.c:1060
const WCHAR * manufacturer
Definition: builtin.c:1063
const WCHAR * model
Definition: builtin.c:1065
const WCHAR * pnpdevice_id
Definition: builtin.c:1066
const WCHAR * interfacetype
Definition: builtin.c:1062
const WCHAR * serialnumber
Definition: builtin.c:1067
const WCHAR * mediatype
Definition: builtin.c:1064
#define DRIVE_REMOVABLE
Definition: winbase.h:251

◆ fill_diskdrivetodiskpartition()

static enum fill_status fill_diskdrivetodiskpartition ( struct table table,
const struct expr cond 
)
static

Definition at line 2728 of file builtin.c.

2729{
2731 UINT i, row = 0, offset = 0, count = 0;
2733 struct association *assoc;
2734
2736 if (!count)
2737 {
2738 free_assocations( assoc, count );
2740 }
2741 if (!resize_table( table, count, sizeof(*rec) ))
2742 {
2743 free_assocations( assoc, count );
2744 return FILL_STATUS_FAILED;
2745 }
2746
2747 for (i = 0; i < count; i++)
2748 {
2749 rec = (struct record_diskdrivetodiskpartition *)(table->data + offset);
2750 rec->antecedent = assoc[i].ref;
2751 rec->dependent = assoc[i].ref2;
2752 if (!match_row( table, row, cond, &status ))
2753 {
2755 continue;
2756 }
2757 offset += sizeof(*rec);
2758 row++;
2759 }
2760
2761 heap_free( assoc );
2762
2763 TRACE("created %u rows\n", row);
2764 table->num_rows = row;
2765 return status;
2766}
static void free_assocations(struct association *assoc, UINT count)
Definition: builtin.c:2670
static struct association * get_diskdrivetodiskpartition_pairs(UINT *count)
Definition: builtin.c:2682
GLuint GLuint GLsizei count
Definition: gl.h:1545
WCHAR * ref2
Definition: builtin.c:2667
WCHAR * ref
Definition: builtin.c:2666

◆ fill_diskpartition()

static enum fill_status fill_diskpartition ( struct table table,
const struct expr cond 
)
static

Definition at line 2778 of file builtin.c.

2779{
2780 static const WCHAR fmtW[] =
2781 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
2782 WCHAR device_id[32], root[] = {'A',':','\\',0};
2783 struct record_diskpartition *rec;
2784 UINT i, row = 0, offset = 0, type, index = 0;
2785 UINT64 size = 1024 * 1024 * 1024;
2786 DWORD drives = GetLogicalDrives();
2788
2789 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
2790
2791 for (i = 0; i < 26; i++)
2792 {
2793 if (drives & (1 << i))
2794 {
2795 root[0] = 'A' + i;
2796 type = GetDriveTypeW( root );
2797 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
2798 continue;
2799
2800 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2801
2802 rec = (struct record_diskpartition *)(table->data + offset);
2803 rec->bootable = (i == 2) ? -1 : 0;
2804 rec->bootpartition = (i == 2) ? -1 : 0;
2805 swprintf( device_id, fmtW, index );
2807 rec->diskindex = index++;
2808 rec->index = 0;
2810 get_freespace( root, &size );
2811 rec->size = size;
2812 rec->startingoffset = 0;
2813 rec->type = get_filesystem( root );
2814 if (!match_row( table, row, cond, &status ))
2815 {
2817 continue;
2818 }
2819 offset += sizeof(*rec);
2820 row++;
2821 }
2822 }
2823 TRACE("created %u rows\n", row);
2824 table->num_rows = row;
2825 return status;
2826}
static WCHAR * get_filesystem(const WCHAR *root)
Definition: builtin.c:2768
const WCHAR * pnpdevice_id
Definition: builtin.c:1082
const WCHAR * device_id
Definition: builtin.c:1079
const WCHAR * type
Definition: builtin.c:1085

◆ fill_displaycontrollerconfig()

static enum fill_status fill_displaycontrollerconfig ( struct table table,
const struct expr cond 
)
static

Definition at line 2841 of file builtin.c.

2842{
2844 UINT row = 0, hres = 1024, vres = 768;
2846
2847 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2848
2849 rec = (struct record_displaycontrollerconfig *)table->data;
2850 rec->bitsperpixel = get_bitsperpixel( &hres, &vres );
2854 rec->verticalresolution = vres;
2855 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2856 else row++;
2857
2858 TRACE("created %u rows\n", row);
2859 table->num_rows = row;
2860 return status;
2861}
static UINT32 get_bitsperpixel(UINT *hres, UINT *vres)
Definition: builtin.c:2828
static const WCHAR videocontroller_deviceidW[]
Definition: builtin.c:972
HRESULT hres
Definition: protocol.c:465

◆ fill_ip4routetable()

static enum fill_status fill_ip4routetable ( struct table table,
const struct expr cond 
)
static

Definition at line 2874 of file builtin.c.

2875{
2876 struct record_ip4routetable *rec;
2877 UINT i, row = 0, offset = 0, size = 0;
2878 MIB_IPFORWARDTABLE *forwards;
2880
2882 if (!(forwards = heap_alloc( size ))) return FILL_STATUS_FAILED;
2883 if (GetIpForwardTable( forwards, &size, TRUE ))
2884 {
2885 heap_free( forwards );
2886 return FILL_STATUS_FAILED;
2887 }
2888 if (!resize_table( table, max(forwards->dwNumEntries, 1), sizeof(*rec) ))
2889 {
2890 heap_free( forwards );
2891 return FILL_STATUS_FAILED;
2892 }
2893
2894 for (i = 0; i < forwards->dwNumEntries; i++)
2895 {
2896 rec = (struct record_ip4routetable *)(table->data + offset);
2897
2898 rec->destination = get_ip4_string( ntohl(forwards->table[i].dwForwardDest) );
2899 rec->interfaceindex = forwards->table[i].dwForwardIfIndex;
2900 rec->nexthop = get_ip4_string( ntohl(forwards->table[i].dwForwardNextHop) );
2901
2902 if (!match_row( table, row, cond, &status ))
2903 {
2905 continue;
2906 }
2907 offset += sizeof(*rec);
2908 row++;
2909 }
2910 TRACE("created %u rows\n", row);
2911 table->num_rows = row;
2912
2913 heap_free( forwards );
2914 return status;
2915}
static WCHAR * get_ip4_string(DWORD addr)
Definition: builtin.c:2863
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define TRUE
Definition: types.h:120
DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
#define ntohl(x)
Definition: module.h:203
DWORD dwForwardNextHop
Definition: ipmib.h:74
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
DWORD dwForwardDest
Definition: ipmib.h:71
DWORD dwNumEntries
Definition: ipmib.h:97
MIB_IPFORWARDROW table[1]
Definition: ipmib.h:98
const WCHAR * nexthop
Definition: builtin.c:1099
const WCHAR * destination
Definition: builtin.c:1097
#define max(a, b)
Definition: svc.c:63

◆ fill_logicaldisk()

static enum fill_status fill_logicaldisk ( struct table table,
const struct expr cond 
)
static

Definition at line 2934 of file builtin.c.

2935{
2936 static const WCHAR fmtW[] = {'%','c',':',0};
2937 WCHAR device_id[3], root[] = {'A',':','\\',0};
2938 struct record_logicaldisk *rec;
2939 UINT i, row = 0, offset = 0, type;
2940 UINT64 size = 1024 * 1024 * 1024;
2941 DWORD drives = GetLogicalDrives();
2943
2944 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
2945
2946 for (i = 0; i < 26; i++)
2947 {
2948 if (drives & (1 << i))
2949 {
2950 root[0] = 'A' + i;
2951 type = GetDriveTypeW( root );
2953 continue;
2954
2955 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2956
2957 rec = (struct record_logicaldisk *)(table->data + offset);
2958 swprintf( device_id, fmtW, 'A' + i );
2960 rec->drivetype = type;
2961 rec->filesystem = get_filesystem( root );
2962 rec->freespace = get_freespace( root, &size );
2963 rec->name = heap_strdupW( device_id );
2964 rec->size = size;
2965 rec->volumename = get_volumename( root );
2967 if (!match_row( table, row, cond, &status ))
2968 {
2970 continue;
2971 }
2972 offset += sizeof(*rec);
2973 row++;
2974 }
2975 }
2976 TRACE("created %u rows\n", row);
2977 table->num_rows = row;
2978 return status;
2979}
static WCHAR * get_volumeserialnumber(const WCHAR *root)
Definition: builtin.c:2923
static WCHAR * get_volumename(const WCHAR *root)
Definition: builtin.c:2917
const WCHAR * volumeserialnumber
Definition: builtin.c:1110
const WCHAR * volumename
Definition: builtin.c:1109
const WCHAR * filesystem
Definition: builtin.c:1105
const WCHAR * device_id
Definition: builtin.c:1103
const WCHAR * name
Definition: builtin.c:1107

◆ fill_logicaldisktopartition()

static enum fill_status fill_logicaldisktopartition ( struct table table,
const struct expr cond 
)
static

Definition at line 3029 of file builtin.c.

3030{
3032 UINT i, row = 0, offset = 0, count = 0;
3034 struct association *assoc;
3035
3037 if (!count)
3038 {
3039 free_assocations( assoc, count );
3041 }
3042 if (!resize_table( table, count, sizeof(*rec) ))
3043 {
3044 free_assocations( assoc, count );
3045 return FILL_STATUS_FAILED;
3046 }
3047
3048 for (i = 0; i < count; i++)
3049 {
3050 rec = (struct record_logicaldisktopartition *)(table->data + offset);
3051 rec->antecedent = assoc[i].ref;
3052 rec->dependent = assoc[i].ref2;
3053 if (!match_row( table, row, cond, &status ))
3054 {
3056 continue;
3057 }
3058 offset += sizeof(*rec);
3059 row++;
3060 }
3061
3062 heap_free( assoc );
3063
3064 TRACE("created %u rows\n", row);
3065 table->num_rows = row;
3066 return status;
3067}
static struct association * get_logicaldisktopartition_pairs(UINT *count)
Definition: builtin.c:2981

◆ fill_networkadapter()

static enum fill_status fill_networkadapter ( struct table table,
const struct expr cond 
)
static

Definition at line 3126 of file builtin.c.

3127{
3128 static const WCHAR fmtW[] = {'%','u',0};
3129 WCHAR device_id[11];
3130 struct record_networkadapter *rec;
3131 IP_ADAPTER_ADDRESSES *aa, *buffer;
3132 UINT row = 0, offset = 0, count = 0;
3133 DWORD size = 0, ret;
3134 int adaptertypeid, physical;
3136
3137 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
3139
3140 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
3141 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
3142 {
3143 heap_free( buffer );
3144 return FILL_STATUS_FAILED;
3145 }
3146 for (aa = buffer; aa; aa = aa->Next)
3147 {
3148 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
3149 }
3150 if (!resize_table( table, count, sizeof(*rec) ))
3151 {
3152 heap_free( buffer );
3153 return FILL_STATUS_FAILED;
3154 }
3155 for (aa = buffer; aa; aa = aa->Next)
3156 {
3157 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
3158
3159 rec = (struct record_networkadapter *)(table->data + offset);
3160 swprintf( device_id, fmtW, aa->u.s.IfIndex );
3161 rec->adaptertype = get_adaptertype( aa->IfType, &adaptertypeid, &physical );
3163 rec->description = heap_strdupW( aa->Description );
3165 rec->index = aa->u.s.IfIndex;
3166 rec->interface_index = aa->u.s.IfIndex;
3167 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
3169 rec->name = heap_strdupW( aa->FriendlyName );
3170 rec->netconnection_status = get_connection_status( aa->OperStatus );
3171 rec->physicaladapter = physical;
3173 rec->speed = 1000000;
3174 if (!match_row( table, row, cond, &status ))
3175 {
3177 continue;
3178 }
3179 offset += sizeof(*rec);
3180 row++;
3181 }
3182 TRACE("created %u rows\n", row);
3183 table->num_rows = row;
3184
3185 heap_free( buffer );
3186 return status;
3187}
static const WCHAR networkadapter_pnpdeviceidW[]
Definition: builtin.c:944
static WCHAR * get_mac_address(const BYTE *addr, DWORD len)
Definition: builtin.c:3083
static const WCHAR * get_adaptertype(DWORD type, int *id, int *physical)
Definition: builtin.c:3094
static UINT16 get_connection_status(IF_OPER_STATUS status)
Definition: builtin.c:3069
GLuint buffer
Definition: glext.h:5915
#define IF_TYPE_SOFTWARE_LOOPBACK
Definition: ipifcons.h:44
const WCHAR * mac_address
Definition: builtin.c:1125
const WCHAR * name
Definition: builtin.c:1127
const WCHAR * device_id
Definition: builtin.c:1122
const WCHAR * adaptertype
Definition: builtin.c:1119
const WCHAR * description
Definition: builtin.c:1121
UINT16 netconnection_status
Definition: builtin.c:1128
const WCHAR * manufacturer
Definition: builtin.c:1126
const WCHAR * pnpdevice_id
Definition: builtin.c:1130
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define AF_UNSPEC
Definition: winsock.h:344

◆ fill_networkadapterconfig()

static enum fill_status fill_networkadapterconfig ( struct table table,
const struct expr cond 
)
static

Definition at line 3370 of file builtin.c.

3371{
3372 struct record_networkadapterconfig *rec;
3373 IP_ADAPTER_ADDRESSES *aa, *buffer;
3374 UINT row = 0, offset = 0, count = 0;
3375 DWORD size = 0, ret;
3377
3378 ret = GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, NULL, &size );
3380
3381 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
3382 if (GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, buffer, &size ))
3383 {
3384 heap_free( buffer );
3385 return FILL_STATUS_FAILED;
3386 }
3387 for (aa = buffer; aa; aa = aa->Next)
3388 {
3389 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
3390 }
3391 if (!resize_table( table, count, sizeof(*rec) ))
3392 {
3393 heap_free( buffer );
3394 return FILL_STATUS_FAILED;
3395 }
3396 for (aa = buffer; aa; aa = aa->Next)
3397 {
3398 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
3399
3400 rec = (struct record_networkadapterconfig *)(table->data + offset);
3401 rec->defaultipgateway = get_defaultipgateway( aa->FirstGatewayAddress );
3402 rec->description = heap_strdupW( aa->Description );
3403 rec->dhcpenabled = -1;
3404 rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
3405 rec->dnsserversearchorder = get_dnsserversearchorder( aa->FirstDnsServerAddress );
3406 rec->index = aa->u.s.IfIndex;
3407#ifndef __REACTOS__
3408 rec->ipaddress = get_ipaddress( aa->FirstUnicastAddress );
3409#endif
3410 rec->ipconnectionmetric = 20;
3411 rec->ipenabled = -1;
3412#ifndef __REACTOS__
3413 rec->ipsubnet = get_ipsubnet( aa->FirstUnicastAddress );
3414#endif
3415 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
3416 rec->settingid = get_settingid( rec->index );
3417 if (!match_row( table, row, cond, &status ))
3418 {
3420 continue;
3421 }
3422 offset += sizeof(*rec);
3423 row++;
3424 }
3425 TRACE("created %u rows\n", row);
3426 table->num_rows = row;
3427
3428 heap_free( buffer );
3429 return status;
3430}
static WCHAR * get_dnshostname(IP_ADAPTER_UNICAST_ADDRESS *addr)
Definition: builtin.c:3189
static struct array * get_ipaddress(IP_ADAPTER_UNICAST_ADDRESS_LH *list)
Definition: builtin.c:3269
static struct array * get_dnsserversearchorder(IP_ADAPTER_DNS_SERVER_ADDRESS *list)
Definition: builtin.c:3232
static WCHAR * get_settingid(UINT32 index)
Definition: builtin.c:3358
static struct array * get_defaultipgateway(IP_ADAPTER_GATEWAY_ADDRESS *list)
Definition: builtin.c:3199
static struct array * get_ipsubnet(IP_ADAPTER_UNICAST_ADDRESS_LH *list)
Definition: builtin.c:3302
const WCHAR * settingid
Definition: builtin.c:1146
const struct array * dnsserversearchorder
Definition: builtin.c:1139
const WCHAR * mac_address
Definition: builtin.c:1145
const struct array * defaultipgateway
Definition: builtin.c:1135
const struct array * ipaddress
Definition: builtin.c:1141
const struct array * ipsubnet
Definition: builtin.c:1144
const WCHAR * dnshostname
Definition: builtin.c:1138
const WCHAR * description
Definition: builtin.c:1136

◆ fill_operatingsystem()

static enum fill_status fill_operatingsystem ( struct table table,
const struct expr cond 
)
static

Definition at line 4040 of file builtin.c.

4041{
4042 static const WCHAR wineprojectW[] = {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
4043 struct record_operatingsystem *rec;
4045 OSVERSIONINFOEXW ver;
4046 UINT row = 0;
4047
4048 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
4049
4050 ver.dwOSVersionInfoSize = sizeof(ver);
4051 GetVersionExW( (OSVERSIONINFOW *)&ver );
4052
4053 rec = (struct record_operatingsystem *)table->data;
4054 rec->buildnumber = get_osbuildnumber( &ver );
4055 rec->caption = get_oscaption( &ver );
4056 rec->codeset = get_codeset();
4058 rec->csdversion = ver.szCSDVersion[0] ? heap_strdupW( ver.szCSDVersion ) : NULL;
4059 rec->csname = get_computername();
4065 rec->locale = get_locale();
4066 rec->manufacturer = wineprojectW;
4067 rec->name = get_osname( rec->caption );
4068#ifndef __REACTOS__
4070#endif
4073 rec->osproductsuite = 2461140; /* Windows XP Professional */
4074 rec->ostype = 18; /* WINNT */
4075 rec->primary = -1;
4079 rec->suitemask = 272; /* Single User + Terminal */
4084 rec->version = get_osversion( &ver );
4085 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
4086 else row++;
4087
4088 TRACE("created %u rows\n", row);
4089 table->num_rows = row;
4090 return status;
4091}
static INT16 get_currenttimezone(void)
Definition: builtin.c:4031
static WCHAR * get_systemdirectory(void)
Definition: builtin.c:3906
static UINT64 get_available_physical_memory(void)
Definition: builtin.c:1931
static const WCHAR os_serialnumberW[]
Definition: builtin.c:954
static WCHAR * get_codeset(void)
Definition: builtin.c:3924
static WCHAR * get_systemdrive(void)
Definition: builtin.c:3917
static WCHAR * get_osversion(OSVERSIONINFOEXW *ver)
Definition: builtin.c:4016
static WCHAR * get_lastbootuptime(void)
Definition: builtin.c:3865
static const WCHAR os_installdateW[]
Definition: builtin.c:952
static WCHAR * get_oscaption(OSVERSIONINFOEXW *ver)
Definition: builtin.c:3950
static WCHAR * get_countrycode(void)
Definition: builtin.c:3931
static WCHAR * get_localdatetime(void)
Definition: builtin.c:3881
static WCHAR * get_osbuildnumber(OSVERSIONINFOEXW *ver)
Definition: builtin.c:3943
static const WCHAR * get_osarchitecture(void)
Definition: builtin.c:3688
static WCHAR * get_osname(const WCHAR *caption)
Definition: builtin.c:4003
static WCHAR * get_locale(void)
Definition: builtin.c:3937
static DWORD get_operatingsystemsku(void)
Definition: builtin.c:4024
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: lang.c:755
WCHAR szCSDVersion[128]
Definition: rtltypes.h:274
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:269
USHORT wServicePackMinor
Definition: rtltypes.h:276
USHORT wServicePackMajor
Definition: rtltypes.h:275
const WCHAR * installdate
Definition: builtin.c:1158
UINT64 totalvisiblememorysize
Definition: builtin.c:1177
const WCHAR * csdversion
Definition: builtin.c:1154
const WCHAR * buildnumber
Definition: builtin.c:1150
UINT64 totalvirtualmemorysize
Definition: builtin.c:1176
const WCHAR * localdatetime
Definition: builtin.c:1160
const WCHAR * osarchitecture
Definition: builtin.c:1165
const WCHAR * systemdirectory
Definition: builtin.c:1174
const WCHAR * systemdrive
Definition: builtin.c:1175
const WCHAR * name
Definition: builtin.c:1163
const WCHAR * codeset
Definition: builtin.c:1152
const WCHAR * csname
Definition: builtin.c:1155
const WCHAR * countrycode
Definition: builtin.c:1153
const WCHAR * lastbootuptime
Definition: builtin.c:1159
const WCHAR * locale
Definition: builtin.c:1161
const WCHAR * caption
Definition: builtin.c:1151
const WCHAR * manufacturer
Definition: builtin.c:1162
const WCHAR * serialnumber
Definition: builtin.c:1170
const WCHAR * version
Definition: builtin.c:1178

◆ fill_physicalmemory()

static enum fill_status fill_physicalmemory ( struct table table,
const struct expr cond 
)
static

Definition at line 3432 of file builtin.c.

3433{
3434 static const WCHAR dimm0W[] = {'D','I','M','M',' ','0',0};
3435 struct record_physicalmemory *rec;
3437 UINT row = 0;
3438
3439 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
3440
3441 rec = (struct record_physicalmemory *)table->data;
3443 rec->configuredclockspeed = 0;
3444 rec->devicelocator = dimm0W;
3445 rec->memorytype = 9; /* RAM */
3446 rec->partnumber = NULL;
3447 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
3448 else row++;
3449
3450 TRACE("created %u rows\n", row);
3451 table->num_rows = row;
3452 return status;
3453}
const WCHAR * devicelocator
Definition: builtin.c:1198
const WCHAR * partnumber
Definition: builtin.c:1200
UINT32 configuredclockspeed
Definition: builtin.c:1197

◆ fill_pnpentity()

static enum fill_status fill_pnpentity ( struct table table,
const struct expr cond 
)
static

Definition at line 3455 of file builtin.c.

3456{
3457 struct record_pnpentity *rec;
3459 HDEVINFO device_info_set;
3460 SP_DEVINFO_DATA devinfo = {0};
3461 DWORD idx;
3462
3464
3465 devinfo.cbSize = sizeof(devinfo);
3466
3467 idx = 0;
3468 while (SetupDiEnumDeviceInfo( device_info_set, idx++, &devinfo ))
3469 {
3470 /* noop */
3471 }
3472
3473 resize_table( table, idx, sizeof(*rec) );
3474 table->num_rows = 0;
3475 rec = (struct record_pnpentity *)table->data;
3476
3477 idx = 0;
3478 while (SetupDiEnumDeviceInfo( device_info_set, idx++, &devinfo ))
3479 {
3481 if (SetupDiGetDeviceInstanceIdW( device_info_set, &devinfo, device_id,
3483 {
3485
3486 table->num_rows++;
3487 if (!match_row( table, table->num_rows - 1, cond, &status ))
3488 {
3490 table->num_rows--;
3491 }
3492 else
3493 rec++;
3494 }
3495 }
3496
3497 SetupDiDestroyDeviceInfoList( device_info_set );
3498
3499 return status;
3500}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
unsigned int idx
Definition: utils.c:41
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1787
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2292
BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1907
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2893
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
#define DIGCF_PRESENT
Definition: setupapi.h:171
const WCHAR * device_id
Definition: builtin.c:1204

◆ fill_printer()

static enum fill_status fill_printer ( struct table table,
const struct expr cond 
)
static

Definition at line 3502 of file builtin.c.

3503{
3504 static const WCHAR fmtW[] = {'P','r','i','n','t','e','r','%','d',0};
3505 struct record_printer *rec;
3508 DWORD i, offset = 0, count = 0, size = 0, num_rows = 0;
3509 WCHAR id[20];
3510
3512 if (!count) return FILL_STATUS_UNFILTERED;
3513
3514 if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
3516 {
3517 heap_free( info );
3518 return FILL_STATUS_FAILED;
3519 }
3520 if (!resize_table( table, count, sizeof(*rec) ))
3521 {
3522 heap_free( info );
3523 return FILL_STATUS_FAILED;
3524 }
3525
3526 for (i = 0; i < count; i++)
3527 {
3528 rec = (struct record_printer *)(table->data + offset);
3529 rec->attributes = info[i].Attributes;
3530 swprintf( id, fmtW, i );
3531 rec->device_id = heap_strdupW( id );
3532 rec->drivername = heap_strdupW( info[i].pDriverName );
3533 rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality;
3534 rec->local = -1;
3535 rec->location = heap_strdupW( info[i].pLocation );
3536 rec->name = heap_strdupW( info[i].pPrinterName );
3537 rec->network = 0;
3538 rec->portname = heap_strdupW( info[i].pPortName );
3539 if (!match_row( table, i, cond, &status ))
3540 {
3542 continue;
3543 }
3544 offset += sizeof(*rec);
3545 num_rows++;
3546 }
3547 TRACE("created %u rows\n", num_rows);
3549
3550 heap_free( info );
3551 return status;
3552}
int JSAMPARRAY int int num_rows
Definition: jpegint.h:421
UINT32 attributes
Definition: builtin.c:1208
const WCHAR * portname
Definition: builtin.c:1216
const WCHAR * name
Definition: builtin.c:1214
UINT32 horizontalresolution
Definition: builtin.c:1211
const WCHAR * drivername
Definition: builtin.c:1210
const WCHAR * location
Definition: builtin.c:1213
const WCHAR * device_id
Definition: builtin.c:1209
#define PRINTER_ENUM_LOCAL
Definition: winspool.h:896
WINBOOL WINAPI EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
unsigned char BYTE
Definition: xxhash.c:193

◆ fill_process()

static enum fill_status fill_process ( struct table table,
const struct expr cond 
)
static

Definition at line 3560 of file builtin.c.

3561{
3562 static const WCHAR fmtW[] = {'%','u',0};
3563 WCHAR handle[11];
3564 struct record_process *rec;
3566 HANDLE snap;
3568 UINT row = 0, offset = 0;
3569
3571 if (snap == INVALID_HANDLE_VALUE) return FILL_STATUS_FAILED;
3572
3573 entry.dwSize = sizeof(entry);
3574 if (!Process32FirstW( snap, &entry )) goto done;
3575 if (!resize_table( table, 8, sizeof(*rec) )) goto done;
3576
3577 do
3578 {
3579 if (!resize_table( table, row + 1, sizeof(*rec) ))
3580 {
3582 goto done;
3583 }
3584
3585 rec = (struct record_process *)(table->data + offset);
3586 rec->caption = heap_strdupW( entry.szExeFile );
3587 rec->commandline = get_cmdline( entry.th32ProcessID );
3588 rec->description = heap_strdupW( entry.szExeFile );
3589 swprintf( handle, fmtW, entry.th32ProcessID );
3590 rec->handle = heap_strdupW( handle );
3591 rec->name = heap_strdupW( entry.szExeFile );
3592 rec->process_id = entry.th32ProcessID;
3593 rec->pprocess_id = entry.th32ParentProcessID;
3594 rec->thread_count = entry.cntThreads;
3595 rec->workingsetsize = 0;
3597 if (!match_row( table, row, cond, &status ))
3598 {
3600 continue;
3601 }
3602 offset += sizeof(*rec);
3603 row++;
3604 } while (Process32NextW( snap, &entry ));
3605
3606 TRACE("created %u rows\n", row);
3607 table->num_rows = row;
3608
3609done:
3610 CloseHandle( snap );
3611 return status;
3612}
static WCHAR * get_cmdline(DWORD process_id)
Definition: builtin.c:3554
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI Process32NextW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe)
Definition: toolhelp.c:1073
HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID)
Definition: toolhelp.c:1255
BOOL WINAPI Process32FirstW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe)
Definition: toolhelp.c:984
HRESULT process_get_owner(IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
Definition: process.c:65
uint32_t entry
Definition: isohybrid.c:63
class_method * get_owner
Definition: builtin.c:1230
UINT32 process_id
Definition: builtin.c:1226
const WCHAR * commandline
Definition: builtin.c:1221
UINT32 pprocess_id
Definition: builtin.c:1225
UINT32 thread_count
Definition: builtin.c:1227
const WCHAR * description
Definition: builtin.c:1222
const WCHAR * handle
Definition: builtin.c:1223
const WCHAR * caption
Definition: builtin.c:1220
UINT64 workingsetsize
Definition: builtin.c:1228
const WCHAR * name
Definition: builtin.c:1224
#define TH32CS_SNAPPROCESS
Definition: tlhelp32.h:26

◆ fill_processor()

static enum fill_status fill_processor ( struct table table,
const struct expr cond 
)
static

Definition at line 3789 of file builtin.c.

3790{
3791 static const WCHAR fmtW[] = {'C','P','U','%','u',0};
3792 WCHAR caption[100], device_id[14], processor_id[17], manufacturer[13], name[49] = {0}, version[50];
3793 struct record_processor *rec;
3794#ifdef __REACTOS__
3796#else
3797 UINT i, offset = 0, num_rows = 0, num_logical, num_physical, num_packages;
3798#endif
3800
3801#ifdef __REACTOS__
3802 if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
3803#else
3804 num_logical = get_logical_processor_count( &num_physical, &num_packages );
3805
3806 if (!resize_table( table, num_packages, sizeof(*rec) )) return FILL_STATUS_FAILED;
3807#endif
3808
3814
3815#ifdef __REACTOS__
3817 num_cores /= count;
3818
3819 for (i = 0; i < count; i++)
3820#else
3821 for (i = 0; i < num_packages; i++)
3822#endif
3823 {
3824 rec = (struct record_processor *)(table->data + offset);
3825 rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64;
3826 rec->architecture = get_osarchitecture() == os_32bitW ? 0 : 9;
3827 rec->caption = heap_strdupW( caption );
3828 rec->cpu_status = 1; /* CPU Enabled */
3830 rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64;
3832 swprintf( device_id, fmtW, i );
3834 rec->family = 2; /* Unknown */
3835 rec->level = 15;
3838 rec->name = heap_strdupW( name );
3839#ifdef __REACTOS__
3840 rec->num_cores = num_cores;
3842#else
3843 rec->num_cores = num_physical / num_packages;
3844 rec->num_logical_processors = num_logical / num_packages;
3845#endif
3847 rec->processortype = 3; /* central processor */
3849 rec->unique_id = NULL;
3850 rec->version = heap_strdupW( version );
3851 if (!match_row( table, i, cond, &status ))
3852 {
3854 continue;
3855 }
3856 offset += sizeof(*rec);
3857 num_rows++;
3858 }
3859
3860 TRACE("created %u rows\n", num_rows);
3862 return status;
3863}
static void get_processor_name(WCHAR *name)
Definition: builtin.c:3743
static const WCHAR os_32bitW[]
Definition: builtin.c:948
static void get_processor_manufacturer(WCHAR *manufacturer, UINT len)
Definition: builtin.c:3677
static UINT get_processor_currentclockspeed(UINT index)
Definition: builtin.c:3760
static void get_processor_caption(WCHAR *caption, UINT len)
Definition: builtin.c:3695
static void get_processor_id(WCHAR *processor_id, UINT len)
Definition: builtin.c:3735
static UINT get_processor_maxclockspeed(UINT index)
Definition: builtin.c:3774
static void get_processor_version(WCHAR *version, UINT len)
Definition: builtin.c:3718
static UINT16 get_processor_revision(void)
Definition: builtin.c:3729
static const WCHAR version[]
Definition: asmname.c:66
Definition: name.c:39
UINT16 datawidth
Definition: builtin.c:1239
const WCHAR * device_id
Definition: builtin.c:1241
UINT16 processortype
Definition: builtin.c:1250
UINT16 addresswidth
Definition: builtin.c:1234
UINT16 cpu_status
Definition: builtin.c:1237
const WCHAR * name
Definition: builtin.c:1246
UINT16 revision
Definition: builtin.c:1251
UINT32 num_logical_processors
Definition: builtin.c:1248
const WCHAR * description
Definition: builtin.c:1240
UINT32 maxclockspeed
Definition: builtin.c:1245
const WCHAR * processor_id
Definition: builtin.c:1249
UINT32 currentclockspeed
Definition: builtin.c:1238
const WCHAR * caption
Definition: builtin.c:1236
UINT32 num_cores
Definition: builtin.c:1247
const WCHAR * version
Definition: builtin.c:1253
const WCHAR * unique_id
Definition: builtin.c:1252
const WCHAR * manufacturer
Definition: builtin.c:1244
UINT16 architecture
Definition: builtin.c:1235

◆ fill_service()

static enum fill_status fill_service ( struct table table,
const struct expr cond 
)
static

Definition at line 4175 of file builtin.c.

4176{
4177 struct record_service *rec;
4178 SC_HANDLE manager;
4181 WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1];
4182 DWORD len = ARRAY_SIZE( sysnameW );
4183 UINT i, row = 0, offset = 0, size = 256, needed, count;
4185 BOOL ret;
4186
4188 if (!(services = heap_alloc( size ))) goto done;
4189
4191 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
4192 &count, NULL, NULL );
4193 if (!ret)
4194 {
4195 if (GetLastError() != ERROR_MORE_DATA) goto done;
4196 size = needed;
4197 if (!(tmp = heap_realloc( services, size ))) goto done;
4198 services = tmp;
4200 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
4201 &count, NULL, NULL );
4202 if (!ret) goto done;
4203 }
4204 if (!resize_table( table, count, sizeof(*rec) )) goto done;
4205
4206 GetComputerNameW( sysnameW, &len );
4208
4209 for (i = 0; i < count; i++)
4210 {
4212
4213 if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue;
4214
4215 status = &services[i].ServiceStatusProcess;
4216 rec = (struct record_service *)(table->data + offset);
4217 rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0;
4218 rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0;
4220 rec->name = heap_strdupW( services[i].lpServiceName );
4221 rec->process_id = status->dwProcessId;
4222 rec->servicetype = get_service_type( status->dwServiceType );
4223 rec->startmode = get_service_startmode( config->dwStartType );
4224 rec->state = get_service_state( status->dwCurrentState );
4225 rec->systemname = heap_strdupW( sysnameW );
4230 heap_free( config );
4231 if (!match_row( table, row, cond, &fill_status ))
4232 {
4234 continue;
4235 }
4236 offset += sizeof(*rec);
4237 row++;
4238 }
4239
4240 TRACE("created %u rows\n", row);
4241 table->num_rows = row;
4242
4243done:
4244 CloseServiceHandle( manager );
4246 return fill_status;
4247}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static const WCHAR * get_service_startmode(DWORD mode)
Definition: builtin.c:4135
static const WCHAR * get_service_type(DWORD type)
Definition: builtin.c:4093
static const WCHAR * get_service_state(DWORD state)
Definition: builtin.c:4111
static QUERY_SERVICE_CONFIGW * query_service_config(SC_HANDLE manager, const WCHAR *name)
Definition: builtin.c:4156
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define ERROR_MORE_DATA
Definition: dderror.h:13
struct config_s config
HRESULT service_stop_service(IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
Definition: service.c:238
HRESULT service_pause_service(IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
Definition: service.c:79
HRESULT service_resume_service(IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
Definition: service.c:124
HRESULT service_start_service(IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
Definition: service.c:193
unsigned int BOOL
Definition: ntddk_ex.h:94
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2016
BOOL WINAPI EnumServicesStatusExW(SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName)
Definition: scm.c:1518
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
const WCHAR * displayname
Definition: builtin.c:1275
class_method * stop_service
Definition: builtin.c:1286
const WCHAR * startmode
Definition: builtin.c:1279
const WCHAR * servicetype
Definition: builtin.c:1278
const WCHAR * state
Definition: builtin.c:1280
const WCHAR * systemname
Definition: builtin.c:1281
class_method * pause_service
Definition: builtin.c:1283
class_method * resume_service
Definition: builtin.c:1284
int accept_pause
Definition: builtin.c:1273
UINT32 process_id
Definition: builtin.c:1277
class_method * start_service
Definition: builtin.c:1285
const WCHAR * name
Definition: builtin.c:1276
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2777
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:243
#define SERVICE_STATE_ALL
Definition: winsvc.h:52
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
@ SC_ENUM_PROCESS_INFO
Definition: winsvc.h:122
#define SERVICE_TYPE_ALL
Definition: cmtypes.h:969

◆ fill_sid()

static enum fill_status fill_sid ( struct table table,
const struct expr cond 
)
static

Definition at line 4296 of file builtin.c.

4297{
4298 PSID sid;
4303 const WCHAR *str;
4304 struct record_sid *rec;
4305 UINT len;
4306
4307 if (!(str = find_sid_str( cond ))) return FILL_STATUS_FAILED;
4308 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
4309
4311 len = GetLengthSid( sid );
4312
4313 memset( &attrs, 0, sizeof(attrs) );
4314 attrs.Length = sizeof(attrs);
4315 if (LsaOpenPolicy( NULL, &attrs, POLICY_ALL_ACCESS, &handle ))
4316 {
4317 LocalFree( sid );
4318 return FILL_STATUS_FAILED;
4319 }
4320 if (LsaLookupSids( handle, 1, &sid, &domain, &name ))
4321 {
4322 LocalFree( sid );
4323 LsaClose( handle );
4324 return FILL_STATUS_FAILED;
4325 }
4326
4327 rec = (struct record_sid *)table->data;
4331 rec->sid = heap_strdupW( str );
4332 rec->sidlength = len;
4333
4334 TRACE("created 1 row\n");
4335 table->num_rows = 1;
4336
4339 LocalFree( sid );
4340 LsaClose( handle );
4341 return FILL_STATUS_FILTERED;
4342}
static WCHAR * get_referenceddomainname(LSA_REFERENCED_DOMAIN_LIST *domain)
Definition: builtin.c:4271
static struct array * get_binaryrepresentation(PSID sid, UINT len)
Definition: builtin.c:4254
static const WCHAR * find_sid_str(const struct expr *cond)
Definition: builtin.c:4276
static WCHAR * get_accountname(LSA_TRANSLATED_NAME *name)
Definition: builtin.c:4249
FT_UInt sid
Definition: cffcmap.c:139
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1181
NTSTATUS WINAPI LsaLookupSids(IN LSA_HANDLE PolicyHandle, IN ULONG Count, IN PSID *Sids, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_NAME *Names)
Definition: lsa.c:1067
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:699
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:192
BOOL WINAPI ConvertStringSidToSidW(LPCWSTR StringSid, PSID *Sid)
Definition: security.c:3335
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:921
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define POLICY_ALL_ACCESS
Definition: ntsecapi.h:77
#define memset(x, y, z)
Definition: compat.h:39
Definition: cookie.c:42
const WCHAR * accountname
Definition: builtin.c:1290
const WCHAR * referenceddomainname
Definition: builtin.c:1292
const struct array * binaryrepresentation
Definition: builtin.c:1291
const WCHAR * sid
Definition: builtin.c:1293
UINT32 sidlength
Definition: builtin.c:1294

◆ fill_systemenclosure()

static enum fill_status fill_systemenclosure ( struct table table,
const struct expr cond 
)
static

Definition at line 4417 of file builtin.c.

4418{
4419 struct record_systemenclosure *rec;
4421 UINT row = 0, len;
4422 char *buf;
4423
4424 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
4425
4426 len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
4427 if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
4429
4430 rec = (struct record_systemenclosure *)table->data;
4438 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
4439 else row++;
4440
4441 heap_free( buf );
4442
4443 TRACE("created %u rows\n", row);
4444 table->num_rows = row;
4445 return status;
4446}
static const WCHAR systemenclosure_systemenclosureW[]
Definition: builtin.c:964
static const WCHAR systemenclosure_tagW[]
Definition: builtin.c:966
static struct array * get_systemenclosure_chassistypes(const char *buf, UINT len)
Definition: builtin.c:4390
static int get_systemenclosure_lockpresent(const char *buf, UINT len)
Definition: builtin.c:4364
static WCHAR * get_systemenclosure_manufacturer(const char *buf, UINT len)
Definition: builtin.c:4357
const WCHAR * caption
Definition: builtin.c:1316
const WCHAR * manufacturer
Definition: builtin.c:1320
const WCHAR * tag
Definition: builtin.c:1322
const WCHAR * name
Definition: builtin.c:1321
const struct array * chassistypes
Definition: builtin.c:1317
const WCHAR * description
Definition: builtin.c:1318

◆ fill_videocontroller()

static enum fill_status fill_videocontroller ( struct table table,
const struct expr cond 
)
static

Definition at line 4489 of file builtin.c.

4490{
4491 static const WCHAR fmtW[] = {'%','u',' ','x',' ','%','u',' ','x',' ','%','I','6','4','u',' ','c','o','l','o','r','s',0};
4492 struct record_videocontroller *rec;
4493 HRESULT hr;
4494 IDXGIFactory *factory = NULL;
4495 IDXGIAdapter *adapter = NULL;
4496 DXGI_ADAPTER_DESC desc;
4497 UINT row = 0, hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
4500 WCHAR mode[44];
4501
4502 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
4503
4504 memset (&desc, 0, sizeof(desc));
4505 hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
4506 if (FAILED(hr)) goto done;
4507
4508 hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
4509 if (FAILED(hr)) goto done;
4510
4511 hr = IDXGIAdapter_GetDesc( adapter, &desc );
4512 if (SUCCEEDED(hr))
4513 {
4514 vidmem = desc.DedicatedVideoMemory;
4515 name = desc.Description;
4516 }
4517
4518done:
4519 rec = (struct record_videocontroller *)table->data;
4521 rec->adapter_ram = vidmem;
4522 rec->availability = 3; /* Running or Full Power */
4523 rec->config_errorcode = 0; /* no error */
4524 rec->caption = heap_strdupW( name );
4525 rec->current_bitsperpixel = get_bitsperpixel( &hres, &vres );
4527 rec->current_refreshrate = 0; /* default refresh rate */
4528 rec->current_scanmode = 2; /* Unknown */
4529 rec->current_verticalres = vres;
4530 rec->description = heap_strdupW( name );
4534 rec->installeddriver = get_installeddriver( desc.VendorId );
4535 rec->name = heap_strdupW( name );
4538 rec->videoarchitecture = 2; /* Unknown */
4539 rec->videomemorytype = 2; /* Unknown */
4540 swprintf( mode, fmtW, hres, vres, (UINT64)1 << rec->current_bitsperpixel );
4543 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
4544 else row++;
4545
4546 TRACE("created %u rows\n", row);
4547 table->num_rows = row;
4548
4549 if (adapter) IDXGIAdapter_Release( adapter );
4550 if (factory) IDXGIFactory_Release( factory );
4551 return status;
4552}
static const WCHAR videocontroller_driverversionW[]
Definition: builtin.c:976
static const WCHAR * get_installeddriver(UINT vendorid)
Definition: builtin.c:4471
static const WCHAR videocontroller_driverdateW[]
Definition: builtin.c:974
static WCHAR * get_pnpdeviceid(DXGI_ADAPTER_DESC *desc)
Definition: builtin.c:4449
static const WCHAR videocontroller_dactypeW[]
Definition: builtin.c:970
static const WCHAR videocontroller_statusW[]
Definition: builtin.c:978
return adapter
GLenum mode
Definition: glext.h:6217
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT hr
Definition: shlfolder.c:183
Definition: main.c:439
UINT32 current_bitsperpixel
Definition: builtin.c:1331
const WCHAR * caption
Definition: builtin.c:1329
const WCHAR * adapter_dactype
Definition: builtin.c:1326
const WCHAR * driverversion
Definition: builtin.c:1339
const WCHAR * pnpdevice_id
Definition: builtin.c:1342
const WCHAR * videomodedescription
Definition: builtin.c:1346
const WCHAR * device_id
Definition: builtin.c:1337
const WCHAR * description
Definition: builtin.c:1336
UINT32 current_horizontalres
Definition: builtin.c:1332
const WCHAR * installeddriver
Definition: builtin.c:1340
UINT32 current_verticalres
Definition: builtin.c:1335
const WCHAR * status
Definition: builtin.c:1343
const WCHAR * driverdate
Definition: builtin.c:1338
const WCHAR * name
Definition: builtin.c:1341
UINT32 current_refreshrate
Definition: builtin.c:1333
const WCHAR * videoprocessor
Definition: builtin.c:1347
PBYTE vidmem
Definition: vgavideo.c:18

◆ find_sid_str()

static const WCHAR * find_sid_str ( const struct expr cond)
static

Definition at line 4276 of file builtin.c.

4277{
4278 const struct expr *left, *right;
4279 const WCHAR *ret = NULL;
4280
4281 if (!cond || cond->type != EXPR_COMPLEX || cond->u.expr.op != OP_EQ) return NULL;
4282
4283 left = cond->u.expr.left;
4284 right = cond->u.expr.right;
4285 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !wcsicmp( left->u.propval->name, prop_sidW ))
4286 {
4287 ret = right->u.sval;
4288 }
4289 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !wcsicmp( right->u.propval->name, prop_sidW ))
4290 {
4291 ret = left->u.sval;
4292 }
4293 return ret;
4294}
static const WCHAR prop_sidW[]
Definition: builtin.c:426
#define wcsicmp
Definition: compat.h:15
@ EXPR_PROPVAL
Definition: parser.h:273
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define EXPR_COMPLEX
Definition: query.h:47
#define OP_EQ
Definition: query.h:36
#define EXPR_SVAL
Definition: query.h:51
Definition: query.h:87
struct complex_expr expr
Definition: query.h:91
<