diff --git a/patches/advapi32-Token_Integrity_Level/0008-ntdll-Implement-process-token-elevation-through-mani.patch b/patches/advapi32-Token_Integrity_Level/0008-ntdll-Implement-process-token-elevation-through-mani.patch index 60c16278..46b14649 100644 --- a/patches/advapi32-Token_Integrity_Level/0008-ntdll-Implement-process-token-elevation-through-mani.patch +++ b/patches/advapi32-Token_Integrity_Level/0008-ntdll-Implement-process-token-elevation-through-mani.patch @@ -1,4 +1,4 @@ -From 0e9d9a6aa1b65dae1c8dc34d6d5fb27aa73f96ea Mon Sep 17 00:00:00 2001 +From 1f2b1bafabfd457836f18741f178b3745e129c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 5 Aug 2017 03:39:55 +0200 Subject: [PATCH] ntdll: Implement process token elevation through manifests. @@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Implement process token elevation through manifests. 5 files changed, 67 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 51addaaf983..71efed5fa32 100644 +index 0c8f05285c4..92ae87c6e6d 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -3903,6 +3903,32 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow +@@ -3898,6 +3898,32 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow } @@ -48,15 +48,15 @@ index 51addaaf983..71efed5fa32 100644 /*********************************************************************** * load_global_options */ -@@ -4363,6 +4389,7 @@ void __wine_process_init(void) - 's','y','s','t','e','m','3','2','\\', +@@ -4359,6 +4385,7 @@ void __wine_process_init(void) 'k','e','r','n','e','l','3','2','.','d','l','l',0}; + void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL; RTL_USER_PROCESS_PARAMETERS *params; + ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION runlevel; WINE_MODREF *wm; NTSTATUS status; ANSI_STRING func_name; -@@ -4466,6 +4493,16 @@ void __wine_process_init(void) +@@ -4453,6 +4480,16 @@ void __wine_process_init(void) unix_funcs->virtual_set_large_address_space(); @@ -74,10 +74,10 @@ index 51addaaf983..71efed5fa32 100644 RemoveEntryList( &wm->ldr.InLoadOrderLinks ); InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks ); diff --git a/server/process.c b/server/process.c -index 80a091b0c72..34010b301c3 100644 +index ac85cace95d..52604ec4d61 100644 --- a/server/process.c +++ b/server/process.c -@@ -1112,6 +1112,14 @@ struct process_snapshot *process_snap( int *count ) +@@ -1115,6 +1115,14 @@ struct process_snapshot *process_snap( int *count ) return snapshot; } @@ -105,10 +105,10 @@ index 5b83e111a6f..dfe5c4e52d8 100644 /* console functions */ extern void inherit_console( struct thread *parent_thread, struct process *parent, diff --git a/server/protocol.def b/server/protocol.def -index d8618a5c964..89adc93305c 100644 +index 7315f8ac4ea..901c380b721 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -3762,6 +3762,13 @@ struct handle_info +@@ -3763,6 +3763,13 @@ struct handle_info @END diff --git a/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch b/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch index 184c393c..48d844f5 100644 --- a/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch +++ b/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch @@ -1,18 +1,18 @@ -From 79b09aa1d8a91ae923d9f951e1c316492a5edb39 Mon Sep 17 00:00:00 2001 +From dea43afaba40a2ab0744a4e5ac8a931ab81df5c2 Mon Sep 17 00:00:00 2001 From: Qian Hong Date: Fri, 17 Apr 2015 00:59:02 +0800 Subject: [PATCH] ntdll/tests: Added tests to set disposition on file which is mapped to memory --- - dlls/ntdll/tests/file.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++- + dlls/ntdll/tests/file.c | 71 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 0f4281d..cafafa1 100644 +index 9971a2b5702..4f6c0d7f847 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c -@@ -2695,12 +2695,13 @@ static void test_file_disposition_information(void) +@@ -2844,12 +2844,13 @@ static void test_file_disposition_information(void) { char tmp_path[MAX_PATH], buffer[MAX_PATH + 16]; DWORD dirpos; @@ -27,9 +27,9 @@ index 0f4281d..cafafa1 100644 GetTempPathA( MAX_PATH, tmp_path ); -@@ -3049,6 +3050,74 @@ todo_wine +@@ -3195,6 +3196,74 @@ todo_wine + ok( !fileDeleted, "Directory shouldn't have been deleted\n" ); fileDeleted = RemoveDirectoryA( buffer ); - todo_wine ok( fileDeleted, "Directory should have been deleted\n" ); + + /* cannot set disposition on file with file mapping opened */ @@ -103,5 +103,5 @@ index 0f4281d..cafafa1 100644 static void test_file_name_information(void) -- -1.9.1 +2.26.2 diff --git a/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch b/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch index 10c16a39..65492e8e 100644 --- a/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch +++ b/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch @@ -1,4 +1,4 @@ -From 3a361998b65a72b219bc342cc88d6fe66cc9e45b Mon Sep 17 00:00:00 2001 +From f41db2526967d4e662fdcf8f602701af6e4e19f8 Mon Sep 17 00:00:00 2001 From: Qian Hong Date: Fri, 17 Apr 2015 18:39:59 +0800 Subject: [PATCH] server: Do not allow to set disposition on file which has a @@ -10,10 +10,10 @@ Subject: [PATCH] server: Do not allow to set disposition on file which has a 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index c8979f6f..49c2de22 100644 +index 4f6c0d7f847..776de6d0cc8 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c -@@ -3060,7 +3060,6 @@ todo_wine +@@ -3205,7 +3205,6 @@ todo_wine ok( mapping != NULL, "failed to create file mapping\n"); fdi.DoDeleteFile = TRUE; res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); @@ -21,7 +21,7 @@ index c8979f6f..49c2de22 100644 ok( res == STATUS_CANNOT_DELETE, "unexpected FileDispositionInformation result (expected STATUS_CANNOT_DELETE, got %x)\n", res ); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -@@ -3094,7 +3093,6 @@ todo_wine +@@ -3239,7 +3238,6 @@ todo_wine CloseHandle( mapping ); fdi.DoDeleteFile = TRUE; res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); @@ -30,10 +30,10 @@ index c8979f6f..49c2de22 100644 CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; diff --git a/server/fd.c b/server/fd.c -index b700f235..34939d05 100644 +index 0a0683e5bce..2cbbdad6e62 100644 --- a/server/fd.c +++ b/server/fd.c -@@ -2309,6 +2309,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl +@@ -2487,6 +2487,7 @@ static int is_dir_empty( int fd ) static void set_fd_disposition( struct fd *fd, int unlink ) { struct stat st; @@ -41,8 +41,8 @@ index b700f235..34939d05 100644 if (!fd->inode) { -@@ -2342,6 +2343,17 @@ static void set_fd_disposition( struct fd *fd, int unlink ) - return; +@@ -2534,6 +2535,17 @@ static void set_fd_disposition( struct fd *fd, int unlink ) + } } + /* can't unlink files which are mapped to memory */ @@ -60,5 +60,5 @@ index b700f235..34939d05 100644 if (fd->options & FILE_DELETE_ON_CLOSE) fd->closed->unlink = -1; -- -2.19.1 +2.26.2 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 0669eac8..ade27581 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,4 +1,4 @@ -From 875ab1e7ff6b708f15b07537a91406fe83dec681 Mon Sep 17 00:00:00 2001 +From 6f7c87fdffe6aca49a2795eb29821557f20858c2 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. @@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data. 3 files changed, 142 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c -index 5474d543248..2d382d4f326 100644 +index 4bafd0f6349..f8a65e10758 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -30,6 +30,7 @@ @@ -21,7 +21,7 @@ index 5474d543248..2d382d4f326 100644 #include "wine/test.h" #include "delayloadhandler.h" -@@ -3934,6 +3935,79 @@ static void test_LoadPackagedLibrary(void) +@@ -3970,6 +3971,79 @@ static void test_LoadPackagedLibrary(void) h, GetLastError()); } @@ -101,7 +101,7 @@ index 5474d543248..2d382d4f326 100644 START_TEST(loader) { int argc; -@@ -4006,10 +4080,12 @@ START_TEST(loader) +@@ -4042,10 +4116,12 @@ START_TEST(loader) test_InMemoryOrderModuleList(); test_LoadPackagedLibrary(); test_wow64_redirection(); @@ -115,10 +115,10 @@ index 5474d543248..2d382d4f326 100644 test_Loader(); } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 35dc7e1eaa4..d1e5fdeb5b8 100644 +index 0c8f05285c4..ebbd910d6cd 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -120,6 +120,9 @@ static const char * const reason_names[] = +@@ -122,6 +122,9 @@ static const char * const reason_names[] = static const WCHAR dllW[] = {'.','d','l','l',0}; @@ -128,7 +128,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 /* internal representation of 32bit modules. per process. */ typedef struct _wine_modref { -@@ -460,6 +463,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module ) +@@ -462,6 +465,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module ) } } @@ -181,7 +181,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 /************************************************************************* * get_modref * -@@ -1225,7 +1274,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name +@@ -1227,7 +1276,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name &wm->ldr.InLoadOrderLinks); InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderLinks); @@ -194,7 +194,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT)) { -@@ -1850,6 +1904,7 @@ static NTSTATUS build_so_dll_module( const WCHAR *load_path, const UNICODE_STRIN +@@ -1886,6 +1940,7 @@ static NTSTATUS build_so_dll_module( const WCHAR *load_path, const UNICODE_STRIN /* the module has only been inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderLinks); RemoveEntryList(&wm->ldr.InMemoryOrderLinks); @@ -202,7 +202,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 /* FIXME: free the modref */ return status; } -@@ -2393,6 +2448,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam +@@ -2429,6 +2484,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.InLoadOrderLinks); RemoveEntryList(&wm->ldr.InMemoryOrderLinks); @@ -210,7 +210,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 /* FIXME: there are several more dangling references * left. Including dlls loaded by this dll before the -@@ -3609,6 +3665,7 @@ static void free_modref( WINE_MODREF *wm ) +@@ -3649,6 +3705,7 @@ static void free_modref( WINE_MODREF *wm ) { RemoveEntryList(&wm->ldr.InLoadOrderLinks); RemoveEntryList(&wm->ldr.InMemoryOrderLinks); @@ -218,7 +218,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 if (wm->ldr.InInitializationOrderLinks.Flink) RemoveEntryList(&wm->ldr.InInitializationOrderLinks); -@@ -4333,6 +4390,7 @@ void __wine_process_init(void) +@@ -4369,6 +4426,7 @@ void __wine_process_init(void) SIZE_T info_size; TEB *teb; PEB *peb; @@ -226,7 +226,7 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 if (!unix_funcs) load_ntdll_so( ntdll_module, &__wine_spec_nt_header ); -@@ -4360,6 +4418,10 @@ void __wine_process_init(void) +@@ -4389,6 +4447,10 @@ void __wine_process_init(void) load_global_options(); version_init(); @@ -237,21 +237,21 @@ index 35dc7e1eaa4..d1e5fdeb5b8 100644 /* setup the load callback and create ntdll modref */ RtlInitUnicodeString( &nt_name, ntdllW ); status = build_so_dll_module( params->DllPath.Buffer, &nt_name, ntdll_module, 0, &wm ); -@@ -4435,6 +4497,9 @@ void __wine_process_init(void) +@@ -4464,6 +4526,9 @@ void __wine_process_init(void) teb->Tib.StackLimit = stack.StackLimit; teb->DeallocationStack = stack.DeallocationStack; + /* the windows version was not set yet when ntdll and kernel32 were loaded */ + recompute_hash_map(); + - server_init_process_done(); + unix_funcs->server_init_process_done( kernel32_start_process ); } diff --git a/include/winternl.h b/include/winternl.h -index 9df1f0bb800..8625b192cf1 100644 +index acbce20c212..150a3777d4b 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -2330,8 +2330,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY +@@ -2354,8 +2354,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY ULONG Flags; SHORT LoadCount; SHORT TlsIndex; diff --git a/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch b/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch index caf7f628..8432d08a 100644 --- a/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch +++ b/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch @@ -1,17 +1,17 @@ -From f15c706847288555a76b3827b09691b23d7ec57d Mon Sep 17 00:00:00 2001 +From 17b12b07aae111f5dde4f4dca3520ab93487b2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 19 Mar 2017 19:08:34 +0100 Subject: [PATCH] ntdll: Catch windows int 0x2e syscall on i386. --- - dlls/ntdll/signal_i386.c | 5 +++++ + dlls/ntdll/unix/signal_i386.c | 5 +++++ 1 file changed, 5 insertions(+) -diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 78d03f669d7..a134b6d54ab 100644 ---- a/dlls/ntdll/signal_i386.c -+++ b/dlls/ntdll/signal_i386.c -@@ -1731,6 +1731,11 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st +diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c +index 7ae4cda33a6..80fef44d055 100644 +--- a/dlls/ntdll/unix/signal_i386.c ++++ b/dlls/ntdll/unix/signal_i386.c +@@ -1638,6 +1638,11 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st stack->rec.ExceptionInformation[2] = stack->context.Edx; setup_raise_exception( sigcontext, stack ); return TRUE; diff --git a/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch b/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch index 0a39d435..2e659ca0 100644 --- a/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch +++ b/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch @@ -1,4 +1,4 @@ -From cd04d1910294b035bb3858b3ef1bb295aec3a732 Mon Sep 17 00:00:00 2001 +From 3c60ef5d082e5298b113cf0cc93fa2bb44deadba Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 30 Dec 2019 13:27:53 +0300 Subject: [PATCH] ntdll: Support x86_64 syscall emulation. @@ -9,10 +9,10 @@ used in the applications (i. e., that the applications get the number from syscall thunks). Linux specific Seccomp is used for trapping syscalls. --- - configure.ac | 1 + - dlls/ntdll/signal_x86_64.c | 111 +++++++++++++++++++++++++++++++++++++ - tools/winebuild/spec32.c | 9 ++- - 3 files changed, 119 insertions(+), 2 deletions(-) + configure.ac | 1 + + dlls/ntdll/unix/signal_x86_64.c | 109 ++++++++++++++++++++++++++++++++ + tools/winebuild/spec32.c | 9 ++- + 3 files changed, 117 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e61a98455c3..4adeb52d225 100644 @@ -26,19 +26,19 @@ index e61a98455c3..4adeb52d225 100644 linux/serial.h \ linux/types.h \ linux/ucdrom.h \ -diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index dd8b45fa907..a5612abf2b1 100644 ---- a/dlls/ntdll/signal_x86_64.c -+++ b/dlls/ntdll/signal_x86_64.c -@@ -24,6 +24,7 @@ +diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c +index 1d1b879310e..d4dda481127 100644 +--- a/dlls/ntdll/unix/signal_x86_64.c ++++ b/dlls/ntdll/unix/signal_x86_64.c +@@ -28,6 +28,7 @@ #include "wine/port.h" #include +#include + #include #include #include - #include -@@ -59,6 +60,13 @@ +@@ -64,6 +65,13 @@ # include #endif @@ -52,16 +52,16 @@ index dd8b45fa907..a5612abf2b1 100644 #define NONAMELESSUNION #define NONAMELESSSTRUCT #include "ntstatus.h" -@@ -76,6 +84,8 @@ +@@ -78,6 +86,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh); +extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); + - typedef struct _SCOPE_TABLE - { - ULONG Count; -@@ -2480,6 +2490,104 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) + /*********************************************************************** + * signal context platform-specific definitions + */ +@@ -982,6 +992,104 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) return 0; } @@ -166,13 +166,11 @@ index dd8b45fa907..a5612abf2b1 100644 /*********************************************************************** * handle_interrupt -@@ -2793,6 +2901,9 @@ void signal_init_process(void) - sig_act.sa_sigaction = trap_handler; - if (sigaction( SIGTRAP, &sig_act, NULL ) == -1) goto error; - #endif -+ +@@ -1431,6 +1539,7 @@ void signal_init_process(void) + if (sigaction( SIGSEGV, &sig_act, NULL ) == -1) goto error; + if (sigaction( SIGILL, &sig_act, NULL ) == -1) goto error; + if (sigaction( SIGBUS, &sig_act, NULL ) == -1) goto error; + install_bpf(&sig_act); -+ return; error: diff --git a/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch b/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch index db063123..e02f0748 100644 --- a/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch +++ b/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch @@ -1,36 +1,36 @@ -From bd60a4308f3ec1df20328887335b4c95f9be215d Mon Sep 17 00:00:00 2001 +From 42a9d6a0464a17831ae2c16df222f4de7638349e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 4 Oct 2014 02:53:22 +0200 Subject: [PATCH] ntdll: Setup a temporary signal handler during process startup to handle page faults. (v2) --- - dlls/ntdll/ntdll_misc.h | 1 + - dlls/ntdll/signal_arm.c | 6 +++++ - dlls/ntdll/signal_arm64.c | 6 +++++ - dlls/ntdll/signal_i386.c | 53 +++++++++++++++++++++++++++++++++++++ - dlls/ntdll/signal_powerpc.c | 6 +++++ - dlls/ntdll/signal_x86_64.c | 6 +++++ - dlls/ntdll/thread.c | 1 + + dlls/ntdll/unix/loader.c | 1 + + dlls/ntdll/unix/signal_arm.c | 6 ++++ + dlls/ntdll/unix/signal_arm64.c | 7 +++++ + dlls/ntdll/unix/signal_i386.c | 52 ++++++++++++++++++++++++++++++++ + dlls/ntdll/unix/signal_powerpc.c | 6 ++++ + dlls/ntdll/unix/signal_x86_64.c | 6 ++++ + dlls/ntdll/unix/unix_private.h | 1 + 7 files changed, 79 insertions(+) -diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 65c65cc02d8..63a4b597872 100644 ---- a/dlls/ntdll/ntdll_misc.h -+++ b/dlls/ntdll/ntdll_misc.h -@@ -78,6 +78,7 @@ extern LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa) DECLSPEC_HI - extern SIZE_T signal_stack_size DECLSPEC_HIDDEN; - extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN; - extern void signal_init_process(void) DECLSPEC_HIDDEN; -+extern void signal_init_early(void) DECLSPEC_HIDDEN; - extern void version_init(void) DECLSPEC_HIDDEN; - extern void debug_init(void) DECLSPEC_HIDDEN; - extern TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) DECLSPEC_HIDDEN; -diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c -index a09848449a6..c6f7231fec6 100644 ---- a/dlls/ntdll/signal_arm.c -+++ b/dlls/ntdll/signal_arm.c -@@ -792,6 +792,12 @@ void signal_init_process(void) +diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c +index eac43ba42c4..48910dd4d50 100644 +--- a/dlls/ntdll/unix/loader.c ++++ b/dlls/ntdll/unix/loader.c +@@ -1418,6 +1418,7 @@ void __wine_main( int argc, char *argv[], char *envp[] ) + #endif + + virtual_init(); ++ signal_init_early(); + + module = load_ntdll(); + fixup_ntdll_imports( &__wine_spec_nt_header, module ); +diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c +index 1ef3ff6618b..5e0b25cec5d 100644 +--- a/dlls/ntdll/unix/signal_arm.c ++++ b/dlls/ntdll/unix/signal_arm.c +@@ -869,6 +869,12 @@ void signal_init_process(void) exit(1); } @@ -42,13 +42,13 @@ index a09848449a6..c6f7231fec6 100644 +} /*********************************************************************** - * RtlUnwind (NTDLL.@) -diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c -index a9a58a2e7ad..a9c6614794e 100644 ---- a/dlls/ntdll/signal_arm64.c -+++ b/dlls/ntdll/signal_arm64.c -@@ -1047,6 +1047,12 @@ static void usr2_handler( int signal, siginfo_t *siginfo, void *sigcontext ) - restore_context( context, sigcontext ); + * init_thread_context +diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c +index 6c9083664e0..3a4e7d5b9cb 100644 +--- a/dlls/ntdll/unix/signal_arm64.c ++++ b/dlls/ntdll/unix/signal_arm64.c +@@ -791,6 +791,13 @@ void signal_init_process(void) + exit(1); } +/********************************************************************** @@ -57,14 +57,15 @@ index a9a58a2e7ad..a9c6614794e 100644 +void signal_init_early(void) +{ +} - - /********************************************************************** - * signal_init_process -diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 83868f25121..b048b2bc688 100644 ---- a/dlls/ntdll/signal_i386.c -+++ b/dlls/ntdll/signal_i386.c -@@ -1575,6 +1575,31 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st ++ + /*********************************************************************** + * init_thread_context + */ +diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c +index 7ae4cda33a6..1a86b6e05f3 100644 +--- a/dlls/ntdll/unix/signal_i386.c ++++ b/dlls/ntdll/unix/signal_i386.c +@@ -1644,6 +1644,30 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st } @@ -76,19 +77,18 @@ index 83868f25121..b048b2bc688 100644 + */ +static void segv_handler_early( int signal, siginfo_t *siginfo, void *sigcontext ) +{ -+ WORD fs, gs; + ucontext_t *context = sigcontext; -+ init_handler( sigcontext, &fs, &gs ); ++ init_handler( sigcontext ); + -+ switch(get_trap_code(context)) ++ switch (TRAP_sig(context)) + { + case TRAP_x86_PAGEFLT: /* Page fault */ -+ if (!unix_funcs->virtual_handle_fault( siginfo->si_addr, (get_error_code(context) >> 1) & 0x09, TRUE )) ++ if (!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(context) >> 1) & 0x09, TRUE )) + return; + /* fall-through */ + default: -+ WINE_ERR( "Got unexpected trap %d during process initialization\n", get_trap_code(context) ); -+ unix_funcs->abort_thread(1); ++ WINE_ERR( "Got unexpected trap %d during process initialization\n", TRAP_sig(context) ); ++ abort_thread(1); + break; + } +} @@ -96,7 +96,7 @@ index 83868f25121..b048b2bc688 100644 /********************************************************************** * segv_handler * -@@ -1883,6 +1908,34 @@ void signal_init_process(void) +@@ -2243,6 +2267,34 @@ void signal_init_process(void) exit(1); } @@ -129,30 +129,13 @@ index 83868f25121..b048b2bc688 100644 + exit(1); +} - /******************************************************************* - * RtlUnwind (NTDLL.@) -diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c -index 879b2b58c49..f17d6267102 100644 ---- a/dlls/ntdll/signal_powerpc.c -+++ b/dlls/ntdll/signal_powerpc.c -@@ -634,6 +634,12 @@ static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext ) - unix_funcs->abort_thread(0); - } - -+/********************************************************************** -+ * signal_init_early -+ */ -+void signal_init_early(void) -+{ -+} - - /********************************************************************** - * usr1_handler -diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index c6b0fbf618d..bb481ba1b81 100644 ---- a/dlls/ntdll/signal_x86_64.c -+++ b/dlls/ntdll/signal_x86_64.c -@@ -2777,6 +2777,12 @@ void signal_init_process(void) + /*********************************************************************** + * init_thread_context +diff --git a/dlls/ntdll/unix/signal_powerpc.c b/dlls/ntdll/unix/signal_powerpc.c +index f98d6fc9713..fdc5f66d092 100644 +--- a/dlls/ntdll/unix/signal_powerpc.c ++++ b/dlls/ntdll/unix/signal_powerpc.c +@@ -978,6 +978,12 @@ void signal_init_process(void) exit(1); } @@ -163,20 +146,37 @@ index c6b0fbf618d..bb481ba1b81 100644 +{ +} - static ULONG64 get_int_reg( CONTEXT *context, int reg ) - { -diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index d045466f6d2..49daa33ca58 100644 ---- a/dlls/ntdll/thread.c -+++ b/dlls/ntdll/thread.c -@@ -186,6 +186,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) - TEB *teb; + /*********************************************************************** + * signal_exit_thread +diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c +index d4a6e821a4c..98bd7bb8bed 100644 +--- a/dlls/ntdll/unix/signal_x86_64.c ++++ b/dlls/ntdll/unix/signal_x86_64.c +@@ -1415,6 +1415,12 @@ void signal_init_process(void) + exit(1); + } - virtual_init(); -+ signal_init_early(); ++/********************************************************************** ++ * signal_init_early ++ */ ++void signal_init_early(void) ++{ ++} - teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, - &is_wow64, &server_start_time ); + /*********************************************************************** + * init_thread_context +diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h +index 3e61111cba5..1319ca90b96 100644 +--- a/dlls/ntdll/unix/unix_private.h ++++ b/dlls/ntdll/unix/unix_private.h +@@ -163,6 +163,7 @@ extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN; + extern void signal_free_thread( TEB *teb ) DECLSPEC_HIDDEN; + extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN; + extern void signal_init_process(void) DECLSPEC_HIDDEN; ++extern void signal_init_early(void) DECLSPEC_HIDDEN; + extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg, + BOOL suspend, void *relay, TEB *teb ) DECLSPEC_HIDDEN; + extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN; -- 2.26.2 diff --git a/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch b/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch index ad417ed9..7c03bd33 100644 --- a/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch +++ b/patches/ntdll-WRITECOPY/0006-ntdll-Support-WRITECOPY-on-x64.patch @@ -1,19 +1,19 @@ -From aae6e8d097aaa6665a65ec6f896e37b445c371ea Mon Sep 17 00:00:00 2001 +From 38e1b3603dc067d91621b63d157edc339d8a33d8 Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Fri, 24 Apr 2020 14:55:15 -0500 Subject: [PATCH] ntdll: Support WRITECOPY on x64. Signed-off-by: Andrew Wesie --- - dlls/ntdll/signal_x86_64.c | 40 ++++++++++++++++++++++++++++++++++++++ - dlls/ntdll/unix/virtual.c | 2 +- + dlls/ntdll/unix/signal_x86_64.c | 40 +++++++++++++++++++++++++++++++++ + dlls/ntdll/unix/virtual.c | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) -diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index 0eb58d3d149..8fdb800984c 100644 ---- a/dlls/ntdll/signal_x86_64.c -+++ b/dlls/ntdll/signal_x86_64.c -@@ -2575,6 +2575,29 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, struct stack_layout +diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c +index 98bd7bb8bed..1d1b879310e 100644 +--- a/dlls/ntdll/unix/signal_x86_64.c ++++ b/dlls/ntdll/unix/signal_x86_64.c +@@ -1019,6 +1019,29 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, struct stack_layout } @@ -30,12 +30,12 @@ index 0eb58d3d149..8fdb800984c 100644 + switch(TRAP_sig(ucontext)) + { + case TRAP_x86_PAGEFLT: /* Page fault */ -+ if (!unix_funcs->virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, TRUE )) ++ if (!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, TRUE )) + return; + /* fall-through */ + default: + WINE_ERR( "Got unexpected trap %lld during process initialization\n", TRAP_sig(ucontext) ); -+ unix_funcs->abort_thread(1); ++ abort_thread(1); + break; + } +} @@ -43,7 +43,7 @@ index 0eb58d3d149..8fdb800984c 100644 /********************************************************************** * segv_handler * -@@ -2855,6 +2878,23 @@ void signal_init_process(void) +@@ -1420,6 +1443,23 @@ void signal_init_process(void) */ void signal_init_early(void) { @@ -66,12 +66,12 @@ index 0eb58d3d149..8fdb800984c 100644 + exit(1); } - static ULONG64 get_int_reg( CONTEXT *context, int reg ) + /*********************************************************************** diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index c81104bd266..1072907ffdd 100644 +index b20eafb3334..c351c7db0e3 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -816,7 +816,7 @@ static int get_unix_prot( BYTE vprot ) +@@ -818,7 +818,7 @@ static int get_unix_prot( BYTE vprot ) if (vprot & VPROT_READ) prot |= PROT_READ; if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ; diff --git a/patches/ntdll-x86_64_SegDs/0001-ntdll-Report-SegDs-to-be-identical-to-SegSs-on-x86_6.patch b/patches/ntdll-x86_64_SegDs/0001-ntdll-Report-SegDs-to-be-identical-to-SegSs-on-x86_6.patch index 455a3be4..d07ca424 100644 --- a/patches/ntdll-x86_64_SegDs/0001-ntdll-Report-SegDs-to-be-identical-to-SegSs-on-x86_6.patch +++ b/patches/ntdll-x86_64_SegDs/0001-ntdll-Report-SegDs-to-be-identical-to-SegSs-on-x86_6.patch @@ -1,4 +1,4 @@ -From 1178a02719088e81b2e5b35074b4559f60d8a5b1 Mon Sep 17 00:00:00 2001 +From 6fb2e6ef08a7cf1339b39fa753b29092fa76c3df Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 21 Nov 2019 10:44:42 -0600 Subject: [PATCH] ntdll: Report SegDs to be identical to SegSs on x86_64. @@ -8,14 +8,14 @@ Based on a patch by David Torok. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47970 Signed-off-by: Zebediah Figura --- - dlls/ntdll/signal_x86_64.c | 11 ++++++----- + dlls/ntdll/unix/signal_x86_64.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index c372f65b34b..a1797811da3 100644 ---- a/dlls/ntdll/signal_x86_64.c -+++ b/dlls/ntdll/signal_x86_64.c -@@ -1699,11 +1699,6 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) +diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c +index d4a6e821a4c..ebbef9d2fcd 100644 +--- a/dlls/ntdll/unix/signal_x86_64.c ++++ b/dlls/ntdll/unix/signal_x86_64.c +@@ -348,11 +348,6 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) context->SegFs = FS_sig(sigcontext); context->SegGs = GS_sig(sigcontext); context->EFlags = EFL_sig(sigcontext); @@ -27,7 +27,7 @@ index c372f65b34b..a1797811da3 100644 #ifdef ES_sig context->SegEs = ES_sig(sigcontext); #else -@@ -1714,6 +1709,12 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) +@@ -363,6 +358,12 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) #else __asm__("movw %%ss,%0" : "=m" (context->SegSs)); #endif @@ -41,5 +41,5 @@ index c372f65b34b..a1797811da3 100644 context->Dr1 = amd64_thread_data()->dr1; context->Dr2 = amd64_thread_data()->dr2; -- -2.23.0 +2.26.2 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 9c2ce4ce..99f6e5be 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "17529582402ebe27ef975fc7dcb8353f4f95e629" + echo "bf454cc39428fc5299e5c26d9c0ddc6a9277c7ae" } # Show version information @@ -3657,10 +3657,10 @@ fi # | Empires II, MSYS2) # | # | Modified files: -# | * dlls/advapi32/crypt.c, dlls/advapi32/tests/security.c, dlls/kernel32/tests/virtual.c, dlls/ntdll/ntdll_misc.h, -# | dlls/ntdll/signal_arm.c, dlls/ntdll/signal_arm64.c, dlls/ntdll/signal_i386.c, dlls/ntdll/signal_powerpc.c, -# | dlls/ntdll/signal_x86_64.c, dlls/ntdll/thread.c, dlls/ntdll/unix/server.c, dlls/ntdll/unix/virtual.c, -# | dlls/psapi/tests/psapi_main.c +# | * dlls/advapi32/crypt.c, dlls/advapi32/tests/security.c, dlls/kernel32/tests/virtual.c, dlls/ntdll/unix/loader.c, +# | dlls/ntdll/unix/server.c, dlls/ntdll/unix/signal_arm.c, dlls/ntdll/unix/signal_arm64.c, dlls/ntdll/unix/signal_i386.c, +# | dlls/ntdll/unix/signal_powerpc.c, dlls/ntdll/unix/signal_x86_64.c, dlls/ntdll/unix/unix_private.h, +# | dlls/ntdll/unix/virtual.c, dlls/psapi/tests/psapi_main.c # | if test "$enable_ntdll_WRITECOPY" -eq 1; then patch_apply ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch @@ -3930,7 +3930,7 @@ fi # | * [#42647] Implement stub handler for int 0x2e # | # | Modified files: -# | * dlls/ntdll/signal_i386.c +# | * dlls/ntdll/unix/signal_i386.c # | if test "$enable_ntdll_Interrupt_0x2e" -eq 1; then patch_apply ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch @@ -4148,11 +4148,11 @@ fi # | dlls/krnl386.exe16/task.c, dlls/krnl386.exe16/thunk.c, dlls/krnl386.exe16/wowthunk.c, dlls/ntdll/actctx.c, # | dlls/ntdll/directory.c, dlls/ntdll/loader.c, dlls/ntdll/locale.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/path.c, # | dlls/ntdll/process.c, dlls/ntdll/signal_i386.c, dlls/ntdll/tests/exception.c, dlls/ntdll/thread.c, -# | dlls/ntdll/unix/thread.c, dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c, dlls/ntdll/unixlib.h, -# | 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, server/mapping.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 +# | dlls/ntdll/unix/signal_i386.c, dlls/ntdll/unix/thread.c, dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c, +# | dlls/ntdll/unixlib.h, 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, server/mapping.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 @@ -4190,7 +4190,7 @@ fi # | * [#48291] Detroit: Become Human crashes on launch # | # | Modified files: -# | * configure.ac, dlls/ntdll/signal_x86_64.c, tools/winebuild/spec32.c +# | * configure.ac, dlls/ntdll/unix/signal_x86_64.c, tools/winebuild/spec32.c # | if test "$enable_ntdll_Syscall_Emulation" -eq 1; then patch_apply ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch @@ -4371,7 +4371,7 @@ fi # | * [#47970] Legends of Runeterra crashes at launch # | # | Modified files: -# | * dlls/ntdll/signal_x86_64.c +# | * dlls/ntdll/unix/signal_x86_64.c # | if test "$enable_ntdll_x86_64_SegDs" -eq 1; then patch_apply ntdll-x86_64_SegDs/0001-ntdll-Report-SegDs-to-be-identical-to-SegSs-on-x86_6.patch diff --git a/patches/user32-rawinput-mouse/0011-dinput8-Add-support-for-dinput-devices-that-use-raw-.patch b/patches/user32-rawinput-mouse/0011-dinput8-Add-support-for-dinput-devices-that-use-raw-.patch index bba505ac..bf50c185 100644 --- a/patches/user32-rawinput-mouse/0011-dinput8-Add-support-for-dinput-devices-that-use-raw-.patch +++ b/patches/user32-rawinput-mouse/0011-dinput8-Add-support-for-dinput-devices-that-use-raw-.patch @@ -1,4 +1,4 @@ -From c2f13f4d65b25a10b2e9dc8a156dbf6adc6e8263 Mon Sep 17 00:00:00 2001 +From 7d1d098c5c456e1791bae10dd27996a62c7d993a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Aug 2019 16:06:59 +0200 Subject: [PATCH] dinput8: Add support for dinput devices that use raw input @@ -12,16 +12,16 @@ anymore. They will also conflict with any raw input device registered outside of dinput, as exposed by the unit tests. --- dlls/dinput/device_private.h | 3 ++ - dlls/dinput/dinput_main.c | 84 +++++++++++++++++++++++++++++++++++- - 2 files changed, 86 insertions(+), 1 deletion(-) + dlls/dinput/dinput_main.c | 98 ++++++++++++++++++++++++++++++++++-- + 2 files changed, 97 insertions(+), 4 deletions(-) diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h -index 423e8f77792..b0fb181fc6d 100644 +index fe5644f21c7..2fac4f0e61e 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h -@@ -70,6 +70,9 @@ struct IDirectInputDeviceImpl +@@ -69,6 +69,9 @@ struct IDirectInputDeviceImpl + HWND win; int acquired; - DI_EVENT_PROC event_proc; /* function to receive mouse & keyboard events */ + BOOL use_raw_input; /* use raw input instead of low-level messages */ + RAWINPUTDEVICE raw_device; /* raw device to (un)register */ @@ -30,10 +30,10 @@ index 423e8f77792..b0fb181fc6d 100644 int queue_len; /* valid size of the queue */ int queue_head; /* position to write new event into queue */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c -index ee5af1b8ce3..79b275af89b 100644 +index 2e561502406..f7e30606bf4 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c -@@ -98,6 +98,10 @@ static const struct dinput_device *dinput_devices[] = +@@ -97,6 +97,10 @@ static const struct dinput_device *dinput_devices[] = HINSTANCE DINPUT_instance; @@ -44,12 +44,13 @@ index ee5af1b8ce3..79b275af89b 100644 static BOOL check_hook_thread(void); static CRITICAL_SECTION dinput_hook_crit; static struct list direct_input_list = LIST_INIT( direct_input_list ); -@@ -626,6 +630,59 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, RE +@@ -637,6 +641,61 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, RE return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj ); } +static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ ++ IDirectInputDeviceImpl *dev; + IDirectInputImpl *dinput; + + TRACE( "%p %d %lx %lx\n", hwnd, msg, wparam, lparam ); @@ -57,20 +58,21 @@ index ee5af1b8ce3..79b275af89b 100644 + if (msg == WM_INPUT) + { + EnterCriticalSection( &dinput_hook_crit ); -+ LIST_FOR_EACH_ENTRY( dinput, &direct_input_list, IDirectInputImpl, entry ) ++ LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + { -+ IDirectInputDeviceImpl *dev; -+ -+ EnterCriticalSection( &dinput->crit ); -+ LIST_FOR_EACH_ENTRY( dev, &dinput->devices_list, IDirectInputDeviceImpl, entry ) ++ if (dev->use_raw_input) + { -+ if (dev->acquired && dev->event_proc && dev->use_raw_input) -+ { -+ TRACE("calling %p->%p (%lx %lx)\n", dev, dev->event_proc, wparam, lparam); -+ dev->event_proc( &dev->IDirectInputDevice8A_iface, GET_RAWINPUT_CODE_WPARAM(wparam), lparam ); -+ } ++ TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); ++ dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, GET_RAWINPUT_CODE_WPARAM(wparam), lparam ); ++ } ++ } ++ LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) ++ { ++ if (dev->use_raw_input) ++ { ++ TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam); ++ dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, GET_RAWINPUT_CODE_WPARAM(wparam), lparam ); + } -+ LeaveCriticalSection( &dinput->crit ); + } + LeaveCriticalSection( &dinput_hook_crit ); + } @@ -104,16 +106,31 @@ index ee5af1b8ce3..79b275af89b 100644 static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion) { if (!This->initialized) -@@ -1695,7 +1752,7 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) +@@ -1668,13 +1727,19 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) + EnterCriticalSection( &dinput_hook_crit ); + LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + { +- TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); +- skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); ++ if (!dev->use_raw_input) ++ { ++ TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); ++ skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); ++ } + } + LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) + { +- TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam); +- skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); ++ if (!dev->use_raw_input) ++ { ++ TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam); ++ skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); ++ } + } + LeaveCriticalSection( &dinput_hook_crit ); - EnterCriticalSection( &dinput->crit ); - LIST_FOR_EACH_ENTRY( dev, &dinput->devices_list, IDirectInputDeviceImpl, entry ) -- if (dev->acquired && dev->event_proc) -+ if (dev->acquired && dev->event_proc && !dev->use_raw_input) - { - TRACE("calling %p->%p (%lx %lx)\n", dev, dev->event_proc, wparam, lparam); - skip |= dev->event_proc( &dev->IDirectInputDevice8A_iface, wparam, lparam ); -@@ -1748,6 +1805,9 @@ static DWORD WINAPI hook_thread_proc(void *param) +@@ -1728,6 +1793,9 @@ static DWORD WINAPI hook_thread_proc(void *param) static HHOOK kbd_hook, mouse_hook; MSG msg; @@ -123,7 +140,7 @@ index ee5af1b8ce3..79b275af89b 100644 /* Force creation of the message queue */ PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); SetEvent(param); -@@ -1816,6 +1876,9 @@ static DWORD WINAPI hook_thread_proc(void *param) +@@ -1778,6 +1846,9 @@ static DWORD WINAPI hook_thread_proc(void *param) DispatchMessageW(&msg); } @@ -133,7 +150,7 @@ index ee5af1b8ce3..79b275af89b 100644 FreeLibraryAndExitThread(DINPUT_instance, 0); } -@@ -1898,6 +1961,23 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) +@@ -1860,6 +1931,23 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) hook_thread_event = NULL; } @@ -157,7 +174,7 @@ index ee5af1b8ce3..79b275af89b 100644 if (acquired) hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL ); PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, (LPARAM)hook_change_finished_event ); -@@ -1932,9 +2012,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved) +@@ -1894,9 +1982,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(inst); DINPUT_instance = inst; @@ -170,5 +187,5 @@ index ee5af1b8ce3..79b275af89b 100644 break; } -- -2.26.1 +2.26.2 diff --git a/patches/user32-rawinput-mouse/0012-dinput8-Use-raw-input-interface-for-dinput8-mouse-de.patch b/patches/user32-rawinput-mouse/0012-dinput8-Use-raw-input-interface-for-dinput8-mouse-de.patch index c45633eb..665d31b0 100644 --- a/patches/user32-rawinput-mouse/0012-dinput8-Use-raw-input-interface-for-dinput8-mouse-de.patch +++ b/patches/user32-rawinput-mouse/0012-dinput8-Use-raw-input-interface-for-dinput8-mouse-de.patch @@ -1,8 +1,7 @@ -From 4994e308b4f1e21c0d84de23df8c655c4bc5bf9f Mon Sep 17 00:00:00 2001 +From 75e4a39ac1bad4b2c69e993b7df3f59d9f2a212c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Aug 2019 14:08:20 +0200 -Subject: [PATCH 12/12] dinput8: Use raw input interface for dinput8 mouse - device. +Subject: [PATCH] dinput8: Use raw input interface for dinput8 mouse device. --- dlls/dinput/mouse.c | 117 +++++++++++++++++++++++++++++++++++- @@ -10,12 +9,12 @@ Subject: [PATCH 12/12] dinput8: Use raw input interface for dinput8 mouse 2 files changed, 119 insertions(+), 8 deletions(-) diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c -index 2e0101facec..b8b88f38c15 100644 +index 5e6f34f0eca..265a9e0a16a 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c -@@ -246,6 +246,13 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput) - list_add_tail(&dinput->devices_list, &newDevice->base.entry); - LeaveCriticalSection(&dinput->crit); +@@ -239,6 +239,13 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput) + newDevice->base.data_format.wine_df = df; + IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface); + if (dinput->dwVersion >= 0x0800) + { @@ -27,7 +26,7 @@ index 2e0101facec..b8b88f38c15 100644 return newDevice; failed: -@@ -318,7 +325,115 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM +@@ -311,7 +318,115 @@ int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam { MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam; SysMouseImpl* This = impl_from_IDirectInputDevice8A(iface); @@ -145,10 +144,10 @@ index 2e0101facec..b8b88f38c15 100644 TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y); diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c -index 45fc2889066..42ba78707c6 100644 +index 328174e5796..b0a863f69f5 100644 --- a/dlls/dinput8/tests/device.c +++ b/dlls/dinput8/tests/device.c -@@ -696,13 +696,9 @@ static void test_mouse_keyboard(void) +@@ -646,13 +646,9 @@ static void test_mouse_keyboard(void) raw_devices_count = ARRAY_SIZE(raw_devices); memset(raw_devices, 0, sizeof(raw_devices)); hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); @@ -162,7 +161,7 @@ index 45fc2889066..42ba78707c6 100644 ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags); todo_wine ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); -@@ -712,6 +708,9 @@ static void test_mouse_keyboard(void) +@@ -662,6 +658,9 @@ static void test_mouse_keyboard(void) GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE)); ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count); @@ -172,7 +171,7 @@ index 45fc2889066..42ba78707c6 100644 /* expect dinput8 to take over any activated raw input devices */ raw_devices[0].usUsagePage = 0x01; raw_devices[0].usUsage = 0x05; -@@ -739,9 +738,7 @@ static void test_mouse_keyboard(void) +@@ -689,9 +688,7 @@ static void test_mouse_keyboard(void) ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count); ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage); ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage); @@ -182,7 +181,7 @@ index 45fc2889066..42ba78707c6 100644 ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); ok(raw_devices[1].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage); ok(raw_devices[1].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage); -@@ -767,7 +764,6 @@ static void test_mouse_keyboard(void) +@@ -717,7 +714,6 @@ static void test_mouse_keyboard(void) todo_wine ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count); ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage); @@ -191,5 +190,5 @@ index 45fc2889066..42ba78707c6 100644 ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags); ok(raw_devices[0].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); -- -2.24.1 +2.26.2 diff --git a/patches/winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch b/patches/winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch index 01293676..15aaa85d 100644 --- a/patches/winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch +++ b/patches/winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch @@ -1,4 +1,4 @@ -From 362b04b78c2da18e81dd4f571d3671d452c76634 Mon Sep 17 00:00:00 2001 +From 25d08438aba3dee16c79ce3168a4f76f39816fad Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 16 May 2017 04:37:52 +0200 Subject: [PATCH] krnl386.exe16: Do not abuse WOW32Reserved field for 16-bit @@ -13,7 +13,7 @@ Subject: [PATCH] krnl386.exe16: Do not abuse WOW32Reserved field for 16-bit dlls/krnl386.exe16/task.c | 14 +++++------ dlls/krnl386.exe16/thunk.c | 36 +++++++++++++-------------- dlls/krnl386.exe16/wowthunk.c | 20 +++++++-------- - dlls/ntdll/signal_i386.c | 2 +- + dlls/ntdll/unix/signal_i386.c | 2 +- dlls/system.drv16/system.c | 2 +- dlls/toolhelp.dll16/toolhelp.c | 6 ++--- dlls/user.exe16/message.c | 16 ++++++------ @@ -267,10 +267,10 @@ index 39a60cb97a9..21de62c5a01 100644 context->Esp = OFFSETOF(pData->old_ss_sp) - sizeof(DWORD); /*ret addr*/ pData->old_ss_sp = 0; diff --git a/dlls/krnl386.exe16/thunk.c b/dlls/krnl386.exe16/thunk.c -index 78925f594ba..141acb8d5e6 100644 +index e913a08f88c..ecc94371488 100644 --- a/dlls/krnl386.exe16/thunk.c +++ b/dlls/krnl386.exe16/thunk.c -@@ -428,7 +428,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context ) +@@ -429,7 +429,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context ) context16.Eip = LOWORD(context->Edx); /* point EBP to the STACK16FRAME on the stack * for the call_to_16 to set up the register content on calling */ @@ -279,7 +279,7 @@ index 78925f594ba..141acb8d5e6 100644 /* * used to be (problematic): -@@ -450,7 +450,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context ) +@@ -451,7 +451,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT *context ) * the number of parameters that the Win16 function * accepted (that it popped from the corresponding Win16 stack) */ context->Esp += LOWORD(context16.Esp) - @@ -288,7 +288,7 @@ index 78925f594ba..141acb8d5e6 100644 } DEFINE_REGS_ENTRYPOINT( QT_Thunk ) -@@ -554,7 +554,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) +@@ -555,7 +555,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) context16.SegCs = HIWORD(callTarget); context16.Eip = LOWORD(callTarget); @@ -297,7 +297,7 @@ index 78925f594ba..141acb8d5e6 100644 argsize = context->Ebp-context->Esp-0x40; if (argsize > sizeof(newstack)) argsize = sizeof(newstack); -@@ -566,8 +566,8 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) +@@ -567,8 +567,8 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) if (mapESPrelative & (1 << i)) { SEGPTR *arg = (SEGPTR *)newstack[i]; @@ -308,7 +308,7 @@ index 78925f594ba..141acb8d5e6 100644 + (*(LPBYTE *)arg - oldstack)); } -@@ -577,7 +577,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) +@@ -578,7 +578,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) context->Ecx = context16.Ecx; context->Esp += LOWORD(context16.Esp) - @@ -317,7 +317,7 @@ index 78925f594ba..141acb8d5e6 100644 /* Copy modified buffers back to 32-bit stack */ memcpy( oldstack, newstack, argsize ); -@@ -712,7 +712,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT *context ) +@@ -713,7 +713,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT *context ) context16.Edi = LOWORD(context->Ecx); context16.SegCs = HIWORD(context->Eax); context16.Eip = LOWORD(context->Eax); @@ -326,7 +326,7 @@ index 78925f594ba..141acb8d5e6 100644 argsize = HIWORD(context->Edx) * 4; -@@ -768,7 +768,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context ) +@@ -769,7 +769,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context ) context16.SegCs = HIWORD(context->Edx); context16.Eip = LOWORD(context->Edx); @@ -335,7 +335,7 @@ index 78925f594ba..141acb8d5e6 100644 argsize = 2 * *(WORD *)context->Esp + 2; -@@ -781,7 +781,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context ) +@@ -782,7 +782,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context ) (LPBYTE)CURRENT_STACK16 - argsize, argsize ); context->Esp += LOWORD(context16.Esp) - @@ -344,7 +344,7 @@ index 78925f594ba..141acb8d5e6 100644 } DEFINE_REGS_ENTRYPOINT( OT_32ThkLSF ) -@@ -1233,26 +1233,26 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT *context ) +@@ -1234,26 +1234,26 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT *context ) DWORD argSize = context->Ebp - context->Esp; char *stack16 = (char *)context->Esp - 4; STACK16FRAME *frame16 = (STACK16FRAME *)stack16 - 1; @@ -375,7 +375,7 @@ index 78925f594ba..141acb8d5e6 100644 } /* entry_point is never used again once the entry point has -@@ -1275,7 +1275,7 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context ) +@@ -1276,7 +1276,7 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context ) if ( code[5] == 0xFF && code[6] == 0x55 && code[7] == 0xFC && code[13] == 0x66 && code[14] == 0xCB) { @@ -384,7 +384,7 @@ index 78925f594ba..141acb8d5e6 100644 char *stack16 = (char *)(frame16 + 1); DWORD argSize = frame16->ebp - (DWORD)stack16; char *stack32 = (char *)frame16->frame32 - argSize; -@@ -1283,15 +1283,15 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context ) +@@ -1284,15 +1284,15 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context ) DWORD nArgsPopped = context->Esp - (DWORD)stack32; TRACE("before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %p\n", @@ -403,7 +403,7 @@ index 78925f594ba..141acb8d5e6 100644 } } DEFINE_REGS_ENTRYPOINT( K32Thk1632Epilog ) -@@ -2302,7 +2302,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT *context ) +@@ -2303,7 +2303,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT *context ) frame32 = pFrame->frame32; while (frame32 && frame32->frame16) { @@ -472,11 +472,11 @@ index 2dddbf93289..3a4b104a673 100644 SYSLEVEL_CheckNotLevel( 2 ); } } -diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index e905ed0af17..8a976f7745d 100644 ---- a/dlls/ntdll/signal_i386.c -+++ b/dlls/ntdll/signal_i386.c -@@ -912,7 +912,7 @@ static inline void *init_handler( const ucontext_t *sigcontext, WORD *fs, WORD * +diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c +index 2928f314358..138f56b94eb 100644 +--- a/dlls/ntdll/unix/signal_i386.c ++++ b/dlls/ntdll/unix/signal_i386.c +@@ -645,7 +645,7 @@ static inline void *init_handler( const ucontext_t *sigcontext ) * SS is still non-system segment. This is why both CS and SS * are checked. */ @@ -630,7 +630,7 @@ index bf86719325b..1f53bdc9540 100644 /* don't use WIN_Handle32 here, we don't care about the full handle */ return IsWindow( HWND_32(hwnd) ); diff --git a/include/winternl.h b/include/winternl.h -index dd63300d915..0aa0ac311c3 100644 +index acbce20c212..68c1ae3fd82 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -362,7 +362,7 @@ typedef struct _TEB diff --git a/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch b/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch index 684c28e1..547e27f8 100644 --- a/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch +++ b/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch @@ -1,4 +1,4 @@ -From e60eb454ecfb4c043a585c1ecd2970c92be1c664 Mon Sep 17 00:00:00 2001 +From 0c4d2573b123f2198f74292133b7a6eefa472620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 11 May 2017 05:32:55 +0200 Subject: [PATCH] winebuild: Generate syscall thunks for ntdll exports. @@ -22,7 +22,7 @@ Based on a patch by Erich E. Hoover. 14 files changed, 214 insertions(+), 32 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index ffbc9fabb23..a633099877d 100644 +index 0c8f05285c4..26c540050dc 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3810,6 +3810,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule) @@ -39,23 +39,23 @@ index ffbc9fabb23..a633099877d 100644 + NtCurrentTeb()->WOW32Reserved = __wine_syscall_dispatcher; + - pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL ); - if (process_detaching) return; + + RtlEnterCriticalSection( &loader_section ); diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 3be6342a945..85329be4f42 100644 +index 21cc1b3ead4..18be5693a7d 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c -@@ -444,6 +444,8 @@ struct stack_layout +@@ -346,6 +346,8 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 4, + "ret $4" ) - static ULONG first_ldt_entry = 32; +extern NTSTATUS WINAPI __syscall_NtGetContextThread( HANDLE handle, CONTEXT *context ); + - enum i386_trap_code - { - TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */ -@@ -1127,7 +1129,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, + /*********************************************************************** + * NtGetContextThread (NTDLL.@) + * ZwGetContextThread (NTDLL.@) +@@ -370,7 +372,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, { context->Ebp = ebp; context->Esp = (DWORD)&retaddr; @@ -78,10 +78,10 @@ index a5e6faa461a..51938bf84cc 100644 ok( context.SegCs == LOWORD(expect.SegCs), "wrong SegCs %08x/%08x\n", context.SegCs, expect.SegCs ); ok( context.SegDs == LOWORD(expect.SegDs), "wrong SegDs %08x/%08x\n", context.SegDs, expect.SegDs ); diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 49daa33ca58..17b5d40215a 100644 +index 5a6809638ae..fa10cdf1062 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -173,6 +173,7 @@ int __cdecl __wine_dbg_output( const char *str ) +@@ -170,6 +170,7 @@ int __cdecl __wine_dbg_output( const char *str ) return unix_funcs->dbg_output( str ); } @@ -89,17 +89,17 @@ index 49daa33ca58..17b5d40215a 100644 /*********************************************************************** * thread_init -@@ -189,7 +190,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) - signal_init_early(); - - teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, -- &is_wow64, &server_start_time ); -+ &is_wow64, &server_start_time, __wine_syscall_dispatcher ); +@@ -181,7 +182,7 @@ int __cdecl __wine_dbg_output( const char *str ) + TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) + { + TEB *teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, +- &is_wow64, &server_start_time ); ++ &is_wow64, &server_start_time, __wine_syscall_dispatcher ); peb = teb->Peb; peb->FastPebLock = &peb_lock; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c -index d4b7a51a627..bdc87e4b9cf 100644 +index 97b191e1a5b..2dbaa43e731 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -85,7 +85,7 @@ static void pthread_exit_wrapper( int status ) @@ -120,42 +120,42 @@ index d4b7a51a627..bdc87e4b9cf 100644 thread_data->request_fd = -1; thread_data->reply_fd = -1; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 19104f0f5cc..bdf8bc99e3f 100644 +index 19dd216fc35..a1c48a52606 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -101,7 +101,7 @@ extern void CDECL server_release_fd( HANDLE handle, int unix_fd ) DECLSPEC_HIDDE - extern void CDECL server_init_process_done(void) DECLSPEC_HIDDEN; +@@ -107,7 +107,7 @@ extern void CDECL server_release_fd( HANDLE handle, int unix_fd ) DECLSPEC_HIDDE + extern void CDECL server_init_process_done( void *relay ) DECLSPEC_HIDDEN; extern TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size, BOOL *suspend, unsigned int *cpus, BOOL *wow64, - timeout_t *start_time ) DECLSPEC_HIDDEN; + timeout_t *start_time, void *syscall_handler ) DECLSPEC_HIDDEN; - extern void CDECL DECLSPEC_NORETURN start_process( PRTL_THREAD_START_ROUTINE entry, BOOL suspend, void *relay ) DECLSPEC_HIDDEN; - extern void CDECL DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN; extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN; + extern void CDECL DECLSPEC_NORETURN exit_process( int status ) DECLSPEC_HIDDEN; + extern NTSTATUS CDECL get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_len ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h -index 6a751993421..4e39ed53786 100644 +index 4c580c49d13..4f0080db03d 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct ldt_copy; struct msghdr; /* increment this when you change the function table */ --#define NTDLL_UNIXLIB_VERSION 33 -+#define NTDLL_UNIXLIB_VERSION 34 +-#define NTDLL_UNIXLIB_VERSION 38 ++#define NTDLL_UNIXLIB_VERSION 39 struct unix_funcs { -@@ -174,7 +174,7 @@ struct unix_funcs +@@ -199,7 +199,7 @@ struct unix_funcs /* thread/process functions */ TEB * (CDECL *init_threading)( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size, - BOOL *suspend, unsigned int *cpus, BOOL *wow64, timeout_t *start_time ); + BOOL *suspend, unsigned int *cpus, BOOL *wow64, timeout_t *start_time, void *syscall_handler ); - void (CDECL *start_process)( PRTL_THREAD_START_ROUTINE entry, BOOL suspend, void *relay ); - void (CDECL *abort_thread)( int status ); void (CDECL *exit_thread)( int status ); + void (CDECL *exit_process)( int status ); + NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len ); diff --git a/include/winternl.h b/include/winternl.h -index 9b8218c861f..ff6916c98e7 100644 +index 68c1ae3fd82..f2da9157aab 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -359,7 +359,7 @@ typedef struct _TEB diff --git a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch index 7dcd7ad9..f96d51ae 100644 --- a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch +++ b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch @@ -1,4 +1,4 @@ -From 1c0ba3961674f316dba2d89042571b7863076f08 Mon Sep 17 00:00:00 2001 +From 167ad04157dd746ee9395afa9505fe00cc866f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 15 May 2017 16:27:56 +0200 Subject: [PATCH] winebuild: Add stub functions in fake dlls. @@ -62,7 +62,7 @@ index 926fa913866..902907329c0 100644 CloseHandle(map); CloseHandle(file); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index b42cff8bcd4..b21d88bb13b 100644 +index 26c540050dc..09d3870c31a 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3811,6 +3811,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule) @@ -73,19 +73,19 @@ index b42cff8bcd4..b21d88bb13b 100644 /****************************************************************** * LdrInitializeThunk (NTDLL.@) -@@ -3829,6 +3830,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow +@@ -3828,6 +3829,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; NtCurrentTeb()->WOW32Reserved = __wine_syscall_dispatcher; + NtCurrentTeb()->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher; - pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL ); + if (process_detaching) return; diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index ed77e4a2e98..a988d4c3e6b 100644 +index fa10cdf1062..4840f527e59 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -175,6 +175,39 @@ int __cdecl __wine_dbg_output( const char *str ) +@@ -172,6 +172,39 @@ int __cdecl __wine_dbg_output( const char *str ) extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); @@ -125,16 +125,16 @@ index ed77e4a2e98..a988d4c3e6b 100644 /*********************************************************************** * thread_init * -@@ -190,6 +223,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) - - teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, - &is_wow64, &server_start_time, __wine_syscall_dispatcher ); +@@ -183,6 +216,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) + { + TEB *teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, + &is_wow64, &server_start_time, __wine_syscall_dispatcher ); + teb->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher; peb = teb->Peb; peb->FastPebLock = &peb_lock; diff --git a/include/winternl.h b/include/winternl.h -index 065f3d24f52..199b8fc52f2 100644 +index f2da9157aab..ce8021af503 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -398,7 +398,7 @@ typedef struct _TEB diff --git a/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch b/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch index f1f5a5e5..6024e5a2 100644 --- a/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch +++ b/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch @@ -1,4 +1,4 @@ -From 7a2dceb0c325caa23d55f4ed4747221b09885c85 Mon Sep 17 00:00:00 2001 +From a5b4feebd008daab008f72567fe0001da619030e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 7 Sep 2017 00:38:09 +0200 Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit. @@ -15,10 +15,10 @@ Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit. 8 files changed, 306 insertions(+), 14 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c -index 1f525194ce7..21af7b4ce7a 100644 +index 95939ba6bde..ae5462f6e55 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c -@@ -1574,7 +1574,7 @@ static void test_filenames(void) +@@ -1573,7 +1573,7 @@ static void test_filenames(void) static void test_FakeDLL(void) { @@ -27,7 +27,7 @@ index 1f525194ce7..21af7b4ce7a 100644 NTSTATUS (WINAPI *pNtSetEvent)(HANDLE, ULONG *) = NULL; IMAGE_EXPORT_DIRECTORY *dir; HMODULE module = GetModuleHandleA("ntdll.dll"); -@@ -1616,8 +1616,13 @@ static void test_FakeDLL(void) +@@ -1615,8 +1615,13 @@ static void test_FakeDLL(void) dll_func = (BYTE *)GetProcAddress(module, func_name); ok(dll_func != NULL, "%s: GetProcAddress returned NULL\n", func_name); @@ -42,10 +42,10 @@ index 1f525194ce7..21af7b4ce7a 100644 todo_wine ok(0, "%s: Export is a stub-function, skipping\n", func_name); continue; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c -index 449e5814c2e..05cbd4b443b 100644 +index 2dbaa43e731..e1da90222d3 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c -@@ -108,7 +108,7 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ +@@ -110,7 +110,7 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ dbg_init(); server_init_process(); info_size = server_init_thread( teb->Peb, suspend ); @@ -55,23 +55,23 @@ index 449e5814c2e..05cbd4b443b 100644 if (size) *size = info_size; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 5f891d52e17..6ccd2ff6cc4 100644 +index a1c48a52606..9c9e5b80b0c 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -137,7 +137,7 @@ extern void virtual_init(void) DECLSPEC_HIDDEN; +@@ -152,7 +152,7 @@ extern void virtual_init(void) DECLSPEC_HIDDEN; extern TEB *virtual_alloc_first_teb(void) DECLSPEC_HIDDEN; extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN; extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN; -extern void virtual_map_user_shared_data(void) DECLSPEC_HIDDEN; +extern void virtual_map_user_shared_data(void *) DECLSPEC_HIDDEN; - - extern void signal_init_threading(void) DECLSPEC_HIDDEN; - extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN; + extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) DECLSPEC_HIDDEN; + extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN; + extern int virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 83e51c369cb..40629214479 100644 +index 660323d4dcc..a5e5cb8422d 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -2742,14 +2742,14 @@ TEB *virtual_alloc_first_teb(void) +@@ -2588,14 +2588,14 @@ TEB *virtual_alloc_first_teb(void) TEB *teb; PEB *peb; NTSTATUS status; @@ -88,7 +88,7 @@ index 83e51c369cb..40629214479 100644 if (status) { ERR( "wine: failed to map the shared user data: %08x\n", status ); -@@ -2943,11 +2943,12 @@ void virtual_clear_thread_stack( void *stack_end ) +@@ -2787,11 +2787,12 @@ void virtual_clear_thread_stack( void *stack_end ) if (force_exec_prot) mprotect( stack, size, PROT_READ | PROT_WRITE | PROT_EXEC ); } @@ -102,7 +102,7 @@ index 83e51c369cb..40629214479 100644 { static const WCHAR wine_usdW[] = {'\\','K','e','r','n','e','l','O','b','j','e','c','t','s', '\\','_','_','w','i','n','e','_','u','s','e','r','_','s','h','a','r','e','d','_','d','a','t','a',0}; -@@ -2970,6 +2971,11 @@ void virtual_map_user_shared_data(void) +@@ -2814,6 +2815,11 @@ void virtual_map_user_shared_data(void) ERR( "failed to remap the process USD: %d\n", res ); exit(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 3e655e0c..ec9de02f 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,4 +1,4 @@ -From 68293a760784f2b4fd2fe79bbba443d76b17e11a Mon Sep 17 00:00:00 2001 +From 8281eb9d4c2c5d20a336fda58c5bf1e603f05590 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 8 Aug 2018 20:00:15 -0500 Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition. @@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 6155996b7c4..0e99604eb2b 100644 +index 92ae87c6e6d..533bad12103 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -4287,6 +4287,7 @@ NTSTATUS WINAPI NtLoadDriver( const UNICODE_STRING *DriverServiceName ) +@@ -4322,6 +4322,7 @@ NTSTATUS WINAPI NtLoadDriver( const UNICODE_STRING *DriverServiceName ) return STATUS_NOT_IMPLEMENTED; } @@ -20,7 +20,7 @@ index 6155996b7c4..0e99604eb2b 100644 /*********************************************************************** * NtUnloadDriver (NTDLL.@) -@@ -4345,12 +4346,13 @@ void __wine_process_init(void) +@@ -4380,13 +4381,14 @@ void __wine_process_init(void) static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2','\\', 'n','t','d','l','l','.','d','l','l',0}; @@ -28,6 +28,7 @@ index 6155996b7c4..0e99604eb2b 100644 static const WCHAR kernel32W[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2','\\', 'k','e','r','n','e','l','3','2','.','d','l','l',0}; + void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL; RTL_USER_PROCESS_PARAMETERS *params; ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION runlevel; - WINE_MODREF *wm; @@ -35,7 +36,7 @@ index 6155996b7c4..0e99604eb2b 100644 NTSTATUS status; ANSI_STRING func_name; UNICODE_STRING nt_name; -@@ -4400,6 +4402,13 @@ void __wine_process_init(void) +@@ -4429,6 +4431,13 @@ void __wine_process_init(void) MESSAGE( "wine: could not load kernel32.dll, status %x\n", status ); exit(1); } @@ -50,10 +51,10 @@ index 6155996b7c4..0e99604eb2b 100644 if ((status = LdrGetProcedureAddress( wm->ldr.DllBase, &func_name, 0, (void **)&kernel32_start_process )) != STATUS_SUCCESS) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index b97eed0bc7d..9e2f6e418eb 100644 +index 05e46bd1b3d..c24889479a4 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec -@@ -1103,6 +1103,7 @@ +@@ -1111,6 +1111,7 @@ @ stdcall WinSqmIsOptedIn() @ stdcall WinSqmSetDWORD(ptr long long) @ stdcall WinSqmStartSession(ptr long long) diff --git a/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch b/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch index 0861f99c..7b9e61d8 100644 --- a/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch +++ b/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch @@ -1,4 +1,4 @@ -From 20661308a50202350a3a2887cbd558b1e931aad1 Mon Sep 17 00:00:00 2001 +From 6cc54a973b9b786166db76df6a4f0a33867103ce Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 6 Sep 2015 12:41:17 +0200 Subject: [PATCH] ws2_32: Invalidate client-side file descriptor cache in @@ -17,7 +17,7 @@ Subject: [PATCH] ws2_32: Invalidate client-side file descriptor cache in 9 files changed, 36 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index ce5c580bd54..279845ae830 100644 +index e054eabba3a..82ed6c68cbe 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1576,6 +1576,7 @@ @@ -29,11 +29,11 @@ index ce5c580bd54..279845ae830 100644 @ cdecl wine_server_handle_to_fd(long long ptr ptr) @ cdecl wine_server_release_fd(long long) diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c -index 6fb86a68d6f..2f95e190963 100644 +index 9e1cc85a36e..3f4ba60b7bb 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c -@@ -239,6 +239,14 @@ void CDECL wine_server_release_fd( HANDLE handle, int unix_fd ) - unix_funcs->server_release_fd( handle, unix_fd ); +@@ -130,6 +130,14 @@ int CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *uni + return unix_funcs->server_handle_to_fd( handle, access, unix_fd, options ); } + /*********************************************************************** @@ -46,21 +46,21 @@ index 6fb86a68d6f..2f95e190963 100644 + /*********************************************************************** - * server_init_process + * wine_server_release_fd (NTDLL.@) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index 618e3d6adb3..bdda739897b 100644 +index eac43ba42c4..cd11d0d647e 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c -@@ -1076,6 +1076,7 @@ static struct unix_funcs unix_funcs = - server_select, - server_wait, +@@ -1089,6 +1089,7 @@ static struct unix_funcs unix_funcs = + get_thread_ldt_entry, + wine_server_call, server_send_fd, + server_remove_fds_from_cache_by_type, server_get_unix_fd, server_fd_to_handle, server_handle_to_fd, diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c -index fb3f98dd579..0754928cfe8 100644 +index cf6f6c3832c..586d0ffcf72 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -995,6 +995,26 @@ static int remove_fd_from_cache( HANDLE handle ) @@ -91,33 +91,33 @@ index fb3f98dd579..0754928cfe8 100644 /*********************************************************************** * server_get_unix_fd diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 03b92f9e912..19104f0f5cc 100644 +index 3e61111cba5..ae0c47b5a79 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -89,6 +89,7 @@ extern unsigned int CDECL server_select( const select_op_t *select_op, data_size - extern unsigned int CDECL server_wait( const select_op_t *select_op, data_size_t size, UINT flags, - const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN; +@@ -95,6 +95,7 @@ extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN; + extern void CDECL virtual_set_large_address_space(void) DECLSPEC_HIDDEN; + extern void CDECL server_send_fd( int fd ) DECLSPEC_HIDDEN; +extern void CDECL server_remove_fds_from_cache_by_type( enum server_fd_type type ) DECLSPEC_HIDDEN; extern int CDECL server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd, int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h -index 017a0a71b3f..6a751993421 100644 +index 80d3ce27601..4c580c49d13 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct ldt_copy; struct msghdr; /* increment this when you change the function table */ --#define NTDLL_UNIXLIB_VERSION 32 -+#define NTDLL_UNIXLIB_VERSION 33 +-#define NTDLL_UNIXLIB_VERSION 37 ++#define NTDLL_UNIXLIB_VERSION 38 struct unix_funcs { -@@ -189,6 +189,7 @@ struct unix_funcs - unsigned int (CDECL *server_wait)( const select_op_t *select_op, data_size_t size, UINT flags, - const LARGE_INTEGER *timeout ); +@@ -207,6 +207,7 @@ struct unix_funcs + /* server functions */ + unsigned int (CDECL *server_call)( void *req_ptr ); void (CDECL *server_send_fd)( int fd ); + void (CDECL *server_remove_fds_from_cache_by_type)( enum server_fd_type type ); int (CDECL *server_get_unix_fd)( HANDLE handle, unsigned int wanted_access, int *unix_fd, diff --git a/staging/upstream-commit b/staging/upstream-commit index 8b37e531..16e02ffc 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -17529582402ebe27ef975fc7dcb8353f4f95e629 +bf454cc39428fc5299e5c26d9c0ddc6a9277c7ae