[WBEMPROX] Sync with Wine Staging 1.9.4. CORE-10912

svn path=/trunk/; revision=70944
This commit is contained in:
Amine Khaldi 2016-03-05 10:48:13 +00:00
parent 9ff47835c1
commit dc9f8b24d1
6 changed files with 217 additions and 51 deletions

View file

@ -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 msvcrt kernel32 ntdll)
add_importlibs(wbemprox iphlpapi oleaut32 advapi32 user32 gdi32 version winspool ws2_32 rpcrt4 msvcrt kernel32 ntdll)
add_dependencies(wbemprox d3d_idl_headers)
add_pch(wbemprox wbemprox_private.h SOURCE)
add_cd_file(TARGET wbemprox DESTINATION reactos/system32/wbem FOR all)

View file

@ -68,8 +68,6 @@ 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_qualifiersW[] =
{'_','_','Q','U','A','L','I','F','I','E','R','S',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[] =
@ -79,6 +77,8 @@ static const WCHAR class_processorW[] =
{'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
static const WCHAR class_processor2W[] =
{'C','I','M','_','P','r','o','c','e','s','s','o','r',0};
static const WCHAR class_qualifiersW[] =
{'_','_','Q','U','A','L','I','F','I','E','R','S',0};
static const WCHAR class_sidW[] =
{'W','i','n','3','2','_','S','I','D',0};
static const WCHAR class_sounddeviceW[] =
@ -148,12 +148,16 @@ static const WCHAR prop_currentverticalresW[] =
{'C','u','r','r','e','n','t','V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0};
static const WCHAR prop_datawidthW[] =
{'D','a','t','a','W','i','d','t','h',0};
static const WCHAR prop_defaultipgatewayW[] =
{'D','e','f','a','u','l','t','I','P','G','a','t','e','w','a','y',0};
static const WCHAR prop_defaultvalueW[] =
{'D','e','f','a','u','l','t','V','a','l','u','e',0};
static const WCHAR prop_descriptionW[] =
{'D','e','s','c','r','i','p','t','i','o','n',0};
static const WCHAR prop_deviceidW[] =
{'D','e','v','i','c','e','I','d',0};
static const WCHAR prop_dhcpenabledW[] =
{'D','H','C','P','E','n','a','b','l','e','d',0};
static const WCHAR prop_directionW[] =
{'D','i','r','e','c','t','i','o','n',0};
static const WCHAR prop_displaynameW[] =
@ -162,6 +166,8 @@ static const WCHAR prop_diskindexW[] =
{'D','i','s','k','I','n','d','e','x',0};
static const WCHAR prop_dnshostnameW[] =
{'D','N','S','H','o','s','t','N','a','m','e',0};
static const WCHAR prop_dnsserversearchorderW[] =
{'D','N','S','S','e','r','v','e','r','S','e','a','r','c','h','O','r','d','e','r',0};
static const WCHAR prop_domainW[] =
{'D','o','m','a','i','n',0};
static const WCHAR prop_domainroleW[] =
@ -282,6 +288,8 @@ static const WCHAR prop_servicepackminorW[] =
{'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
static const WCHAR prop_servicetypeW[] =
{'S','e','r','v','i','c','e','T','y','p','e',0};
static const WCHAR prop_settingidW[] =
{'S','e','t','t','i','n','g','I','D',0};
static const WCHAR prop_smbiosbiosversionW[] =
{'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
static const WCHAR prop_startmodeW[] =
@ -332,6 +340,8 @@ static const WCHAR prop_videoarchitectureW[] =
{'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
static const WCHAR prop_videomemorytypeW[] =
{'V','i','d','e','o','M','e','m','o','r','y','T','y','p','e',0};
static const WCHAR prop_videomodedescriptionW[] =
{'V','i','d','e','o','M','o','d','e','D','e','s','c','r','i','p','t','i','o','n',0};
static const WCHAR prop_videoprocessorW[] =
{'V','i','d','e','o','P','r','o','c','e','s','s','o','r',0};
static const WCHAR prop_volumenameW[] =
@ -454,11 +464,16 @@ static const struct column col_networkadapter[] =
};
static const struct column col_networkadapterconfig[] =
{
{ prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 },
{ prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
{ prop_ipenabledW, CIM_BOOLEAN },
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }
{ prop_defaultipgatewayW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_dhcpenabledW, CIM_BOOLEAN },
{ 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_ipconnectionmetricW, CIM_UINT32, VT_I4 },
{ prop_ipenabledW, CIM_BOOLEAN },
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_settingidW, CIM_STRING|COL_FLAG_DYNAMIC }
};
static const struct column col_os[] =
{
@ -627,6 +642,7 @@ static const struct column col_videocontroller[] =
{ prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_videoarchitectureW, CIM_UINT16, VT_I4 },
{ prop_videomemorytypeW, CIM_UINT16, VT_I4 },
{ prop_videomodedescriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_videoprocessorW, CIM_STRING|COL_FLAG_DYNAMIC }
};
@ -844,11 +860,16 @@ struct record_networkadapter
};
struct record_networkadapterconfig
{
const WCHAR *dnshostname;
UINT32 index;
UINT32 ipconnectionmetric;
int ipenabled;
const WCHAR *mac_address;
const struct array *defaultipgateway;
const WCHAR *description;
int dhcpenabled;
const WCHAR *dnshostname;
const struct array *dnsserversearchorder;
UINT32 index;
UINT32 ipconnectionmetric;
int ipenabled;
const WCHAR *mac_address;
const WCHAR *settingid;
};
struct record_operatingsystem
{
@ -1017,6 +1038,7 @@ struct record_videocontroller
const WCHAR *pnpdevice_id;
UINT16 videoarchitecture;
UINT16 videomemorytype;
const WCHAR *videomodedescription;
const WCHAR *videoprocessor;
};
#include "poppack.h"
@ -1159,7 +1181,7 @@ static enum fill_status fill_cdromdrive( struct table *table, const struct expr
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
for (i = 0; i < sizeof(drives); i++)
for (i = 0; i < 26; i++)
{
if (drives & (1 << i))
{
@ -1581,7 +1603,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
dirstack = alloc_dirstack(2);
for (i = 0; i < sizeof(drives); i++)
for (i = 0; i < 26; i++)
{
if (!(drives & (1 << i))) continue;
@ -1702,7 +1724,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
dirstack = alloc_dirstack(2);
for (i = 0; i < sizeof(drives); i++)
for (i = 0; i < 26; i++)
{
if (!(drives & (1 << i))) continue;
@ -1814,7 +1836,7 @@ static enum fill_status fill_diskdrive( struct table *table, const struct expr *
if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED;
for (i = 0; i < sizeof(drives); i++)
for (i = 0; i < 26; i++)
{
if (drives & (1 << i))
{
@ -1878,7 +1900,7 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex
if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
for (i = 0; i < sizeof(drives); i++)
for (i = 0; i < 26; i++)
{
if (drives & (1 << i))
{
@ -1945,7 +1967,7 @@ static enum fill_status fill_logicaldisk( struct table *table, const struct expr
if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
for (i = 0; i < sizeof(drives); i++)
for (i = 0; i < 26; i++)
{
if (drives & (1 << i))
{
@ -2093,6 +2115,82 @@ static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr )
0, NI_NAMEREQD )) return NULL;
return heap_strdupW( buf );
}
static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list )
{
IP_ADAPTER_GATEWAY_ADDRESS *gateway;
struct array *ret;
ULONG buflen, i = 0, count = 0;
WCHAR **ptr, buf[54]; /* max IPv6 address length */
if (!list) return NULL;
for (gateway = list; gateway; gateway = gateway->Next) count++;
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
{
heap_free( ret );
return NULL;
}
for (gateway = list; gateway; gateway = gateway->Next)
{
buflen = sizeof(buf)/sizeof(buf[0]);
if (WSAAddressToStringW( gateway->Address.lpSockaddr, gateway->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_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *list )
{
IP_ADAPTER_DNS_SERVER_ADDRESS *server;
struct array *ret;
ULONG buflen, i = 0, count = 0;
WCHAR **ptr, *p, buf[54]; /* max IPv6 address length */
if (!list) return NULL;
for (server = list; server; server = server->Next) count++;
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
{
heap_free( ret );
return NULL;
}
for (server = list; server; server = server->Next)
{
buflen = sizeof(buf)/sizeof(buf[0]);
if (WSAAddressToStringW( server->Address.lpSockaddr, server->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;
}
if ((p = strrchrW( ptr[i - 1], ':' ))) *p = 0;
}
ret->count = count;
ret->ptr = ptr;
return ret;
}
static WCHAR *get_settingid( UINT32 index )
{
GUID guid;
WCHAR *ret, *str;
memset( &guid, 0, sizeof(guid) );
guid.Data1 = index;
UuidToStringW( &guid, &str );
ret = heap_strdupW( str );
RpcStringFreeW( &str );
return ret;
}
static enum fill_status fill_networkadapterconfig( struct table *table, const struct expr *cond )
{
@ -2102,11 +2200,11 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
DWORD size = 0, ret;
enum fill_status status = FILL_STATUS_UNFILTERED;
ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
ret = GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, NULL, &size );
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
if (GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, buffer, &size ))
{
heap_free( buffer );
return FILL_STATUS_FAILED;
@ -2125,11 +2223,16 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
rec = (struct record_networkadapterconfig *)(table->data + offset);
rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
rec->index = aa->u.s.IfIndex;
rec->ipconnectionmetric = 20;
rec->ipenabled = -1;
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
rec->defaultipgateway = get_defaultipgateway( aa->FirstGatewayAddress );
rec->description = heap_strdupW( aa->Description );
rec->dhcpenabled = -1;
rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
rec->dnsserversearchorder = get_dnsserversearchorder( aa->FirstDnsServerAddress );
rec->index = aa->u.s.IfIndex;
rec->ipconnectionmetric = 20;
rec->ipenabled = -1;
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
rec->settingid = get_settingid( rec->index );
if (!match_row( table, row, cond, &status ))
{
free_row_values( table, row );
@ -2824,16 +2927,16 @@ static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
static enum fill_status fill_videocontroller( struct table *table, const struct expr *cond )
{
static const WCHAR fmtW[] = {'%','u',' ','x',' ','%','u',' ','x',' ','%','I','6','4','u',' ','c','o','l','o','r','s',0};
struct record_videocontroller *rec;
HRESULT hr;
IDXGIFactory *factory = NULL;
IDXGIAdapter *adapter = NULL;
DXGI_ADAPTER_DESC desc;
UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
UINT row = 0, hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
const WCHAR *name = videocontroller_deviceidW;
enum fill_status status = FILL_STATUS_UNFILTERED;
UINT row = 0;
WCHAR mode[44];
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
@ -2869,6 +2972,8 @@ done:
rec->pnpdevice_id = get_pnpdeviceid( &desc );
rec->videoarchitecture = 2; /* Unknown */
rec->videomemorytype = 2; /* Unknown */
wsprintfW( mode, fmtW, hres, vres, (UINT64)1 << rec->current_bitsperpixel );
rec->videomodedescription = heap_strdupW( mode );
rec->videoprocessor = heap_strdupW( name );
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;

View file

@ -18,6 +18,8 @@
#include "wbemprox_private.h"
#include <winuser.h>
HRESULT create_view( const struct property *proplist, const WCHAR *class,
const struct expr *cond, struct view **ret )
{
@ -96,10 +98,31 @@ static HRESULT eval_strcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGL
return S_OK;
}
static inline BOOL is_strcmp( const struct complex_expr *expr )
static BOOL is_int( CIMTYPE type )
{
return ((expr->left->type == EXPR_PROPVAL && expr->right->type == EXPR_SVAL) ||
(expr->left->type == EXPR_SVAL && expr->right->type == EXPR_PROPVAL));
switch (type)
{
case CIM_SINT8:
case CIM_SINT16:
case CIM_SINT32:
case CIM_SINT64:
case CIM_UINT8:
case CIM_UINT16:
case CIM_UINT32:
case CIM_UINT64:
return TRUE;
default:
return FALSE;
}
}
static inline BOOL is_strcmp( const struct complex_expr *expr, UINT ltype, UINT rtype )
{
if ((ltype == CIM_STRING || is_int( ltype )) && expr->left->type == EXPR_PROPVAL &&
expr->right->type == EXPR_SVAL) return TRUE;
else if ((rtype == CIM_STRING || is_int( rtype )) && expr->right->type == EXPR_PROPVAL &&
expr->left->type == EXPR_SVAL) return TRUE;
return FALSE;
}
static inline BOOL is_boolcmp( const struct complex_expr *expr, UINT ltype, UINT rtype )
@ -174,6 +197,41 @@ static UINT resolve_type( UINT left, UINT right )
return CIM_ILLEGAL;
}
static const WCHAR *format_int( WCHAR *buf, CIMTYPE type, LONGLONG val )
{
static const WCHAR fmt_signedW[] = {'%','d',0};
static const WCHAR fmt_unsignedW[] = {'%','u',0};
static const WCHAR fmt_signed64W[] = {'%','I','6','4','d',0};
static const WCHAR fmt_unsigned64W[] = {'%','I','6','4','u',0};
switch (type)
{
case CIM_SINT8:
case CIM_SINT16:
case CIM_SINT32:
sprintfW( buf, fmt_signedW, val );
return buf;
case CIM_UINT8:
case CIM_UINT16:
case CIM_UINT32:
sprintfW( buf, fmt_unsignedW, val );
return buf;
case CIM_SINT64:
wsprintfW( buf, fmt_signed64W, val );
return buf;
case CIM_UINT64:
wsprintfW( buf, fmt_unsigned64W, val );
return buf;
default:
ERR( "unhandled type %u\n", type );
return NULL;
}
}
static HRESULT eval_binary( const struct table *table, UINT row, const struct complex_expr *expr,
LONGLONG *val, UINT *type )
{
@ -190,10 +248,16 @@ static HRESULT eval_binary( const struct table *table, UINT row, const struct co
if (is_boolcmp( expr, ltype, rtype ))
return eval_boolcmp( expr->op, lval, rval, ltype, rtype, val );
if (is_strcmp( expr ))
if (is_strcmp( expr, ltype, rtype ))
{
const WCHAR *lstr = (const WCHAR *)(INT_PTR)lval;
const WCHAR *rstr = (const WCHAR *)(INT_PTR)rval;
const WCHAR *lstr, *rstr;
WCHAR lbuf[21], rbuf[21];
if (is_int( ltype )) lstr = format_int( lbuf, ltype, lval );
else lstr = (const WCHAR *)(INT_PTR)lval;
if (is_int( rtype )) rstr = format_int( rbuf, rtype, rval );
else rstr = (const WCHAR *)(INT_PTR)rval;
return eval_strcmp( expr->op, lstr, rstr, val );
}
@ -767,7 +831,8 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
CIMTYPE basetype = view->table->columns[column].type & CIM_TYPE_MASK;
val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype );
if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY;
if (!val_ptr) vartype = VT_NULL;
else if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY;
goto done;
}
switch (view->table->columns[column].type & COL_TYPE_MASK)

View file

@ -2221,15 +2221,13 @@ static int get_token( const WCHAR *s, int *token )
return 1;
case '\"':
case '\'':
for (i = 1; s[i]; i++)
{
for (i = 1; s[i]; i++)
{
if (s[i] == s[0]) break;
}
if (s[i]) i++;
*token = TK_STRING;
return i;
if (s[i] == s[0]) break;
}
if (s[i]) i++;
*token = TK_STRING;
return i;
case '.':
if (!isdigitW( s[1] ))
{

View file

@ -647,15 +647,13 @@ static int get_token( const WCHAR *s, int *token )
return 1;
case '\"':
case '\'':
for (i = 1; s[i]; i++)
{
for (i = 1; s[i]; i++)
{
if (s[i] == s[0]) break;
}
if (s[i]) i++;
*token = TK_STRING;
return i;
if (s[i] == s[0]) break;
}
if (s[i]) i++;
*token = TK_STRING;
return i;
case '.':
if (!isdigitW( s[1] ))
{

View file

@ -199,7 +199,7 @@ reactos/dll/win32/vbscript # Synced to WineStaging-1.7.55
reactos/dll/win32/version # Synced to WineStaging-1.9.4
reactos/dll/win32/vssapi # Synced to WineStaging-1.7.55
reactos/dll/win32/wbemdisp # Synced to WineStaging-1.9.4
reactos/dll/win32/wbemprox # Synced to WineStaging-1.7.55
reactos/dll/win32/wbemprox # Synced to WineStaging-1.9.4
reactos/dll/win32/windowscodecs # Synced to WineStaging-1.7.55
reactos/dll/win32/windowscodecsext # Synced to WineStaging-1.7.55
reactos/dll/win32/winemp3.acm # Synced to WineStaging-1.7.55