Andrey Turkin : kernel32: Always use ANSI version of OutputDebugString.

Alexandre Julliard julliard at winehq.org
Tue Oct 6 10:35:50 CDT 2009


Module: wine
Branch: master
Commit: 3eaecf04761812caa7478af4bf812d2cd812b09c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3eaecf04761812caa7478af4bf812d2cd812b09c

Author: Andrey Turkin <andrey.turkin at gmail.com>
Date:   Mon Oct  5 21:42:22 2009 +0400

kernel32: Always use ANSI version of OutputDebugString.

---

 dlls/kernel32/debugger.c       |   17 ++++++++---------
 include/wine/server_protocol.h |    5 +----
 server/debugger.c              |    1 -
 server/protocol.def            |    4 +---
 server/request.h               |    3 +--
 server/trace.c                 |    4 +---
 6 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/dlls/kernel32/debugger.c b/dlls/kernel32/debugger.c
index bb0b5fa..f0dae2d 100644
--- a/dlls/kernel32/debugger.c
+++ b/dlls/kernel32/debugger.c
@@ -118,7 +118,7 @@ BOOL WINAPI WaitForDebugEvent(
                 break;
             case OUTPUT_DEBUG_STRING_EVENT:
                 event->u.DebugString.lpDebugStringData  = wine_server_get_ptr( data.output_string.string );
-                event->u.DebugString.fUnicode           = data.output_string.unicode;
+                event->u.DebugString.fUnicode           = FALSE;
                 event->u.DebugString.nDebugStringLength = data.output_string.length;
                 break;
             case RIP_EVENT:
@@ -243,7 +243,6 @@ void WINAPI OutputDebugStringA( LPCSTR str )
     SERVER_START_REQ( output_debug_string )
     {
         req->string  = wine_server_client_ptr( str );
-        req->unicode = 0;
         req->length  = strlen(str) + 1;
         wine_server_call( req );
     }
@@ -267,15 +266,15 @@ void WINAPI OutputDebugStringA( LPCSTR str )
  */
 void WINAPI OutputDebugStringW( LPCWSTR str )
 {
-    SERVER_START_REQ( output_debug_string )
+    UNICODE_STRING strW;
+    STRING strA;
+
+    RtlInitUnicodeString( &strW, str );
+    if (!RtlUnicodeStringToAnsiString( &strA, &strW, TRUE ))
     {
-        req->string  = wine_server_client_ptr( str );
-        req->unicode = 1;
-        req->length  = (lstrlenW(str) + 1) * sizeof(WCHAR);
-        wine_server_call( req );
+        OutputDebugStringA( strA.Buffer );
+        RtlFreeAnsiString( &strA );
     }
-    SERVER_END_REQ;
-    WARN("%s\n", debugstr_w(str));
 }
 
 
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 0b18b50..7683e8a 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -115,7 +115,6 @@ typedef union
     struct
     {
         int          code;
-        int          unicode;
         client_ptr_t string;
         data_size_t  length;
     } output_string;
@@ -2048,8 +2047,6 @@ struct output_debug_string_request
     struct request_header __header;
     data_size_t   length;
     client_ptr_t  string;
-    int           unicode;
-    char __pad_28[4];
 };
 struct output_debug_string_reply
 {
@@ -5347,6 +5344,6 @@ union generic_reply
     struct set_window_layered_info_reply set_window_layered_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 390
+#define SERVER_PROTOCOL_VERSION 391
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/debugger.c b/server/debugger.c
index faade98..795a24a 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -699,7 +699,6 @@ DECL_HANDLER(output_debug_string)
     debug_event_t data;
 
     data.output_string.string  = req->string;
-    data.output_string.unicode = req->unicode;
     data.output_string.length  = req->length;
     generate_debug_event( current, OUTPUT_DEBUG_STRING_EVENT, &data );
 }
diff --git a/server/protocol.def b/server/protocol.def
index 9748931..d7b31f4 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -131,9 +131,8 @@ typedef union
     struct
     {
         int          code;       /* OUTPUT_DEBUG_STRING_EVENT */
-        int          unicode;    /* is it Unicode? */
-        client_ptr_t string;     /* string to display (in debugged process address space) */
         data_size_t  length;     /* string length */
+        client_ptr_t string;     /* string to display (in debugged process address space) */
     } output_string;
     struct
     {
@@ -1580,7 +1579,6 @@ enum char_info_mode
 @REQ(output_debug_string)
     data_size_t   length;      /* string length */
     client_ptr_t  string;      /* string to display (in debugged process address space) */
-    int           unicode;     /* is it Unicode? */
 @END
 
 
diff --git a/server/request.h b/server/request.h
index c726130..02c7984 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1102,8 +1102,7 @@ C_ASSERT( FIELD_OFFSET(struct get_exception_status_request, handle) == 12 );
 C_ASSERT( sizeof(struct get_exception_status_reply) == 8 );
 C_ASSERT( FIELD_OFFSET(struct output_debug_string_request, length) == 12 );
 C_ASSERT( FIELD_OFFSET(struct output_debug_string_request, string) == 16 );
-C_ASSERT( FIELD_OFFSET(struct output_debug_string_request, unicode) == 24 );
-C_ASSERT( sizeof(struct output_debug_string_request) == 32 );
+C_ASSERT( sizeof(struct output_debug_string_request) == 24 );
 C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, pid) == 12 );
 C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, tid) == 16 );
 C_ASSERT( FIELD_OFFSET(struct continue_debug_event_request, status) == 20 );
diff --git a/server/trace.c b/server/trace.c
index 511c460..10c731c 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -656,8 +656,7 @@ static void dump_varargs_debug_event( const char *prefix, data_size_t size )
     case OUTPUT_DEBUG_STRING_EVENT:
         fprintf( stderr, "%s{output_string", prefix );
         dump_uint64( ",string=", &event.output_string.string );
-        fprintf( stderr, ",unicode=%d,len=%u}",
-                 event.output_string.unicode, event.output_string.length );
+        fprintf( stderr, ",len=%u}", event.output_string.length );
         break;
     case RIP_EVENT:
         fprintf( stderr, "%s{rip,err=%d,type=%d}", prefix,
@@ -1994,7 +1993,6 @@ static void dump_output_debug_string_request( const struct output_debug_string_r
 {
     fprintf( stderr, " length=%u", req->length );
     dump_uint64( ", string=", &req->string );
-    fprintf( stderr, ", unicode=%d", req->unicode );
 }
 
 static void dump_continue_debug_event_request( const struct continue_debug_event_request *req )




More information about the wine-cvs mailing list