Alexandre Julliard : wmic: Build with msvcrt.

Alexandre Julliard julliard at winehq.org
Thu May 2 16:45:07 CDT 2019


Module: wine
Branch: master
Commit: be5c1c86d416735b09d1c1b48d08ad241204b00d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=be5c1c86d416735b09d1c1b48d08ad241204b00d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May  2 09:31:22 2019 +0200

wmic: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/wmic/Makefile.in |  3 ++-
 programs/wmic/main.c      | 41 ++++++++++++++++++++---------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/programs/wmic/Makefile.in b/programs/wmic/Makefile.in
index 87185f7..16098c1 100644
--- a/programs/wmic/Makefile.in
+++ b/programs/wmic/Makefile.in
@@ -1,7 +1,8 @@
 MODULE    = wmic.exe
-APPMODE   = -mconsole -municode
 IMPORTS   = oleaut32 ole32 user32
 
+EXTRADLLFLAGS = -mconsole -municode -mno-cygwin
+
 C_SRCS = \
 	main.c
 
diff --git a/programs/wmic/main.c b/programs/wmic/main.c
index 5d50045..e20b1f8 100644
--- a/programs/wmic/main.c
+++ b/programs/wmic/main.c
@@ -28,7 +28,6 @@
 #include "wmic.h"
 
 #include "wine/debug.h"
-#include "wine/unicode.h"
 
 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++)
     {
-        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;
 }
@@ -93,8 +92,8 @@ static inline WCHAR *strdupW( const WCHAR *src )
 {
     WCHAR *dst;
     if (!src) return NULL;
-    if (!(dst = HeapAlloc( GetProcessHeap(), 0, (strlenW( src ) + 1) * sizeof(WCHAR) ))) return NULL;
-    strcpyW( dst, src );
+    if (!(dst = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) return NULL;
+    lstrcpyW( dst, src );
     return dst;
 }
 
@@ -111,7 +110,7 @@ static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
     for (i = 0; i <= last_index; i++)
     {
         SafeArrayGetElement( sa, &i, &str );
-        if (!strcmpiW( str, prop ))
+        if (!wcsicmp( str, prop ))
         {
             ret = strdupW( str );
             break;
@@ -121,16 +120,16 @@ static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
     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;
     DWORD count;
     WCHAR buffer[8192];
 
-    va_start( va_args, msg );
-    len = vsnprintfW( buffer, ARRAY_SIZE(buffer), msg, va_args );
-    va_end( va_args );
+    __ms_va_start( va_args, msg );
+    len = vswprintf( buffer, ARRAY_SIZE(buffer), msg, va_args );
+    __ms_va_end( va_args );
 
     if (!WriteConsoleW( handle, buffer, len, &count, NULL ))
         WriteFile( handle, buffer, len * sizeof(WCHAR), &count, FALSE );
@@ -154,7 +153,7 @@ static int output_header( const WCHAR *prop, ULONG column_width )
     DWORD count;
     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 */
     {
@@ -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 );
     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;
-    strcpyW( query, select_allW );
-    strcatW( query, class );
+    lstrcpyW( query, select_allW );
+    lstrcatW( query, class );
 
     if (!(wql = SysAllocString( wqlW ))) goto done;
     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)
         {
             VariantChangeType( &v, &v, 0, VT_BSTR );
-            width = max( strlenW( V_BSTR( &v ) ), width );
+            width = max( lstrlenW( V_BSTR( &v ) ), width );
             VariantClear( &v );
         }
         IWbemClassObject_Release( obj );
@@ -283,20 +282,20 @@ int wmain(int argc, WCHAR *argv[])
     if (i >= argc)
         goto not_supported;
 
-    if (!strcmpiW( argv[i], quitW ) ||
-        !strcmpiW( argv[i], exitW ))
+    if (!wcsicmp( argv[i], quitW ) ||
+        !wcsicmp( argv[i], exitW ))
     {
         return 0;
     }
 
-    if (!strcmpiW( argv[i], classW) ||
-        !strcmpiW( argv[i], contextW ))
+    if (!wcsicmp( argv[i], classW) ||
+        !wcsicmp( argv[i], contextW ))
     {
         WINE_FIXME( "command %s not supported\n", debugstr_w(argv[i]) );
         goto not_supported;
     }
 
-    if (!strcmpiW( argv[i], pathW ))
+    if (!wcsicmp( argv[i], pathW ))
     {
         if (++i >= argc)
         {
@@ -318,7 +317,7 @@ int wmain(int argc, WCHAR *argv[])
     if (++i >= argc)
         goto not_supported;
 
-    if (!strcmpiW( argv[i], getW ))
+    if (!wcsicmp( argv[i], getW ))
     {
         if (++i >= argc)
             goto not_supported;




More information about the wine-cvs mailing list