Rebase against fee112f90accd80805e9b499b9f8917661f76cba.

This commit is contained in:
Zebediah Figura 2019-01-24 21:06:01 -06:00
parent b39ac4692c
commit 04c8f24337
5 changed files with 84 additions and 150 deletions

View File

@ -1,2 +1,3 @@
Fixes: [31910] Add stub for NtContinue
Fixes: [45572] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of NtContinue)
Depends: winebuild-Fake_Dlls

View File

@ -1,44 +1,21 @@
From a6f1c5b7034160cb86659f59c929fb227e53dac6 Mon Sep 17 00:00:00 2001
From 84aadc0cb7a6929906fc2d4a4d1591ef9e6b10ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 5 May 2017 05:40:50 +0200
Subject: [PATCH] ntdll: Create thread to update user_shared_data time values
when necessary.
---
dlls/kernel32/cpu.c | 4 +--
dlls/ntdll/loader.c | 31 ++++++++++++++++++++++
dlls/ntdll/ntdll_misc.h | 3 +++
dlls/ntdll/thread.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-----
dlls/ntdll/virtual.c | 17 ++++++++++++
5 files changed, 116 insertions(+), 9 deletions(-)
dlls/ntdll/loader.c | 31 ++++++++++++++++++
dlls/ntdll/ntdll_misc.h | 3 ++
dlls/ntdll/thread.c | 70 ++++++++++++++++++++++++++++++++++++-----
dlls/ntdll/virtual.c | 17 ++++++++++
4 files changed, 114 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index a8f014c..e2780aa 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -46,7 +46,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(reg);
-#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000)
+extern KSHARED_USER_DATA* CDECL __wine_user_shared_data(void);
/****************************************************************************
* QueryPerformanceCounter (KERNEL32.@)
@@ -206,7 +206,7 @@ BOOL WINAPI IsProcessorFeaturePresent (
DWORD feature /* [in] Feature number, (PF_ constants from "winnt.h") */)
{
if (feature < PROCESSOR_FEATURE_MAX)
- return SHARED_DATA->ProcessorFeatures[feature];
+ return __wine_user_shared_data()->ProcessorFeatures[feature];
else
return FALSE;
}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 3e95e51..cceb6b0 100644
index ace3676f..003ef60e 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3436,6 +3436,36 @@ static void load_global_options(void)
@@ -3465,6 +3465,36 @@ static void load_global_options(void)
}
@ -75,7 +52,7 @@ index 3e95e51..cceb6b0 100644
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
@@ -3465,6 +3495,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
@@ -3493,6 +3523,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
if (!peb->ProcessParameters->WindowTitle.Buffer)
peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName;
version_init( wm->ldr.FullDllName.Buffer );
@ -84,10 +61,10 @@ index 3e95e51..cceb6b0 100644
virtual_set_large_address_space();
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 5def773..661ba8b 100644
index f7f7e8ec..910d1031 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -191,6 +191,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
@@ -190,6 +190,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
@ -98,7 +75,7 @@ index 5def773..661ba8b 100644
/* completion */
extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index c034d70..d6523f7 100644
index 0b405818..243175f9 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -44,6 +44,7 @@
@ -120,7 +97,7 @@ index c034d70..d6523f7 100644
static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0};
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
@@ -358,18 +361,71 @@ static ULONG_PTR get_image_addr(void)
@@ -357,18 +360,71 @@ static ULONG_PTR get_image_addr(void)
*/
BYTE* CDECL __wine_user_shared_data(void)
{
@ -197,7 +174,7 @@ index c034d70..d6523f7 100644
/***********************************************************************
* thread_init
*
@@ -400,7 +456,7 @@ void thread_init(void)
@@ -399,7 +455,7 @@ void thread_init(void)
MESSAGE( "wine: failed to map the shared user data: %08x\n", status );
exit(1);
}
@ -207,10 +184,10 @@ index c034d70..d6523f7 100644
/* allocate and initialize the PEB */
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index b200d0d..fd6e3cb 100644
index 030c6588..24b42f91 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2013,6 +2013,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2009,6 +2009,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
{
NTSTATUS ret = STATUS_ACCESS_VIOLATION;
void *page = ROUND_ADDR( addr, page_mask );
@ -218,7 +195,7 @@ index b200d0d..fd6e3cb 100644
sigset_t sigset;
BYTE vprot;
@@ -2038,7 +2039,23 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2034,7 +2035,23 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
ret = STATUS_SUCCESS;
}
}
@ -243,5 +220,5 @@ index b200d0d..fd6e3cb 100644
}
--
1.9.1
2.20.1

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "f5d7d9cccc941024f1532a9ac23427d07810f337"
echo "fee112f90accd80805e9b499b9f8917661f76cba"
}
# Show version information
@ -398,7 +398,6 @@ patch_enable_all ()
enable_ws2_32_getaddrinfo="$1"
enable_ws2_32_getsockopt="$1"
enable_wtsapi32_EnumerateProcesses="$1"
enable_wtsapi32_WTSQueryUserToken="$1"
enable_wuauserv_Dummy_Service="$1"
enable_wusa_MSU_Package_Installer="$1"
enable_xaudio2_7_CreateFX_FXEcho="$1"
@ -1355,9 +1354,6 @@ patch_enable ()
wtsapi32-EnumerateProcesses)
enable_wtsapi32_EnumerateProcesses="$2"
;;
wtsapi32-WTSQueryUserToken)
enable_wtsapi32_WTSQueryUserToken="$2"
;;
wuauserv-Dummy_Service)
enable_wuauserv_Dummy_Service="$2"
;;
@ -1812,13 +1808,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
enable_wined3d_UAV_Counters=1
fi
if test "$enable_winebuild_Fake_Dlls" -eq 1; then
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
abort "Patchset ntdll-User_Shared_Data disabled, but winebuild-Fake_Dlls depends on that."
fi
enable_ntdll_User_Shared_Data=1
fi
if test "$enable_wineboot_ProxySettings" -eq 1; then
if test "$enable_wineboot_DriveSerial" -gt 1; then
abort "Patchset wineboot-DriveSerial disabled, but wineboot-ProxySettings depends on that."
@ -2030,6 +2019,20 @@ if test "$enable_ntdll_NtDevicePath" -eq 1; then
enable_ntdll_Pipe_SpecialCharacters=1
fi
if test "$enable_ntdll_NtContinue" -eq 1; then
if test "$enable_winebuild_Fake_Dlls" -gt 1; then
abort "Patchset winebuild-Fake_Dlls disabled, but ntdll-NtContinue depends on that."
fi
enable_winebuild_Fake_Dlls=1
fi
if test "$enable_winebuild_Fake_Dlls" -eq 1; then
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
abort "Patchset ntdll-User_Shared_Data disabled, but winebuild-Fake_Dlls depends on that."
fi
enable_ntdll_User_Shared_Data=1
fi
if test "$enable_ntdll_LdrInitializeThunk" -eq 1; then
if test "$enable_advapi32_Token_Integrity_Level" -gt 1; then
abort "Patchset advapi32-Token_Integrity_Level disabled, but ntdll-LdrInitializeThunk depends on that."
@ -4330,7 +4333,7 @@ fi
# | * [#29168] Update user shared data at realtime
# |
# | Modified files:
# | * dlls/kernel32/cpu.c, dlls/ntdll/loader.c, dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/tests/time.c,
# | * dlls/ntdll/loader.c, dlls/ntdll/nt.c, dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/tests/time.c,
# | dlls/ntdll/thread.c, dlls/ntdll/virtual.c, dlls/ntoskrnl.exe/instr.c
# |
if test "$enable_ntdll_User_Shared_Data" -eq 1; then
@ -4728,8 +4731,57 @@ if test "$enable_ntdll_NtAccessCheck" -eq 1; then
) >> "$patchlist"
fi
# Patchset winebuild-Fake_Dlls
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data
# |
# | This patchset fixes the following Wine bugs:
# | * [#21232] Chromium-based browser engines (Chrome, Opera, Comodo Dragon, SRWare Iron) crash on startup unless '--no-
# | sandbox' is used (native API sandboxing/hooking scheme incompatible with Wine)
# | * [#42741] StarCraft I: 1.18 PTR fails to initialize ClientSdk.dll
# | * [#45349] Multiple applications and games crash due to missing support for 64-bit syscall thunks (StreetFighter V)
# |
# | Modified files:
# | * dlls/dbghelp/cpu_i386.c, dlls/kernel32/tests/loader.c, dlls/krnl386.exe16/kernel.c,
# | dlls/krnl386.exe16/kernel16_private.h, dlls/krnl386.exe16/ne_module.c, dlls/krnl386.exe16/ne_segment.c,
# | dlls/krnl386.exe16/task.c, dlls/krnl386.exe16/thunk.c, dlls/krnl386.exe16/wowthunk.c, dlls/ntdll/signal_i386.c,
# | dlls/ntdll/signal_x86_64.c, dlls/ntdll/tests/exception.c, dlls/ntdll/thread.c, dlls/system.drv16/system.c,
# | dlls/toolhelp.dll16/toolhelp.c, dlls/user.exe16/message.c, dlls/user.exe16/user.c, dlls/user.exe16/window.c,
# | include/winternl.h, libs/wine/loader.c, tools/winebuild/build.h, tools/winebuild/import.c, tools/winebuild/parser.c,
# | tools/winebuild/relay.c, tools/winebuild/res32.c, tools/winebuild/spec16.c, tools/winebuild/spec32.c,
# | tools/winebuild/utils.c
# |
if test "$enable_winebuild_Fake_Dlls" -eq 1; then
patch_apply winebuild-Fake_Dlls/0001-kernel32-tests-Add-basic-tests-for-fake-dlls.patch
patch_apply winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch
patch_apply winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch
patch_apply winebuild-Fake_Dlls/0004-winebuild-Use-multipass-label-system-to-generate-fak.patch
patch_apply winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch
patch_apply winebuild-Fake_Dlls/0006-winebuild-Add-syscall-thunks-in-fake-dlls.patch
patch_apply winebuild-Fake_Dlls/0007-winebuild-Fix-size-of-relocation-information-in-fake.patch
patch_apply winebuild-Fake_Dlls/0008-winebuild-Try-to-make-sure-RVA-matches-between-fake-.patch
patch_apply winebuild-Fake_Dlls/0009-libs-wine-Use-same-file-alignment-for-fake-and-built.patch
patch_apply winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch
(
printf '%s\n' '+ { "Michael Müller", "kernel32/tests: Add basic tests for fake dlls.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "krnl386.exe16: Do not abuse WOW32Reserved field for 16-bit stack address.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Generate syscall thunks for ntdll exports.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Use multipass label system to generate fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Add stub functions in fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Add syscall thunks in fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Fix size of relocation information in fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Try to make sure RVA matches between fake and builtin DLLs.", 1 },';
printf '%s\n' '+ { "Michael Müller", "libs/wine: Use same file alignment for fake and builtin DLLs.", 1 },';
printf '%s\n' '+ { "Michael Müller", "tools/winebuild: Add syscall thunks for 64 bit.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-NtContinue
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls
# |
# | This patchset fixes the following Wine bugs:
# | * [#31910] Add stub for NtContinue
# | * [#45572] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of NtContinue)
@ -6995,52 +7047,6 @@ if test "$enable_wineboot_ProxySettings" -eq 1; then
) >> "$patchlist"
fi
# Patchset winebuild-Fake_Dlls
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data
# |
# | This patchset fixes the following Wine bugs:
# | * [#21232] Chromium-based browser engines (Chrome, Opera, Comodo Dragon, SRWare Iron) crash on startup unless '--no-
# | sandbox' is used (native API sandboxing/hooking scheme incompatible with Wine)
# | * [#42741] StarCraft I: 1.18 PTR fails to initialize ClientSdk.dll
# | * [#45349] Multiple applications and games crash due to missing support for 64-bit syscall thunks (StreetFighter V)
# |
# | Modified files:
# | * dlls/dbghelp/cpu_i386.c, dlls/kernel32/tests/loader.c, dlls/krnl386.exe16/kernel.c,
# | dlls/krnl386.exe16/kernel16_private.h, dlls/krnl386.exe16/ne_module.c, dlls/krnl386.exe16/ne_segment.c,
# | dlls/krnl386.exe16/task.c, dlls/krnl386.exe16/thunk.c, dlls/krnl386.exe16/wowthunk.c, dlls/ntdll/signal_i386.c,
# | dlls/ntdll/signal_x86_64.c, dlls/ntdll/tests/exception.c, dlls/ntdll/thread.c, dlls/system.drv16/system.c,
# | dlls/toolhelp.dll16/toolhelp.c, dlls/user.exe16/message.c, dlls/user.exe16/user.c, dlls/user.exe16/window.c,
# | include/winternl.h, libs/wine/loader.c, tools/winebuild/build.h, tools/winebuild/import.c, tools/winebuild/parser.c,
# | tools/winebuild/relay.c, tools/winebuild/res32.c, tools/winebuild/spec16.c, tools/winebuild/spec32.c,
# | tools/winebuild/utils.c
# |
if test "$enable_winebuild_Fake_Dlls" -eq 1; then
patch_apply winebuild-Fake_Dlls/0001-kernel32-tests-Add-basic-tests-for-fake-dlls.patch
patch_apply winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch
patch_apply winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch
patch_apply winebuild-Fake_Dlls/0004-winebuild-Use-multipass-label-system-to-generate-fak.patch
patch_apply winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch
patch_apply winebuild-Fake_Dlls/0006-winebuild-Add-syscall-thunks-in-fake-dlls.patch
patch_apply winebuild-Fake_Dlls/0007-winebuild-Fix-size-of-relocation-information-in-fake.patch
patch_apply winebuild-Fake_Dlls/0008-winebuild-Try-to-make-sure-RVA-matches-between-fake-.patch
patch_apply winebuild-Fake_Dlls/0009-libs-wine-Use-same-file-alignment-for-fake-and-built.patch
patch_apply winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch
(
printf '%s\n' '+ { "Michael Müller", "kernel32/tests: Add basic tests for fake dlls.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "krnl386.exe16: Do not abuse WOW32Reserved field for 16-bit stack address.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Generate syscall thunks for ntdll exports.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Use multipass label system to generate fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Add stub functions in fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Add syscall thunks in fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Fix size of relocation information in fake dlls.", 1 },';
printf '%s\n' '+ { "Michael Müller", "winebuild: Try to make sure RVA matches between fake and builtin DLLs.", 1 },';
printf '%s\n' '+ { "Michael Müller", "libs/wine: Use same file alignment for fake and builtin DLLs.", 1 },';
printf '%s\n' '+ { "Michael Müller", "tools/winebuild: Add syscall thunks for 64 bit.", 1 },';
) >> "$patchlist"
fi
# Patchset winecfg-Libraries
# |
# | Modified files:
@ -7908,21 +7914,6 @@ if test "$enable_wtsapi32_EnumerateProcesses" -eq 1; then
) >> "$patchlist"
fi
# Patchset wtsapi32-WTSQueryUserToken
# |
# | This patchset fixes the following Wine bugs:
# | * [#39663] Improve WTSQueryUserToken stub to make GOG Galaxy happy
# |
# | Modified files:
# | * dlls/wtsapi32/wtsapi32.c
# |
if test "$enable_wtsapi32_WTSQueryUserToken" -eq 1; then
patch_apply wtsapi32-WTSQueryUserToken/0001-wtsapi32-Improve-WTSQueryUserToken-stub.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "wtsapi32: Improve WTSQueryUserToken stub.", 2 },';
) >> "$patchlist"
fi
# Patchset wuauserv-Dummy_Service
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,34 +0,0 @@
From ed5c597acaf69d26f736c90502946292eeef6e40 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 11 Feb 2016 19:07:36 +0100
Subject: wtsapi32: Improve WTSQueryUserToken stub. (v2)
---
dlls/wtsapi32/wtsapi32.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c
index c668604..6f8223c 100644
--- a/dlls/wtsapi32/wtsapi32.c
+++ b/dlls/wtsapi32/wtsapi32.c
@@ -243,7 +243,16 @@ BOOL WINAPI WTSQuerySessionInformationW(
BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
{
FIXME("%u %p\n", session_id, token);
- return FALSE;
+
+ if (!token)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
+ GetCurrentProcess(), token,
+ 0, FALSE, DUPLICATE_SAME_ACCESS);
}
/************************************************************
--
2.7.1

View File

@ -1 +0,0 @@
Fixes: [39663] Improve WTSQueryUserToken stub to make GOG Galaxy happy