[PATCH 2/2] user32: Clear last error if loading an icon succeeded.
Bernhard Übelacker
bernhardu at mailbox.org
Fri Mar 6 08:30:41 CST 2020
---
dlls/user32/cursoricon.c | 6 +++++-
dlls/user32/tests/resource.c | 1 -
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 6413d22d03..78cb3dfe1a 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -3042,6 +3042,7 @@ HANDLE WINAPI LoadImageA( HINSTANCE hinst, LPCSTR name, UINT type,
HANDLE WINAPI LoadImageW( HINSTANCE hinst, LPCWSTR name, UINT type,
INT desiredx, INT desiredy, UINT loadflags )
{
+ HANDLE ret;
int depth;
WCHAR path[MAX_PATH];
@@ -3062,7 +3063,10 @@ HANDLE WINAPI LoadImageW( HINSTANCE hinst, LPCWSTR name, UINT type,
case IMAGE_CURSOR:
depth = 1;
if (!(loadflags & LR_MONOCHROME)) depth = get_display_bpp();
- return CURSORICON_Load(hinst, name, desiredx, desiredy, depth, (type == IMAGE_CURSOR), loadflags);
+ ret = CURSORICON_Load(hinst, name, desiredx, desiredy, depth, (type == IMAGE_CURSOR), loadflags);
+ if (hinst && ret)
+ SetLastError(ERROR_SUCCESS);
+ return ret;
}
return 0;
}
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 959b6c0a46..e33fc0d8ec 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -421,7 +421,6 @@ static void test_LoadImage(void)
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);
--
2.20.1
More information about the wine-devel
mailing list