From 3d627699120b018c08c9bc5ec023248be6bb8841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 7 Aug 2014 02:00:57 +0200 Subject: [PATCH] Add patches for LoadIconMetric. --- README.md | 1 + patches/Makefile | 22 +++ ...32-Implement-LoadIconMetric-function.patch | 131 ++++++++++++++++++ ...dd-tests-for-LoadIconMetric-function.patch | 128 +++++++++++++++++ patches/comctl32-LoadIconMetric/definition | 4 + 5 files changed, 286 insertions(+) create mode 100644 patches/comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch create mode 100644 patches/comctl32-LoadIconMetric/0002-comctl32-tests-Add-tests-for-LoadIconMetric-function.patch create mode 100644 patches/comctl32-LoadIconMetric/definition diff --git a/README.md b/README.md index d9294a4b..db23c394 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Wine-Compholio contains fixes for the following Wine bugs: * Allow special characters in pipe names ([Wine Bug #28995](http://bugs.winehq.org/show_bug.cgi?id=28995 "Unable to use named pipes with \">\" character in the name")) * Fix for ConnectNamedPort return value in overlapped mode ([Wine Bug #16550](http://bugs.winehq.org/show_bug.cgi?id=16550 "ConnectNamedPort should never return OK in overlapped mode (affects chromium ui_tests.exe)")) * GetSecurityInfo returns NULL DACL for process object ([Wine Bug #15980](http://bugs.winehq.org/show_bug.cgi?id=15980 "Rhapsody 2 crashes on startup (GetSecurityInfo returns NULL DACL for process object)")) +* Implement LoadIconMetric function. ([Wine Bug #35375](http://bugs.winehq.org/show_bug.cgi?id=35375 "Multiple applications need Vista+ API COMCTL32.dll.380 a.k.a. 'LoadIconMetric' (Solidworks 2013 systray monitor, Microsoft One/SkyDrive)")) * Implement a Microsoft Yahei replacement font ([Wine Bug #13829](http://bugs.winehq.org/show_bug.cgi?id=13829 "Wine does not have CJK fonts")) * Implement an Arial replacement font ([Wine Bug #32323](http://bugs.winehq.org/show_bug.cgi?id=32323 "Netflix (Silverlight 4.x) and several .NET Framework 3.x/4.0 WPF apps require either Arial or Verdana to be installed")) * Make it possible to change media center / tablet pc status ([Wine Bug #18732](http://bugs.winehq.org/show_bug.cgi?id=18732 "Microsoft Experience Pack for Tablet PC 1 refuses to install")) diff --git a/patches/Makefile b/patches/Makefile index 0fc948d6..c04fed05 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -8,6 +8,7 @@ PATCH := $(CURDIR)/../debian/tools/gitapply.sh -d $(DESTDIR) PATCHLIST := Miscellaneous.ok \ Pipelight.ok \ atl-IOCS_Property.ok \ + comctl32-LoadIconMetric.ok \ ddraw-Empty_Hardware_Flags.ok \ fonts-Missing_Fonts.ok \ iphlpapi-TCP_Table.ok \ @@ -119,6 +120,27 @@ atl-IOCS_Property.ok: echo '+ { "atl-IOCS_Property", "Qian Hong", "Store IOCS data in a property instead of GWLP_USERDATA." },'; \ ) > atl-IOCS_Property.ok +# Patchset comctl32-LoadIconMetric +# | +# | Included patches: +# | * Implement LoadIconMetric function. [by Michael Müller] +# | +# | This patchset fixes the following Wine bugs: +# | * [#35375] Multiple applications need Vista+ API COMCTL32.dll.380 a.k.a. 'LoadIconMetric' (Solidworks 2013 systray +# | monitor, Microsoft One/SkyDrive) +# | +# | Modified files: +# | * dlls/comctl32/Makefile.in, dlls/comctl32/comctl32.spec, dlls/comctl32/icon.c, dlls/comctl32/tests/misc.c, +# | include/commctrl.h +# | +.INTERMEDIATE: comctl32-LoadIconMetric.ok +comctl32-LoadIconMetric.ok: + $(PATCH) < comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch + $(PATCH) < comctl32-LoadIconMetric/0002-comctl32-tests-Add-tests-for-LoadIconMetric-function.patch + @( \ + echo '+ { "comctl32-LoadIconMetric", "Michael Müller", "Implement LoadIconMetric function." },'; \ + ) > comctl32-LoadIconMetric.ok + # Patchset ddraw-Empty_Hardware_Flags # | # | Included patches: diff --git a/patches/comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch b/patches/comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch new file mode 100644 index 00000000..5fcf048d --- /dev/null +++ b/patches/comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch @@ -0,0 +1,131 @@ +From bd8ddd1f8297c0216db8f027652c35cbfdfdcb54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Thu, 7 Aug 2014 01:41:25 +0200 +Subject: comctl32: Implement LoadIconMetric function. + +--- + dlls/comctl32/Makefile.in | 1 + + dlls/comctl32/comctl32.spec | 1 + + dlls/comctl32/icon.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ + include/commctrl.h | 6 ++++ + 4 files changed, 76 insertions(+) + create mode 100644 dlls/comctl32/icon.c + +diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in +index e63f0ac..af49017 100644 +--- a/dlls/comctl32/Makefile.in ++++ b/dlls/comctl32/Makefile.in +@@ -16,6 +16,7 @@ C_SRCS = \ + flatsb.c \ + header.c \ + hotkey.c \ ++ icon.c \ + imagelist.c \ + ipaddress.c \ + listview.c \ +diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec +index 0dff369..1343fca 100644 +--- a/dlls/comctl32/comctl32.spec ++++ b/dlls/comctl32/comctl32.spec +@@ -88,6 +88,7 @@ + 375 stdcall -noname -private StrCSpnIW(wstr wstr) + 376 stdcall -noname -private IntlStrEqWorkerA(long str str long) + 377 stdcall -noname -private IntlStrEqWorkerW(long wstr wstr long) ++380 stdcall LoadIconMetric(ptr wstr long ptr) + 382 stdcall -noname SmoothScrollWindow(ptr) + 383 stub -noname DoReaderMode + 384 stdcall -noname SetPathWordBreakProc(ptr long) +diff --git a/dlls/comctl32/icon.c b/dlls/comctl32/icon.c +new file mode 100644 +index 0000000..a664e2c +--- /dev/null ++++ b/dlls/comctl32/icon.c +@@ -0,0 +1,68 @@ ++/* ++ * Comctl32 Icon functions ++ * ++ * Copyright 2014 Michael Müller ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#include ++#include ++#include "windef.h" ++#include "winbase.h" ++#include "wingdi.h" ++#include "winuser.h" ++#include "winnls.h" ++#include "commctrl.h" ++#include "comctl32.h" ++#include "wine/debug.h" ++ ++WINE_DEFAULT_DEBUG_CHANNEL(commctrl); ++ ++HRESULT WINAPI ++LoadIconMetric (HINSTANCE hinst, PCWSTR name, INT size, HICON *icon) ++{ ++ INT width, height; ++ ++ TRACE("(%p %s %d %p)\n", hinst, debugstr_w(name), size, icon); ++ ++ if (!icon) ++ return E_INVALIDARG; ++ ++ /* windows sets it to zero in a case of failure */ ++ *icon = NULL; ++ ++ if (!name) ++ return E_INVALIDARG; ++ ++ if (size == LIM_SMALL) ++ { ++ width = GetSystemMetrics( SM_CXSMICON ); ++ height = GetSystemMetrics( SM_CYSMICON ); ++ } ++ else if (size == LIM_LARGE) ++ { ++ width = GetSystemMetrics( SM_CXICON ); ++ height = GetSystemMetrics( SM_CYICON ); ++ } ++ else ++ return E_INVALIDARG; ++ ++ *icon = LoadImageW( hinst, name, IMAGE_ICON, width, height, LR_SHARED ); ++ if (*icon) ++ return S_OK; ++ ++ return HRESULT_FROM_WIN32(GetLastError()); ++} +diff --git a/include/commctrl.h b/include/commctrl.h +index 9993ec7..0cc401e 100644 +--- a/include/commctrl.h ++++ b/include/commctrl.h +@@ -1373,6 +1373,12 @@ typedef struct tagTBADDBITMAP { + #define HIST_ADDTOFAVORITES 3 + #define HIST_VIEWTREE 4 + ++enum _LI_METRIC ++{ ++ LIM_SMALL, ++ LIM_LARGE, ++}; ++ + typedef struct tagTBSAVEPARAMSA { + HKEY hkr; + LPCSTR pszSubKey; +-- +1.8.3.2 + diff --git a/patches/comctl32-LoadIconMetric/0002-comctl32-tests-Add-tests-for-LoadIconMetric-function.patch b/patches/comctl32-LoadIconMetric/0002-comctl32-tests-Add-tests-for-LoadIconMetric-function.patch new file mode 100644 index 00000000..0bc8f004 --- /dev/null +++ b/patches/comctl32-LoadIconMetric/0002-comctl32-tests-Add-tests-for-LoadIconMetric-function.patch @@ -0,0 +1,128 @@ +From 12e3dc5ffa57a18e67e8e30dd5c15e3dc0727e19 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Thu, 7 Aug 2014 01:54:28 +0200 +Subject: comctl32/tests: Add tests for LoadIconMetric function. + +--- + dlls/comctl32/tests/misc.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 84 insertions(+) + +diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c +index 69a7db4..55ea14a 100644 +--- a/dlls/comctl32/tests/misc.c ++++ b/dlls/comctl32/tests/misc.c +@@ -20,6 +20,7 @@ + + #include + #include ++#include + + #include "wine/test.h" + #include "v6util.h" +@@ -34,6 +35,8 @@ static BOOL (WINAPI * pStr_SetPtrA)(LPSTR, LPCSTR); + static INT (WINAPI * pStr_GetPtrW)(LPCWSTR, LPWSTR, INT); + static BOOL (WINAPI * pStr_SetPtrW)(LPWSTR, LPCWSTR); + ++static HRESULT (WINAPI * LoadIconMetric)(HINSTANCE, PCWSTR, INT, HICON*); ++ + static HMODULE hComctl32 = 0; + + #define COMCTL32_GET_PROC(ordinal, func) \ +@@ -205,6 +208,86 @@ static void test_TaskDialogIndirect(void) + ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); + } + ++static void test_LoadIconMetric(void) ++{ ++ static const WCHAR nonExistingFile[] = {'d','o','e','s','n','o','t','e','x','i','s','t','.','i','c','o','\0'}; ++ HINSTANCE hinst; ++ void *ptr; ++ HICON icon; ++ HRESULT result; ++ ICONINFO info; ++ BOOL res; ++ INT bytes; ++ BITMAP bmp; ++ ++ hinst = LoadLibraryA("comctl32.dll"); ++ ++ LoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric"); ++ if (!LoadIconMetric) ++ { ++ win_skip("LoadIconMetric not exported by name\n"); ++ return; ++ } ++ ++ ptr = GetProcAddress(hinst, (const CHAR*)380); ++ ok(ptr == LoadIconMetric, "got wrong pointer for ordinal 380, %p expected %p", ++ ptr, LoadIconMetric); ++ ++ result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_SMALL, &icon); ++ ok(result == S_OK, "Expected S_OK, got %x\n", result); ++ if (result == S_OK) ++ { ++ res = GetIconInfo(icon, &info); ++ ok(res, "Failed to get icon info\n"); ++ if (res && info.hbmColor) ++ { ++ bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); ++ ok(bytes > 0, "Failed to get bitmap info for icon\n"); ++ if (bytes > 0) ++ { ++ ok(bmp.bmWidth == GetSystemMetrics( SM_CXSMICON ), "Wrong icon width\n"); ++ ok(bmp.bmHeight == GetSystemMetrics( SM_CYSMICON ), "Wrong icon height\n"); ++ } ++ } ++ DestroyIcon(icon); ++ } ++ ++ result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_LARGE, &icon); ++ ok(result == S_OK, "Expected S_OK, got %x\n", result); ++ if (result == S_OK) ++ { ++ res = GetIconInfo(icon, &info); ++ ok(res, "Failed to get icon info\n"); ++ if (res && info.hbmColor) ++ { ++ bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); ++ ok(bytes > 0, "Failed to get bitmap info for icon\n"); ++ if (bytes > 0) ++ { ++ ok(bmp.bmWidth == GetSystemMetrics( SM_CXICON ), "Wrong icon width\n"); ++ ok(bmp.bmHeight == GetSystemMetrics( SM_CYICON ), "Wrong icon height\n"); ++ } ++ } ++ DestroyIcon(icon); ++ } ++ ++ result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, 0x100, &icon); ++ ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result); ++ if (result == S_OK) DestroyIcon(icon); ++ ++ icon = (HICON)0x1234; ++ result = LoadIconMetric(NULL, NULL, LIM_LARGE, &icon); ++ ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result); ++ ok(icon == (HICON)0, "Expected 0x0, got %p\n", icon); ++ if (result == S_OK) DestroyIcon(icon); ++ ++ result = LoadIconMetric(NULL, nonExistingFile, LIM_LARGE, &icon); ++ ok(result == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), ++ "Expected 80070715, got %x\n", result); ++ if (result == S_OK) DestroyIcon(icon); ++} ++ ++ + START_TEST(misc) + { + ULONG_PTR ctx_cookie; +@@ -220,6 +303,7 @@ START_TEST(misc) + return; + + test_TaskDialogIndirect(); ++ test_LoadIconMetric(); + + unload_v6_module(ctx_cookie, hCtx); + } +-- +1.8.3.2 + diff --git a/patches/comctl32-LoadIconMetric/definition b/patches/comctl32-LoadIconMetric/definition new file mode 100644 index 00000000..44483490 --- /dev/null +++ b/patches/comctl32-LoadIconMetric/definition @@ -0,0 +1,4 @@ +Author: Michael Müller +Subject: Implement LoadIconMetric function. +Revision: 1 +Fixes: [35375] Implement LoadIconMetric function.