mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
comctl32-LoadIconMetric: Some additional improvements, add FIXME for unimplemented functionality.
This commit is contained in:
parent
495e7f4985
commit
278c0ed870
@ -1,4 +1,4 @@
|
||||
From f746bb419f12a1a65e52e3814617afed5fdce7a1 Mon Sep 17 00:00:00 2001
|
||||
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.
|
||||
@ -7,12 +7,11 @@ 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 +++++++++++++++++++++++++++++++++++++++
|
||||
dlls/comctl32/commctrl.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||
include/commctrl.h | 7 +++++++
|
||||
3 files changed, 47 insertions(+)
|
||||
3 files changed, 48 insertions(+)
|
||||
|
||||
diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec
|
||||
index 1e92e5f..e61dfbf 100644
|
||||
@ -27,7 +26,7 @@ index 1e92e5f..e61dfbf 100644
|
||||
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
|
||||
index e18c27d..462ecf8 100644
|
||||
--- a/dlls/comctl32/commctrl.c
|
||||
+++ b/dlls/comctl32/commctrl.c
|
||||
@@ -3,6 +3,7 @@
|
||||
@ -38,7 +37,7 @@ index e18c27d..5fbd5f5 100644
|
||||
*
|
||||
* 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
|
||||
@@ -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;
|
||||
}
|
||||
@ -55,7 +54,7 @@ index e18c27d..5fbd5f5 100644
|
||||
+ if (!icon)
|
||||
+ return E_INVALIDARG;
|
||||
+
|
||||
+ /* windows sets it to zero in a case of failure */
|
||||
+ /* Windows sets it to zero in a case of failure. */
|
||||
+ *icon = NULL;
|
||||
+
|
||||
+ if (!name)
|
||||
@ -74,37 +73,31 @@ index e18c27d..5fbd5f5 100644
|
||||
+ else
|
||||
+ return E_INVALIDARG;
|
||||
+
|
||||
+ *icon = LoadImageW(hinst, name, IMAGE_ICON, width, height, LR_SHARED);
|
||||
+ /* 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..0ff1fea 100644
|
||||
index 0bcaeb6..662dca1 100644
|
||||
--- a/include/commctrl.h
|
||||
+++ b/include/commctrl.h
|
||||
@@ -43,6 +43,7 @@ LANGID WINAPI GetMUILanguage (VOID);
|
||||
@@ -42,6 +42,13 @@ BOOL WINAPI InitCommonControlsEx (const INITCOMMONCONTROLSEX*);
|
||||
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,
|
||||
+ LIM_SMALL,
|
||||
+ LIM_LARGE
|
||||
+};
|
||||
+
|
||||
typedef struct tagTBSAVEPARAMSA {
|
||||
HKEY hkr;
|
||||
LPCSTR pszSubKey;
|
||||
+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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 16706a9c1d322c48f94b51be8c0bbb52f3e4d0e4 Mon Sep 17 00:00:00 2001
|
||||
From 54e59f6203fc4e8ce1a3855f51de9ba179bf7ef5 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.
|
||||
@ -8,11 +8,11 @@ Changes by Alistair Leslie-Hughes:
|
||||
* Changed LoadIconMetric to pLoadIconMetric
|
||||
(caused a compile error since it's in the header).
|
||||
---
|
||||
dlls/comctl32/tests/misc.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 66 insertions(+)
|
||||
dlls/comctl32/tests/misc.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 60 insertions(+)
|
||||
|
||||
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c
|
||||
index 280b46c..b51873c 100644
|
||||
index 280b46c..3d2231e 100644
|
||||
--- a/dlls/comctl32/tests/misc.c
|
||||
+++ b/dlls/comctl32/tests/misc.c
|
||||
@@ -20,6 +20,7 @@
|
||||
@ -32,7 +32,7 @@ index 280b46c..b51873c 100644
|
||||
static HMODULE hComctl32 = 0;
|
||||
|
||||
#define COMCTL32_GET_PROC(ordinal, func) \
|
||||
@@ -205,6 +208,68 @@ static void test_TaskDialogIndirect(void)
|
||||
@@ -205,6 +208,62 @@ static void test_TaskDialogIndirect(void)
|
||||
ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ index 280b46c..b51873c 100644
|
||||
+ ok(ptr == pLoadIconMetric, "got wrong pointer for ordinal 380, %p expected %p\n",
|
||||
+ ptr, pLoadIconMetric);
|
||||
+
|
||||
+ result = pLoadIconMetric(NULL, (const WCHAR *)IDI_APPLICATION, 0x100, &icon);
|
||||
+ result = pLoadIconMetric(NULL, MAKEINTRESOURCEW(IDI_APPLICATION), 0x100, &icon);
|
||||
+ ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result);
|
||||
+
|
||||
+ icon = (HICON)0x1234;
|
||||
@ -70,30 +70,24 @@ index 280b46c..b51873c 100644
|
||||
+ ok(result == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND),
|
||||
+ "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", result);
|
||||
+
|
||||
+ result = pLoadIconMetric(NULL, (const WCHAR *)IDI_APPLICATION, LIM_SMALL, &icon);
|
||||
+ result = pLoadIconMetric(NULL, MAKEINTRESOURCEW(IDI_APPLICATION), LIM_SMALL, &icon);
|
||||
+ ok(result == S_OK, "Expected S_OK, got %x\n", result);
|
||||
+ res = GetIconInfo(icon, &info);
|
||||
+ ok(res, "Failed to get icon info, error %d\n", GetLastError());
|
||||
+ if (res && info.hbmColor)
|
||||
+ {
|
||||
+ bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
|
||||
+ ok(bytes > 0, "Failed to get bitmap info for icon\n");
|
||||
+ ok(bmp.bmWidth == GetSystemMetrics(SM_CXSMICON), "Wrong icon width\n");
|
||||
+ ok(bmp.bmHeight == GetSystemMetrics(SM_CYSMICON), "Wrong icon height\n");
|
||||
+ }
|
||||
+ bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
|
||||
+ ok(bytes > 0, "Failed to get bitmap info for icon\n");
|
||||
+ ok(bmp.bmWidth == GetSystemMetrics(SM_CXSMICON), "Wrong icon width\n");
|
||||
+ ok(bmp.bmHeight == GetSystemMetrics(SM_CYSMICON), "Wrong icon height\n");
|
||||
+ DestroyIcon(icon);
|
||||
+
|
||||
+ result = pLoadIconMetric(NULL, (const WCHAR *)IDI_APPLICATION, LIM_LARGE, &icon);
|
||||
+ result = pLoadIconMetric(NULL, MAKEINTRESOURCEW(IDI_APPLICATION), LIM_LARGE, &icon);
|
||||
+ ok(result == S_OK, "Expected S_OK, got %x\n", result);
|
||||
+ res = GetIconInfo(icon, &info);
|
||||
+ ok(res, "Failed to get icon info, error %d\n", GetLastError());
|
||||
+ if (res && info.hbmColor)
|
||||
+ {
|
||||
+ bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
|
||||
+ ok(bytes > 0, "Failed to get bitmap info for icon\n");
|
||||
+ ok(bmp.bmWidth == GetSystemMetrics(SM_CXICON), "Wrong icon width\n");
|
||||
+ ok(bmp.bmHeight == GetSystemMetrics(SM_CYICON), "Wrong icon height\n");
|
||||
+ }
|
||||
+ bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
|
||||
+ ok(bytes > 0, "Failed to get bitmap info for icon\n");
|
||||
+ ok(bmp.bmWidth == GetSystemMetrics(SM_CXICON), "Wrong icon width\n");
|
||||
+ ok(bmp.bmHeight == GetSystemMetrics(SM_CYICON), "Wrong icon height\n");
|
||||
+ DestroyIcon(icon);
|
||||
+}
|
||||
+
|
||||
@ -101,7 +95,7 @@ index 280b46c..b51873c 100644
|
||||
START_TEST(misc)
|
||||
{
|
||||
ULONG_PTR ctx_cookie;
|
||||
@@ -220,6 +285,7 @@ START_TEST(misc)
|
||||
@@ -220,6 +279,7 @@ START_TEST(misc)
|
||||
return;
|
||||
|
||||
test_TaskDialogIndirect();
|
||||
|
Loading…
x
Reference in New Issue
Block a user