From 0e6f0618f5d3dad56bff4680dce0a2099441789a Mon Sep 17 00:00:00 2001
From: Francois Boisvert <francois@macadamian.com>
Date: Tue, 22 Jun 1999 19:02:07 +0000
Subject: [PATCH] Modified ImageList_LoadImageA to check the case where cx is
 set to zero.

---
 dlls/comctl32/imagelist.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 810c615c42d..8cef688b42d 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -1416,6 +1416,19 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx,	INT cGrow,
     if (uType == IMAGE_BITMAP) {
         BITMAP bmp;
         GetObjectA (handle, sizeof(BITMAP), &bmp);
+
+        /* To match windows behavior, if cx is set to zero and
+         the flag DI_DEFAULTSIZE is specified, cx becomes the
+         system metric value for icons. If the flag is not specified
+         the function sets the size to the height of the bitmap */
+        if (cx == 0)
+        {
+            if (uFlags & DI_DEFAULTSIZE)
+                cx = GetSystemMetrics (SM_CXICON);
+            else
+                cx = bmp.bmHeight;
+        }
+
         nImageCount = bmp.bmWidth / cx;
 
         himl = ImageList_Create (cx, bmp.bmHeight, ILC_MASK | ILC_COLOR,
-- 
GitLab