https://git.reactos.org/?p=reactos.git;a=commitdiff;h=46add00db53659fbdbd777...
commit 46add00db53659fbdbd777cb73acfbfd38eea2fa Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Mon Feb 4 13:10:55 2019 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Mon Feb 4 13:10:55 2019 +0100
[WBEMPROX] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/wbemprox/CMakeLists.txt | 2 +- dll/win32/wbemprox/builtin.c | 255 ++++++++++++++++++++++++++++------ dll/win32/wbemprox/class.c | 32 +++-- dll/win32/wbemprox/qualifier.c | 4 +- dll/win32/wbemprox/query.c | 63 ++++++--- dll/win32/wbemprox/reg.c | 63 ++++++++- dll/win32/wbemprox/services.c | 39 +++++- dll/win32/wbemprox/wbemlocator.c | 8 +- dll/win32/wbemprox/wbemprox_private.h | 4 +- dll/win32/wbemprox/wql.tab.c | 26 ++-- dll/win32/wbemprox/wql.y | 26 ++-- media/doc/README.WINE | 2 +- 12 files changed, 409 insertions(+), 115 deletions(-)
diff --git a/dll/win32/wbemprox/CMakeLists.txt b/dll/win32/wbemprox/CMakeLists.txt index ac67fdf9cf..5aea8b6621 100644 --- a/dll/win32/wbemprox/CMakeLists.txt +++ b/dll/win32/wbemprox/CMakeLists.txt @@ -31,7 +31,7 @@ add_library(wbemprox SHARED set_source_files_properties(wbemprox.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/wbemprox.rgs) set_module_type(wbemprox win32dll) target_link_libraries(wbemprox uuid wine) -add_importlibs(wbemprox iphlpapi oleaut32 advapi32 user32 gdi32 version winspool ws2_32 rpcrt4 msvcrt kernel32 ntdll) +add_importlibs(wbemprox iphlpapi oleaut32 advapi32 user32 gdi32 version winspool ws2_32 rpcrt4 setupapi msvcrt kernel32 ntdll) add_dependencies(wbemprox d3d_idl_headers) add_pch(wbemprox precomp.h SOURCE) add_cd_file(TARGET wbemprox DESTINATION reactos/system32/wbem FOR all) diff --git a/dll/win32/wbemprox/builtin.c b/dll/win32/wbemprox/builtin.c index bec0ed20b8..5f689635cf 100644 --- a/dll/win32/wbemprox/builtin.c +++ b/dll/win32/wbemprox/builtin.c @@ -37,6 +37,7 @@ #ifdef __MINGW32__ # include "winsock2.h" # include "ws2tcpip.h" +# define WS_AF_INET AF_INET # define WS_AF_UNSPEC AF_UNSPEC # define WS_NI_MAXHOST NI_MAXHOST # define WS_NI_NAMEREQD NI_NAMEREQD @@ -49,6 +50,7 @@ #include "wbemcli.h" #include "wbemprov.h" #include "iphlpapi.h" +#include "netioapi.h" #include "tlhelp32.h" #ifndef __REACTOS__ #include "d3d10.h" @@ -61,8 +63,10 @@ #include "ntsecapi.h" #ifdef __REACTOS__ #include <wingdi.h> +#include <winreg.h> #endif #include "winspool.h" +#include "setupapi.h"
#include "wine/debug.h" #include "wbemprox_private.h" @@ -108,6 +112,8 @@ static const WCHAR class_physicalmediaW[] = {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0}; static const WCHAR class_physicalmemoryW[] = {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; +static const WCHAR class_pnpentityW[] = + {'W','i','n','3','2','_','P','n','P','E','n','t','i','t','y',0}; static const WCHAR class_printerW[] = {'W','i','n','3','2','_','P','r','i','n','t','e','r',0}; static const WCHAR class_process_getowner_outW[] = @@ -272,10 +278,14 @@ static const WCHAR prop_interfacetypeW[] = {'I','n','t','e','r','f','a','c','e','T','y','p','e',0}; static const WCHAR prop_intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0}; +static const WCHAR prop_ipaddressW[] = + {'I','P','A','d','d','r','e','s','s',0}; static const WCHAR prop_ipconnectionmetricW[] = {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0}; static const WCHAR prop_ipenabledW[] = {'I','P','E','n','a','b','l','e','d',0}; +static const WCHAR prop_ipsubnet[] = + {'I','P','S','u','b','n','e','t',0}; static const WCHAR prop_lastbootuptimeW[] = {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0}; static const WCHAR prop_levelW[] = @@ -572,8 +582,10 @@ static const struct column col_networkadapterconfig[] = { prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_dnsserversearchorderW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, { prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 }, + { prop_ipaddressW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, { prop_ipconnectionmetricW, CIM_UINT32, VT_I4 }, { prop_ipenabledW, CIM_BOOLEAN }, + { prop_ipsubnet, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_settingidW, CIM_STRING|COL_FLAG_DYNAMIC } }; @@ -624,6 +636,10 @@ static const struct column col_physicalmemory[] = { prop_capacityW, CIM_UINT64 }, { prop_memorytypeW, CIM_UINT16, VT_I4 } }; +static const struct column col_pnpentity[] = +{ + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC }, +}; static const struct column col_printer[] = { { prop_attributesW, CIM_UINT32 }, @@ -716,6 +732,7 @@ static const struct column col_sounddevice[] = }; static const struct column col_stdregprov[] = { + { method_createkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } @@ -994,8 +1011,10 @@ struct record_networkadapterconfig const WCHAR *dnshostname; const struct array *dnsserversearchorder; UINT32 index; + const struct array *ipaddress; UINT32 ipconnectionmetric; int ipenabled; + const struct array *ipsubnet; const WCHAR *mac_address; const WCHAR *settingid; }; @@ -1046,6 +1065,10 @@ struct record_physicalmemory UINT64 capacity; UINT16 memorytype; }; +struct record_pnpentity +{ + const WCHAR *device_id; +}; struct record_printer { UINT32 attributes; @@ -1138,6 +1161,7 @@ struct record_sounddevice }; struct record_stdregprov { + class_method *createkey; class_method *enumkey; class_method *enumvalues; class_method *getstringvalue; @@ -1202,6 +1226,9 @@ static const struct record_param data_param[] = { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_createkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_createkeyW, 1, param_subkeynameW, CIM_STRING }, + { class_stdregprovW, method_createkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING }, { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, @@ -1240,7 +1267,7 @@ static const struct record_sounddevice data_sounddevice[] = }; static const struct record_stdregprov data_stdregprov[] = { - { reg_enum_key, reg_enum_values, reg_get_stringvalue } + { reg_create_key, reg_enum_key, reg_enum_values, reg_get_stringvalue } }; static UINT16 systemenclosure_chassistypes[] = { @@ -1248,7 +1275,7 @@ static UINT16 systemenclosure_chassistypes[] = }; static const struct array systemenclosure_chassistypes_array = { - SIZEOF(systemenclosure_chassistypes), + ARRAY_SIZE(systemenclosure_chassistypes), &systemenclosure_chassistypes }; static const struct record_systemenclosure data_systemenclosure[] = @@ -1785,7 +1812,7 @@ static WCHAR *get_file_version( const WCHAR *filename ) void *block; WCHAR *ret;
- if (!(ret = heap_alloc( (4 * 5 + sizeof(fmtW) / sizeof(fmtW[0])) * sizeof(WCHAR) ))) return NULL; + if (!(ret = heap_alloc( (4 * 5 + ARRAY_SIZE( fmtW )) * sizeof(WCHAR) ))) return NULL; if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size ))) { heap_free( ret ); @@ -2044,7 +2071,7 @@ static enum fill_status fill_diskdrive( struct table *table, const struct expr * { static const WCHAR fmtW[] = {'\','\','\','\','.','\','\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0}; - WCHAR device_id[sizeof(fmtW)/sizeof(fmtW[0]) + 10], root[] = {'A',':','\',0}; + WCHAR device_id[ARRAY_SIZE( fmtW ) + 10], root[] = {'A',':','\',0}; struct record_diskdrive *rec; UINT i, row = 0, offset = 0, index = 0, type; UINT64 size = 1024 * 1024 * 1024; @@ -2211,7 +2238,7 @@ static enum fill_status fill_ip4routetable( struct table *table, const struct ex static WCHAR *get_volumename( const WCHAR *root ) { WCHAR buf[MAX_PATH + 1] = {0}; - GetVolumeInformationW( root, buf, sizeof(buf)/sizeof(buf[0]), NULL, NULL, NULL, NULL, 0 ); + GetVolumeInformationW( root, buf, ARRAY_SIZE( buf ), NULL, NULL, NULL, NULL, 0 ); return heap_strdupW( buf ); } static WCHAR *get_volumeserialnumber( const WCHAR *root ) @@ -2381,7 +2408,7 @@ static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr ) WCHAR buf[NI_MAXHOST];
if (!addr) return NULL; - if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, sizeof(buf)/sizeof(buf[0]), NULL, + if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, ARRAY_SIZE( buf ), NULL, 0, NI_NAMEREQD )) return NULL; return heap_strdupW( buf ); } @@ -2403,7 +2430,7 @@ static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list ) } for (gateway = list; gateway; gateway = gateway->Next) { - buflen = sizeof(buf)/sizeof(buf[0]); + buflen = ARRAY_SIZE( buf ); if (WSAAddressToStringW( gateway->Address.lpSockaddr, gateway->Address.iSockaddrLength, NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf ))) { @@ -2435,7 +2462,7 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li } for (server = list; server; server = server->Next) { - buflen = sizeof(buf)/sizeof(buf[0]); + buflen = ARRAY_SIZE( buf ); if (WSAAddressToStringW( server->Address.lpSockaddr, server->Address.iSockaddrLength, NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf ))) { @@ -2450,6 +2477,96 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li ret->ptr = ptr; return ret; } + +#ifndef __REACTOS__ + +static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) +{ + IP_ADAPTER_UNICAST_ADDRESS_LH *address; + struct array *ret; + ULONG buflen, i = 0, count = 0; + WCHAR **ptr, buf[54]; /* max IPv6 address length */ + + if (!list) return NULL; + for (address = list; address; address = address->Next) count++; + + if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL; + if (!(ptr = heap_alloc( sizeof(*ptr) * count ))) + { + heap_free( ret ); + return NULL; + } + for (address = list; address; address = address->Next) + { + buflen = ARRAY_SIZE( buf ); + if (WSAAddressToStringW( address->Address.lpSockaddr, address->Address.iSockaddrLength, + NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf ))) + { + for (; i > 0; i--) heap_free( ptr[i - 1] ); + heap_free( ptr ); + heap_free( ret ); + return NULL; + } + } + ret->count = count; + ret->ptr = ptr; + return ret; +} +static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) +{ + IP_ADAPTER_UNICAST_ADDRESS_LH *address; + struct array *ret; + ULONG i = 0, count = 0; + WCHAR **ptr; + + if (!list) return NULL; + for (address = list; address; address = address->Next) count++; + + if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL; + if (!(ptr = heap_alloc( sizeof(*ptr) * count ))) + { + heap_free( ret ); + return NULL; + } + for (address = list; address; address = address->Next) + { + if (address->Address.lpSockaddr->sa_family == WS_AF_INET) + { + WCHAR buf[INET_ADDRSTRLEN]; + SOCKADDR_IN addr; + ULONG buflen = ARRAY_SIZE( buf ); + + memset( &addr, 0, sizeof(addr) ); + addr.sin_family = WS_AF_INET; + if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR + || WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen)) + ptr[i] = NULL; + else + ptr[i] = heap_strdupW( buf ); + } + else + { + static const WCHAR fmtW[] = {'%','u',0}; + WCHAR buf[11]; + + sprintfW(buf, fmtW, address->OnLinkPrefixLength); + ptr[i] = heap_strdupW( buf ); + } + if (!ptr[i++]) + { + for (; i > 0; i--) heap_free( ptr[i - 1] ); + heap_free( ptr ); + heap_free( ret ); + return NULL; + } + } + ret->count = count; + ret->ptr = ptr; + return ret; +} + +#endif /* !__REACTOS__ */ + static WCHAR *get_settingid( UINT32 index ) { GUID guid; @@ -2499,8 +2616,14 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress ); rec->dnsserversearchorder = get_dnsserversearchorder( aa->FirstDnsServerAddress ); rec->index = aa->u.s.IfIndex; +#ifndef __REACTOS__ + rec->ipaddress = get_ipaddress( aa->FirstUnicastAddress ); +#endif rec->ipconnectionmetric = 20; rec->ipenabled = -1; +#ifndef __REACTOS__ + rec->ipsubnet = get_ipsubnet( aa->FirstUnicastAddress ); +#endif rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength ); rec->settingid = get_settingid( rec->index ); if (!match_row( table, row, cond, &status )) @@ -2537,6 +2660,53 @@ static enum fill_status fill_physicalmemory( struct table *table, const struct e return status; }
+static enum fill_status fill_pnpentity( struct table *table, const struct expr *cond ) +{ + struct record_pnpentity *rec; + enum fill_status status = FILL_STATUS_UNFILTERED; + HDEVINFO device_info_set; + SP_DEVINFO_DATA devinfo = {0}; + DWORD idx; + + device_info_set = SetupDiGetClassDevsW( NULL, NULL, NULL, DIGCF_ALLCLASSES|DIGCF_PRESENT ); + + devinfo.cbSize = sizeof(devinfo); + + idx = 0; + while (SetupDiEnumDeviceInfo( device_info_set, idx++, &devinfo )) + { + /* noop */ + } + + resize_table( table, idx, sizeof(*rec) ); + table->num_rows = 0; + rec = (struct record_pnpentity *)table->data; + + idx = 0; + while (SetupDiEnumDeviceInfo( device_info_set, idx++, &devinfo )) + { + WCHAR device_id[MAX_PATH]; + if (SetupDiGetDeviceInstanceIdW( device_info_set, &devinfo, device_id, + ARRAY_SIZE(device_id), NULL )) + { + rec->device_id = heap_strdupW( device_id ); + + table->num_rows++; + if (!match_row( table, table->num_rows - 1, cond, &status )) + { + free_row_values( table, table->num_rows - 1 ); + table->num_rows--; + } + else + rec++; + } + } + + SetupDiDestroyDeviceInfoList( device_info_set ); + + return status; +} + static enum fill_status fill_printer( struct table *table, const struct expr *cond ) { static const WCHAR fmtW[] = {'P','r','i','n','t','e','r','%','d',0}; @@ -2928,7 +3098,7 @@ static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver ) {'8','.','1',' ','P','r','o',0}; static const WCHAR win10W[] = {'1','0',' ','P','r','o',0}; - int len = sizeof(windowsW)/sizeof(windowsW[0]); + int len = ARRAY_SIZE( windowsW ); WCHAR *ret;
if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(win2003W) ))) return NULL; @@ -3110,7 +3280,7 @@ static enum fill_status fill_service( struct table *table, const struct expr *co ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL; SERVICE_STATUS_PROCESS *status; WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]); + DWORD len = ARRAY_SIZE( sysnameW ); UINT i, row = 0, offset = 0, size = 256, needed, count; enum fill_status fill_status = FILL_STATUS_FAILED; BOOL ret; @@ -3391,39 +3561,40 @@ done:
static struct table builtin_classes[] = { - { class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), 0, (BYTE *)data_baseboard }, - { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), 0, (BYTE *)data_bios }, - { class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive }, - { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys }, - { class_compsysproductW, SIZEOF(col_compsysproduct), col_compsysproduct, 0, 0, NULL, fill_compsysproduct }, - { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile }, - { class_desktopmonitorW, SIZEOF(col_desktopmonitor), col_desktopmonitor, 0, 0, NULL, fill_desktopmonitor }, - { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory }, - { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive }, - { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition }, - { class_ip4routetableW, SIZEOF(col_ip4routetable), col_ip4routetable, 0, 0, NULL, fill_ip4routetable }, - { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, - { class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, - { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter }, - { class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig }, - { class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os }, - { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param }, - { class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia }, - { class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory }, - { class_printerW, SIZEOF(col_printer), col_printer, 0, 0, NULL, fill_printer }, - { class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process }, - { class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor }, - { class_processor2W, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor }, - { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier }, - { class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service }, - { class_sidW, SIZEOF(col_sid), col_sid, 0, 0, NULL, fill_sid }, - { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice }, - { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov }, - { class_systemsecurityW, SIZEOF(col_systemsecurity), col_systemsecurity, SIZEOF(data_systemsecurity), 0, (BYTE *)data_systemsecurity }, - { class_systemenclosureW, SIZEOF(col_systemenclosure), col_systemenclosure, SIZEOF(data_systemenclosure), 0, (BYTE *)data_systemenclosure }, + { class_baseboardW, ARRAY_SIZE(col_baseboard), col_baseboard, ARRAY_SIZE(data_baseboard), 0, (BYTE *)data_baseboard }, + { class_biosW, ARRAY_SIZE(col_bios), col_bios, ARRAY_SIZE(data_bios), 0, (BYTE *)data_bios }, + { class_cdromdriveW, ARRAY_SIZE(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive }, + { class_compsysW, ARRAY_SIZE(col_compsys), col_compsys, 0, 0, NULL, fill_compsys }, + { class_compsysproductW, ARRAY_SIZE(col_compsysproduct), col_compsysproduct, 0, 0, NULL, fill_compsysproduct }, + { class_datafileW, ARRAY_SIZE(col_datafile), col_datafile, 0, 0, NULL, fill_datafile }, + { class_desktopmonitorW, ARRAY_SIZE(col_desktopmonitor), col_desktopmonitor, 0, 0, NULL, fill_desktopmonitor }, + { class_directoryW, ARRAY_SIZE(col_directory), col_directory, 0, 0, NULL, fill_directory }, + { class_diskdriveW, ARRAY_SIZE(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive }, + { class_diskpartitionW, ARRAY_SIZE(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition }, + { class_ip4routetableW, ARRAY_SIZE(col_ip4routetable), col_ip4routetable, 0, 0, NULL, fill_ip4routetable }, + { class_logicaldiskW, ARRAY_SIZE(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, + { class_logicaldisk2W, ARRAY_SIZE(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, + { class_networkadapterW, ARRAY_SIZE(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter }, + { class_networkadapterconfigW, ARRAY_SIZE(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig }, + { class_osW, ARRAY_SIZE(col_os), col_os, 0, 0, NULL, fill_os }, + { class_paramsW, ARRAY_SIZE(col_param), col_param, ARRAY_SIZE(data_param), 0, (BYTE *)data_param }, + { class_physicalmediaW, ARRAY_SIZE(col_physicalmedia), col_physicalmedia, ARRAY_SIZE(data_physicalmedia), 0, (BYTE *)data_physicalmedia }, + { class_physicalmemoryW, ARRAY_SIZE(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory }, + { class_pnpentityW, ARRAY_SIZE(col_pnpentity), col_pnpentity, 0, 0, NULL, fill_pnpentity }, + { class_printerW, ARRAY_SIZE(col_printer), col_printer, 0, 0, NULL, fill_printer }, + { class_processW, ARRAY_SIZE(col_process), col_process, 0, 0, NULL, fill_process }, + { class_processorW, ARRAY_SIZE(col_processor), col_processor, 0, 0, NULL, fill_processor }, + { class_processor2W, ARRAY_SIZE(col_processor), col_processor, 0, 0, NULL, fill_processor }, + { class_qualifiersW, ARRAY_SIZE(col_qualifier), col_qualifier, ARRAY_SIZE(data_qualifier), 0, (BYTE *)data_qualifier }, + { class_serviceW, ARRAY_SIZE(col_service), col_service, 0, 0, NULL, fill_service }, + { class_sidW, ARRAY_SIZE(col_sid), col_sid, 0, 0, NULL, fill_sid }, + { class_sounddeviceW, ARRAY_SIZE(col_sounddevice), col_sounddevice, ARRAY_SIZE(data_sounddevice), 0, (BYTE *)data_sounddevice }, + { class_stdregprovW, ARRAY_SIZE(col_stdregprov), col_stdregprov, ARRAY_SIZE(data_stdregprov), 0, (BYTE *)data_stdregprov }, + { class_systemsecurityW, ARRAY_SIZE(col_systemsecurity), col_systemsecurity, ARRAY_SIZE(data_systemsecurity), 0, (BYTE *)data_systemsecurity }, + { class_systemenclosureW, ARRAY_SIZE(col_systemenclosure), col_systemenclosure, ARRAY_SIZE(data_systemenclosure), 0, (BYTE *)data_systemenclosure }, #ifndef __REACTOS__ /* Requires dxgi.dll */ - { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller } + { class_videocontrollerW, ARRAY_SIZE(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller } #endif };
@@ -3432,6 +3603,6 @@ void init_table_list( void ) static struct list tables = LIST_INIT( tables ); UINT i;
- for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry ); + for (i = 0; i < ARRAY_SIZE(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry ); table_list = &tables; } diff --git a/dll/win32/wbemprox/class.c b/dll/win32/wbemprox/class.c index 27229bd69a..a005204791 100644 --- a/dll/win32/wbemprox/class.c +++ b/dll/win32/wbemprox/class.c @@ -532,8 +532,11 @@ static HRESULT WINAPI class_object_Next( SysFreeString( prop ); return hr; } + obj->index_property = i + 1; - *strName = prop; + if (strName) *strName = prop; + else SysFreeString( prop ); + return S_OK; } return WBEM_S_NO_MORE_DATA; @@ -582,7 +585,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len ) { if ((value = get_value_bstr( table, row, i ))) { - *len += sizeof(fmtW) / sizeof(fmtW[0]); + *len += ARRAY_SIZE( fmtW ); *len += strlenW( table->columns[i].name ); *len += SysStringLen( value ); SysFreeString( value ); @@ -608,7 +611,7 @@ static BSTR get_object_text( const struct view *view, UINT index ) UINT len, len_body, row = view->result[index]; BSTR ret, body;
- len = sizeof(fmtW) / sizeof(fmtW[0]); + len = ARRAY_SIZE( fmtW ); len += strlenW( view->table->name ); if (!(body = get_body_text( view->table, row, &len_body ))) return NULL; len += len_body; @@ -804,7 +807,7 @@ static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *metho static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0}; static const WCHAR outW[] = {'O','U','T',0}; static const WCHAR inW[] = {'I','N',0}; - UINT len = SIZEOF(fmtW) + SIZEOF(outW) + strlenW( class ) + strlenW( method ); + UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + strlenW( class ) + strlenW( method ); WCHAR *ret;
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; @@ -823,7 +826,7 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di 'D','i','r','e','c','t','i','o','n','%','s',0}; static const WCHAR geW[] = {'>','=','0',0}; static const WCHAR leW[] = {'<','=','0',0}; - UINT len = SIZEOF(selectW) + SIZEOF(geW); + UINT len = ARRAY_SIZE(selectW) + ARRAY_SIZE(geW); IEnumWbemClassObject *iter; WCHAR *query, *name; HRESULT hr; @@ -836,6 +839,13 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di heap_free( query ); if (hr != S_OK) return hr;
+ if (!count_instances( iter )) + { + *sig = NULL; + IEnumWbemClassObject_Release( iter ); + return S_OK; + } + if (!(name = build_signature_table_name( class, method, dir ))) { IEnumWbemClassObject_Release( iter ); @@ -870,9 +880,9 @@ static HRESULT WINAPI class_object_GetMethod( if (hr == S_OK) { if (ppInSignature) *ppInSignature = in; - else IWbemClassObject_Release( in ); + else if (in) IWbemClassObject_Release( in ); if (ppOutSignature) *ppOutSignature = out; - else IWbemClassObject_Release( out ); + else if (out) IWbemClassObject_Release( out ); } else IWbemClassObject_Release( in ); return hr; @@ -907,11 +917,6 @@ static HRESULT WINAPI class_object_BeginMethodEnumeration(
if (lEnumFlags) FIXME("flags 0x%08x not supported\n", lEnumFlags);
- if (co->iter) - { - WARN("not allowed on instance\n"); - return WBEM_E_ILLEGAL_OPERATION; - } co->index_method = 0; return S_OK; } @@ -941,7 +946,8 @@ static HRESULT WINAPI class_object_NextMethod( if (hr != S_OK) { SysFreeString( method ); - IWbemClassObject_Release( *ppInSignature ); + if (*ppInSignature) + IWbemClassObject_Release( *ppInSignature ); } else { diff --git a/dll/win32/wbemprox/qualifier.c b/dll/win32/wbemprox/qualifier.c index 4da34454ae..06dcc59e31 100644 --- a/dll/win32/wbemprox/qualifier.c +++ b/dll/win32/wbemprox/qualifier.c @@ -109,8 +109,8 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c
if (!member) member = noneW; len = strlenW( class ) + strlenW( member ); - if (name) len += strlenW( name ) + SIZEOF(fmtW); - else len += SIZEOF(fmt2W); + if (name) len += strlenW( name ) + ARRAY_SIZE(fmtW); + else len += ARRAY_SIZE(fmt2W);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; if (name) sprintfW( query, fmtW, class, member, name ); diff --git a/dll/win32/wbemprox/query.c b/dll/win32/wbemprox/query.c index 76f5caa634..d193574a39 100644 --- a/dll/win32/wbemprox/query.c +++ b/dll/win32/wbemprox/query.c @@ -507,7 +507,7 @@ static BOOL is_system_prop( const WCHAR *name ) static BSTR build_servername( const struct view *view ) { WCHAR server[MAX_COMPUTERNAME_LENGTH + 1], *p; - DWORD len = sizeof(server)/sizeof(server[0]); + DWORD len = ARRAY_SIZE( server );
if (view->proplist) return NULL;
@@ -668,50 +668,71 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (!strcmpiW( name, classW )) { - V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_classname( view ); + if (ret) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_classname( view ); + } if (type) *type = CIM_STRING; return S_OK; } if (!strcmpiW( name, genusW )) { - V_VT( ret ) = VT_I4; - V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */ + if (ret) + { + V_VT( ret ) = VT_I4; + V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */ + } if (type) *type = CIM_SINT32; return S_OK; } else if (!strcmpiW( name, namespaceW )) { - V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_namespace( view ); + if (ret) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_namespace( view ); + } if (type) *type = CIM_STRING; return S_OK; } else if (!strcmpiW( name, pathW )) { - V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_path( view, index, name ); + if (ret) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_path( view, index, name ); + } if (type) *type = CIM_STRING; return S_OK; } if (!strcmpiW( name, propcountW )) { - V_VT( ret ) = VT_I4; - V_I4( ret ) = count_selected_properties( view ); + if (ret) + { + V_VT( ret ) = VT_I4; + V_I4( ret ) = count_selected_properties( view ); + } if (type) *type = CIM_SINT32; return S_OK; } else if (!strcmpiW( name, relpathW )) { - V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_relpath( view, index, name ); + if (ret) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_relpath( view, index, name ); + } if (type) *type = CIM_STRING; return S_OK; } else if (!strcmpiW( name, serverW )) { - V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_servername( view ); + if (ret) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_servername( view ); + } if (type) *type = CIM_STRING; return S_OK; } @@ -835,6 +856,11 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR hr = get_value( view->table, row, column, &val ); if (hr != S_OK) return hr;
+ if (type) *type = view->table->columns[column].type & COL_TYPE_MASK; + if (flavor) *flavor = 0; + + if (!ret) return S_OK; + vartype = view->table->columns[column].vartype; if (view->table->columns[column].type & CIM_FLAG_ARRAY) { @@ -843,8 +869,10 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype ); if (!val_ptr) vartype = VT_NULL; else if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY; - goto done; + set_variant( vartype, val, val_ptr, ret ); + return S_OK; } + switch (view->table->columns[column].type & COL_TYPE_MASK) { case CIM_BOOLEAN: @@ -891,10 +919,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR return WBEM_E_FAILED; }
-done: set_variant( vartype, val, val_ptr, ret ); - if (type) *type = view->table->columns[column].type & COL_TYPE_MASK; - if (flavor) *flavor = 0; return S_OK; }
diff --git a/dll/win32/wbemprox/reg.c b/dll/win32/wbemprox/reg.c index b0bacd7ab8..c45cbbef78 100644 --- a/dll/win32/wbemprox/reg.c +++ b/dll/win32/wbemprox/reg.c @@ -80,13 +80,74 @@ static HRESULT to_i4_array( DWORD *values, DWORD count, VARIANT *var ) return S_OK; }
+static HRESULT create_key( HKEY root, const WCHAR *subkey, VARIANT *retval ) +{ + LONG res; + HKEY hkey; + + TRACE("%p, %s\n", root, debugstr_w(subkey)); + + res = RegCreateKeyExW( root, subkey, 0, NULL, 0, 0, NULL, &hkey, NULL ); + set_variant( VT_UI4, res, NULL, retval ); + if (!res) + { + RegCloseKey( hkey ); + return S_OK; + } + return HRESULT_FROM_WIN32( res ); +} + +HRESULT reg_create_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT defkey, subkey, retval; + IWbemClassObject *sig, *out_params = NULL; + HRESULT hr; + + TRACE("%p, %p\n", in, out); + + hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_stdregprovW, method_createkeyW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &subkey ); + return hr; + } + if (out) + { + hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params ); + if (hr != S_OK) + { + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + return hr; + } + } + hr = create_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &retval ); + if (hr == S_OK && out_params) + hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 ); + + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + if (hr == S_OK && out) + { + *out = out_params; + IWbemClassObject_AddRef( out_params ); + } + if (out_params) IWbemClassObject_Release( out_params ); + return hr; +} + static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *retval ) { HKEY hkey; HRESULT hr = S_OK; WCHAR buf[256]; BSTR *strings, *tmp; - DWORD count = 2, len = sizeof(buf)/sizeof(buf[0]); + DWORD count = 2, len = ARRAY_SIZE( buf ); LONG res, i = 0;
TRACE("%p, %s\n", root, debugstr_w(subkey)); diff --git a/dll/win32/wbemprox/services.c b/dll/win32/wbemprox/services.c index fd87feb12e..599a421ced 100644 --- a/dll/win32/wbemprox/services.c +++ b/dll/win32/wbemprox/services.c @@ -338,15 +338,46 @@ static HRESULT parse_path( const WCHAR *str, struct path **ret )
if (!(path = heap_alloc_zero( sizeof(*path) ))) return E_OUTOFMEMORY;
+ if (*p == '\') + { + static const WCHAR cimv2W[] = {'R','O','O','T','\','C','I','M','V','2'}; + + WCHAR server[MAX_COMPUTERNAME_LENGTH+1]; + DWORD server_len = ARRAY_SIZE(server); + + p++; + if (*p != '\') return WBEM_E_INVALID_OBJECT_PATH; + p++; + + q = p; + while (*p && *p != '\') p++; + if (!*p) return WBEM_E_INVALID_OBJECT_PATH; + + len = p - q; + if (!GetComputerNameW( server, &server_len ) || server_len != len + || memcmp( q, server, server_len * sizeof(WCHAR) )) + return WBEM_E_NOT_SUPPORTED; + + q = ++p; + while (*p && *p != ':') p++; + if (!*p) return WBEM_E_INVALID_OBJECT_PATH; + + len = p - q; + if (len != ARRAY_SIZE(cimv2W) || memcmp( q, cimv2W, sizeof(cimv2W) )) + return WBEM_E_INVALID_NAMESPACE; + p++; + } + + q = p; while (*p && *p != '.') p++;
- len = p - str; + len = p - q; if (!(path->class = heap_alloc( (len + 1) * sizeof(WCHAR) ))) { heap_free( path ); return E_OUTOFMEMORY; } - memcpy( path->class, str, len * sizeof(WCHAR) ); + memcpy( path->class, q, len * sizeof(WCHAR) ); path->class[len] = 0; path->class_len = len;
@@ -389,13 +420,13 @@ static WCHAR *query_from_path( const struct path *path )
if (path->filter) { - len = path->class_len + path->filter_len + SIZEOF(selectW); + len = path->class_len + path->filter_len + ARRAY_SIZE(selectW); if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL; sprintfW( query, selectW, path->class, path->filter ); } else { - len = path->class_len + SIZEOF(select_allW); + len = path->class_len + ARRAY_SIZE(select_allW); if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL; strcpyW( query, select_allW ); strcatW( query, path->class ); diff --git a/dll/win32/wbemprox/wbemlocator.c b/dll/win32/wbemprox/wbemlocator.c index 6ed0aed59e..fe26a871b5 100644 --- a/dll/win32/wbemprox/wbemlocator.c +++ b/dll/win32/wbemprox/wbemlocator.c @@ -91,7 +91,7 @@ static BOOL is_local_machine( const WCHAR *server ) static const WCHAR dotW[] = {'.',0}; static const WCHAR localhostW[] = {'l','o','c','a','l','h','o','s','t',0}; WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD len = sizeof(buffer) / sizeof(buffer[0]); + DWORD len = ARRAY_SIZE( buffer );
if (!server || !strcmpW( server, dotW ) || !strcmpiW( server, localhostW )) return TRUE; if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; @@ -133,7 +133,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na p = q; while (*q && *q != '\' && *q != '/') q++; len = q - p; - if (len >= sizeof(rootW) / sizeof(rootW[0]) && memicmpW( rootW, p, len )) goto done; + if (len >= ARRAY_SIZE( rootW ) && memicmpW( rootW, p, len )) goto done; if (!*q) { hr = S_OK; @@ -141,8 +141,8 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na } q++; len = strlenW( q ); - if ((len != sizeof(cimv2W) / sizeof(cimv2W[0]) || memicmpW( q, cimv2W, len )) && - (len != sizeof(defaultW) / sizeof(defaultW[0]) || memicmpW( q, defaultW, len ))) + if ((len != ARRAY_SIZE( cimv2W ) || memicmpW( q, cimv2W, len )) && + (len != ARRAY_SIZE( defaultW ) || memicmpW( q, defaultW, len ))) goto done; if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; else diff --git a/dll/win32/wbemprox/wbemprox_private.h b/dll/win32/wbemprox/wbemprox_private.h index a2696bb459..596ad21d51 100644 --- a/dll/win32/wbemprox/wbemprox_private.h +++ b/dll/win32/wbemprox/wbemprox_private.h @@ -26,8 +26,6 @@ IClientSecurity client_security DECLSPEC_HIDDEN; struct list *table_list DECLSPEC_HIDDEN;
-#define SIZEOF(array) (sizeof(array)/sizeof((array)[0])) - enum param_direction { PARAM_OUT = -1, @@ -220,6 +218,7 @@ HRESULT EnumWbemClassObject_create(struct query *, LPVOID *) DECLSPEC_HIDDEN; HRESULT WbemQualifierSet_create(const WCHAR *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT process_get_owner(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_create_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT reg_enum_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; @@ -245,6 +244,7 @@ static const WCHAR class_systemsecurityW[] = {'_','_','S','y','s','t','e','m','S
static const WCHAR prop_nameW[] = {'N','a','m','e',0};
+static const WCHAR method_createkeyW[] = {'C','r','e','a','t','e','K','e','y',0}; static const WCHAR method_enumkeyW[] = {'E','n','u','m','K','e','y',0}; static const WCHAR method_enumvaluesW[] = {'E','n','u','m','V','a','l','u','e','s',0}; static const WCHAR method_getownerW[] = {'G','e','t','O','w','n','e','r',0}; diff --git a/dll/win32/wbemprox/wql.tab.c b/dll/win32/wbemprox/wql.tab.c index 13baba575c..42e8232854 100644 --- a/dll/win32/wbemprox/wql.tab.c +++ b/dll/win32/wbemprox/wql.tab.c @@ -2155,18 +2155,18 @@ static const WCHAR whereW[] = {'W','H','E','R','E'};
static const struct keyword keyword_table[] = { - { andW, SIZEOF(andW), TK_AND }, - { byW, SIZEOF(byW), TK_BY }, - { falseW, SIZEOF(falseW), TK_FALSE }, - { fromW, SIZEOF(fromW), TK_FROM }, - { isW, SIZEOF(isW), TK_IS }, - { likeW, SIZEOF(likeW), TK_LIKE }, - { notW, SIZEOF(notW), TK_NOT }, - { nullW, SIZEOF(nullW), TK_NULL }, - { orW, SIZEOF(orW), TK_OR }, - { selectW, SIZEOF(selectW), TK_SELECT }, - { trueW, SIZEOF(trueW), TK_TRUE }, - { whereW, SIZEOF(whereW), TK_WHERE } + { andW, ARRAY_SIZE(andW), TK_AND }, + { byW, ARRAY_SIZE(byW), TK_BY }, + { falseW, ARRAY_SIZE(falseW), TK_FALSE }, + { fromW, ARRAY_SIZE(fromW), TK_FROM }, + { isW, ARRAY_SIZE(isW), TK_IS }, + { likeW, ARRAY_SIZE(likeW), TK_LIKE }, + { notW, ARRAY_SIZE(notW), TK_NOT }, + { nullW, ARRAY_SIZE(nullW), TK_NULL }, + { orW, ARRAY_SIZE(orW), TK_OR }, + { selectW, ARRAY_SIZE(selectW), TK_SELECT }, + { trueW, ARRAY_SIZE(trueW), TK_TRUE }, + { whereW, ARRAY_SIZE(whereW), TK_WHERE } };
static int cmp_keyword( const void *arg1, const void *arg2 ) @@ -2190,7 +2190,7 @@ static int keyword_type( const WCHAR *str, unsigned int len ) key.name = str; key.len = len; key.type = 0; - ret = bsearch( &key, keyword_table, SIZEOF(keyword_table), sizeof(struct keyword), cmp_keyword ); + ret = bsearch( &key, keyword_table, ARRAY_SIZE(keyword_table), sizeof(struct keyword), cmp_keyword ); if (ret) return ret->type; return TK_ID; } diff --git a/dll/win32/wbemprox/wql.y b/dll/win32/wbemprox/wql.y index 88da2b9b0f..0c48c98b73 100644 --- a/dll/win32/wbemprox/wql.y +++ b/dll/win32/wbemprox/wql.y @@ -559,18 +559,18 @@ static const WCHAR whereW[] = {'W','H','E','R','E'};
static const struct keyword keyword_table[] = { - { andW, SIZEOF(andW), TK_AND }, - { byW, SIZEOF(byW), TK_BY }, - { falseW, SIZEOF(falseW), TK_FALSE }, - { fromW, SIZEOF(fromW), TK_FROM }, - { isW, SIZEOF(isW), TK_IS }, - { likeW, SIZEOF(likeW), TK_LIKE }, - { notW, SIZEOF(notW), TK_NOT }, - { nullW, SIZEOF(nullW), TK_NULL }, - { orW, SIZEOF(orW), TK_OR }, - { selectW, SIZEOF(selectW), TK_SELECT }, - { trueW, SIZEOF(trueW), TK_TRUE }, - { whereW, SIZEOF(whereW), TK_WHERE } + { andW, ARRAY_SIZE(andW), TK_AND }, + { byW, ARRAY_SIZE(byW), TK_BY }, + { falseW, ARRAY_SIZE(falseW), TK_FALSE }, + { fromW, ARRAY_SIZE(fromW), TK_FROM }, + { isW, ARRAY_SIZE(isW), TK_IS }, + { likeW, ARRAY_SIZE(likeW), TK_LIKE }, + { notW, ARRAY_SIZE(notW), TK_NOT }, + { nullW, ARRAY_SIZE(nullW), TK_NULL }, + { orW, ARRAY_SIZE(orW), TK_OR }, + { selectW, ARRAY_SIZE(selectW), TK_SELECT }, + { trueW, ARRAY_SIZE(trueW), TK_TRUE }, + { whereW, ARRAY_SIZE(whereW), TK_WHERE } };
static int cmp_keyword( const void *arg1, const void *arg2 ) @@ -594,7 +594,7 @@ static int keyword_type( const WCHAR *str, unsigned int len ) key.name = str; key.len = len; key.type = 0; - ret = bsearch( &key, keyword_table, SIZEOF(keyword_table), sizeof(struct keyword), cmp_keyword ); + ret = bsearch( &key, keyword_table, ARRAY_SIZE(keyword_table), sizeof(struct keyword), cmp_keyword ); if (ret) return ret->type; return TK_ID; } diff --git a/media/doc/README.WINE b/media/doc/README.WINE index f81e450da1..218b028e45 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -195,7 +195,7 @@ reactos/dll/win32/vbscript # Synced to WineStaging-4.0 reactos/dll/win32/version # Synced to WineStaging-4.0 reactos/dll/win32/vssapi # Synced to WineStaging-2.9 reactos/dll/win32/wbemdisp # Synced to WineStaging-4.0 -reactos/dll/win32/wbemprox # Synced to WineStaging-3.9 +reactos/dll/win32/wbemprox # Synced to WineStaging-4.0 reactos/dll/win32/windowscodecs # Synced to WineStaging-3.9 reactos/dll/win32/windowscodecsext # Synced to WineStaging-2.9 reactos/dll/win32/winemp3.acm # Synced to WineStaging-3.3