I got a private utility without source, that silently fails in current wine. After a succeeding call to RegisterClassExW it checks instead of the return value the value of GetLastError. I assume is a bug in the utility itself.
But it works in Windows and I could track it down to a call to LoadIconW, that clears the last error value, and therefore makes the utility work.
Windows XP does not clear last error, but the utility is just targeting version Vista or later.
Uncertainties: - Should both patches go into a single one? - Is there a better place for the test? - The file windowsm.ico is copied from programs/taskmgr, is this ok? --- dlls/user32/tests/resource.c | 21 +++++++++++++++++++++ dlls/user32/tests/resource.rc | 3 +++ dlls/user32/tests/windowsm.ico | Bin 0 -> 318 bytes 3 files changed, 24 insertions(+) create mode 100644 dlls/user32/tests/windowsm.ico
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c index 5d4c4e2f96..959b6c0a46 100644 --- a/dlls/user32/tests/resource.c +++ b/dlls/user32/tests/resource.c @@ -394,17 +394,38 @@ static void test_LoadImage(void) { HBITMAP bmp; HRSRC hres; + HICON ico; + int error;
+ SetLastError(0xdeadbeef); bmp = LoadBitmapA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(100)); + error = GetLastError(); ok(bmp != NULL, "Could not load a bitmap resource\n"); + ok(error == 0xdeadbeef, "Last error: %u\n", error); if (bmp) DeleteObject(bmp);
+ SetLastError(0xdeadbeef); hres = FindResourceA(GetModuleHandleA(NULL), "#100", (LPCSTR)RT_BITMAP); + error = GetLastError(); ok(hres != NULL, "Could not find a bitmap resource with a numeric string\n"); + ok(error == 0xdeadbeef, "Last error: %u\n", error);
+ SetLastError(0xdeadbeef); bmp = LoadBitmapA(GetModuleHandleA(NULL), "#100"); + error = GetLastError(); ok(bmp != NULL, "Could not load a bitmap resource with a numeric string\n"); + ok(error == 0xdeadbeef, "Last error: %u\n", error); if (bmp) DeleteObject(bmp); + + SetLastError(0xdeadbeef); + ico = LoadIconA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(102)); + error = GetLastError(); + ok(ico != NULL, "Could not load an icon resource\n"); + todo_wine + ok(error == ERROR_SUCCESS || + broken(error == ERROR_INVALID_HANDLE), /* WinXP */ + "Last error: %u\n", error); + if (ico) DeleteObject(ico); }
START_TEST(resource) diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc index 89aaf5a61c..0afc25188e 100644 --- a/dlls/user32/tests/resource.rc +++ b/dlls/user32/tests/resource.rc @@ -252,6 +252,9 @@ FONT 8, "MS Shell Dlg" /* @makedep: bmp1x1_32bpp.bmp */ 101 BITMAP bmp1x1_32bpp.bmp
+/* @makedep: windowsm.ico */ +102 ICON windowsm.ico + 1 MENU { POPUP "&File" diff --git a/dlls/user32/tests/windowsm.ico b/dlls/user32/tests/windowsm.ico new file mode 100644 index 0000000000000000000000000000000000000000..9d4b2cff3bd2a9347e7775c6dc258ed8e186794d GIT binary patch literal 318 zcmb78u?@f=3^P&>VCvklhwxL^Y;aai;sa_!St_KePHabs5&!}t#t7jIz%D1%Imm#G z3V7F*7{G+tFe*#9J6(g;6RoKt8EQ#hC<B%`B>wx{Pbt+}Ez=3hSBE|K%Y1h6g*p0k F?cOT^Vu%0$
literal 0 HcmV?d00001