Alexandre Julliard : cmd: FormatMessage() now reports ERROR_NO_WORK_DONE error for empty string.

Alexandre Julliard julliard at winehq.org
Wed May 13 16:29:54 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 13 22:06:39 2020 +0200

cmd: FormatMessage() now reports ERROR_NO_WORK_DONE error for empty string.

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

---

 programs/cmd/wcmdmain.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 4026f3e6be..97cc607a64 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -134,12 +134,11 @@ void WINAPIV WCMD_output (const WCHAR *format, ...) {
   DWORD len;
 
   __ms_va_start(ap,format);
-  SetLastError(NO_ERROR);
   string = NULL;
   len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER,
                        format, 0, 0, (LPWSTR)&string, 0, &ap);
   __ms_va_end(ap);
-  if (len == 0 && GetLastError() != NO_ERROR)
+  if (len == 0 && GetLastError() != ERROR_NO_WORK_DONE)
     WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(format));
   else
   {
@@ -160,12 +159,11 @@ void WINAPIV WCMD_output_stderr (const WCHAR *format, ...) {
   DWORD len;
 
   __ms_va_start(ap,format);
-  SetLastError(NO_ERROR);
   string = NULL;
   len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER,
                        format, 0, 0, (LPWSTR)&string, 0, &ap);
   __ms_va_end(ap);
-  if (len == 0 && GetLastError() != NO_ERROR)
+  if (len == 0 && GetLastError() != ERROR_NO_WORK_DONE)
     WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(format));
   else
   {
@@ -186,11 +184,10 @@ WCHAR* WINAPIV WCMD_format_string (const WCHAR *format, ...)
   DWORD len;
 
   __ms_va_start(ap,format);
-  SetLastError(NO_ERROR);
   len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER,
                        format, 0, 0, (LPWSTR)&string, 0, &ap);
   __ms_va_end(ap);
-  if (len == 0 && GetLastError() != NO_ERROR) {
+  if (len == 0 && GetLastError() != ERROR_NO_WORK_DONE) {
     WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(format));
     string = (WCHAR*)LocalAlloc(LMEM_FIXED, 2);
     *string = 0;




More information about the wine-cvs mailing list