[PATCH] kernel32/tests: Fix FormatMessage test failures on recent win10 (ERROR_NO_WORK_DONE)
Detlef Riekenberg
wine.dev at web.de
Sun Mar 31 00:52:01 CDT 2019
Microsoft changed FormatMessageA/W and set LastError to ERROR_NO_WORK_DONE, when nothing was done.
(After Sep. 2015, but before ot with Win10 v1709)
I do not expect, that apps depend on this recently used failure-code,
so I did not touch our implementation to save some bytes and code cycles
Example failed tests:
From the big 90 failure package afer updating win7 to win10:
http://test.winehq.org/data/c6ff0e01224e86c7baa31d019fcb0a7bf03e2f96/win10_dr-i7-HD3000-wowv3/kernel32:format_msg.html
win10_cw1-hd6800-1709-* fail since a long time. 30. Jan 2019 as example
http://test.winehq.org/data/7003ba44892d39ec0f409c793b97a0c5f4ae72d0/win10_cw1-hd6800-1709-t64/kernel32:format_msg.html
Patch tested:
https://testbot.winehq.org/JobDetails.pl?Key=50231
One machine failed with ERROR_RESOURCE_TYPE_NOT_FOUND,
so i changed that test also.
--
bye bye ...
... Detlef
Signed-off-by: Detlef Riekenberg <wine.dev at web.de>
---
dlls/kernel32/tests/format_msg.c | 26 ++++++++++++++++++--------
include/winerror.h | 1 +
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c
index 57ee78af9e..364741e6ff 100644
--- a/dlls/kernel32/tests/format_msg.c
+++ b/dlls/kernel32/tests/format_msg.c
@@ -155,7 +155,8 @@ static void test_message_from_string_wide(void)
error = GetLastError();
ok(!lstrcmpW(empty, out), "failed out=%s\n", wine_dbgstr_w(out));
ok(r==0, "succeeded: r=%d\n", r);
- ok(error==0xdeadbeef, "last error %u\n", error);
+ /* Since Win10 v1709, LastError is set to ERROR_NO_WORK_DONE */
+ ok((error==0xdeadbeef) || (error == ERROR_NO_WORK_DONE), "last error %u\n", error);
/* format placeholder with no specifier */
SetLastError(0xdeadbeef);
@@ -443,7 +444,8 @@ static void test_message_from_string(void)
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "", 0, 0, out, ARRAY_SIZE(out), NULL);
ok(!memcmp(out, init_buf, sizeof(init_buf)), "Expected the buffer to be untouched\n");
ok(r==0, "succeeded: r=%d\n", r);
- ok(GetLastError()==0xdeadbeef,
+ /* Since Win10 v1709, LastError is set to ERROR_NO_WORK_DONE */
+ ok((GetLastError()==0xdeadbeef) || (GetLastError() == ERROR_NO_WORK_DONE),
"last error %u\n", GetLastError());
/* format placeholder with no specifier */
@@ -745,7 +747,9 @@ static void test_message_ignore_inserts(void)
ARRAY_SIZE(out), NULL);
ok(ret == 0, "Expected FormatMessageA to return 0, got %d\n", ret);
ok(!memcmp(out, init_buf, sizeof(init_buf)), "Expected the output buffer to be untouched\n");
- ok(GetLastError() == 0xdeadbeef, "Expected GetLastError() to return 0xdeadbeef, got %u\n", GetLastError());
+ /* Since Win10 v1709, LastError is set to ERROR_NO_WORK_DONE */
+ ok((GetLastError() == 0xdeadbeef) || (GetLastError() == ERROR_NO_WORK_DONE),
+ "Expected GetLastError() to return 0xdeadbeef or ERROR_NO_WORK_DONE, got %u\n", GetLastError());
/* Insert sequences are ignored. */
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "test%1%2!*.*s!%99", 0, 0, out,
@@ -855,7 +859,9 @@ static void test_message_ignore_inserts_wide(void)
ARRAY_SIZE(out), NULL);
ok(ret == 0, "Expected FormatMessageW to return 0, got %d\n", ret);
ok(!lstrcmpW(empty, out), "Expected the output buffer to be the empty string, got %s\n", wine_dbgstr_w(out));
- ok(GetLastError() == 0xdeadbeef, "Expected GetLastError() to return 0xdeadbeef, got %u\n", GetLastError());
+ /* Since Win10 v1709, LastError is set to ERROR_NO_WORK_DONE */
+ ok((GetLastError() == 0xdeadbeef) || (GetLastError() == ERROR_NO_WORK_DONE),
+ "Expected GetLastError() to return 0xdeadbeef or ERROR_NO_WORK_DONE, got %u\n", GetLastError());
/* Insert sequences are ignored. */
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_t12oos99, 0, 0, out,
@@ -1294,8 +1300,9 @@ static void test_message_allocate_buffer(void)
"", 0, 0, (char *)&buf, 0, NULL);
ok(ret == 0, "Expected FormatMessageA to return 0, got %u\n", ret);
ok(buf == NULL, "Expected output buffer pointer to be NULL\n");
- ok(GetLastError() == 0xdeadbeef,
- "Expected last error to be untouched, got %u\n", GetLastError());
+ /* Since Win10 v1709, LastError is set to ERROR_NO_WORK_DONE */
+ ok((GetLastError() == 0xdeadbeef) || (GetLastError() == ERROR_NO_WORK_DONE),
+ "Expected GetLastError() to return 0xdeadbeef or ERROR_NO_WORK_DONE, got %u\n", GetLastError());
buf = (char *)0xdeadbeef;
ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER,
@@ -1391,8 +1398,9 @@ static void test_message_allocate_buffer_wide(void)
empty, 0, 0, (WCHAR *)&buf, 0, NULL);
ok(ret == 0, "Expected FormatMessageW to return 0, got %u\n", ret);
ok(buf == NULL, "Expected output buffer pointer to be NULL\n");
- ok(GetLastError() == 0xdeadbeef,
- "Expected last error to be untouched, got %u\n", GetLastError());
+ /* Since Win10-1709, LastError is set to ERROR_NO_WORK_DONE */
+ ok((GetLastError() == 0xdeadbeef) || (GetLastError() == ERROR_NO_WORK_DONE),
+ "Expected GetLastError() to return 0xdeadbeef or ERROR_NO_WORK_DONE, got %u\n", GetLastError());
buf = (WCHAR *)0xdeadbeef;
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER,
@@ -1522,6 +1530,7 @@ static void test_message_from_hmodule(void)
error = GetLastError();
ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret);
ok(error == ERROR_RESOURCE_LANG_NOT_FOUND ||
+ error == ERROR_RESOURCE_TYPE_NOT_FOUND ||
error == ERROR_MR_MID_NOT_FOUND ||
error == ERROR_MUI_FILE_NOT_FOUND ||
error == ERROR_MUI_FILE_NOT_LOADED,
@@ -1533,6 +1542,7 @@ static void test_message_from_hmodule(void)
error = GetLastError();
ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret);
ok(error == ERROR_RESOURCE_LANG_NOT_FOUND ||
+ error == ERROR_RESOURCE_TYPE_NOT_FOUND ||
error == ERROR_MR_MID_NOT_FOUND ||
error == ERROR_MUI_FILE_NOT_FOUND ||
error == ERROR_MUI_FILE_NOT_LOADED,
diff --git a/include/winerror.h b/include/winerror.h
index d78c91e84e..79be438e16 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -291,6 +291,7 @@ static inline HRESULT HRESULT_FROM_WIN32(unsigned int x)
#define ERROR_NO_DATA 232
#define ERROR_PIPE_NOT_CONNECTED 233
#define ERROR_MORE_DATA 234
+#define ERROR_NO_WORK_DONE 235
#define ERROR_VC_DISCONNECTED 240
#define ERROR_INVALID_EA_NAME 254
#define ERROR_EA_LIST_INCONSISTENT 255
--
2.21.0.windows.1
More information about the wine-devel
mailing list