[PATCH 0/1] MR9484: user32: Fix loading cursor image with resource id using LR_LOADFROMFILE on older windows versions
Based on patch from staging Wine-Bug: //https://bugs.winehq.org/show_bug.cgi?id=24963 Signed-off-by: Vijay Kiran Kamuju infyquest(a)gmail.com -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9484
From: Vijay Kiran Kamuju <infyquest(a)gmail.com> Based on patch from staging Wine-Bug: //https://bugs.winehq.org/show_bug.cgi?id=24963 Signed-off-by: Vijay Kiran Kamuju infyquest(a)gmail.com --- dlls/user32/cursoricon.c | 2 +- dlls/user32/edit.c | 2 +- dlls/user32/user_private.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 552504accc4..59e2e42d30d 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -1375,7 +1375,7 @@ static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name, TRACE("%p, %s, %dx%d, depth %d, fCursor %d, flags 0x%04x\n", hInstance, debugstr_w(name), width, height, depth, fCursor, loadflags); - if ( loadflags & LR_LOADFROMFILE ) /* Load from file */ + if ( (loadflags & LR_LOADFROMFILE) && (get_app_version() >= 0x4000) ) /* Load from file */ return CURSORICON_LoadFromFile( name, width, height, depth, fCursor, loadflags ); if (!hInstance) hInstance = user32_module; /* Load OEM cursor/icon */ diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 4b58c3e3226..cad14800995 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -188,7 +188,7 @@ static inline void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es) * applications with an expected version 0f 4.0 or higher. * */ -static DWORD get_app_version(void) +DWORD get_app_version(void) { static DWORD version; if (!version) diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index f68e7c2c467..3513e502295 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -80,6 +80,8 @@ extern INT_PTR WINPROC_CallDlgProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM extern void winproc_init(void); extern LRESULT dispatch_win_proc_params( struct win_proc_params *params ); +extern DWORD get_app_version(void); + extern void init_class_name( UNICODE_STRING *str, const WCHAR *name ); extern void init_class_name_ansi( UNICODE_STRING *str, const char *name ); extern void get_class_version( UNICODE_STRING *name, UNICODE_STRING *version, BOOL load ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9484
Any way we could make a test for this? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9484#note_122602
The written a test but it crashes on the testbot, we may need a very old vm to test it. https://testbot.winehq.org/JobDetails.pl?Key=160863 `diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c index bc42563b0e4..1c6839781df 100644 --- a/dlls/user32/tests/cursoricon.c +++ b/dlls/user32/tests/cursoricon.c @@ -1496,9 +1496,16 @@ static void test_LoadImage(void) "GetIconInfoEx wrong module %s\n", wine_dbgstr_w(infoexW.szModName) ); ok( infoexW.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", wine_dbgstr_w(infoexW.szResName) ); } - SetLastError(0xdeadbeef); DestroyIcon(handle); + /* Test loading a resource as a cursor. */ + SetLastError(0xdeadbeef); + handle = LoadImageA(NULL, (LPSTR)IDC_APPSTARTING, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE); + ok(handle != NULL, "LoadImage() failed.\n"); + error = GetLastError(); + ok(error == 0, "Last error: %lu\n", error); + SetLastError(0xdeadbeef); + test_LoadImageFile("BMP", bmpimage, sizeof(bmpimage), "bmp", 1); test_LoadImageFile("BMP (coreinfo)", bmpcoreimage, sizeof(bmpcoreimage), "bmp", 1); test_LoadImageFile("GIF", gifimage, sizeof(gifimage), "gif", 0);` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9484#note_122603
participants (3)
-
Nikolay Sivov (@nsivov) -
Vijay Kiran Kamuju -
Vijay Kiran Kamuju (@infyquest)