wmic: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-05-02 09:31:22 +02:00
parent 6cd7240fec
commit be5c1c86d4
2 changed files with 22 additions and 22 deletions

View File

@ -1,7 +1,8 @@
MODULE = wmic.exe MODULE = wmic.exe
APPMODE = -mconsole -municode
IMPORTS = oleaut32 ole32 user32 IMPORTS = oleaut32 ole32 user32
EXTRADLLFLAGS = -mconsole -municode -mno-cygwin
C_SRCS = \ C_SRCS = \
main.c main.c

View File

@ -28,7 +28,6 @@
#include "wmic.h" #include "wmic.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wmic); WINE_DEFAULT_DEBUG_CHANNEL(wmic);
@ -84,7 +83,7 @@ static const WCHAR *find_class( const WCHAR *alias )
for (i = 0; i < ARRAY_SIZE(alias_map); i++) for (i = 0; i < ARRAY_SIZE(alias_map); i++)
{ {
if (!strcmpiW( alias, alias_map[i].alias )) return alias_map[i].class; if (!wcsicmp( alias, alias_map[i].alias )) return alias_map[i].class;
} }
return NULL; return NULL;
} }
@ -93,8 +92,8 @@ static inline WCHAR *strdupW( const WCHAR *src )
{ {
WCHAR *dst; WCHAR *dst;
if (!src) return NULL; if (!src) return NULL;
if (!(dst = HeapAlloc( GetProcessHeap(), 0, (strlenW( src ) + 1) * sizeof(WCHAR) ))) return NULL; if (!(dst = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) return NULL;
strcpyW( dst, src ); lstrcpyW( dst, src );
return dst; return dst;
} }
@ -111,7 +110,7 @@ static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
for (i = 0; i <= last_index; i++) for (i = 0; i <= last_index; i++)
{ {
SafeArrayGetElement( sa, &i, &str ); SafeArrayGetElement( sa, &i, &str );
if (!strcmpiW( str, prop )) if (!wcsicmp( str, prop ))
{ {
ret = strdupW( str ); ret = strdupW( str );
break; break;
@ -121,16 +120,16 @@ static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
return ret; return ret;
} }
static int output_string( HANDLE handle, const WCHAR *msg, ... ) static int WINAPIV output_string( HANDLE handle, const WCHAR *msg, ... )
{ {
va_list va_args; __ms_va_list va_args;
int len; int len;
DWORD count; DWORD count;
WCHAR buffer[8192]; WCHAR buffer[8192];
va_start( va_args, msg ); __ms_va_start( va_args, msg );
len = vsnprintfW( buffer, ARRAY_SIZE(buffer), msg, va_args ); len = vswprintf( buffer, ARRAY_SIZE(buffer), msg, va_args );
va_end( va_args ); __ms_va_end( va_args );
if (!WriteConsoleW( handle, buffer, len, &count, NULL )) if (!WriteConsoleW( handle, buffer, len, &count, NULL ))
WriteFile( handle, buffer, len * sizeof(WCHAR), &count, FALSE ); WriteFile( handle, buffer, len * sizeof(WCHAR), &count, FALSE );
@ -154,7 +153,7 @@ static int output_header( const WCHAR *prop, ULONG column_width )
DWORD count; DWORD count;
WCHAR buffer[8192]; WCHAR buffer[8192];
len = snprintfW( buffer, ARRAY_SIZE(buffer), fmtW, column_width, prop ); len = swprintf( buffer, ARRAY_SIZE(buffer), fmtW, column_width, prop );
if (!WriteConsoleW( GetStdHandle(STD_OUTPUT_HANDLE), buffer, len, &count, NULL )) /* redirected */ if (!WriteConsoleW( GetStdHandle(STD_OUTPUT_HANDLE), buffer, len, &count, NULL )) /* redirected */
{ {
@ -204,10 +203,10 @@ static int query_prop( const WCHAR *class, const WCHAR *propname )
hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services ); hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services );
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
len = strlenW( class ) + ARRAY_SIZE(select_allW); len = lstrlenW( class ) + ARRAY_SIZE(select_allW);
if (!(query = SysAllocStringLen( NULL, len ))) goto done; if (!(query = SysAllocStringLen( NULL, len ))) goto done;
strcpyW( query, select_allW ); lstrcpyW( query, select_allW );
strcatW( query, class ); lstrcatW( query, class );
if (!(wql = SysAllocString( wqlW ))) goto done; if (!(wql = SysAllocString( wqlW ))) goto done;
hr = IWbemServices_ExecQuery( services, wql, query, flags, NULL, &result ); hr = IWbemServices_ExecQuery( services, wql, query, flags, NULL, &result );
@ -226,7 +225,7 @@ static int query_prop( const WCHAR *class, const WCHAR *propname )
if (IWbemClassObject_Get( obj, prop, 0, &v, NULL, NULL ) == WBEM_S_NO_ERROR) if (IWbemClassObject_Get( obj, prop, 0, &v, NULL, NULL ) == WBEM_S_NO_ERROR)
{ {
VariantChangeType( &v, &v, 0, VT_BSTR ); VariantChangeType( &v, &v, 0, VT_BSTR );
width = max( strlenW( V_BSTR( &v ) ), width ); width = max( lstrlenW( V_BSTR( &v ) ), width );
VariantClear( &v ); VariantClear( &v );
} }
IWbemClassObject_Release( obj ); IWbemClassObject_Release( obj );
@ -283,20 +282,20 @@ int wmain(int argc, WCHAR *argv[])
if (i >= argc) if (i >= argc)
goto not_supported; goto not_supported;
if (!strcmpiW( argv[i], quitW ) || if (!wcsicmp( argv[i], quitW ) ||
!strcmpiW( argv[i], exitW )) !wcsicmp( argv[i], exitW ))
{ {
return 0; return 0;
} }
if (!strcmpiW( argv[i], classW) || if (!wcsicmp( argv[i], classW) ||
!strcmpiW( argv[i], contextW )) !wcsicmp( argv[i], contextW ))
{ {
WINE_FIXME( "command %s not supported\n", debugstr_w(argv[i]) ); WINE_FIXME( "command %s not supported\n", debugstr_w(argv[i]) );
goto not_supported; goto not_supported;
} }
if (!strcmpiW( argv[i], pathW )) if (!wcsicmp( argv[i], pathW ))
{ {
if (++i >= argc) if (++i >= argc)
{ {
@ -318,7 +317,7 @@ int wmain(int argc, WCHAR *argv[])
if (++i >= argc) if (++i >= argc)
goto not_supported; goto not_supported;
if (!strcmpiW( argv[i], getW )) if (!wcsicmp( argv[i], getW ))
{ {
if (++i >= argc) if (++i >= argc)
goto not_supported; goto not_supported;