wbemprox: Build with msvcrt.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2019-07-04 09:27:39 +02:00 committed by Alexandre Julliard
parent 4f8dfdba3d
commit dba0dd4161
15 changed files with 141 additions and 169 deletions

View File

@ -1,6 +1,8 @@
MODULE = wbemprox.dll MODULE = wbemprox.dll
IMPORTS = winspool version iphlpapi dxgi oleaut32 ole32 advapi32 user32 gdi32 ws2_32 rpcrt4 setupapi IMPORTS = winspool version iphlpapi dxgi oleaut32 ole32 advapi32 user32 gdi32 ws2_32 rpcrt4 setupapi
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
builtin.c \ builtin.c \
class.c \ class.c \

View File

@ -20,32 +20,14 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#ifdef __MINGW32__ #include "winsock2.h"
# include "winsock2.h" #include "ws2tcpip.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
#else
# define USE_WS_PREFIX
# include "winsock2.h"
# include "ws2tcpip.h"
#endif
#include "initguid.h" #include "initguid.h"
#include "wbemcli.h" #include "wbemcli.h"
#include "wbemprov.h" #include "wbemprov.h"
@ -1351,7 +1333,7 @@ static enum fill_status fill_cdromdrive( struct table *table, const struct expr
rec = (struct record_cdromdrive *)(table->data + offset); rec = (struct record_cdromdrive *)(table->data + offset);
rec->device_id = cdromdrive_pnpdeviceidW; rec->device_id = cdromdrive_pnpdeviceidW;
sprintfW( drive, fmtW, 'A' + i ); swprintf( drive, ARRAY_SIZE( drive ), fmtW, 'A' + i );
rec->drive = heap_strdupW( drive ); rec->drive = heap_strdupW( drive );
rec->mediatype = cdromdrive_mediatypeW; rec->mediatype = cdromdrive_mediatypeW;
rec->name = cdromdrive_nameW; rec->name = cdromdrive_nameW;
@ -1574,7 +1556,7 @@ static WCHAR *get_compsysproduct_uuid(void)
} }
if (!uuid || !memcmp( uuid, none, sizeof(none) ) || !(ret = heap_alloc( 37 * sizeof(WCHAR) ))) goto done; if (!uuid || !memcmp( uuid, none, sizeof(none) ) || !(ret = heap_alloc( 37 * sizeof(WCHAR) ))) goto done;
sprintfW( ret, fmtW, uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], swprintf( ret, 37, fmtW, uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8],
uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] ); uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] );
done: done:
@ -1747,9 +1729,9 @@ static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
UINT len, i; UINT len, i;
WCHAR *ret; WCHAR *ret;
if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL; if (!iswalpha( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
start = path + 4; start = path + 4;
len = strlenW( start ); len = lstrlenW( start );
p = start + len - 1; p = start + len - 1;
if (*p == '\\') return NULL; if (*p == '\\') return NULL;
@ -1774,7 +1756,7 @@ static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path ) static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path )
{ {
UINT i; UINT i;
for (i = 0; i < dirstack->num_dirs; i++) if (!strcmpW( dirstack->dirs[i], path )) return TRUE; for (i = 0; i < dirstack->num_dirs; i++) if (!wcscmp( dirstack->dirs[i], path )) return TRUE;
return FALSE; return FALSE;
} }
@ -1794,14 +1776,14 @@ static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR
const WCHAR *str = NULL; const WCHAR *str = NULL;
if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL &&
!strcmpW( left->u.propval->name, prop_nameW ) && !wcscmp( left->u.propval->name, prop_nameW ) &&
toupperW( right->u.sval[0] ) == toupperW( root )) towupper( right->u.sval[0] ) == towupper( root ))
{ {
str = right->u.sval; str = right->u.sval;
} }
else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL &&
!strcmpW( right->u.propval->name, prop_nameW ) && !wcscmp( right->u.propval->name, prop_nameW ) &&
toupperW( left->u.sval[0] ) == toupperW( root )) towupper( left->u.sval[0] ) == towupper( root ))
{ {
str = left->u.sval; str = left->u.sval;
} }
@ -1830,11 +1812,11 @@ static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR
static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len ) static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len )
{ {
UINT len_path = 0, len_segment = strlenW( segment ); UINT len_path = 0, len_segment = lstrlenW( segment );
WCHAR *ret; WCHAR *ret;
*len = 0; *len = 0;
if (path) len_path = strlenW( path ); if (path) len_path = lstrlenW( path );
if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL; if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
if (path && len_path) if (path && len_path)
{ {
@ -1852,11 +1834,11 @@ static WCHAR *get_file_version( const WCHAR *filename )
{ {
static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
VS_FIXEDFILEINFO *info; VS_FIXEDFILEINFO *info;
DWORD size; DWORD size, len = 4 * 5 + ARRAY_SIZE( fmtW );
void *block; void *block;
WCHAR *ret; WCHAR *ret;
if (!(ret = heap_alloc( (4 * 5 + ARRAY_SIZE( fmtW )) * sizeof(WCHAR) ))) return NULL; if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size ))) if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
{ {
heap_free( ret ); heap_free( ret );
@ -1869,8 +1851,8 @@ static WCHAR *get_file_version( const WCHAR *filename )
heap_free( ret ); heap_free( ret );
return NULL; return NULL;
} }
sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff, swprintf( ret, len, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff ); info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
heap_free( block ); heap_free( block );
return ret; return ret;
} }
@ -1921,7 +1903,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
FindClose( handle ); FindClose( handle );
goto done; goto done;
} }
if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue; if (!wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW )) continue;
new_path = append_path( path, data.cFileName, &len ); new_path = append_path( path, data.cFileName, &len );
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
@ -2043,7 +2025,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
goto done; goto done;
} }
if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) !wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW ))
continue; continue;
new_path = append_path( path, data.cFileName, &len ); new_path = append_path( path, data.cFileName, &len );
@ -2136,7 +2118,7 @@ static enum fill_status fill_diskdrive( struct table *table, const struct expr *
if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED; if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
rec = (struct record_diskdrive *)(table->data + offset); rec = (struct record_diskdrive *)(table->data + offset);
sprintfW( device_id, fmtW, index ); swprintf( device_id, ARRAY_SIZE( device_id ), fmtW, index );
rec->device_id = heap_strdupW( device_id ); rec->device_id = heap_strdupW( device_id );
rec->index = index; rec->index = index;
rec->interfacetype = diskdrive_interfacetypeW; rec->interfacetype = diskdrive_interfacetypeW;
@ -2202,7 +2184,7 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex
rec = (struct record_diskpartition *)(table->data + offset); rec = (struct record_diskpartition *)(table->data + offset);
rec->bootable = (i == 2) ? -1 : 0; rec->bootable = (i == 2) ? -1 : 0;
rec->bootpartition = (i == 2) ? -1 : 0; rec->bootpartition = (i == 2) ? -1 : 0;
sprintfW( device_id, fmtW, index ); swprintf( device_id, ARRAY_SIZE( device_id ), fmtW, index );
rec->device_id = heap_strdupW( device_id ); rec->device_id = heap_strdupW( device_id );
rec->diskindex = index; rec->diskindex = index;
rec->index = 0; rec->index = 0;
@ -2229,10 +2211,11 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex
static WCHAR *get_ip4_string( DWORD addr ) static WCHAR *get_ip4_string( DWORD addr )
{ {
static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
DWORD len = sizeof("ddd.ddd.ddd.ddd");
WCHAR *ret; WCHAR *ret;
if (!(ret = heap_alloc( sizeof("ddd.ddd.ddd.ddd") * sizeof(WCHAR) ))) return NULL; if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
sprintfW( ret, fmtW, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff ); swprintf( ret, len, fmtW, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff );
return ret; return ret;
} }
@ -2292,7 +2275,7 @@ static WCHAR *get_volumeserialnumber( const WCHAR *root )
WCHAR buffer[9]; WCHAR buffer[9];
GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 ); GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
sprintfW( buffer, fmtW, serial ); swprintf( buffer, ARRAY_SIZE( buffer ), fmtW, serial );
return heap_strdupW( buffer ); return heap_strdupW( buffer );
} }
@ -2320,7 +2303,7 @@ static enum fill_status fill_logicaldisk( struct table *table, const struct expr
if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED; if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
rec = (struct record_logicaldisk *)(table->data + offset); rec = (struct record_logicaldisk *)(table->data + offset);
sprintfW( device_id, fmtW, 'A' + i ); swprintf( device_id, ARRAY_SIZE( device_id ), fmtW, 'A' + i );
rec->device_id = heap_strdupW( device_id ); rec->device_id = heap_strdupW( device_id );
rec->drivetype = type; rec->drivetype = type;
rec->filesystem = get_filesystem( root ); rec->filesystem = get_filesystem( root );
@ -2365,7 +2348,7 @@ static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
WCHAR *ret; WCHAR *ret;
if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL; if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] ); swprintf( ret, 18, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
return ret; return ret;
} }
static const WCHAR *get_adaptertype( DWORD type, int *id, int *physical ) static const WCHAR *get_adaptertype( DWORD type, int *id, int *physical )
@ -2411,11 +2394,11 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
int adaptertypeid, physical; int adaptertypeid, physical;
enum fill_status status = FILL_STATUS_UNFILTERED; enum fill_status status = FILL_STATUS_UNFILTERED;
ret = GetAdaptersAddresses( WS_AF_UNSPEC, 0, NULL, NULL, &size ); ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED; if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED; if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
if (GetAdaptersAddresses( WS_AF_UNSPEC, 0, NULL, buffer, &size )) if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
{ {
heap_free( buffer ); heap_free( buffer );
return FILL_STATUS_FAILED; return FILL_STATUS_FAILED;
@ -2434,7 +2417,7 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue; if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
rec = (struct record_networkadapter *)(table->data + offset); rec = (struct record_networkadapter *)(table->data + offset);
sprintfW( device_id, fmtW, aa->u.s.IfIndex ); swprintf( device_id, ARRAY_SIZE( device_id ), fmtW, aa->u.s.IfIndex );
rec->adaptertype = get_adaptertype( aa->IfType, &adaptertypeid, &physical ); rec->adaptertype = get_adaptertype( aa->IfType, &adaptertypeid, &physical );
rec->adaptertypeid = adaptertypeid; rec->adaptertypeid = adaptertypeid;
rec->description = heap_strdupW( aa->Description ); rec->description = heap_strdupW( aa->Description );
@ -2466,11 +2449,11 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr ) static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr )
{ {
const SOCKET_ADDRESS *sa = &addr->Address; const SOCKET_ADDRESS *sa = &addr->Address;
WCHAR buf[WS_NI_MAXHOST]; WCHAR buf[NI_MAXHOST];
if (!addr) return NULL; if (!addr) return NULL;
if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, ARRAY_SIZE( buf ), NULL, if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, ARRAY_SIZE( buf ), NULL,
0, WS_NI_NAMEREQD )) return NULL; 0, NI_NAMEREQD )) return NULL;
return heap_strdupW( buf ); return heap_strdupW( buf );
} }
static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list ) static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list )
@ -2532,7 +2515,7 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li
heap_free( ret ); heap_free( ret );
return NULL; return NULL;
} }
if ((p = strrchrW( ptr[i - 1], ':' ))) *p = 0; if ((p = wcsrchr( ptr[i - 1], ':' ))) *p = 0;
} }
ret->count = count; ret->count = count;
ret->ptr = ptr; ret->ptr = ptr;
@ -2588,14 +2571,14 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
} }
for (address = list; address; address = address->Next) for (address = list; address; address = address->Next)
{ {
if (address->Address.lpSockaddr->sa_family == WS_AF_INET) if (address->Address.lpSockaddr->sa_family == AF_INET)
{ {
WCHAR buf[INET_ADDRSTRLEN]; WCHAR buf[INET_ADDRSTRLEN];
SOCKADDR_IN addr; SOCKADDR_IN addr;
ULONG buflen = ARRAY_SIZE( buf ); ULONG buflen = ARRAY_SIZE( buf );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.sin_family = WS_AF_INET; addr.sin_family = AF_INET;
if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR
|| WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen)) || WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen))
ptr[i] = NULL; ptr[i] = NULL;
@ -2607,7 +2590,7 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
static const WCHAR fmtW[] = {'%','u',0}; static const WCHAR fmtW[] = {'%','u',0};
WCHAR buf[11]; WCHAR buf[11];
sprintfW(buf, fmtW, address->OnLinkPrefixLength); swprintf( buf, ARRAY_SIZE( buf ), fmtW, address->OnLinkPrefixLength );
ptr[i] = heap_strdupW( buf ); ptr[i] = heap_strdupW( buf );
} }
if (!ptr[i++]) if (!ptr[i++])
@ -2642,11 +2625,11 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
DWORD size = 0, ret; DWORD size = 0, ret;
enum fill_status status = FILL_STATUS_UNFILTERED; enum fill_status status = FILL_STATUS_UNFILTERED;
ret = GetAdaptersAddresses( WS_AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, 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 (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED; if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
if (GetAdaptersAddresses( WS_AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, buffer, &size )) if (GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, buffer, &size ))
{ {
heap_free( buffer ); heap_free( buffer );
return FILL_STATUS_FAILED; return FILL_STATUS_FAILED;
@ -2788,7 +2771,7 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co
{ {
rec = (struct record_printer *)(table->data + offset); rec = (struct record_printer *)(table->data + offset);
rec->attributes = info[i].Attributes; rec->attributes = info[i].Attributes;
sprintfW( id, fmtW, i ); swprintf( id, ARRAY_SIZE( id ), fmtW, i );
rec->device_id = heap_strdupW( id ); rec->device_id = heap_strdupW( id );
rec->drivername = heap_strdupW( info[i].pDriverName ); rec->drivername = heap_strdupW( info[i].pDriverName );
rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality; rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality;
@ -2843,7 +2826,7 @@ static enum fill_status fill_process( struct table *table, const struct expr *co
rec->caption = heap_strdupW( entry.szExeFile ); rec->caption = heap_strdupW( entry.szExeFile );
rec->commandline = get_cmdline( entry.th32ProcessID ); rec->commandline = get_cmdline( entry.th32ProcessID );
rec->description = heap_strdupW( entry.szExeFile ); rec->description = heap_strdupW( entry.szExeFile );
sprintfW( handle, fmtW, entry.th32ProcessID ); swprintf( handle, ARRAY_SIZE( handle ), fmtW, entry.th32ProcessID );
rec->handle = heap_strdupW( handle ); rec->handle = heap_strdupW( handle );
rec->name = heap_strdupW( entry.szExeFile ); rec->name = heap_strdupW( entry.szExeFile );
rec->process_id = entry.th32ProcessID; rec->process_id = entry.th32ProcessID;
@ -2891,14 +2874,17 @@ __ASM_GLOBAL_FUNC( do_cpuid,
"ret" ) "ret" )
#elif defined(__x86_64__) #elif defined(__x86_64__)
__ASM_GLOBAL_FUNC( do_cpuid, __ASM_GLOBAL_FUNC( do_cpuid,
"pushq %rsi\n\t"
"pushq %rbx\n\t" "pushq %rbx\n\t"
"movl %edi,%eax\n\t" "movq %rcx,%rax\n\t"
"movq %rdx,%rsi\n\t"
"cpuid\n\t" "cpuid\n\t"
"movl %eax,(%rsi)\n\t" "movl %eax,(%rsi)\n\t"
"movl %ebx,4(%rsi)\n\t" "movl %ebx,4(%rsi)\n\t"
"movl %ecx,8(%rsi)\n\t" "movl %ecx,8(%rsi)\n\t"
"movl %edx,12(%rsi)\n\t" "movl %edx,12(%rsi)\n\t"
"popq %rbx\n\t" "popq %rbx\n\t"
"popq %rsi\n\t"
"ret" ) "ret" )
#else #else
void do_cpuid( unsigned int ax, unsigned int *p ) void do_cpuid( unsigned int ax, unsigned int *p )
@ -2929,7 +2915,7 @@ static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer )
for (i = 0; i < len; i++) { buffer[i] = *p++; } for (i = 0; i < len; i++) { buffer[i] = *p++; }
buffer[i] = 0; buffer[i] = 0;
} }
static void get_processor_manufacturer( WCHAR *manufacturer ) static void get_processor_manufacturer( WCHAR *manufacturer, UINT len )
{ {
unsigned int tmp, regs[4] = {0, 0, 0, 0}; unsigned int tmp, regs[4] = {0, 0, 0, 0};
@ -2938,7 +2924,7 @@ static void get_processor_manufacturer( WCHAR *manufacturer )
regs[2] = regs[3]; regs[2] = regs[3];
regs[3] = tmp; regs[3] = tmp;
regs_to_str( regs + 1, 12, manufacturer ); regs_to_str( regs + 1, min( 12, len ), manufacturer );
} }
static const WCHAR *get_osarchitecture(void) static const WCHAR *get_osarchitecture(void)
{ {
@ -2947,7 +2933,7 @@ static const WCHAR *get_osarchitecture(void)
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW; if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
return os_32bitW; return os_32bitW;
} }
static void get_processor_caption( WCHAR *caption ) static void get_processor_caption( WCHAR *caption, UINT len )
{ {
static const WCHAR fmtW[] = static const WCHAR fmtW[] =
{'%','s',' ','F','a','m','i','l','y',' ','%','u',' ', {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ',
@ -2960,17 +2946,17 @@ static void get_processor_caption( WCHAR *caption )
WCHAR manufacturer[13]; WCHAR manufacturer[13];
unsigned int regs[4] = {0, 0, 0, 0}, family, model, stepping; unsigned int regs[4] = {0, 0, 0, 0}, family, model, stepping;
get_processor_manufacturer( manufacturer ); get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) );
if (get_osarchitecture() == os_32bitW) arch = x86W; if (get_osarchitecture() == os_32bitW) arch = x86W;
else if (!strcmpW( manufacturer, authenticamdW )) arch = amd64W; else if (!wcscmp( manufacturer, authenticamdW )) arch = amd64W;
else arch = intel64W; else arch = intel64W;
do_cpuid( 1, regs ); do_cpuid( 1, regs );
model = get_processor_model( regs[0], &stepping, &family ); model = get_processor_model( regs[0], &stepping, &family );
sprintfW( caption, fmtW, arch, family, model, stepping ); swprintf( caption, len, fmtW, arch, family, model, stepping );
} }
static void get_processor_version( WCHAR *version ) static void get_processor_version( WCHAR *version, UINT len )
{ {
static const WCHAR fmtW[] = static const WCHAR fmtW[] =
{'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0}; {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
@ -2979,7 +2965,7 @@ static void get_processor_version( WCHAR *version )
do_cpuid( 1, regs ); do_cpuid( 1, regs );
model = get_processor_model( regs[0], &stepping, NULL ); model = get_processor_model( regs[0], &stepping, NULL );
sprintfW( version, fmtW, model, stepping ); swprintf( version, len, fmtW, model, stepping );
} }
static UINT16 get_processor_revision(void) static UINT16 get_processor_revision(void)
{ {
@ -2987,13 +2973,13 @@ static UINT16 get_processor_revision(void)
do_cpuid( 1, regs ); do_cpuid( 1, regs );
return regs[0]; return regs[0];
} }
static void get_processor_id( WCHAR *processor_id ) static void get_processor_id( WCHAR *processor_id, UINT len )
{ {
static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0}; static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
unsigned int regs[4] = {0, 0, 0, 0}; unsigned int regs[4] = {0, 0, 0, 0};
do_cpuid( 1, regs ); do_cpuid( 1, regs );
sprintfW( processor_id, fmtW, regs[3], regs[0] ); swprintf( processor_id, len, fmtW, regs[3], regs[0] );
} }
static void get_processor_name( WCHAR *name ) static void get_processor_name( WCHAR *name )
{ {
@ -3010,7 +2996,7 @@ static void get_processor_name( WCHAR *name )
do_cpuid( 0x80000004, regs ); do_cpuid( 0x80000004, regs );
regs_to_str( regs, 16, name + 32 ); regs_to_str( regs, 16, name + 32 );
} }
for (i = strlenW(name) - 1; i >= 0 && name[i] == ' '; i--) name[i] = 0; for (i = lstrlenW(name) - 1; i >= 0 && name[i] == ' '; i--) name[i] = 0;
} }
static UINT get_processor_currentclockspeed( UINT index ) static UINT get_processor_currentclockspeed( UINT index )
{ {
@ -3053,11 +3039,11 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
if (!resize_table( table, num_packages, sizeof(*rec) )) return FILL_STATUS_FAILED; if (!resize_table( table, num_packages, sizeof(*rec) )) return FILL_STATUS_FAILED;
get_processor_caption( caption ); get_processor_caption( caption, ARRAY_SIZE( caption ) );
get_processor_id( processor_id ); get_processor_id( processor_id, ARRAY_SIZE( processor_id ) );
get_processor_manufacturer( manufacturer ); get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) );
get_processor_name( name ); get_processor_name( name );
get_processor_version( version ); get_processor_version( version, ARRAY_SIZE( version ) );
for (i = 0; i < num_packages; i++) for (i = 0; i < num_packages; i++)
{ {
@ -3069,7 +3055,7 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
rec->currentclockspeed = get_processor_currentclockspeed( i ); rec->currentclockspeed = get_processor_currentclockspeed( i );
rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64; rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64;
rec->description = heap_strdupW( caption ); rec->description = heap_strdupW( caption );
sprintfW( device_id, fmtW, i ); swprintf( device_id, ARRAY_SIZE( device_id ), fmtW, i );
rec->device_id = heap_strdupW( device_id ); rec->device_id = heap_strdupW( device_id );
rec->family = 2; /* Unknown */ rec->family = 2; /* Unknown */
rec->level = 15; rec->level = 15;
@ -3110,7 +3096,7 @@ static WCHAR *get_lastbootuptime(void)
NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL ); NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
RtlTimeToTimeFields( &ti.liKeBootTime, &tf ); RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 ); swprintf( ret, 26, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
return ret; return ret;
} }
static WCHAR *get_localdatetime(void) static WCHAR *get_localdatetime(void)
@ -3135,7 +3121,7 @@ static WCHAR *get_localdatetime(void)
if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL; if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
GetLocalTime(&st); GetLocalTime(&st);
sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias); swprintf( ret, 26, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias );
return ret; return ret;
} }
static WCHAR *get_systemdirectory(void) static WCHAR *get_systemdirectory(void)
@ -3160,7 +3146,7 @@ static WCHAR *get_codeset(void)
{ {
static const WCHAR fmtW[] = {'%','u',0}; static const WCHAR fmtW[] = {'%','u',0};
WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) ); WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
if (ret) sprintfW( ret, fmtW, GetACP() ); if (ret) swprintf( ret, 11, fmtW, GetACP() );
return ret; return ret;
} }
static WCHAR *get_countrycode(void) static WCHAR *get_countrycode(void)
@ -3179,7 +3165,7 @@ static WCHAR *get_osbuildnumber( OSVERSIONINFOEXW *ver )
{ {
static const WCHAR fmtW[] = {'%','u',0}; static const WCHAR fmtW[] = {'%','u',0};
WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) ); WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
if (ret) sprintfW( ret, fmtW, ver->dwBuildNumber ); if (ret) swprintf( ret, 11, fmtW, ver->dwBuildNumber );
return ret; return ret;
} }
static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver ) static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver )
@ -3240,7 +3226,7 @@ static WCHAR *get_osname( const WCHAR *caption )
static const WCHAR partitionW[] = static const WCHAR partitionW[] =
{'|','C',':','\\','W','I','N','D','O','W','S','|','\\','D','e','v','i','c','e','\\', {'|','C',':','\\','W','I','N','D','O','W','S','|','\\','D','e','v','i','c','e','\\',
'H','a','r','d','d','i','s','k','0','\\','P','a','r','t','i','t','i','o','n','1',0}; 'H','a','r','d','d','i','s','k','0','\\','P','a','r','t','i','t','i','o','n','1',0};
int len = strlenW( caption ); int len = lstrlenW( caption );
WCHAR *ret; WCHAR *ret;
if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(partitionW) ))) return NULL; if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(partitionW) ))) return NULL;
@ -3252,7 +3238,7 @@ static WCHAR *get_osversion( OSVERSIONINFOEXW *ver )
{ {
static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u',0}; static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u',0};
WCHAR *ret = heap_alloc( 33 * sizeof(WCHAR) ); WCHAR *ret = heap_alloc( 33 * sizeof(WCHAR) );
if (ret) sprintfW( ret, fmtW, ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber ); if (ret) swprintf( ret, 33, fmtW, ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber );
return ret; return ret;
} }
static DWORD get_operatingsystemsku(void) static DWORD get_operatingsystemsku(void)
@ -3501,11 +3487,11 @@ static const WCHAR *find_sid_str( const struct expr *cond )
left = cond->u.expr.left; left = cond->u.expr.left;
right = cond->u.expr.right; right = cond->u.expr.right;
if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !strcmpiW( left->u.propval->name, prop_sidW )) if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !wcsicmp( left->u.propval->name, prop_sidW ))
{ {
ret = right->u.sval; ret = right->u.sval;
} }
else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !strcmpiW( right->u.propval->name, prop_sidW )) else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !wcsicmp( right->u.propval->name, prop_sidW ))
{ {
ret = left->u.sval; ret = left->u.sval;
} }
@ -3578,10 +3564,11 @@ static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
{'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X', {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
'&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\', '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
'0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0}; '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
UINT len = sizeof(fmtW) + 2;
WCHAR *ret; WCHAR *ret;
if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL; if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision ); swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
return ret; return ret;
} }
@ -3659,7 +3646,7 @@ done:
rec->status = videocontroller_statusW; rec->status = videocontroller_statusW;
rec->videoarchitecture = 2; /* Unknown */ rec->videoarchitecture = 2; /* Unknown */
rec->videomemorytype = 2; /* Unknown */ rec->videomemorytype = 2; /* Unknown */
wsprintfW( mode, fmtW, hres, vres, (UINT64)1 << rec->current_bitsperpixel ); swprintf( mode, ARRAY_SIZE( mode ), fmtW, hres, vres, (UINT64)1 << rec->current_bitsperpixel );
rec->videomodedescription = heap_strdupW( mode ); rec->videomodedescription = heap_strdupW( mode );
rec->videoprocessor = heap_strdupW( name ); rec->videoprocessor = heap_strdupW( name );
if (!match_row( table, row, cond, &status )) free_row_values( table, row ); if (!match_row( table, row, cond, &status )) free_row_values( table, row );

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -586,7 +585,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len )
if ((value = get_value_bstr( table, row, i ))) if ((value = get_value_bstr( table, row, i )))
{ {
*len += ARRAY_SIZE( fmtW ); *len += ARRAY_SIZE( fmtW );
*len += strlenW( table->columns[i].name ); *len += lstrlenW( table->columns[i].name );
*len += SysStringLen( value ); *len += SysStringLen( value );
SysFreeString( value ); SysFreeString( value );
} }
@ -597,7 +596,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len )
{ {
if ((value = get_value_bstr( table, row, i ))) if ((value = get_value_bstr( table, row, i )))
{ {
p += sprintfW( p, fmtW, table->columns[i].name, value ); p += swprintf( p, *len - (p - ret), fmtW, table->columns[i].name, value );
SysFreeString( value ); SysFreeString( value );
} }
} }
@ -612,12 +611,12 @@ static BSTR get_object_text( const struct view *view, UINT index )
BSTR ret, body; BSTR ret, body;
len = ARRAY_SIZE( fmtW ); len = ARRAY_SIZE( fmtW );
len += strlenW( view->table->name ); len += lstrlenW( view->table->name );
if (!(body = get_body_text( view->table, row, &len_body ))) return NULL; if (!(body = get_body_text( view->table, row, &len_body ))) return NULL;
len += len_body; len += len_body;
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
sprintfW( ret, fmtW, view->table->name, body ); swprintf( ret, len, fmtW, view->table->name, body );
SysFreeString( body ); SysFreeString( body );
return ret; return ret;
} }
@ -807,12 +806,12 @@ static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *metho
static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0}; static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0};
static const WCHAR outW[] = {'O','U','T',0}; static const WCHAR outW[] = {'O','U','T',0};
static const WCHAR inW[] = {'I','N',0}; static const WCHAR inW[] = {'I','N',0};
UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + strlenW( class ) + strlenW( method ); UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + lstrlenW( class ) + lstrlenW( method );
WCHAR *ret; WCHAR *ret;
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
sprintfW( ret, fmtW, class, method, dir == PARAM_IN ? inW : outW ); swprintf( ret, len, fmtW, class, method, dir == PARAM_IN ? inW : outW );
return struprW( ret ); return wcsupr( ret );
} }
HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_direction dir, HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_direction dir,
@ -831,9 +830,9 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di
WCHAR *query, *name; WCHAR *query, *name;
HRESULT hr; HRESULT hr;
len += strlenW( class ) + strlenW( method ); len += lstrlenW( class ) + lstrlenW( method );
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
sprintfW( query, selectW, class, method, dir >= 0 ? geW : leW ); swprintf( query, len, selectW, class, method, dir >= 0 ? geW : leW );
hr = exec_query( query, &iter ); hr = exec_query( query, &iter );
heap_free( query ); heap_free( query );

View File

@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS #define COBJMACROS

View File

@ -20,7 +20,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -108,13 +107,13 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c
int len; int len;
if (!member) member = noneW; if (!member) member = noneW;
len = strlenW( class ) + strlenW( member ); len = lstrlenW( class ) + lstrlenW( member );
if (name) len += strlenW( name ) + ARRAY_SIZE(fmtW); if (name) len += lstrlenW( name ) + ARRAY_SIZE(fmtW);
else len += ARRAY_SIZE(fmt2W); else len += ARRAY_SIZE(fmt2W);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
if (name) sprintfW( query, fmtW, class, member, name ); if (name) swprintf( query, len, fmtW, class, member, name );
else sprintfW( query, fmt2W, class, member ); else swprintf( query, len, fmt2W, class, member );
hr = exec_query( query, iter ); hr = exec_query( query, iter );
heap_free( query ); heap_free( query );

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -63,10 +62,10 @@ static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr )
{ {
while (*q == '%') q++; while (*q == '%') q++;
if (!*q) return TRUE; if (!*q) return TRUE;
while (*p && *q && toupperW( *p ) == toupperW( *q )) { p++; q++; }; while (*p && *q && towupper( *p ) == towupper( *q )) { p++; q++; };
if (!*p && !*q) return TRUE; if (!*p && !*q) return TRUE;
} }
if (*q != '%' && toupperW( *p++ ) != toupperW( *q++ )) return FALSE; if (*q != '%' && towupper( *p++ ) != towupper( *q++ )) return FALSE;
} }
return TRUE; return TRUE;
} }
@ -81,22 +80,22 @@ static HRESULT eval_strcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGL
switch (op) switch (op)
{ {
case OP_EQ: case OP_EQ:
*val = !strcmpW( lstr, rstr ); *val = !wcscmp( lstr, rstr );
break; break;
case OP_GT: case OP_GT:
*val = strcmpW( lstr, rstr ) > 0; *val = wcscmp( lstr, rstr ) > 0;
break; break;
case OP_LT: case OP_LT:
*val = strcmpW( lstr, rstr ) < 0; *val = wcscmp( lstr, rstr ) < 0;
break; break;
case OP_LE: case OP_LE:
*val = strcmpW( lstr, rstr ) <= 0; *val = wcscmp( lstr, rstr ) <= 0;
break; break;
case OP_GE: case OP_GE:
*val = strcmpW( lstr, rstr ) >= 0; *val = wcscmp( lstr, rstr ) >= 0;
break; break;
case OP_NE: case OP_NE:
*val = strcmpW( lstr, rstr ); *val = wcscmp( lstr, rstr );
break; break;
case OP_LIKE: case OP_LIKE:
*val = eval_like( lstr, rstr ); *val = eval_like( lstr, rstr );
@ -148,8 +147,8 @@ static HRESULT eval_boolcmp( UINT op, LONGLONG lval, LONGLONG rval, UINT ltype,
{ {
static const WCHAR trueW[] = {'T','r','u','e',0}; static const WCHAR trueW[] = {'T','r','u','e',0};
if (ltype == CIM_STRING) lval = !strcmpiW( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0; if (ltype == CIM_STRING) lval = !wcsicmp( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0;
else if (rtype == CIM_STRING) rval = !strcmpiW( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0; else if (rtype == CIM_STRING) rval = !wcsicmp( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0;
switch (op) switch (op)
{ {
@ -207,7 +206,7 @@ static UINT resolve_type( UINT left, UINT right )
return CIM_ILLEGAL; return CIM_ILLEGAL;
} }
static const WCHAR *format_int( WCHAR *buf, CIMTYPE type, LONGLONG val ) static const WCHAR *format_int( WCHAR *buf, UINT len, CIMTYPE type, LONGLONG val )
{ {
static const WCHAR fmt_signedW[] = {'%','d',0}; static const WCHAR fmt_signedW[] = {'%','d',0};
static const WCHAR fmt_unsignedW[] = {'%','u',0}; static const WCHAR fmt_unsignedW[] = {'%','u',0};
@ -219,13 +218,13 @@ static const WCHAR *format_int( WCHAR *buf, CIMTYPE type, LONGLONG val )
case CIM_SINT8: case CIM_SINT8:
case CIM_SINT16: case CIM_SINT16:
case CIM_SINT32: case CIM_SINT32:
sprintfW( buf, fmt_signedW, val ); swprintf( buf, len, fmt_signedW, val );
return buf; return buf;
case CIM_UINT8: case CIM_UINT8:
case CIM_UINT16: case CIM_UINT16:
case CIM_UINT32: case CIM_UINT32:
sprintfW( buf, fmt_unsignedW, val ); swprintf( buf, len, fmt_unsignedW, val );
return buf; return buf;
case CIM_SINT64: case CIM_SINT64:
@ -263,10 +262,10 @@ static HRESULT eval_binary( const struct table *table, UINT row, const struct co
const WCHAR *lstr, *rstr; const WCHAR *lstr, *rstr;
WCHAR lbuf[21], rbuf[21]; WCHAR lbuf[21], rbuf[21];
if (is_int( ltype )) lstr = format_int( lbuf, ltype, lval ); if (is_int( ltype )) lstr = format_int( lbuf, ARRAY_SIZE( lbuf ), ltype, lval );
else lstr = (const WCHAR *)(INT_PTR)lval; else lstr = (const WCHAR *)(INT_PTR)lval;
if (is_int( rtype )) rstr = format_int( rbuf, rtype, rval ); if (is_int( rtype )) rstr = format_int( rbuf, ARRAY_SIZE( rbuf ), rtype, rval );
else rstr = (const WCHAR *)(INT_PTR)rval; else rstr = (const WCHAR *)(INT_PTR)rval;
return eval_strcmp( expr->op, lstr, rstr, val ); return eval_strcmp( expr->op, lstr, rstr, val );
@ -493,7 +492,7 @@ BOOL is_selected_prop( const struct view *view, const WCHAR *name )
if (!prop) return TRUE; if (!prop) return TRUE;
while (prop) while (prop)
{ {
if (!strcmpiW( prop->name, name )) return TRUE; if (!wcsicmp( prop->name, name )) return TRUE;
prop = prop->next; prop = prop->next;
} }
return FALSE; return FALSE;
@ -512,7 +511,7 @@ static BSTR build_servername( const struct view *view )
if (view->proplist) return NULL; if (view->proplist) return NULL;
if (!(GetComputerNameW( server, &len ))) return NULL; if (!(GetComputerNameW( server, &len ))) return NULL;
for (p = server; *p; p++) *p = toupperW( *p ); for (p = server; *p; p++) *p = towupper( *p );
return SysAllocString( server ); return SysAllocString( server );
} }
@ -545,7 +544,7 @@ static BSTR build_proplist( const struct view *view, UINT index, UINT count, UIN
const WCHAR *name = view->table->columns[i].name; const WCHAR *name = view->table->columns[i].name;
values[j] = get_value_bstr( view->table, row, i ); values[j] = get_value_bstr( view->table, row, i );
*len += strlenW( fmtW ) + strlenW( name ) + strlenW( values[j] ); *len += lstrlenW( fmtW ) + lstrlenW( name ) + lstrlenW( values[j] );
j++; j++;
} }
} }
@ -558,7 +557,7 @@ static BSTR build_proplist( const struct view *view, UINT index, UINT count, UIN
{ {
const WCHAR *name = view->table->columns[i].name; const WCHAR *name = view->table->columns[i].name;
offset += sprintfW( ret + offset, fmtW, name, values[j] ); offset += swprintf( ret + offset, *len - offset, fmtW, name, values[j] );
if (j < count - 1) ret[offset++] = ','; if (j < count - 1) ret[offset++] = ',';
j++; j++;
} }
@ -592,9 +591,9 @@ static BSTR build_relpath( const struct view *view, UINT index, const WCHAR *nam
if (!(num_keys = count_key_columns( view ))) return class; if (!(num_keys = count_key_columns( view ))) return class;
if (!(proplist = build_proplist( view, index, num_keys, &len ))) goto done; if (!(proplist = build_proplist( view, index, num_keys, &len ))) goto done;
len += strlenW( fmtW ) + SysStringLen( class ); len += lstrlenW( fmtW ) + SysStringLen( class );
if (!(ret = SysAllocStringLen( NULL, len ))) goto done; if (!(ret = SysAllocStringLen( NULL, len ))) goto done;
sprintfW( ret, fmtW, class, proplist ); swprintf( ret, len, fmtW, class, proplist );
done: done:
SysFreeString( class ); SysFreeString( class );
@ -614,9 +613,9 @@ static BSTR build_path( const struct view *view, UINT index, const WCHAR *name )
if (!(namespace = build_namespace( view ))) goto done; if (!(namespace = build_namespace( view ))) goto done;
if (!(relpath = build_relpath( view, index, name ))) goto done; if (!(relpath = build_relpath( view, index, name ))) goto done;
len = strlenW( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath ); len = lstrlenW( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath );
if (!(ret = SysAllocStringLen( NULL, len ))) goto done; if (!(ret = SysAllocStringLen( NULL, len ))) goto done;
sprintfW( ret, fmtW, server, namespace, relpath ); swprintf( ret, len, fmtW, server, namespace, relpath );
done: done:
SysFreeString( server ); SysFreeString( server );
@ -666,7 +665,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (flavor) *flavor = WBEM_FLAVOR_ORIGIN_SYSTEM; if (flavor) *flavor = WBEM_FLAVOR_ORIGIN_SYSTEM;
if (!strcmpiW( name, classW )) if (!wcsicmp( name, classW ))
{ {
if (ret) if (ret)
{ {
@ -676,7 +675,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
if (!strcmpiW( name, genusW )) if (!wcsicmp( name, genusW ))
{ {
if (ret) if (ret)
{ {
@ -686,7 +685,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (type) *type = CIM_SINT32; if (type) *type = CIM_SINT32;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, namespaceW )) else if (!wcsicmp( name, namespaceW ))
{ {
if (ret) if (ret)
{ {
@ -696,7 +695,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, pathW )) else if (!wcsicmp( name, pathW ))
{ {
if (ret) if (ret)
{ {
@ -706,7 +705,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
if (!strcmpiW( name, propcountW )) if (!wcsicmp( name, propcountW ))
{ {
if (ret) if (ret)
{ {
@ -716,7 +715,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (type) *type = CIM_SINT32; if (type) *type = CIM_SINT32;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, relpathW )) else if (!wcsicmp( name, relpathW ))
{ {
if (ret) if (ret)
{ {
@ -726,7 +725,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, serverW )) else if (!wcsicmp( name, serverW ))
{ {
if (ret) if (ret)
{ {

View File

@ -20,7 +20,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"

View File

@ -20,7 +20,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"

View File

@ -20,7 +20,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -27,7 +26,6 @@
#include "wbemcli.h" #include "wbemcli.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "wbemprox_private.h" #include "wbemprox_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
@ -279,7 +277,7 @@ static HRESULT WINAPI wbem_services_OpenNamespace(
TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags, TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags,
pCtx, ppWorkingNamespace, ppResult); pCtx, ppWorkingNamespace, ppResult);
if ((strcmpiW( strNamespace, cimv2W ) && strcmpiW( strNamespace, defaultW )) || ws->namespace) if ((wcsicmp( strNamespace, cimv2W ) && wcsicmp( strNamespace, defaultW )) || ws->namespace)
return WBEM_E_INVALID_NAMESPACE; return WBEM_E_INVALID_NAMESPACE;
return WbemServices_create( cimv2W, (void **)ppWorkingNamespace ); return WbemServices_create( cimv2W, (void **)ppWorkingNamespace );
@ -422,14 +420,14 @@ static WCHAR *query_from_path( const struct path *path )
{ {
len = path->class_len + path->filter_len + ARRAY_SIZE(selectW); len = path->class_len + path->filter_len + ARRAY_SIZE(selectW);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL; if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
sprintfW( query, selectW, path->class, path->filter ); swprintf( query, len, selectW, path->class, path->filter );
} }
else else
{ {
len = path->class_len + ARRAY_SIZE(select_allW); len = path->class_len + ARRAY_SIZE(select_allW);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL; if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
strcpyW( query, select_allW ); lstrcpyW( query, select_allW );
strcatW( query, path->class ); lstrcatW( query, path->class );
} }
return query; return query;
} }
@ -653,7 +651,7 @@ static HRESULT WINAPI wbem_services_ExecQuery(
debugstr_w(strQuery), lFlags, pCtx, ppEnum); debugstr_w(strQuery), lFlags, pCtx, ppEnum);
if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER; if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER;
if (strcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE; if (wcsicmp( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE;
return exec_query( strQuery, ppEnum ); return exec_query( strQuery, ppEnum );
} }

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -35,7 +34,7 @@ HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *co
UINT i; UINT i;
for (i = 0; i < table->num_cols; i++) for (i = 0; i < table->num_cols; i++)
{ {
if (!strcmpiW( table->columns[i].name, name )) if (!wcsicmp( table->columns[i].name, name ))
{ {
*column = i; *column = i;
return S_OK; return S_OK;
@ -176,19 +175,19 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column )
case CIM_DATETIME: case CIM_DATETIME:
case CIM_STRING: case CIM_STRING:
if (!val) return NULL; if (!val) return NULL;
len = strlenW( (const WCHAR *)(INT_PTR)val ) + 2; len = lstrlenW( (const WCHAR *)(INT_PTR)val ) + 2;
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
sprintfW( ret, fmt_strW, (const WCHAR *)(INT_PTR)val ); swprintf( ret, len, fmt_strW, (const WCHAR *)(INT_PTR)val );
return ret; return ret;
case CIM_SINT16: case CIM_SINT16:
case CIM_SINT32: case CIM_SINT32:
sprintfW( number, fmt_signedW, val ); swprintf( number, ARRAY_SIZE( number ), fmt_signedW, val );
return SysAllocString( number ); return SysAllocString( number );
case CIM_UINT16: case CIM_UINT16:
case CIM_UINT32: case CIM_UINT32:
sprintfW( number, fmt_unsignedW, val ); swprintf( number, ARRAY_SIZE( number ), fmt_unsignedW, val );
return SysAllocString( number ); return SysAllocString( number );
case CIM_SINT64: case CIM_SINT64:
@ -263,7 +262,7 @@ HRESULT get_method( const struct table *table, const WCHAR *name, class_method *
{ {
for (j = 0; j < table->num_cols; j++) for (j = 0; j < table->num_cols; j++)
{ {
if (table->columns[j].type & COL_FLAG_METHOD && !strcmpW( table->columns[j].name, name )) if (table->columns[j].type & COL_FLAG_METHOD && !wcscmp( table->columns[j].name, name ))
{ {
HRESULT hr; HRESULT hr;
LONGLONG val; LONGLONG val;
@ -357,7 +356,7 @@ struct table *grab_table( const WCHAR *name )
LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry ) LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry )
{ {
if (name && !strcmpiW( table->name, name )) if (name && !wcsicmp( table->name, name ))
{ {
TRACE("returning %p\n", table); TRACE("returning %p\n", table);
return addref_table( table ); return addref_table( table );
@ -392,7 +391,7 @@ BOOL add_table( struct table *table )
LIST_FOR_EACH_ENTRY( iter, table_list, struct table, entry ) LIST_FOR_EACH_ENTRY( iter, table_list, struct table, entry )
{ {
if (!strcmpiW( iter->name, table->name )) if (!wcsicmp( iter->name, table->name ))
{ {
TRACE("table %s already exists\n", debugstr_w(table->name)); TRACE("table %s already exists\n", debugstr_w(table->name));
return FALSE; return FALSE;

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -27,7 +26,6 @@
#include "wbemcli.h" #include "wbemcli.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "wbemprox_private.h" #include "wbemprox_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
@ -93,8 +91,8 @@ static BOOL is_local_machine( const WCHAR *server )
WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1];
DWORD len = ARRAY_SIZE( buffer ); DWORD len = ARRAY_SIZE( buffer );
if (!server || !strcmpW( server, dotW ) || !strcmpiW( server, localhostW )) return TRUE; if (!server || !wcscmp( server, dotW ) || !wcsicmp( server, localhostW )) return TRUE;
if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; if (GetComputerNameW( buffer, &len ) && !wcsicmp( server, buffer )) return TRUE;
return FALSE; return FALSE;
} }
@ -133,15 +131,15 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
p = q; p = q;
while (*q && *q != '\\' && *q != '/') q++; while (*q && *q != '\\' && *q != '/') q++;
len = q - p; len = q - p;
if (len >= ARRAY_SIZE( rootW ) && strncmpiW( rootW, p, len )) goto done; if (len >= ARRAY_SIZE( rootW ) && wcsnicmp( rootW, p, len )) goto done;
if (!*q) if (!*q)
{ {
hr = S_OK; hr = S_OK;
goto done; goto done;
} }
q++; q++;
len = strlenW( q ); len = lstrlenW( q );
if (strcmpiW( q, cimv2W ) && strcmpiW( q, defaultW )) if (wcsicmp( q, cimv2W ) && wcsicmp( q, defaultW ))
goto done; goto done;
if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
else else

View File

@ -19,7 +19,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/unicode.h"
IClientSecurity client_security DECLSPEC_HIDDEN; IClientSecurity client_security DECLSPEC_HIDDEN;
struct list *table_list DECLSPEC_HIDDEN; struct list *table_list DECLSPEC_HIDDEN;
@ -240,7 +239,7 @@ static inline WCHAR *heap_strdupW( const WCHAR *src )
{ {
WCHAR *dst; WCHAR *dst;
if (!src) return NULL; if (!src) return NULL;
if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src ); if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
return dst; return dst;
} }

View File

@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -28,7 +27,6 @@
#include "wine/list.h" #include "wine/list.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
@ -666,13 +664,13 @@ static const struct wql_keyword keyword_table[] =
{ whereW, ARRAY_SIZE(whereW), TK_WHERE } { whereW, ARRAY_SIZE(whereW), TK_WHERE }
}; };
static int cmp_keyword( const void *arg1, const void *arg2 ) static int __cdecl cmp_keyword( const void *arg1, const void *arg2 )
{ {
const struct wql_keyword *key1 = arg1, *key2 = arg2; const struct wql_keyword *key1 = arg1, *key2 = arg2;
int len = min( key1->len, key2->len ); int len = min( key1->len, key2->len );
int ret; int ret;
if ((ret = strncmpiW( key1->name, key2->name, len ))) return ret; if ((ret = wcsnicmp( key1->name, key2->name, len ))) return ret;
if (key1->len < key2->len) return -1; if (key1->len < key2->len) return -1;
else if (key1->len > key2->len) return 1; else if (key1->len > key2->len) return 1;
return 0; return 0;
@ -702,7 +700,7 @@ static int get_token( const WCHAR *s, int *token )
case '\t': case '\t':
case '\r': case '\r':
case '\n': case '\n':
for (i = 1; isspaceW( s[i] ); i++) {} for (i = 1; iswspace( s[i] ); i++) {}
*token = TK_SPACE; *token = TK_SPACE;
return i; return i;
case '-': case '-':
@ -781,7 +779,7 @@ static int get_token( const WCHAR *s, int *token )
*token = TK_STRING; *token = TK_STRING;
return i; return i;
case '.': case '.':
if (!isdigitW( s[1] )) if (!iswdigit( s[1] ))
{ {
*token = TK_DOT; *token = TK_DOT;
return 1; return 1;
@ -790,7 +788,7 @@ static int get_token( const WCHAR *s, int *token )
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
*token = TK_INTEGER; *token = TK_INTEGER;
for (i = 1; isdigitW( s[i] ); i++) {} for (i = 1; iswdigit( s[i] ); i++) {}
return i; return i;
default: default:
if (!id_char[*s]) break; if (!id_char[*s]) break;