Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/wbemprox/Makefile.in | 2 + dlls/wbemprox/builtin.c | 157 ++++++++++++++----------------- dlls/wbemprox/class.c | 19 ++-- dlls/wbemprox/main.c | 2 - dlls/wbemprox/process.c | 1 - dlls/wbemprox/qualifier.c | 9 +- dlls/wbemprox/query.c | 61 ++++++------ dlls/wbemprox/reg.c | 1 - dlls/wbemprox/security.c | 1 - dlls/wbemprox/service.c | 1 - dlls/wbemprox/services.c | 12 +-- dlls/wbemprox/table.c | 17 ++-- dlls/wbemprox/wbemlocator.c | 12 +-- dlls/wbemprox/wbemprox_private.h | 3 +- dlls/wbemprox/wql.y | 10 +- 15 files changed, 140 insertions(+), 168 deletions(-)
diff --git a/dlls/wbemprox/Makefile.in b/dlls/wbemprox/Makefile.in index a86893a45c..a26c833878 100644 --- a/dlls/wbemprox/Makefile.in +++ b/dlls/wbemprox/Makefile.in @@ -1,6 +1,8 @@ MODULE = wbemprox.dll IMPORTS = winspool version iphlpapi dxgi oleaut32 ole32 advapi32 user32 gdi32 ws2_32 rpcrt4 setupapi
+EXTRADLLFLAGS = -mno-cygwin + C_SRCS = \ builtin.c \ class.c \ diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 6302cf574d..4b91b643a9 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -20,32 +20,14 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT
-#include "config.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" #define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" -#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 -#else -# define USE_WS_PREFIX -# include "winsock2.h" -# include "ws2tcpip.h" -#endif +#include "winsock2.h" +#include "ws2tcpip.h" #include "initguid.h" #include "wbemcli.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->device_id = cdromdrive_pnpdeviceidW; - sprintfW( drive, fmtW, 'A' + i ); + swprintf( drive, ARRAY_SIZE( drive ), fmtW, 'A' + i ); rec->drive = heap_strdupW( drive ); rec->mediatype = cdromdrive_mediatypeW; 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;
- 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] );
done: @@ -1747,9 +1729,9 @@ static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len ) UINT len, i; 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; - len = strlenW( start ); + len = lstrlenW( start ); p = start + len - 1; 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 ) { 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 (!lstrcmpW( dirstack->dirs[i], path )) return TRUE; return FALSE; }
@@ -1794,14 +1776,14 @@ static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR const WCHAR *str = NULL;
if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && - !strcmpW( left->u.propval->name, prop_nameW ) && - toupperW( right->u.sval[0] ) == toupperW( root )) + !lstrcmpW( left->u.propval->name, prop_nameW ) && + towupper( right->u.sval[0] ) == towupper( root )) { str = right->u.sval; } else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && - !strcmpW( right->u.propval->name, prop_nameW ) && - toupperW( left->u.sval[0] ) == toupperW( root )) + !lstrcmpW( right->u.propval->name, prop_nameW ) && + towupper( left->u.sval[0] ) == towupper( root )) { 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 ) { - UINT len_path = 0, len_segment = strlenW( segment ); + UINT len_path = 0, len_segment = lstrlenW( segment ); WCHAR *ret;
*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 (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}; VS_FIXEDFILEINFO *info; - DWORD size; + DWORD size, len = 4 * 5 + ARRAY_SIZE( fmtW ); void *block; 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 ))) { heap_free( ret ); @@ -1869,8 +1851,8 @@ static WCHAR *get_file_version( const WCHAR *filename ) heap_free( ret ); return NULL; } - sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff, - info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff ); + swprintf( ret, len, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff, + info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff ); heap_free( block ); return ret; } @@ -1921,7 +1903,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c FindClose( handle ); goto done; } - if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue; + if (!lstrcmpW( data.cFileName, dotW ) || !lstrcmpW( data.cFileName, dotdotW )) continue; new_path = append_path( path, data.cFileName, &len );
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) @@ -2043,7 +2025,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr * goto done; } if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - !strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) + !lstrcmpW( data.cFileName, dotW ) || !lstrcmpW( data.cFileName, dotdotW )) continue;
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;
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->index = index; 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->bootable = (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->diskindex = index; 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 const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; + DWORD len = sizeof("ddd.ddd.ddd.ddd"); WCHAR *ret;
- if (!(ret = heap_alloc( sizeof("ddd.ddd.ddd.ddd") * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff ); + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + swprintf( ret, len, fmtW, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff ); return ret; }
@@ -2292,7 +2275,7 @@ static WCHAR *get_volumeserialnumber( const WCHAR *root ) WCHAR buffer[9];
GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 ); - sprintfW( buffer, fmtW, serial ); + swprintf( buffer, ARRAY_SIZE( buffer ), fmtW, serial ); 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;
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->drivetype = type; rec->filesystem = get_filesystem( root ); @@ -2365,7 +2348,7 @@ static WCHAR *get_mac_address( const BYTE *addr, DWORD len ) WCHAR *ret;
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; } 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; 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 (!(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 ); 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;
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->adaptertypeid = adaptertypeid; 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 ) { const SOCKET_ADDRESS *sa = &addr->Address; - WCHAR buf[WS_NI_MAXHOST]; + WCHAR buf[NI_MAXHOST];
if (!addr) return 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 ); } 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 ); return NULL; } - if ((p = strrchrW( ptr[i - 1], ':' ))) *p = 0; + if ((p = wcsrchr( ptr[i - 1], ':' ))) *p = 0; } ret->count = count; 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) { - if (address->Address.lpSockaddr->sa_family == WS_AF_INET) + if (address->Address.lpSockaddr->sa_family == 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; + addr.sin_family = 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; @@ -2607,7 +2590,7 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) static const WCHAR fmtW[] = {'%','u',0}; WCHAR buf[11];
- sprintfW(buf, fmtW, address->OnLinkPrefixLength); + swprintf( buf, ARRAY_SIZE( buf ), fmtW, address->OnLinkPrefixLength ); ptr[i] = heap_strdupW( buf ); } if (!ptr[i++]) @@ -2642,11 +2625,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( 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 (!(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 ); 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->attributes = info[i].Attributes; - sprintfW( id, fmtW, i ); + swprintf( id, ARRAY_SIZE( id ), fmtW, i ); rec->device_id = heap_strdupW( id ); rec->drivername = heap_strdupW( info[i].pDriverName ); 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->commandline = get_cmdline( entry.th32ProcessID ); 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->name = heap_strdupW( entry.szExeFile ); rec->process_id = entry.th32ProcessID; @@ -2891,14 +2874,17 @@ __ASM_GLOBAL_FUNC( do_cpuid, "ret" ) #elif defined(__x86_64__) __ASM_GLOBAL_FUNC( do_cpuid, + "pushq %rsi\n\t" "pushq %rbx\n\t" - "movl %edi,%eax\n\t" + "movq %rcx,%rax\n\t" + "movq %rdx,%rsi\n\t" "cpuid\n\t" "movl %eax,(%rsi)\n\t" "movl %ebx,4(%rsi)\n\t" "movl %ecx,8(%rsi)\n\t" "movl %edx,12(%rsi)\n\t" "popq %rbx\n\t" + "popq %rsi\n\t" "ret" ) #else 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++; } 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};
@@ -2938,7 +2924,7 @@ static void get_processor_manufacturer( WCHAR *manufacturer ) regs[2] = regs[3]; 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) { @@ -2947,7 +2933,7 @@ static const WCHAR *get_osarchitecture(void) if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW; return os_32bitW; } -static void get_processor_caption( WCHAR *caption ) +static void get_processor_caption( WCHAR *caption, UINT len ) { static const WCHAR fmtW[] = {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ', @@ -2960,17 +2946,17 @@ static void get_processor_caption( WCHAR *caption ) WCHAR manufacturer[13]; 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; - else if (!strcmpW( manufacturer, authenticamdW )) arch = amd64W; + else if (!lstrcmpW( manufacturer, authenticamdW )) arch = amd64W; else arch = intel64W;
do_cpuid( 1, regs );
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[] = {'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 );
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) { @@ -2987,13 +2973,13 @@ static UINT16 get_processor_revision(void) do_cpuid( 1, regs ); 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}; unsigned int regs[4] = {0, 0, 0, 0};
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 ) { @@ -3010,7 +2996,7 @@ static void get_processor_name( WCHAR *name ) do_cpuid( 0x80000004, regs ); 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 ) { @@ -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;
- get_processor_caption( caption ); - get_processor_id( processor_id ); - get_processor_manufacturer( manufacturer ); + get_processor_caption( caption, ARRAY_SIZE( caption ) ); + get_processor_id( processor_id, ARRAY_SIZE( processor_id ) ); + get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) ); get_processor_name( name ); - get_processor_version( version ); + get_processor_version( version, ARRAY_SIZE( version ) );
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->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64; 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->family = 2; /* Unknown */ rec->level = 15; @@ -3110,7 +3096,7 @@ static WCHAR *get_lastbootuptime(void)
NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL ); 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; } static WCHAR *get_localdatetime(void) @@ -3135,7 +3121,7 @@ static WCHAR *get_localdatetime(void) if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
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; } static WCHAR *get_systemdirectory(void) @@ -3160,7 +3146,7 @@ static WCHAR *get_codeset(void) { static const WCHAR fmtW[] = {'%','u',0}; WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) ); - if (ret) sprintfW( ret, fmtW, GetACP() ); + if (ret) swprintf( ret, 11, fmtW, GetACP() ); return ret; } static WCHAR *get_countrycode(void) @@ -3179,7 +3165,7 @@ static WCHAR *get_osbuildnumber( OSVERSIONINFOEXW *ver ) { static const WCHAR fmtW[] = {'%','u',0}; WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) ); - if (ret) sprintfW( ret, fmtW, ver->dwBuildNumber ); + if (ret) swprintf( ret, 11, fmtW, ver->dwBuildNumber ); return ret; } static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver ) @@ -3240,7 +3226,7 @@ static WCHAR *get_osname( const WCHAR *caption ) static const WCHAR partitionW[] = {'|','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}; - int len = strlenW( caption ); + int len = lstrlenW( caption ); WCHAR *ret;
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}; 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; } static DWORD get_operatingsystemsku(void) @@ -3501,11 +3487,11 @@ static const WCHAR *find_sid_str( const struct expr *cond )
left = cond->u.expr.left; 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 && !lstrcmpiW( left->u.propval->name, prop_sidW )) { 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 && !lstrcmpiW( right->u.propval->name, prop_sidW )) { 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', '&','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}; + UINT len = sizeof(fmtW) + 2; WCHAR *ret;
- if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision ); + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision ); return ret; }
@@ -3659,7 +3646,7 @@ done: rec->status = videocontroller_statusW; rec->videoarchitecture = 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->videoprocessor = heap_strdupW( name ); if (!match_row( table, row, cond, &status )) free_row_values( table, row ); diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index a005204791..6cb065b222 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -18,7 +18,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.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 ))) { *len += ARRAY_SIZE( fmtW ); - *len += strlenW( table->columns[i].name ); + *len += lstrlenW( table->columns[i].name ); *len += SysStringLen( 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 ))) { - p += sprintfW( p, fmtW, table->columns[i].name, value ); + p += swprintf( p, *len - (p - ret), fmtW, table->columns[i].name, value ); SysFreeString( value ); } } @@ -612,12 +611,12 @@ static BSTR get_object_text( const struct view *view, UINT index ) BSTR ret, body;
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; len += len_body;
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; - sprintfW( ret, fmtW, view->table->name, body ); + swprintf( ret, len, fmtW, view->table->name, body ); SysFreeString( body ); 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 outW[] = {'O','U','T',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;
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, class, method, dir == PARAM_IN ? inW : outW ); - return struprW( ret ); + swprintf( ret, len, fmtW, class, method, dir == PARAM_IN ? inW : outW ); + return wcsupr( ret ); }
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; HRESULT hr;
- len += strlenW( class ) + strlenW( method ); + len += lstrlenW( class ) + lstrlenW( method ); 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 ); heap_free( query ); diff --git a/dlls/wbemprox/main.c b/dlls/wbemprox/main.c index e6ccd5c21c..d90f4f8cc6 100644 --- a/dlls/wbemprox/main.c +++ b/dlls/wbemprox/main.c @@ -17,8 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" - #include <stdarg.h>
#define COBJMACROS diff --git a/dlls/wbemprox/process.c b/dlls/wbemprox/process.c index 6bc3f37529..de9b03f708 100644 --- a/dlls/wbemprox/process.c +++ b/dlls/wbemprox/process.c @@ -20,7 +20,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" diff --git a/dlls/wbemprox/qualifier.c b/dlls/wbemprox/qualifier.c index 06dcc59e31..9a4f74b978 100644 --- a/dlls/wbemprox/qualifier.c +++ b/dlls/wbemprox/qualifier.c @@ -18,7 +18,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" @@ -108,13 +107,13 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c int len;
if (!member) member = noneW; - len = strlenW( class ) + strlenW( member ); - if (name) len += strlenW( name ) + ARRAY_SIZE(fmtW); + len = lstrlenW( class ) + lstrlenW( member ); + if (name) len += lstrlenW( 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 ); - else sprintfW( query, fmt2W, class, member ); + if (name) swprintf( query, len, fmtW, class, member, name ); + else swprintf( query, len, fmt2W, class, member );
hr = exec_query( query, iter ); heap_free( query ); diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index 3221e27b0b..cb76d2946a 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -18,7 +18,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" @@ -63,10 +62,10 @@ static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr ) { while (*q == '%') q++; 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 (*q != '%' && toupperW( *p++ ) != toupperW( *q++ )) return FALSE; + if (*q != '%' && towupper( *p++ ) != towupper( *q++ )) return FALSE; } return TRUE; } @@ -81,22 +80,22 @@ static HRESULT eval_strcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGL switch (op) { case OP_EQ: - *val = !strcmpW( lstr, rstr ); + *val = !lstrcmpW( lstr, rstr ); break; case OP_GT: - *val = strcmpW( lstr, rstr ) > 0; + *val = lstrcmpW( lstr, rstr ) > 0; break; case OP_LT: - *val = strcmpW( lstr, rstr ) < 0; + *val = lstrcmpW( lstr, rstr ) < 0; break; case OP_LE: - *val = strcmpW( lstr, rstr ) <= 0; + *val = lstrcmpW( lstr, rstr ) <= 0; break; case OP_GE: - *val = strcmpW( lstr, rstr ) >= 0; + *val = lstrcmpW( lstr, rstr ) >= 0; break; case OP_NE: - *val = strcmpW( lstr, rstr ); + *val = lstrcmpW( lstr, rstr ); break; case OP_LIKE: *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};
- if (ltype == CIM_STRING) lval = !strcmpiW( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0; - else if (rtype == CIM_STRING) rval = !strcmpiW( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0; + if (ltype == CIM_STRING) lval = !lstrcmpiW( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0; + else if (rtype == CIM_STRING) rval = !lstrcmpiW( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0;
switch (op) { @@ -207,7 +206,7 @@ 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 *format_int( WCHAR *buf, UINT len, CIMTYPE type, LONGLONG val ) { static const WCHAR fmt_signedW[] = {'%','d',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_SINT16: case CIM_SINT32: - sprintfW( buf, fmt_signedW, val ); + swprintf( buf, len, fmt_signedW, val ); return buf;
case CIM_UINT8: case CIM_UINT16: case CIM_UINT32: - sprintfW( buf, fmt_unsignedW, val ); + swprintf( buf, len, fmt_unsignedW, val ); return buf;
case CIM_SINT64: @@ -263,10 +262,10 @@ static HRESULT eval_binary( const struct table *table, UINT row, const struct co const WCHAR *lstr, *rstr; 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;
- 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;
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; while (prop) { - if (!strcmpiW( prop->name, name )) return TRUE; + if (!lstrcmpiW( prop->name, name )) return TRUE; prop = prop->next; } return FALSE; @@ -512,7 +511,7 @@ static BSTR build_servername( const struct view *view ) if (view->proplist) 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 ); }
@@ -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;
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++; } } @@ -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;
- offset += sprintfW( ret + offset, fmtW, name, values[j] ); + offset += swprintf( ret + offset, *len - offset, fmtW, name, values[j] ); if (j < count - 1) ret[offset++] = ','; 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 (!(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; - sprintfW( ret, fmtW, class, proplist ); + swprintf( ret, len, fmtW, class, proplist );
done: 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 (!(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; - sprintfW( ret, fmtW, server, namespace, relpath ); + swprintf( ret, len, fmtW, server, namespace, relpath );
done: 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 (!strcmpiW( name, classW )) + if (!lstrcmpiW( name, classW )) { if (ret) { @@ -676,7 +675,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_STRING; return S_OK; } - if (!strcmpiW( name, genusW )) + if (!lstrcmpiW( name, genusW )) { if (ret) { @@ -686,7 +685,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_SINT32; return S_OK; } - else if (!strcmpiW( name, namespaceW )) + else if (!lstrcmpiW( name, namespaceW )) { if (ret) { @@ -696,7 +695,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_STRING; return S_OK; } - else if (!strcmpiW( name, pathW )) + else if (!lstrcmpiW( name, pathW )) { if (ret) { @@ -706,7 +705,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_STRING; return S_OK; } - if (!strcmpiW( name, propcountW )) + if (!lstrcmpiW( name, propcountW )) { if (ret) { @@ -716,7 +715,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_SINT32; return S_OK; } - else if (!strcmpiW( name, relpathW )) + else if (!lstrcmpiW( name, relpathW )) { if (ret) { @@ -726,7 +725,7 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_STRING; return S_OK; } - else if (!strcmpiW( name, serverW )) + else if (!lstrcmpiW( name, serverW )) { if (ret) { diff --git a/dlls/wbemprox/reg.c b/dlls/wbemprox/reg.c index ed30d15100..64e94f6e1f 100644 --- a/dlls/wbemprox/reg.c +++ b/dlls/wbemprox/reg.c @@ -20,7 +20,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" diff --git a/dlls/wbemprox/security.c b/dlls/wbemprox/security.c index d3057e01f5..3ad7321a60 100644 --- a/dlls/wbemprox/security.c +++ b/dlls/wbemprox/security.c @@ -20,7 +20,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" diff --git a/dlls/wbemprox/service.c b/dlls/wbemprox/service.c index b096c5ceb9..53010bc100 100644 --- a/dlls/wbemprox/service.c +++ b/dlls/wbemprox/service.c @@ -20,7 +20,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c index 599a421ced..fd08bad5bf 100644 --- a/dlls/wbemprox/services.c +++ b/dlls/wbemprox/services.c @@ -18,7 +18,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" @@ -27,7 +26,6 @@ #include "wbemcli.h"
#include "wine/debug.h" -#include "wine/unicode.h" #include "wbemprox_private.h"
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, pCtx, ppWorkingNamespace, ppResult);
- if ((strcmpiW( strNamespace, cimv2W ) && strcmpiW( strNamespace, defaultW )) || ws->namespace) + if ((lstrcmpiW( strNamespace, cimv2W ) && lstrcmpiW( strNamespace, defaultW )) || ws->namespace) return WBEM_E_INVALID_NAMESPACE;
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); 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 { 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 ); + lstrcpyW( query, select_allW ); + lstrcatW( query, path->class ); } return query; } @@ -653,7 +651,7 @@ static HRESULT WINAPI wbem_services_ExecQuery( debugstr_w(strQuery), lFlags, pCtx, ppEnum);
if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER; - if (strcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE; + if (lstrcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE; return exec_query( strQuery, ppEnum ); }
diff --git a/dlls/wbemprox/table.c b/dlls/wbemprox/table.c index a8fd0041b3..fcff6c403a 100644 --- a/dlls/wbemprox/table.c +++ b/dlls/wbemprox/table.c @@ -18,7 +18,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" @@ -35,7 +34,7 @@ HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *co UINT i; for (i = 0; i < table->num_cols; i++) { - if (!strcmpiW( table->columns[i].name, name )) + if (!lstrcmpiW( table->columns[i].name, name )) { *column = i; return S_OK; @@ -176,19 +175,19 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column ) case CIM_DATETIME: case CIM_STRING: 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; - sprintfW( ret, fmt_strW, (const WCHAR *)(INT_PTR)val ); + swprintf( ret, len, fmt_strW, (const WCHAR *)(INT_PTR)val ); return ret;
case CIM_SINT16: case CIM_SINT32: - sprintfW( number, fmt_signedW, val ); + swprintf( number, ARRAY_SIZE( number ), fmt_signedW, val ); return SysAllocString( number );
case CIM_UINT16: case CIM_UINT32: - sprintfW( number, fmt_unsignedW, val ); + swprintf( number, ARRAY_SIZE( number ), fmt_unsignedW, val ); return SysAllocString( number );
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++) { - if (table->columns[j].type & COL_FLAG_METHOD && !strcmpW( table->columns[j].name, name )) + if (table->columns[j].type & COL_FLAG_METHOD && !lstrcmpW( table->columns[j].name, name )) { HRESULT hr; LONGLONG val; @@ -357,7 +356,7 @@ struct table *grab_table( const WCHAR *name )
LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry ) { - if (name && !strcmpiW( table->name, name )) + if (name && !lstrcmpiW( table->name, name )) { TRACE("returning %p\n", 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 ) { - if (!strcmpiW( iter->name, table->name )) + if (!lstrcmpiW( iter->name, table->name )) { TRACE("table %s already exists\n", debugstr_w(table->name)); return FALSE; diff --git a/dlls/wbemprox/wbemlocator.c b/dlls/wbemprox/wbemlocator.c index 998dc0ef63..e8cd88d2e1 100644 --- a/dlls/wbemprox/wbemlocator.c +++ b/dlls/wbemprox/wbemlocator.c @@ -18,7 +18,6 @@
#define COBJMACROS
-#include "config.h" #include <stdarg.h>
#include "windef.h" @@ -27,7 +26,6 @@ #include "wbemcli.h"
#include "wine/debug.h" -#include "wine/unicode.h" #include "wbemprox_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); @@ -93,8 +91,8 @@ static BOOL is_local_machine( const WCHAR *server ) WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; DWORD len = ARRAY_SIZE( buffer );
- if (!server || !strcmpW( server, dotW ) || !strcmpiW( server, localhostW )) return TRUE; - if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; + if (!server || !lstrcmpW( server, dotW ) || !lstrcmpiW( server, localhostW )) return TRUE; + if (GetComputerNameW( buffer, &len ) && !lstrcmpiW( server, buffer )) return TRUE; return FALSE; }
@@ -133,15 +131,15 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na p = q; while (*q && *q != '\' && *q != '/') q++; 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) { hr = S_OK; goto done; } q++; - len = strlenW( q ); - if (strcmpiW( q, cimv2W ) && strcmpiW( q, defaultW )) + len = lstrlenW( q ); + if (lstrcmpiW( q, cimv2W ) && lstrcmpiW( q, defaultW )) goto done; if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; else diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 15b961de52..cbf4c894f1 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -19,7 +19,6 @@ #include "wine/debug.h" #include "wine/heap.h" #include "wine/list.h" -#include "wine/unicode.h"
IClientSecurity client_security DECLSPEC_HIDDEN; struct list *table_list DECLSPEC_HIDDEN; @@ -240,7 +239,7 @@ static inline WCHAR *heap_strdupW( const WCHAR *src ) { WCHAR *dst; 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; }
diff --git a/dlls/wbemprox/wql.y b/dlls/wbemprox/wql.y index 4d9ba493f0..2206525897 100644 --- a/dlls/wbemprox/wql.y +++ b/dlls/wbemprox/wql.y @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" #include <stdarg.h>
#include "windef.h" @@ -28,7 +27,6 @@
#include "wine/list.h" #include "wine/debug.h" -#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
@@ -672,7 +670,7 @@ static int cmp_keyword( const void *arg1, const void *arg2 ) int len = min( key1->len, key2->len ); 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; else if (key1->len > key2->len) return 1; return 0; @@ -702,7 +700,7 @@ static int get_token( const WCHAR *s, int *token ) case '\t': case '\r': case '\n': - for (i = 1; isspaceW( s[i] ); i++) {} + for (i = 1; iswspace( s[i] ); i++) {} *token = TK_SPACE; return i; case '-': @@ -781,7 +779,7 @@ static int get_token( const WCHAR *s, int *token ) *token = TK_STRING; return i; case '.': - if (!isdigitW( s[1] )) + if (!iswdigit( s[1] )) { *token = TK_DOT; 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 '5': case '6': case '7': case '8': case '9': *token = TK_INTEGER; - for (i = 1; isdigitW( s[i] ); i++) {} + for (i = 1; iswdigit( s[i] ); i++) {} return i; default: if (!id_char[*s]) break;