From 0eda0c4092b0673e4b4e646388c53e2a8ecc2379 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 18 May 2016 18:08:24 +0800
Subject: user32: Add a workaround for Windows 3.1 apps which call
 LoadImage(LR_LOADFROMFILE) with a resource id. (v2)

Fixes #24963.
---
 dlls/user32/cursoricon.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 4f93195..95cc410 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1404,7 +1404,12 @@ static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name,
           hInstance, debugstr_w(name), width, height, depth, fCursor, loadflags);
 
     if ( loadflags & LR_LOADFROMFILE )    /* Load from file */
-        return CURSORICON_LoadFromFile( name, width, height, depth, fCursor, loadflags );
+    {
+        if (IS_INTRESOURCE(name) && GetProcessVersion(0) < 0x40000)
+            WARN("Windows 3.1 app set LR_LOADFROMFILE without a name, fallback to loading from resource\n");
+        else
+            return CURSORICON_LoadFromFile( name, width, height, depth, fCursor, loadflags );
+    }
 
     if (!hInstance) hInstance = user32_module;  /* Load OEM cursor/icon */
 
-- 
2.8.0

