@@ -39,10 +39,12 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------

**Bug fixes and features included in the next upcoming release [5]:**
**Bug fixes and features included in the next upcoming release [7]:**

* Add stubs for d3dx10_43.D3DX10CreateEffectFromFileA/W ([Wine Bug #27739](https://bugs.winehq.org/show_bug.cgi?id=27739))
* Check architecture before trying to load libraries ([Wine Bug #38021](https://bugs.winehq.org/show_bug.cgi?id=38021))
* Fix loading of libraries with incomplete IMAGE_LOAD_CONFIG_DIRECTORY struct
* Fix security cookie handling for UPX compressed executables ([Wine Bug #38949](https://bugs.winehq.org/show_bug.cgi?id=38949))
* Forward exitcode from child process when in wineconsole
* Share source of d3dx9_36 with d3dx9_33 to avoid Wine DLL forwards ([Wine Bug #21817](https://bugs.winehq.org/show_bug.cgi?id=21817))
* Silence repeated LocaleNameToLCID/LCIDToLocaleName unsupported flags FIXMEs ([Wine Bug #30076](https://bugs.winehq.org/show_bug.cgi?id=30076))
@@ -3,13 +3,15 @@ wine-staging (1.7.48) UNRELEASED; urgency=low
additional tests.
* Update patchset to query GPU infos with GLX_MESA_query_renderer extension
(fixes a regression with broken MESA versions).
* Update vcomp patchset and add implementation for various atomic functions.
* Added patch to forward exitcode from child process when in wineconsole.
* Added patch to check architecture before trying to load libraries.
* Added patch to share source of d3dx9_36 with d3dx9_33 to avoid Wine DLL
forwards.
* Added patch with stubs for d3dx10_43.D3DX10CreateEffectFromFileA/W.
* Added patch to silence repeated LocaleNameToLCID/LCIDToLocaleName
unsupported flags FIXMEs.
* Added patches to improve security cookie handling.
* Removed patch to allow to enable/disable InsertMode in wineconsole settings
(accepted upstream).
* Removed patch to improve IoGetDeviceObjectPointer stub to appease SecuROM
@@ -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,38 +70,32 @@ 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);
+}
+
+
START_TEST(misc)
{
ULONG_PTR ctx_cookie;
@@ -220,6 +285,7 @@ START_TEST(misc)
@@ -220,6 +279,7 @@ START_TEST(misc)
return;

test_TaskDialogIndirect();
@@ -1,4 +1,4 @@
From 4d6d770eb49046728e4262f796b1d1dd597d288d Mon Sep 17 00:00:00 2001
From e8e425059101d8c719a8aea674f1c1da3d9a1085 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sun, 26 May 2013 19:42:08 +0200
Subject: d3dx9_36: Implement ID3DXFontImpl_DrawText.
@@ -21,7 +21,7 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
1 file changed, 210 insertions(+), 19 deletions(-)

diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index dd1243e..368c784 100644
index dd1243e..7152dab 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -36,8 +36,29 @@ struct d3dx_font
@@ -97,7 +97,7 @@ index dd1243e..368c784 100644
iface, sprite, debugstr_a(string), count, wine_dbgstr_rect(rect), format, color);
- return 1;
+
+ if (!string || !count)
+ if (!string || count <= 0)
+ return 0;
+
+ countW = MultiByteToWideChar(CP_ACP, 0, string, count, NULL, 0);
@@ -124,7 +124,7 @@ index dd1243e..368c784 100644
iface, sprite, debugstr_w(string), count, wine_dbgstr_rect(rect), format, color);
- return 1;
+
+ if (!string || !count)
+ if (!string || count <= 0)
+ return 0;
+
+ /* Strip terminating NULL characters */
@@ -329,5 +329,5 @@ index dd1243e..368c784 100644
return D3D_OK;
}
--
2.2.1
2.4.5

@@ -0,0 +1,39 @@
From 85b9819021a4e4b8f31050f5e894eb36b56e8cba Mon Sep 17 00:00:00 2001
From: Martin Storsjo <martin@martin.st>
Date: Thu, 23 Jul 2015 10:36:06 +0300
Subject: ntdll: Handle partial image load config structs. (try 3)

Some DLLs have a struct that only is large enough to contain the fields
that are relevant. Don't require the full struct to be available;
only make sure that it is large enough to contain the SecurityCookie
field.

This fixes loading ucrtbase.dll (from the redistributable visual
studio 2015 c++ runtime), which requires the security cookie to be
initialized. The 32 bit version of this DLL had loadcfg_size == 64,
where offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) == 60.
That is, SecurityCookie is the last field included in the struct in
that case.

This fixes loading ucrtbase.dll.
---
dlls/ntdll/virtual.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index ff947da..479ca79 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1320,7 +1320,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz

loadcfg = RtlImageDirectoryEntryToData( (HMODULE)ptr, TRUE,
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG, &loadcfg_size );
- if (loadcfg && loadcfg_size >= sizeof(*loadcfg))
+ if (loadcfg &&
+ loadcfg_size >= offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) + sizeof(loadcfg->SecurityCookie))
set_security_cookie((ULONG_PTR *)loadcfg->SecurityCookie);

/* set the image protections */
--
2.4.5

@@ -0,0 +1,30 @@
From e365fdbc966b3aab4dbfced4c651965cc8cd9c23 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 21 Jul 2015 20:33:47 +0200
Subject: ntdll: Validate SecurityCookie pointer before dereferencing.

---
dlls/ntdll/virtual.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 479ca79..2fd8198 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1320,9 +1320,11 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz

loadcfg = RtlImageDirectoryEntryToData( (HMODULE)ptr, TRUE,
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG, &loadcfg_size );
- if (loadcfg &&
- loadcfg_size >= offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) + sizeof(loadcfg->SecurityCookie))
+ if (loadcfg && loadcfg_size >= offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) + sizeof(loadcfg->SecurityCookie) &&
+ (ULONG_PTR)ptr <= loadcfg->SecurityCookie && loadcfg->SecurityCookie <= (ULONG_PTR)ptr + total_size - sizeof(ULONG_PTR))
+ {
set_security_cookie((ULONG_PTR *)loadcfg->SecurityCookie);
+ }

/* set the image protections */

--
2.4.5

@@ -0,0 +1,2 @@
Fixes: Fix loading of libraries with incomplete IMAGE_LOAD_CONFIG_DIRECTORY struct
Fixes: [38949] Fix security cookie handling for UPX compressed executables