wine-staging/patches/comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch

104 lines
3.3 KiB
Diff

From 74254e3904454c5d088bf400d3d58107aa2b138b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 7 Aug 2014 01:41:25 +0200
Subject: comctl32: Implement LoadIconMetric function.
Changes by Alistair Leslie-Hughes:
* Moved LoadIconMetric to commctrl.c
* Changed INT, PCWSTR type
* Added function to include/commctrl.h
---
dlls/comctl32/comctl32.spec | 1 +
dlls/comctl32/commctrl.c | 40 ++++++++++++++++++++++++++++++++++++++++
include/commctrl.h | 7 +++++++
3 files changed, 48 insertions(+)
diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec
index 1e92e5f..e61dfbf 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)
381 stdcall -ordinal LoadIconWithScaleDown(ptr wstr long long ptr)
382 stdcall -noname SmoothScrollWindow(ptr)
383 stub -noname DoReaderMode
diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index e18c27d..462ecf8 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -3,6 +3,7 @@
*
* Copyright 1997 Dimitrie O. Paun
* Copyright 1998,2000 Eric Kohl
+ * 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
@@ -1646,3 +1647,42 @@ HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR name, int cx, int c
FIXME("stub: %p %s %d %d %p\n", hinst, wine_dbgstr_w(name), cx, cy, icon);
return E_NOTIMPL;
}
+
+/***********************************************************************
+ * LoadIconMetric [COMCTL32.@]
+ */
+HRESULT WINAPI LoadIconMetric(HINSTANCE hinst, const WCHAR *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;
+
+ /* FIXME: This doesn't seem to work properly yet with file names. */
+ *icon = LoadImageW(hinst, name, IMAGE_ICON, width, height, 0);
+ if (*icon)
+ return S_OK;
+
+ return HRESULT_FROM_WIN32(GetLastError());
+}
diff --git a/include/commctrl.h b/include/commctrl.h
index 0bcaeb6..662dca1 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -42,6 +42,13 @@ BOOL WINAPI InitCommonControlsEx (const INITCOMMONCONTROLSEX*);
LANGID WINAPI GetMUILanguage (VOID);
VOID WINAPI InitMUILanguage (LANGID uiLang);
+enum _LI_METRIC
+{
+ LIM_SMALL,
+ LIM_LARGE
+};
+
+HRESULT WINAPI LoadIconMetric(HINSTANCE, const WCHAR *, int, HICON *);
HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE, PCWSTR, int, int, HICON *);
#define COMCTL32_VERSION 5 /* dll version */
--
2.4.5