wine-staging/patches/comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch
2015-07-24 15:09:27 +02:00

111 lines
3.3 KiB
Diff

From f746bb419f12a1a65e52e3814617afed5fdce7a1 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 | 39 +++++++++++++++++++++++++++++++++++++++
include/commctrl.h | 7 +++++++
3 files changed, 47 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..5fbd5f5 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,41 @@ 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;
+
+ *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 0bcaeb6..0ff1fea 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -43,6 +43,7 @@ LANGID WINAPI GetMUILanguage (VOID);
VOID WINAPI InitMUILanguage (LANGID uiLang);
HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE, PCWSTR, int, int, HICON *);
+HRESULT WINAPI LoadIconMetric(HINSTANCE, const WCHAR *, int, HICON *);
#define COMCTL32_VERSION 5 /* dll version */
@@ -1374,6 +1375,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;
--
2.4.5