mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Updated comctl32 LoadIconMetric patches.
This commit is contained in:
parent
06226bdc44
commit
77d2d3e4e0
@ -1,30 +1,21 @@
|
||||
From 3e8d16b07793f5794702e31dc08a55a71f46fa1f Mon Sep 17 00:00:00 2001
|
||||
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.
|
||||
|
||||
---
|
||||
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
|
||||
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/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 0bd8b13..2b96891 100644
|
||||
index 1e92e5f..e61dfbf 100644
|
||||
--- a/dlls/comctl32/comctl32.spec
|
||||
+++ b/dlls/comctl32/comctl32.spec
|
||||
@@ -88,6 +88,7 @@
|
||||
@ -35,49 +26,29 @@ index 0bd8b13..2b96891 100644
|
||||
381 stdcall -ordinal LoadIconWithScaleDown(ptr wstr long long ptr)
|
||||
382 stdcall -noname SmoothScrollWindow(ptr)
|
||||
383 stub -noname DoReaderMode
|
||||
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
|
||||
+ *
|
||||
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
|
||||
+ * 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
|
||||
*
|
||||
* 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.@]
|
||||
+ */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+#include <string.h>
|
||||
+#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)
|
||||
+HRESULT WINAPI LoadIconMetric(HINSTANCE hinst, const WCHAR *name, int size, HICON *icon)
|
||||
+{
|
||||
+ INT width, height;
|
||||
+ int width, height;
|
||||
+
|
||||
+ TRACE("(%p %s %d %p)\n", hinst, debugstr_w(name), size, icon);
|
||||
+
|
||||
@ -92,28 +63,36 @@ index 0000000..a664e2c
|
||||
+
|
||||
+ if (size == LIM_SMALL)
|
||||
+ {
|
||||
+ width = GetSystemMetrics( SM_CXSMICON );
|
||||
+ height = GetSystemMetrics( SM_CYSMICON );
|
||||
+ width = GetSystemMetrics(SM_CXSMICON);
|
||||
+ height = GetSystemMetrics(SM_CYSMICON);
|
||||
+ }
|
||||
+ else if (size == LIM_LARGE)
|
||||
+ {
|
||||
+ width = GetSystemMetrics( SM_CXICON );
|
||||
+ height = GetSystemMetrics( SM_CYICON );
|
||||
+ width = GetSystemMetrics(SM_CXICON);
|
||||
+ height = GetSystemMetrics(SM_CYICON);
|
||||
+ }
|
||||
+ else
|
||||
+ return E_INVALIDARG;
|
||||
+
|
||||
+ *icon = LoadImageW( hinst, name, IMAGE_ICON, width, height, LR_SHARED );
|
||||
+ *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..525f356 100644
|
||||
index 0bcaeb6..0ff1fea 100644
|
||||
--- a/include/commctrl.h
|
||||
+++ b/include/commctrl.h
|
||||
@@ -1374,6 +1374,12 @@ typedef struct tagTBADDBITMAP {
|
||||
@@ -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
|
||||
|
||||
@ -127,5 +106,5 @@ index 0bcaeb6..525f356 100644
|
||||
HKEY hkr;
|
||||
LPCSTR pszSubKey;
|
||||
--
|
||||
2.1.3
|
||||
2.4.5
|
||||
|
||||
|
@ -1,14 +1,19 @@
|
||||
From 12e3dc5ffa57a18e67e8e30dd5c15e3dc0727e19 Mon Sep 17 00:00:00 2001
|
||||
From c5fa9198dd9ab87266d6dc0c22504ccb9740b366 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:54:28 +0200
|
||||
Subject: comctl32/tests: Add tests for LoadIconMetric function.
|
||||
|
||||
Changes by Alistair Leslie-Hughes:
|
||||
* Changed PCWSTR, CHAR, INT
|
||||
* Changed LoadIconMetric to pLoadIconMetric
|
||||
(caused a compile error since it's in the header).
|
||||
|
||||
---
|
||||
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
|
||||
index 280b46c..d5d882d 100644
|
||||
--- a/dlls/comctl32/tests/misc.c
|
||||
+++ b/dlls/comctl32/tests/misc.c
|
||||
@@ -20,6 +20,7 @@
|
||||
@ -23,7 +28,7 @@ index 69a7db4..55ea14a 100644
|
||||
static INT (WINAPI * pStr_GetPtrW)(LPCWSTR, LPWSTR, INT);
|
||||
static BOOL (WINAPI * pStr_SetPtrW)(LPWSTR, LPCWSTR);
|
||||
|
||||
+static HRESULT (WINAPI * LoadIconMetric)(HINSTANCE, PCWSTR, INT, HICON*);
|
||||
+static HRESULT (WINAPI * pLoadIconMetric)(HINSTANCE, const WCHAR *, int, HICON *);
|
||||
+
|
||||
static HMODULE hComctl32 = 0;
|
||||
|
||||
@ -41,23 +46,23 @@ index 69a7db4..55ea14a 100644
|
||||
+ HRESULT result;
|
||||
+ ICONINFO info;
|
||||
+ BOOL res;
|
||||
+ INT bytes;
|
||||
+ int bytes;
|
||||
+ BITMAP bmp;
|
||||
+
|
||||
+ hinst = LoadLibraryA("comctl32.dll");
|
||||
+
|
||||
+ LoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric");
|
||||
+ if (!LoadIconMetric)
|
||||
+ pLoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric");
|
||||
+ if (!pLoadIconMetric)
|
||||
+ {
|
||||
+ 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\n",
|
||||
+ ptr, LoadIconMetric);
|
||||
+ ptr = GetProcAddress(hinst, (const char*)380);
|
||||
+ ok(ptr == pLoadIconMetric, "got wrong pointer for ordinal 380, %p expected %p\n",
|
||||
+ ptr, pLoadIconMetric);
|
||||
+
|
||||
+ result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_SMALL, &icon);
|
||||
+ result = pLoadIconMetric(NULL, (const WCHAR*)IDI_APPLICATION, LIM_SMALL, &icon);
|
||||
+ ok(result == S_OK, "Expected S_OK, got %x\n", result);
|
||||
+ if (result == S_OK)
|
||||
+ {
|
||||
@ -76,7 +81,7 @@ index 69a7db4..55ea14a 100644
|
||||
+ DestroyIcon(icon);
|
||||
+ }
|
||||
+
|
||||
+ result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_LARGE, &icon);
|
||||
+ result = pLoadIconMetric(NULL, (const WCHAR*)IDI_APPLICATION, LIM_LARGE, &icon);
|
||||
+ ok(result == S_OK, "Expected S_OK, got %x\n", result);
|
||||
+ if (result == S_OK)
|
||||
+ {
|
||||
@ -95,17 +100,17 @@ index 69a7db4..55ea14a 100644
|
||||
+ DestroyIcon(icon);
|
||||
+ }
|
||||
+
|
||||
+ result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, 0x100, &icon);
|
||||
+ result = pLoadIconMetric(NULL, (const WCHAR*)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);
|
||||
+ result = pLoadIconMetric(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);
|
||||
+ result = pLoadIconMetric(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);
|
||||
@ -124,5 +129,5 @@ index 69a7db4..55ea14a 100644
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
2.4.5
|
||||
|
||||
|
@ -2054,8 +2054,7 @@ fi
|
||||
# | * [#35375] Support for LoadIconMetric
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/comctl32/Makefile.in, dlls/comctl32/comctl32.spec, dlls/comctl32/icon.c, dlls/comctl32/tests/misc.c,
|
||||
# | include/commctrl.h
|
||||
# | * dlls/comctl32/comctl32.spec, dlls/comctl32/commctrl.c, dlls/comctl32/tests/misc.c, include/commctrl.h
|
||||
# |
|
||||
if test "$enable_comctl32_LoadIconMetric" -eq 1; then
|
||||
patch_apply comctl32-LoadIconMetric/0001-comctl32-Implement-LoadIconMetric-function.patch
|
||||
|
Loading…
Reference in New Issue
Block a user