From ecc4fe6d6a0809fdebc8e294939a9a1d7b57abe0 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Feb 2019 21:57:06 -0600 Subject: [PATCH] Rebase against f7b3120991df02ecaa975c18c6421fedb48ae731. --- ...d8-Improve-ValidateVertexShader-stub.patch | 151 ------------------ ...3d8-Improve-ValidatePixelShader-stub.patch | 28 ++-- ...to-determine-module-basename-into-se.patch | 118 +++++++------- ...tdll-Implement-get_redirect-function.patch | 33 ++-- ...-Implement-loader-redirection-scheme.patch | 119 +++++++------- ...t-HashLinks-field-in-LDR-module-data.patch | 40 ++--- patches/patchinstall.sh | 20 +-- ...32-Fix-compile-error-on-older-gnutls.patch | 75 --------- ...ub-implementation-of-Wow64Transition.patch | 23 +-- 9 files changed, 183 insertions(+), 424 deletions(-) delete mode 100644 patches/d3d8-ValidateShader/0001-d3d8-Improve-ValidateVertexShader-stub.patch delete mode 100644 patches/secur32-compile-fix/0001-secur32-Fix-compile-error-on-older-gnutls.patch diff --git a/patches/d3d8-ValidateShader/0001-d3d8-Improve-ValidateVertexShader-stub.patch b/patches/d3d8-ValidateShader/0001-d3d8-Improve-ValidateVertexShader-stub.patch deleted file mode 100644 index 8a0daff1..00000000 --- a/patches/d3d8-ValidateShader/0001-d3d8-Improve-ValidateVertexShader-stub.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 577b48296711a6ad2bd507687a05f3aac9d7a54a Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 14 Jan 2017 07:50:36 +0100 -Subject: [PATCH] d3d8: Improve ValidateVertexShader stub. - ---- - dlls/d3d8/d3d8_main.c | 39 ++++++++++++++++++++++----------------- - dlls/d3d8/tests/device.c | 40 +++++++++++++++++++++++++--------------- - 2 files changed, 47 insertions(+), 32 deletions(-) - -diff --git a/dlls/d3d8/d3d8_main.c b/dlls/d3d8/d3d8_main.c -index 5fbd165..c48b397 100644 ---- a/dlls/d3d8/d3d8_main.c -+++ b/dlls/d3d8/d3d8_main.c -@@ -64,33 +64,38 @@ IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version) - * boolean seems always passed as 0 or 1, but other values work as well... - * toto result? - */ --HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL boolean, DWORD* toto) -+HRESULT WINAPI ValidateVertexShader(DWORD *vertexshader, DWORD *reserved1, DWORD *reserved2, -+ BOOL return_error, char **errors) - { -- HRESULT ret; -- static BOOL warned; -+ const char *message = ""; -+ HRESULT hr = E_FAIL; - -- if (TRACE_ON(d3d8) || !warned) { -- FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, boolean, toto); -- warned = TRUE; -- } -+ TRACE("(%p %p %p %d %p): semi-stub\n", vertexshader, reserved1, reserved2, return_error, errors); - -- if (!vertexshader) -- return E_FAIL; -- -- if (reserved1 || reserved2) -- return E_FAIL; -+ if (!vertexshader) -+ { -+ message = "(Global Validation Error) Version Token: Code pointer cannot be NULL.\n"; -+ goto done; -+ } - -- switch(*vertexshader) { -+ switch (*vertexshader) -+ { - case 0xFFFE0101: - case 0xFFFE0100: -- ret=S_OK; -+ hr = S_OK; - break; -+ - default: - WARN("Invalid shader version token %#x.\n", *vertexshader); -- ret=E_FAIL; -- } -+ message = "(Global Validation Error) Version Token: Unsupported vertex shader version.\n"; -+ } - -- return ret; -+done: -+ if (!return_error) message = ""; -+ if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 1))) -+ strcpy(*errors, message); -+ -+ return hr; - } - - /*********************************************************************** -diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c -index 884cdb1..6b9e70d 100644 ---- a/dlls/d3d8/tests/device.c -+++ b/dlls/d3d8/tests/device.c -@@ -51,7 +51,7 @@ struct device_desc - - static DEVMODEW registry_mode; - --static HRESULT (WINAPI *ValidateVertexShader)(DWORD *, DWORD *, DWORD *, int, DWORD *); -+static HRESULT (WINAPI *ValidateVertexShader)(DWORD *, DWORD *, DWORD *, BOOL, char **); - static HRESULT (WINAPI *ValidatePixelShader)(DWORD *, DWORD *, int, DWORD *); - - static BOOL (WINAPI *pGetCursorInfo)(PCURSORINFO); -@@ -4369,18 +4369,31 @@ static void test_validate_vs(void) - 0x00000009, 0xc0080000, 0x90e40000, 0xa0e40003, /* dp4 oPos.w, v0, c3 */ - 0x0000ffff, /* end */ - }; -+ char *errors; - HRESULT hr; - - hr = ValidateVertexShader(0, 0, 0, 0, 0); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - hr = ValidateVertexShader(0, 0, 0, 1, 0); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -+ -+ errors = (void *)0xdeadbeef; -+ hr = ValidateVertexShader(0, 0, 0, 0, &errors); -+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -+ ok(!strcmp(errors, ""), "Got unexpected string '%s'.\n", errors); -+ HeapFree(GetProcessHeap(), 0, errors); -+ -+ errors = (void *)0xdeadbeef; -+ hr = ValidateVertexShader(0, 0, 0, 1, &errors); -+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -+ ok(strstr(errors, "Validation Error") != NULL, "Got unexpected string '%s'.\n", errors); -+ HeapFree(GetProcessHeap(), 0, errors); -+ - hr = ValidateVertexShader(vs, 0, 0, 0, 0); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); -- - hr = ValidateVertexShader(vs, 0, 0, 1, 0); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); -- /* Seems to do some version checking. */ -+ - *vs = 0xfffe0100; /* vs_1_0 */ - hr = ValidateVertexShader(vs, 0, 0, 0, 0); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); -@@ -4388,21 +4401,18 @@ static void test_validate_vs(void) - *vs = 0xfffe0102; /* bogus version */ - hr = ValidateVertexShader(vs, 0, 0, 1, 0); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -- /* I've seen that applications always pass the 2nd and 3rd parameter as 0. -- * Simple test with non-zero parameters. */ -- *vs = 0xfffe0101; /* vs_1_1 */ -- hr = ValidateVertexShader(vs, vs, 0, 1, 0); -+ -+ errors = (void *)0xdeadbeef; -+ hr = ValidateVertexShader(vs, 0, 0, 0, &errors); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -+ ok(!strcmp(errors, ""), "Got unexpected string '%s'.\n", errors); -+ HeapFree(GetProcessHeap(), 0, errors); - -- hr = ValidateVertexShader(vs, 0, vs, 1, 0); -+ errors = (void *)0xdeadbeef; -+ hr = ValidateVertexShader(vs, 0, 0, 1, &errors); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -- /* I've seen the 4th parameter always passed as either 0 or 1, but passing -- * other values doesn't seem to hurt. */ -- hr = ValidateVertexShader(vs, 0, 0, 12345, 0); -- ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); -- /* What is the 5th parameter? The following seems to work ok. */ -- hr = ValidateVertexShader(vs, 0, 0, 1, vs); -- ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); -+ ok(strstr(errors, "Validation Error") != NULL, "Got unexpected string '%s'.\n", errors); -+ HeapFree(GetProcessHeap(), 0, errors); - } - - static void test_validate_ps(void) --- -1.9.1 - diff --git a/patches/d3d8-ValidateShader/0002-d3d8-Improve-ValidatePixelShader-stub.patch b/patches/d3d8-ValidateShader/0002-d3d8-Improve-ValidatePixelShader-stub.patch index 2dde114d..46b635c2 100644 --- a/patches/d3d8-ValidateShader/0002-d3d8-Improve-ValidatePixelShader-stub.patch +++ b/patches/d3d8-ValidateShader/0002-d3d8-Improve-ValidatePixelShader-stub.patch @@ -1,4 +1,4 @@ -From f13fda7095a5fa275232f7440d7737a54c1f1c6c Mon Sep 17 00:00:00 2001 +From a26d43a10fb5de70732970b20a29ce4437b33076 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 14 Jan 2017 07:54:39 +0100 Subject: [PATCH] d3d8: Improve ValidatePixelShader stub. @@ -9,10 +9,10 @@ Subject: [PATCH] d3d8: Improve ValidatePixelShader stub. 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/dlls/d3d8/d3d8_main.c b/dlls/d3d8/d3d8_main.c -index c48b397..6feb8e5 100644 +index 17f35c90..7b28bdf1 100644 --- a/dlls/d3d8/d3d8_main.c +++ b/dlls/d3d8/d3d8_main.c -@@ -100,39 +100,36 @@ done: +@@ -105,39 +105,36 @@ done: /*********************************************************************** * ValidatePixelShader (D3D8.@) @@ -70,19 +70,19 @@ index c48b397..6feb8e5 100644 void d3d8_resource_cleanup(struct d3d8_resource *resource) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c -index 6b9e70d..4a4c0e5 100644 +index 315640d3..6f8354f4 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c -@@ -52,7 +52,7 @@ struct device_desc +@@ -53,7 +53,7 @@ struct device_desc static DEVMODEW registry_mode; - static HRESULT (WINAPI *ValidateVertexShader)(DWORD *, DWORD *, DWORD *, BOOL, char **); + static HRESULT (WINAPI *ValidateVertexShader)(const DWORD *, const DWORD *, const D3DCAPS8 *, BOOL, char **); -static HRESULT (WINAPI *ValidatePixelShader)(DWORD *, DWORD *, int, DWORD *); +static HRESULT (WINAPI *ValidatePixelShader)(DWORD *, DWORD *, BOOL, char **); static BOOL (WINAPI *pGetCursorInfo)(PCURSORINFO); -@@ -4427,33 +4427,39 @@ static void test_validate_ps(void) +@@ -4474,33 +4474,39 @@ static void test_validate_ps(void) 0x00000005, 0x800f0000, 0xb0e40000, 0x80e40000, /* mul r0, t0, r0 */ 0x0000ffff, /* end */ }; @@ -116,12 +116,6 @@ index 6b9e70d..4a4c0e5 100644 + + errors = (void *)0xdeadbeef; + hr = ValidatePixelShader(ps, 0, 0, &errors); -+ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); -+ ok(!strcmp(errors, ""), "Got unexpected string '%s'.\n", errors); -+ HeapFree(GetProcessHeap(), 0, errors); -+ -+ errors = (void *)0xdeadbeef; -+ hr = ValidatePixelShader(ps, 0, 1, &errors); ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - /* I've seen the 3rd parameter always passed as either 0 or 1, but passing - * other values doesn't seem to hurt. */ @@ -130,11 +124,17 @@ index 6b9e70d..4a4c0e5 100644 - /* What is the 4th parameter? The following seems to work ok. */ - hr = ValidatePixelShader(ps, 0, 1, ps); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ++ ok(!strcmp(errors, ""), "Got unexpected string '%s'.\n", errors); ++ HeapFree(GetProcessHeap(), 0, errors); ++ ++ errors = (void *)0xdeadbeef; ++ hr = ValidatePixelShader(ps, 0, 1, &errors); ++ ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(strstr(errors, "Validation Error") != NULL, "Got unexpected string '%s'.\n", errors); + HeapFree(GetProcessHeap(), 0, errors); } static void test_volume_get_container(void) -- -1.9.1 +2.20.1 diff --git a/patches/ntdll-DllRedirects/0003-ntdll-Move-code-to-determine-module-basename-into-se.patch b/patches/ntdll-DllRedirects/0003-ntdll-Move-code-to-determine-module-basename-into-se.patch index a7e45f76..913d94f8 100644 --- a/patches/ntdll-DllRedirects/0003-ntdll-Move-code-to-determine-module-basename-into-se.patch +++ b/patches/ntdll-DllRedirects/0003-ntdll-Move-code-to-determine-module-basename-into-se.patch @@ -1,84 +1,84 @@ -From 964df09f462ea704710aff50633ecbd7024884f7 Mon Sep 17 00:00:00 2001 +From 7fd1463fccfb8ef7dc9632ab779c49050906b5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 13 Dec 2014 02:57:41 +0100 Subject: [PATCH] ntdll: Move code to determine module basename into separate function. --- - dlls/ntdll/loadorder.c | 44 ++++++++++++++++++++++++++++++-------------- - 1 file changed, 30 insertions(+), 14 deletions(-) + dlls/ntdll/loadorder.c | 46 +++++++++++++++++++++++++++--------------- + 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c -index 2d50fc4..eb27d60 100644 +index c013bb2b..eb7e6723 100644 --- a/dlls/ntdll/loadorder.c +++ b/dlls/ntdll/loadorder.c -@@ -452,23 +452,15 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons +@@ -450,6 +450,34 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons + return ret; + } - - /*************************************************************************** -- * get_load_order (internal) -+ * get_module_basename (internal) - * - * Return the loadorder of a module. - * The system directory and '.dll' extension is stripped from the path. - */ --enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) ++ /*************************************************************************** ++ * get_module_basename (internal) ++ * ++ * Return the loadorder of a module. ++ * The system directory and '.dll' extension is stripped from the path. ++ */ +static WCHAR* get_module_basename( const WCHAR *path, WCHAR **basename ) - { -- enum loadorder ret = LO_INVALID; -- HANDLE std_key, app_key = 0; -- WCHAR *module, *basename; - int len; -- -- if (!init_done) init_load_order(); -- std_key = get_standard_key(); -- if (app_name) app_key = get_app_key( app_name ); -- -- TRACE("looking for %s\n", debugstr_w(path)); ++{ ++ int len; + WCHAR *module; - - /* Strip path information if the module resides in the system directory - */ -@@ -479,12 +471,36 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) - if (!strchrW( p, '\\' ) && !strchrW( p, '/' )) path = p; - } - -- if (!(len = strlenW(path))) return ret; -- if (!(module = RtlAllocateHeap( GetProcessHeap(), 0, (len + 2) * sizeof(WCHAR) ))) return ret; ++ ++ /* Strip path information if the module resides in the system directory ++ */ ++ if (!strncmpiW( system_dir, path, strlenW( system_dir ))) ++ { ++ const WCHAR *p = path + strlenW( system_dir ); ++ while (*p == '\\' || *p == '/') p++; ++ if (!strchrW( p, '\\' ) && !strchrW( p, '/' )) path = p; ++ } ++ + if (!(len = strlenW(path))) return NULL; + if (!(module = RtlAllocateHeap( GetProcessHeap(), 0, (len + 2) * sizeof(WCHAR) ))) return NULL; - strcpyW( module+1, path ); /* reserve module[0] for the wildcard char */ -- basename = (WCHAR *)get_basename( module+1 ); ++ strcpyW( module+1, path ); /* reserve module[0] for the wildcard char */ + *basename = (WCHAR *)get_basename( module+1 ); - - if (len >= 4) remove_dll_ext( module + 1 + len - 4 ); ++ ++ if (len >= 4) remove_dll_ext( module + 1 + len - 4 ); + return module; +} -+ -+ -+/*************************************************************************** -+ * get_load_order (internal) -+ * -+ * Return the loadorder of a module. -+ * The system directory and '.dll' extension is stripped from the path. -+ */ -+enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) -+{ -+ enum loadorder ret = LO_INVALID; -+ HANDLE std_key, app_key = 0; -+ WCHAR *module, *basename; -+ -+ if (!init_done) init_load_order(); -+ std_key = get_standard_key(); -+ if (app_name) app_key = get_app_key( app_name ); -+ -+ TRACE("looking for %s\n", debugstr_w(path)); -+ + + /*************************************************************************** + * get_load_order (internal) +@@ -464,7 +492,6 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n + HANDLE std_key, app_key = 0; + const WCHAR *path = nt_name->Buffer; + WCHAR *module, *basename; +- int len; + + if (!init_done) init_load_order(); + std_key = get_standard_key(); +@@ -473,21 +500,8 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n + + TRACE("looking for %s\n", debugstr_w(path)); + +- /* Strip path information if the module resides in the system directory +- */ +- if (!strncmpiW( system_dir, path, strlenW( system_dir ))) +- { +- const WCHAR *p = path + strlenW( system_dir ); +- while (*p == '\\' || *p == '/') p++; +- if (!strchrW( p, '\\' ) && !strchrW( p, '/' )) path = p; +- } +- +- if (!(len = strlenW(path))) return ret; +- if (!(module = RtlAllocateHeap( GetProcessHeap(), 0, (len + 2) * sizeof(WCHAR) ))) return ret; +- strcpyW( module+1, path ); /* reserve module[0] for the wildcard char */ +- basename = (WCHAR *)get_basename( module+1 ); +- +- if (len >= 4) remove_dll_ext( module + 1 + len - 4 ); + if (!(module = get_module_basename(path, &basename))) + return ret; /* first explicit module name */ if ((ret = get_load_order_value( std_key, app_key, module+1 )) != LO_INVALID) -- -1.9.1 +2.20.1 diff --git a/patches/ntdll-DllRedirects/0004-ntdll-Implement-get_redirect-function.patch b/patches/ntdll-DllRedirects/0004-ntdll-Implement-get_redirect-function.patch index beadbfaa..bb448b8e 100644 --- a/patches/ntdll-DllRedirects/0004-ntdll-Implement-get_redirect-function.patch +++ b/patches/ntdll-DllRedirects/0004-ntdll-Implement-get_redirect-function.patch @@ -1,15 +1,15 @@ -From 0683c1a5e5093e865f2d3b76db7a5e269155c964 Mon Sep 17 00:00:00 2001 +From 4dfc4b1420d91a8f288aaad946e85c170e7dd214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 13 Dec 2014 03:18:35 +0100 Subject: [PATCH] ntdll: Implement get_redirect function. --- - dlls/ntdll/loadorder.c | 118 +++++++++++++++++++++++++++++++++++++++++++++--- + dlls/ntdll/loadorder.c | 118 +++++++++++++++++++++++++++++++++++++--- dlls/ntdll/ntdll_misc.h | 1 + 2 files changed, 112 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c -index eb27d60..9f536ff 100644 +index eb7e6723..c88666ad 100644 --- a/dlls/ntdll/loadorder.c +++ b/dlls/ntdll/loadorder.c @@ -344,11 +344,11 @@ static HANDLE open_app_reg_key( const WCHAR *sub_key, const WCHAR *app_name ) @@ -40,10 +40,11 @@ index eb27d60..9f536ff 100644 { static const WCHAR DllOverridesW[] = {'\\','D','l','l','O','v','e','r','r','i','d','e','s',0}; static HANDLE app_key = (HANDLE)-1; -@@ -379,6 +379,41 @@ static HANDLE get_app_key( const WCHAR *app_name ) +@@ -378,6 +378,41 @@ static HANDLE get_app_key( const WCHAR *app_name ) + } - /*************************************************************************** ++/*************************************************************************** + * get_redirect_standard_key + * + * Return a handle to the standard DllRedirects registry section. @@ -78,12 +79,11 @@ index eb27d60..9f536ff 100644 +} + + -+/*************************************************************************** + /*************************************************************************** * get_registry_string * - * Load a registry string for a given module. -@@ -450,6 +485,32 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons - return ret; +@@ -416,6 +451,32 @@ static enum loadorder get_registry_load_order( HANDLE hkey, const WCHAR *module + return str ? parse_load_order( str ) : LO_INVALID; } + /*************************************************************************** @@ -114,8 +114,8 @@ index eb27d60..9f536ff 100644 +} /*************************************************************************** - * get_module_basename (internal) -@@ -494,10 +555,10 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) + * get_load_order_value +@@ -494,11 +555,11 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n WCHAR *module, *basename; if (!init_done) init_load_order(); @@ -123,13 +123,14 @@ index eb27d60..9f536ff 100644 - if (app_name) app_key = get_app_key( app_name ); + std_key = get_override_standard_key(); + if (app_name) app_key = get_override_app_key( app_name ); + if (!strncmpW( path, nt_prefixW, 4 )) path += 4; - TRACE("looking for %s\n", debugstr_w(path)); + TRACE("looking up loadorder for %s\n", debugstr_w(path)); if (!(module = get_module_basename(path, &basename))) return ret; -@@ -531,3 +592,46 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) +@@ -532,3 +593,46 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n RtlFreeHeap( GetProcessHeap(), 0, module ); return ret; } @@ -177,17 +178,17 @@ index eb27d60..9f536ff 100644 + return ret; +} diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 561e23f..3c2424c 100644 +index 5b32abc5..eff7d579 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -258,6 +258,7 @@ enum loadorder +@@ -217,6 +217,7 @@ enum loadorder }; - extern enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) DECLSPEC_HIDDEN; + extern enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name ) DECLSPEC_HIDDEN; +extern WCHAR* get_redirect( const WCHAR *app_name, const WCHAR *path, BYTE *buffer, ULONG size ) DECLSPEC_HIDDEN; struct debug_info { -- -1.9.1 +2.20.1 diff --git a/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch b/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch index 7fca4809..65f3aa40 100644 --- a/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch +++ b/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch @@ -1,4 +1,4 @@ -From a135acee2139211fa5f8ef8fb841f24b2d575ad8 Mon Sep 17 00:00:00 2001 +From 7867b70c1096e5cf40677b6c15ff2900fb2697f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 13 Dec 2014 05:34:48 +0100 Subject: [PATCH] ntdll: Implement loader redirection scheme. @@ -8,16 +8,16 @@ Subject: [PATCH] ntdll: Implement loader redirection scheme. 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 094c454d..b2ca761e 100644 +index c1976ef5..8ab33a11 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -110,6 +110,7 @@ struct builtin_load_info { - const WCHAR *load_path; - const WCHAR *filename; + const WCHAR *load_path; + const UNICODE_STRING *filename; + const WCHAR *fakemodule; - NTSTATUS status; - WINE_MODREF *wm; + NTSTATUS status; + WINE_MODREF *wm; }; @@ -134,7 +135,8 @@ static WINE_MODREF *cached_modref; static WINE_MODREF *current_modref; @@ -29,7 +29,7 @@ index 094c454d..b2ca761e 100644 static NTSTATUS process_attach( WINE_MODREF *wm, LPVOID lpReserved ); static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size, DWORD ordinal, LPCWSTR load_path ); -@@ -510,7 +512,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS +@@ -515,7 +517,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS if (!(wm = find_basename_module( mod_name ))) { TRACE( "delay loading %s for '%s'\n", debugstr_w(mod_name), forward ); @@ -38,7 +38,7 @@ index 094c454d..b2ca761e 100644 !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) { if (!imports_fixup_done && current_modref) -@@ -681,7 +683,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP +@@ -686,7 +688,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP { ascii_to_unicode( buffer, name, len ); buffer[len] = 0; @@ -47,7 +47,7 @@ index 094c454d..b2ca761e 100644 } else /* need to allocate a larger buffer */ { -@@ -689,7 +691,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP +@@ -694,7 +696,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP if (!ptr) return FALSE; ascii_to_unicode( ptr, name, len ); ptr[len] = 0; @@ -56,7 +56,7 @@ index 094c454d..b2ca761e 100644 RtlFreeHeap( GetProcessHeap(), 0, ptr ); } -@@ -975,7 +977,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void * +@@ -980,7 +982,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void * prev = current_modref; current_modref = wm; @@ -65,65 +65,65 @@ index 094c454d..b2ca761e 100644 current_modref = prev; if (status) { -@@ -1063,7 +1065,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) +@@ -1068,7 +1070,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) * Allocate a WINE_MODREF structure and add it to the process list * The loader_section must be locked while calling this function. */ --static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) -+static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename, LPCWSTR fakemodule ) +-static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name ) ++static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name, const WCHAR *fakemodule ) { WINE_MODREF *wm; const WCHAR *p; -@@ -1077,7 +1079,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) +@@ -1082,7 +1084,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name wm->ldr.TlsIndex = -1; wm->ldr.LoadCount = 1; -- RtlCreateUnicodeString( &wm->ldr.FullDllName, filename ); -+ RtlCreateUnicodeString( &wm->ldr.FullDllName, fakemodule ? fakemodule : filename ); +- RtlCreateUnicodeString( &wm->ldr.FullDllName, nt_name->Buffer + 4 /* \??\ prefix */ ); ++ RtlCreateUnicodeString( &wm->ldr.FullDllName, fakemodule ? fakemodule : nt_name->Buffer + 4 /* \??\ prefix */ ); if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\\' ))) p++; else p = wm->ldr.FullDllName.Buffer; RtlInitUnicodeString( &wm->ldr.BaseDllName, p ); -@@ -1744,7 +1746,7 @@ static void load_builtin_callback( void *module, const char *filename ) +@@ -1752,7 +1754,7 @@ static void load_builtin_callback( void *module, const char *filename ) return; } -- wm = alloc_module( module, fullname ); -+ wm = alloc_module( module, fullname, builtin_load_info->fakemodule ); - RtlFreeHeap( GetProcessHeap(), 0, fullname ); +- wm = alloc_module( module, &nt_name ); ++ wm = alloc_module( module, &nt_name, builtin_load_info->fakemodule ); + RtlFreeUnicodeString( &nt_name ); if (!wm) { -@@ -2007,8 +2009,8 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info ) +@@ -2015,8 +2017,8 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info ) /****************************************************************************** * load_native_dll (internal) */ --static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, +-static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name, HANDLE file, - DWORD flags, WINE_MODREF** pwm, struct stat *st ) -+static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, LPCWSTR fakemodule, ++static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name, LPCWSTR fakemodule, + HANDLE file, DWORD flags, WINE_MODREF** pwm, struct stat *st ) { void *module; HANDLE mapping; -@@ -2051,7 +2053,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, +@@ -2059,7 +2061,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam /* create the MODREF */ -- if (!(wm = alloc_module( module, name ))) -+ if (!(wm = alloc_module( module, name, fakemodule ))) +- if (!(wm = alloc_module( module, nt_name ))) ++ if (!(wm = alloc_module( module, nt_name, fakemodule ))) { if (module) NtUnmapViewOfSection( NtCurrentProcess(), module ); return STATUS_NO_MEMORY; -@@ -2119,8 +2121,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, +@@ -2127,8 +2129,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam /*********************************************************************** * load_builtin_dll */ --static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file, +-static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name, HANDLE file, - DWORD flags, WINE_MODREF** pwm ) -+static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, LPCWSTR fakemodule, ++static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name, LPCWSTR fakemodule, + HANDLE file, DWORD flags, WINE_MODREF** pwm ) { char error[256], dllname[MAX_PATH]; const WCHAR *name, *p; -@@ -2140,6 +2142,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file, +@@ -2148,6 +2150,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_na */ info.load_path = load_path; info.filename = NULL; @@ -131,7 +131,7 @@ index 094c454d..b2ca761e 100644 info.status = STATUS_SUCCESS; info.wm = NULL; -@@ -2484,7 +2487,8 @@ overflow: +@@ -2513,7 +2516,8 @@ found: * Load a PE style module according to the load order. * The loader_section must be locked while calling this function. */ @@ -140,8 +140,8 @@ index 094c454d..b2ca761e 100644 + DWORD flags, WINE_MODREF** pwm ) { enum loadorder loadorder; - WCHAR buffer[64]; -@@ -2522,6 +2526,30 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ + WINE_MODREF *main_exe; +@@ -2540,6 +2544,30 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ } main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress ); @@ -151,65 +151,65 @@ index 094c454d..b2ca761e 100644 + { + BYTE buffer2[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + MAX_PATH * sizeof(WCHAR)]; + WCHAR *redirect = get_redirect( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, -+ filename, buffer2, sizeof(buffer2) ); ++ nt_name.Buffer, buffer2, sizeof(buffer2) ); + if (redirect) + { + FIXME("Loader redirect from %s to %s\n", debugstr_w(libname), debugstr_w(redirect)); + -+ nts = load_dll( load_path, redirect, filename, flags, pwm ); ++ nts = load_dll( load_path, redirect, nt_name.Buffer, flags, pwm ); + + if (nts == STATUS_SUCCESS) + { + if (handle) NtClose( handle ); -+ if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename ); ++ RtlFreeUnicodeString( &nt_name ); + return nts; + } + else -+ ERR("Failed to load redirected DLL %s, falling back to %s\n", debugstr_w(redirect), debugstr_w(libname)); ++ ERR("Failed to load redirected DLL %s, falling back to %s\n", debugstr_w(redirect), debugstr_w(libname)); + } + } + - loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, filename ); + loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, &nt_name ); if (handle && is_fake_dll( handle )) -@@ -2544,22 +2572,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ +@@ -2562,22 +2590,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ if (!handle) nts = STATUS_DLL_NOT_FOUND; else { -- nts = load_native_dll( load_path, filename, handle, flags, pwm, &st ); -+ nts = load_native_dll( load_path, filename, fakemodule, handle, flags, pwm, &st ); +- nts = load_native_dll( load_path, &nt_name, handle, flags, pwm, &st ); ++ nts = load_native_dll( load_path, &nt_name, fakemodule, handle, flags, pwm, &st ); if (nts == STATUS_INVALID_IMAGE_NOT_MZ) /* not in PE format, maybe it's a builtin */ -- nts = load_builtin_dll( load_path, filename, handle, flags, pwm ); -+ nts = load_builtin_dll( load_path, filename, fakemodule, handle, flags, pwm ); +- nts = load_builtin_dll( load_path, &nt_name, handle, flags, pwm ); ++ nts = load_builtin_dll( load_path, &nt_name, fakemodule, handle, flags, pwm ); } if (nts == STATUS_DLL_NOT_FOUND && loadorder == LO_NATIVE_BUILTIN) -- nts = load_builtin_dll( load_path, filename, 0, flags, pwm ); -+ nts = load_builtin_dll( load_path, filename, fakemodule, 0, flags, pwm ); +- nts = load_builtin_dll( load_path, &nt_name, 0, flags, pwm ); ++ nts = load_builtin_dll( load_path, &nt_name, fakemodule, 0, flags, pwm ); break; case LO_BUILTIN: case LO_BUILTIN_NATIVE: case LO_DEFAULT: /* default is builtin,native */ -- nts = load_builtin_dll( load_path, filename, handle, flags, pwm ); -+ nts = load_builtin_dll( load_path, filename, fakemodule, handle, flags, pwm ); +- nts = load_builtin_dll( load_path, &nt_name, handle, flags, pwm ); ++ nts = load_builtin_dll( load_path, &nt_name, fakemodule, handle, flags, pwm ); if (!handle) break; /* nothing else we can try */ /* file is not a builtin library, try without using the specified file */ if (nts != STATUS_SUCCESS) -- nts = load_builtin_dll( load_path, filename, 0, flags, pwm ); -+ nts = load_builtin_dll( load_path, filename, fakemodule, 0, flags, pwm ); +- nts = load_builtin_dll( load_path, &nt_name, 0, flags, pwm ); ++ nts = load_builtin_dll( load_path, &nt_name, fakemodule, 0, flags, pwm ); if (nts == STATUS_SUCCESS && loadorder == LO_DEFAULT && (MODULE_InitDLL( *pwm, DLL_WINE_PREATTACH, NULL ) != STATUS_SUCCESS)) { -@@ -2569,7 +2597,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ +@@ -2587,7 +2615,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ nts = STATUS_DLL_NOT_FOUND; } if (nts == STATUS_DLL_NOT_FOUND && loadorder != LO_BUILTIN) -- nts = load_native_dll( load_path, filename, handle, flags, pwm, &st ); -+ nts = load_native_dll( load_path, filename, fakemodule, handle, flags, pwm, &st ); +- nts = load_native_dll( load_path, &nt_name, handle, flags, pwm, &st ); ++ nts = load_native_dll( load_path, &nt_name, fakemodule, handle, flags, pwm, &st ); break; } -@@ -2602,7 +2630,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags, +@@ -2614,7 +2642,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags, RtlEnterCriticalSection( &loader_section ); if (!path_name) path_name = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; @@ -218,19 +218,20 @@ index 094c454d..b2ca761e 100644 if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) { -@@ -3578,13 +3606,13 @@ void __wine_process_init(void) - /* setup the load callback and create ntdll modref */ +@@ -3578,14 +3606,14 @@ void __wine_process_init(void) wine_dll_set_callback( load_builtin_callback ); -- if ((status = load_builtin_dll( NULL, kernel32W, 0, 0, &wm )) != STATUS_SUCCESS) -+ if ((status = load_builtin_dll( NULL, kernel32W, NULL, 0, 0, &wm )) != STATUS_SUCCESS) + RtlInitUnicodeString( &nt_name, kernel32W ); +- if ((status = load_builtin_dll( NULL, &nt_name, 0, 0, &wm )) != STATUS_SUCCESS) ++ if ((status = load_builtin_dll( NULL, &nt_name, NULL, 0, 0, &wm )) != STATUS_SUCCESS) { MESSAGE( "wine: could not load kernel32.dll, status %x\n", status ); exit(1); } -- if ((status = load_builtin_dll( NULL, wow64cpuW, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS) -+ if ((status = load_builtin_dll( NULL, wow64cpuW, NULL, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS) + RtlInitUnicodeString( &nt_name, wow64cpuW ); +- if ((status = load_builtin_dll( NULL, &nt_name, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS) ++ if ((status = load_builtin_dll( NULL, &nt_name, NULL, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS) Wow64Transition = wow64cpu_wm->ldr.BaseAddress; else WARN( "could not load wow64cpu.dll, status %#x\n", status ); diff --git a/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch b/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch index 76f09ba5..73fd71e0 100644 --- a/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch +++ b/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch @@ -1,16 +1,16 @@ -From 4cf5c404e02fb82de6ce8568a5b6ac6ccfcbe23e Mon Sep 17 00:00:00 2001 +From 33e1022c63ace91f96c3e1376412bcb17a3a4289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 3 Apr 2017 05:30:27 +0200 Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data. --- - dlls/kernel32/tests/loader.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ - dlls/ntdll/loader.c | 65 +++++++++++++++++++++++++++++++++++++ - include/winternl.h | 6 ++-- + dlls/kernel32/tests/loader.c | 76 ++++++++++++++++++++++++++++++++++++ + dlls/ntdll/loader.c | 65 ++++++++++++++++++++++++++++++ + include/winternl.h | 6 ++- 3 files changed, 145 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c -index 165c05e..d26b787 100644 +index 165c05ea..d26b7879 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -30,6 +30,7 @@ @@ -111,7 +111,7 @@ index 165c05e..d26b787 100644 test_Loader(); } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index a47dfe0..a8599bd 100644 +index e7a9c2ca..83b95fa9 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -93,6 +93,9 @@ static const char * const reason_names[] = @@ -124,10 +124,11 @@ index a47dfe0..a8599bd 100644 /* internal representation of 32bit modules. per process. */ typedef struct _wine_modref { -@@ -376,6 +379,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module ) +@@ -375,6 +378,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module ) + } } - /************************************************************************* ++/************************************************************************* + * hash_basename + * + * Calculates the bucket index of a dll using the basename. @@ -173,11 +174,10 @@ index a47dfe0..a8599bd 100644 + } +} + -+/************************************************************************* + /************************************************************************* * get_modref * - * Looks for the referenced HMODULE in the current process -@@ -1094,7 +1143,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) +@@ -1099,7 +1148,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name &wm->ldr.InLoadOrderModuleList); InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList); @@ -190,7 +190,7 @@ index a47dfe0..a8599bd 100644 if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT)) { -@@ -1768,6 +1822,7 @@ static void load_builtin_callback( void *module, const char *filename ) +@@ -1776,6 +1830,7 @@ static void load_builtin_callback( void *module, const char *filename ) /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -198,7 +198,7 @@ index a47dfe0..a8599bd 100644 /* FIXME: free the modref */ builtin_load_info->status = STATUS_DLL_NOT_FOUND; return; -@@ -2081,6 +2136,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, +@@ -2089,6 +2144,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -206,7 +206,7 @@ index a47dfe0..a8599bd 100644 /* FIXME: there are several more dangling references * left. Including dlls loaded by this dll before the -@@ -3097,6 +3153,7 @@ static void free_modref( WINE_MODREF *wm ) +@@ -3089,6 +3145,7 @@ static void free_modref( WINE_MODREF *wm ) { RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -214,7 +214,7 @@ index a47dfe0..a8599bd 100644 if (wm->ldr.InInitializationOrderModuleList.Flink) RemoveEntryList(&wm->ldr.InInitializationOrderModuleList); -@@ -3424,6 +3481,9 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, +@@ -3416,6 +3473,9 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, RemoveEntryList( &wm->ldr.InMemoryOrderModuleList ); InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList ); @@ -224,15 +224,15 @@ index a47dfe0..a8599bd 100644 if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0, NULL )) != STATUS_SUCCESS) { ERR( "Main exe initialization for %s failed, status %x\n", -@@ -3570,6 +3630,7 @@ void __wine_process_init(void) - NTSTATUS status; +@@ -3563,6 +3623,7 @@ void __wine_process_init(void) ANSI_STRING func_name; + UNICODE_STRING nt_name; void (* DECLSPEC_NORETURN CDECL init_func)(void); + DWORD i; thread_init(); -@@ -3579,6 +3640,10 @@ void __wine_process_init(void) +@@ -3572,6 +3633,10 @@ void __wine_process_init(void) load_global_options(); @@ -244,7 +244,7 @@ index a47dfe0..a8599bd 100644 wine_dll_set_callback( load_builtin_callback ); diff --git a/include/winternl.h b/include/winternl.h -index 9dfc440..ee89bc3 100644 +index 9dfc4407..ee89bc31 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2198,8 +2198,7 @@ typedef struct _LDR_MODULE @@ -268,5 +268,5 @@ index 9dfc440..ee89bc3 100644 typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA -- -1.9.1 +2.20.1 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index bc3233b9..dde49bfe 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "957a1f0216995c14c3a3fe737358578a506af707" + echo "f7b3120991df02ecaa975c18c6421fedb48ae731" } # Show version information @@ -259,7 +259,6 @@ patch_enable_all () enable_qwave_QOSCreateHandle="$1" enable_riched20_Class_Tests="$1" enable_riched20_IText_Interface="$1" - enable_secur32_compile_fix="$1" enable_server_ClipCursor="$1" enable_server_Desktop_Refcount="$1" enable_server_FileEndOfFileInformation="$1" @@ -939,9 +938,6 @@ patch_enable () riched20-IText_Interface) enable_riched20_IText_Interface="$2" ;; - secur32-compile-fix) - enable_secur32_compile_fix="$2" - ;; server-ClipCursor) enable_server_ClipCursor="$2" ;; @@ -2855,10 +2851,8 @@ fi # | * dlls/d3d8/d3d8_main.c, dlls/d3d8/tests/device.c # | if test "$enable_d3d8_ValidateShader" -eq 1; then - patch_apply d3d8-ValidateShader/0001-d3d8-Improve-ValidateVertexShader-stub.patch patch_apply d3d8-ValidateShader/0002-d3d8-Improve-ValidatePixelShader-stub.patch ( - printf '%s\n' '+ { "Sebastian Lackner", "d3d8: Improve ValidateVertexShader stub.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "d3d8: Improve ValidatePixelShader stub.", 1 },'; ) >> "$patchlist" fi @@ -5527,18 +5521,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then ) >> "$patchlist" fi -# Patchset secur32-compile-fix -# | -# | Modified files: -# | * dlls/secur32/schannel_gnutls.c -# | -if test "$enable_secur32_compile_fix" -eq 1; then - patch_apply secur32-compile-fix/0001-secur32-Fix-compile-error-on-older-gnutls.patch - ( - printf '%s\n' '+ { "Alistair Leslie-Hughes", "secur32: Fix compile error on older gnutls.", 2 },'; - ) >> "$patchlist" -fi - # Patchset server-ClipCursor # | # | This patchset fixes the following Wine bugs: diff --git a/patches/secur32-compile-fix/0001-secur32-Fix-compile-error-on-older-gnutls.patch b/patches/secur32-compile-fix/0001-secur32-Fix-compile-error-on-older-gnutls.patch deleted file mode 100644 index f1866e7f..00000000 --- a/patches/secur32-compile-fix/0001-secur32-Fix-compile-error-on-older-gnutls.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 44fc8063acc1575f4bbf7d8dfe3f519e8365b9cc Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 8 Feb 2019 09:53:13 +1100 -Subject: [PATCH v2] secur32: Fix compile error on older gnutls. - -Signed-off-by: Alistair Leslie-Hughes ---- - dlls/secur32/schannel_gnutls.c | 23 +++++++++++++++++++++-- - 1 file changed, 21 insertions(+), 2 deletions(-) - -diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c -index ddb10ac..d14e6f3 100644 ---- a/dlls/secur32/schannel_gnutls.c -+++ b/dlls/secur32/schannel_gnutls.c -@@ -54,6 +54,12 @@ static int (*pgnutls_cipher_get_block_size)(gnutls_cipher_algorithm_t); - /* Not present in gnutls version < 3.4.0. */ - static int (*pgnutls_privkey_export_x509)(gnutls_privkey_t, gnutls_x509_privkey_t *); - -+static int (*pgnutls_privkey_import_rsa_raw)(gnutls_privkey_t, const gnutls_datum_t *, -+ const gnutls_datum_t *, const gnutls_datum_t *, -+ const gnutls_datum_t *, const gnutls_datum_t *, -+ const gnutls_datum_t *, const gnutls_datum_t *, -+ const gnutls_datum_t *); -+ - static void *libgnutls_handle; - #define MAKE_FUNCPTR(f) static typeof(f) * p##f - MAKE_FUNCPTR(gnutls_alert_get); -@@ -79,7 +85,6 @@ MAKE_FUNCPTR(gnutls_perror); - MAKE_FUNCPTR(gnutls_protocol_get_version); - MAKE_FUNCPTR(gnutls_priority_set_direct); - MAKE_FUNCPTR(gnutls_privkey_deinit); --MAKE_FUNCPTR(gnutls_privkey_import_rsa_raw); - MAKE_FUNCPTR(gnutls_privkey_init); - MAKE_FUNCPTR(gnutls_record_get_max_size); - MAKE_FUNCPTR(gnutls_record_recv); -@@ -138,6 +143,16 @@ static int compat_gnutls_privkey_export_x509(gnutls_privkey_t privkey, gnutls_x5 - return GNUTLS_E_UNKNOWN_PK_ALGORITHM; - } - -+static int compat_gnutls_privkey_import_rsa_raw(gnutls_privkey_t key, const gnutls_datum_t *p1, -+ const gnutls_datum_t *p2, const gnutls_datum_t *p3, -+ const gnutls_datum_t *p4, const gnutls_datum_t *p5, -+ const gnutls_datum_t *p6, const gnutls_datum_t *p7, -+ const gnutls_datum_t *p8) -+{ -+ FIXME("\n"); -+ return GNUTLS_E_UNKNOWN_PK_ALGORITHM; -+} -+ - static ssize_t schan_pull_adapter(gnutls_transport_ptr_t transport, - void *buff, size_t buff_len) - { -@@ -897,7 +912,6 @@ BOOL schan_imp_init(void) - LOAD_FUNCPTR(gnutls_protocol_get_version) - LOAD_FUNCPTR(gnutls_priority_set_direct) - LOAD_FUNCPTR(gnutls_privkey_deinit) -- LOAD_FUNCPTR(gnutls_privkey_import_rsa_raw) - LOAD_FUNCPTR(gnutls_privkey_init) - LOAD_FUNCPTR(gnutls_record_get_max_size); - LOAD_FUNCPTR(gnutls_record_recv); -@@ -924,6 +938,11 @@ BOOL schan_imp_init(void) - WARN("gnutls_privkey_export_x509 not found\n"); - pgnutls_privkey_export_x509 = compat_gnutls_privkey_export_x509; - } -+ if (!(pgnutls_privkey_import_rsa_raw = wine_dlsym(libgnutls_handle, "gnutls_privkey_import_rsa_raw", NULL, 0))) -+ { -+ WARN("gnutls_privkey_import_rsa_raw not found\n"); -+ pgnutls_privkey_import_rsa_raw = compat_gnutls_privkey_import_rsa_raw; -+ } - - ret = pgnutls_global_init(); - if (ret != GNUTLS_E_SUCCESS) --- -1.9.1 - diff --git a/patches/wow64cpu-Wow64Transition/0002-ntdll-Add-a-stub-implementation-of-Wow64Transition.patch b/patches/wow64cpu-Wow64Transition/0002-ntdll-Add-a-stub-implementation-of-Wow64Transition.patch index bf20c6c2..7762f46d 100644 --- a/patches/wow64cpu-Wow64Transition/0002-ntdll-Add-a-stub-implementation-of-Wow64Transition.patch +++ b/patches/wow64cpu-Wow64Transition/0002-ntdll-Add-a-stub-implementation-of-Wow64Transition.patch @@ -1,18 +1,18 @@ -From af247c7d7c66b23aaa62054d2f7eeb20f8428e26 Mon Sep 17 00:00:00 2001 +From 087eb0c8e28afd243d5e92d5de09db5446c2d9cb Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 8 Aug 2018 20:00:15 -0500 Subject: [PATCH 2/2] ntdll: Add a stub implementation of Wow64Transition. --- - dlls/ntdll/loader.c | 10 +++++++++- + dlls/ntdll/loader.c | 11 ++++++++++- dlls/ntdll/ntdll.spec | 1 + - 2 files changed, 10 insertions(+), 1 deletion(-) + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 631e8bd9..f7a64a80 100644 +index e7a9c2ca..c1976ef5 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -3546,15 +3546,17 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +@@ -3550,15 +3550,17 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) return TRUE; } @@ -30,13 +30,14 @@ index 631e8bd9..f7a64a80 100644 + WINE_MODREF *wm, *wow64cpu_wm; NTSTATUS status; ANSI_STRING func_name; - void (* DECLSPEC_NORETURN CDECL init_func)(void); -@@ -3575,6 +3577,12 @@ void __wine_process_init(void) + UNICODE_STRING nt_name; +@@ -3581,6 +3583,13 @@ void __wine_process_init(void) MESSAGE( "wine: could not load kernel32.dll, status %x\n", status ); exit(1); } + -+ if ((status = load_builtin_dll( NULL, wow64cpuW, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS) ++ RtlInitUnicodeString( &nt_name, wow64cpuW ); ++ if ((status = load_builtin_dll( NULL, &nt_name, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS) + Wow64Transition = wow64cpu_wm->ldr.BaseAddress; + else + WARN( "could not load wow64cpu.dll, status %#x\n", status ); @@ -45,10 +46,10 @@ index 631e8bd9..f7a64a80 100644 if ((status = LdrGetProcedureAddress( wm->ldr.BaseAddress, &func_name, 0, (void **)&init_func )) != STATUS_SUCCESS) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index c2e2fb1c..cb55df3a 100644 +index 649774f4..b584d962 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec -@@ -1046,6 +1046,7 @@ +@@ -1048,6 +1048,7 @@ @ stdcall WinSqmIsOptedIn() @ stdcall WinSqmSetDWORD(ptr long long) @ stdcall WinSqmStartSession(ptr long long) @@ -57,5 +58,5 @@ index c2e2fb1c..cb55df3a 100644 @ stdcall -private ZwAccessCheck(ptr long long ptr ptr ptr ptr ptr) NtAccessCheck @ stdcall -private ZwAccessCheckAndAuditAlarm(ptr long ptr ptr ptr long ptr long ptr ptr ptr) NtAccessCheckAndAuditAlarm -- -2.19.2 +2.20.1