You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against 3c86adab766e3bc7c91da088c2dd6bc41a917055.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
From 43c4595226819c7b5993937fc8f088b8b6ffa545 Mon Sep 17 00:00:00 2001
|
||||
From 505b2a7167d4b0ea533663ef30663f21b0ab9863 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 11 May 2017 05:32:55 +0200
|
||||
Subject: [PATCH] winebuild: Generate syscall thunks for ntdll exports.
|
||||
|
||||
Based on a patch by Erich E. Hoover.
|
||||
---
|
||||
dlls/ntdll/signal_i386.c | 7 ++-
|
||||
dlls/ntdll/signal_i386.c | 4 +-
|
||||
dlls/ntdll/tests/exception.c | 2 +
|
||||
dlls/ntdll/thread.c | 4 ++
|
||||
include/winternl.h | 2 +-
|
||||
tools/winebuild/build.h | 7 +++
|
||||
tools/winebuild/import.c | 10 ++--
|
||||
@@ -14,23 +15,22 @@ Based on a patch by Erich E. Hoover.
|
||||
tools/winebuild/spec16.c | 22 +-------
|
||||
tools/winebuild/spec32.c | 104 +++++++++++++++++++++++++++++++++++
|
||||
tools/winebuild/utils.c | 21 +++++++
|
||||
9 files changed, 207 insertions(+), 27 deletions(-)
|
||||
10 files changed, 208 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index 5353ab4df2ce..527ba01672e1 100644
|
||||
index 5fd54071ffd..950408cbc38 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -476,6 +476,9 @@ static ULONG first_ldt_entry = 32;
|
||||
@@ -449,6 +449,8 @@ static ULONG first_ldt_entry = 32;
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
+extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
|
||||
+extern NTSTATUS WINAPI __syscall_NtGetContextThread( HANDLE handle, CONTEXT *context );
|
||||
+
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
@@ -1514,7 +1517,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi,
|
||||
@@ -1487,7 +1489,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi,
|
||||
{
|
||||
context->Ebp = ebp;
|
||||
context->Esp = (DWORD)&retaddr;
|
||||
@@ -39,17 +39,8 @@ index 5353ab4df2ce..527ba01672e1 100644
|
||||
context->SegCs = get_cs();
|
||||
context->SegSs = get_ds();
|
||||
context->EFlags = eflags;
|
||||
@@ -2561,6 +2564,8 @@ NTSTATUS signal_alloc_thread( TEB *teb )
|
||||
}
|
||||
else thread_data->fs = gdt_fs_sel;
|
||||
|
||||
+ teb->WOW32Reserved = __wine_syscall_dispatcher;
|
||||
+
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
|
||||
index a5e6faa461a3..51938bf84cc1 100644
|
||||
index a5e6faa461a..51938bf84cc 100644
|
||||
--- a/dlls/ntdll/tests/exception.c
|
||||
+++ b/dlls/ntdll/tests/exception.c
|
||||
@@ -1643,6 +1643,8 @@ static void test_thread_context(void)
|
||||
@@ -61,8 +52,37 @@ index a5e6faa461a3..51938bf84cc1 100644
|
||||
/* segment registers clear the high word */
|
||||
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 bb11521cf69..edd6c4dfa99 100644
|
||||
--- a/dlls/ntdll/thread.c
|
||||
+++ b/dlls/ntdll/thread.c
|
||||
@@ -212,6 +212,8 @@ void map_user_shared_data(void)
|
||||
NtClose( section );
|
||||
}
|
||||
|
||||
+extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
|
||||
+
|
||||
/***********************************************************************
|
||||
* thread_init
|
||||
*
|
||||
@@ -248,6 +250,7 @@ TEB *thread_init(void)
|
||||
unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy );
|
||||
unix_funcs->alloc_thread( teb );
|
||||
unix_funcs->init_thread( teb );
|
||||
+ teb->WOW32Reserved = __wine_syscall_dispatcher;
|
||||
|
||||
peb = teb->Peb;
|
||||
peb->FastPebLock = &peb_lock;
|
||||
@@ -493,6 +496,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
|
||||
teb->Tib.StackBase = stack.StackBase;
|
||||
teb->Tib.StackLimit = stack.StackLimit;
|
||||
teb->DeallocationStack = stack.DeallocationStack;
|
||||
+ teb->WOW32Reserved = __wine_syscall_dispatcher;
|
||||
|
||||
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
|
||||
thread_data->request_fd = request_pipe[1];
|
||||
diff --git a/include/winternl.h b/include/winternl.h
|
||||
index 0f808d71dd33..d641ed1436ad 100644
|
||||
index 44a58cadc7a..065f3d24f52 100644
|
||||
--- a/include/winternl.h
|
||||
+++ b/include/winternl.h
|
||||
@@ -359,7 +359,7 @@ typedef struct _TEB
|
||||
@@ -75,7 +95,7 @@ index 0f808d71dd33..d641ed1436ad 100644
|
||||
ULONG FpSoftwareStatusRegister; /* 0c8/010c */
|
||||
PVOID SystemReserved1[54]; /* 0cc/0110 used for krnl386.exe16 private data in Wine */
|
||||
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
|
||||
index c162888a0356..55d5b0b9dc28 100644
|
||||
index c162888a035..55d5b0b9dc2 100644
|
||||
--- a/tools/winebuild/build.h
|
||||
+++ b/tools/winebuild/build.h
|
||||
@@ -105,6 +105,7 @@ typedef struct
|
||||
@@ -123,7 +143,7 @@ index c162888a0356..55d5b0b9dc28 100644
|
||||
|
||||
extern int byte_swapped;
|
||||
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
|
||||
index 04ab433dd65a..0c6bafed8e54 100644
|
||||
index 04ab433dd65..0c6bafed8e5 100644
|
||||
--- a/tools/winebuild/import.c
|
||||
+++ b/tools/winebuild/import.c
|
||||
@@ -531,6 +531,7 @@ static void check_undefined_forwards( DLLSPEC *spec )
|
||||
@@ -163,7 +183,7 @@ index 04ab433dd65a..0c6bafed8e54 100644
|
||||
}
|
||||
}
|
||||
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
|
||||
index 0f2b9c1e10ad..74216f8bb6e7 100644
|
||||
index 0f2b9c1e10a..74216f8bb6e 100644
|
||||
--- a/tools/winebuild/parser.c
|
||||
+++ b/tools/winebuild/parser.c
|
||||
@@ -543,6 +543,24 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp )
|
||||
@@ -254,7 +274,7 @@ index 0f2b9c1e10ad..74216f8bb6e7 100644
|
||||
}
|
||||
|
||||
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
|
||||
index a52c03aaa6a7..15ef9a3f8930 100644
|
||||
index a52c03aaa6a..15ef9a3f893 100644
|
||||
--- a/tools/winebuild/spec16.c
|
||||
+++ b/tools/winebuild/spec16.c
|
||||
@@ -495,27 +495,6 @@ static int relay_type_compare( const void *e1, const void *e2 )
|
||||
@@ -294,7 +314,7 @@ index a52c03aaa6a7..15ef9a3f8930 100644
|
||||
entry_point->u.func.nb_args = 0;
|
||||
assert( !spec->ordinals[0] );
|
||||
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
|
||||
index b1e20e0484dc..22dd399cb2b4 100644
|
||||
index b1e20e0484d..22dd399cb2b 100644
|
||||
--- a/tools/winebuild/spec32.c
|
||||
+++ b/tools/winebuild/spec32.c
|
||||
@@ -374,6 +374,109 @@ static void output_relay_debug( DLLSPEC *spec )
|
||||
@@ -416,7 +436,7 @@ index b1e20e0484dc..22dd399cb2b4 100644
|
||||
output_exports( spec );
|
||||
output_imports( spec );
|
||||
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
|
||||
index 2a1fc960926b..07a579004adc 100644
|
||||
index 2a1fc960926..07a579004ad 100644
|
||||
--- a/tools/winebuild/utils.c
|
||||
+++ b/tools/winebuild/utils.c
|
||||
@@ -860,6 +860,7 @@ void free_dll_spec( DLLSPEC *spec )
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
From 49daa93dd311ff1b28e2878852b6337140b4d499 Mon Sep 17 00:00:00 2001
|
||||
From 22a245956909fc1cd3a733d460441bb05d09c775 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 15 May 2017 16:27:56 +0200
|
||||
Subject: [PATCH] winebuild: Add stub functions in fake dlls.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/loader.c | 8 +-
|
||||
dlls/ntdll/signal_i386.c | 34 ++++++
|
||||
dlls/ntdll/thread.c | 35 ++++++
|
||||
include/winternl.h | 2 +-
|
||||
tools/winebuild/build.h | 1 +
|
||||
tools/winebuild/spec32.c | 209 +++++++++++++++++++++++++++++++++--
|
||||
tools/winebuild/utils.c | 10 +-
|
||||
6 files changed, 249 insertions(+), 15 deletions(-)
|
||||
6 files changed, 250 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
|
||||
index 4e7a15970cb..ec173c94a8e 100644
|
||||
index 926fa913866..902907329c0 100644
|
||||
--- a/dlls/kernel32/tests/loader.c
|
||||
+++ b/dlls/kernel32/tests/loader.c
|
||||
@@ -1560,9 +1560,7 @@ static void test_FakeDLL(void)
|
||||
@@ -1596,9 +1596,7 @@ static void test_FakeDLL(void)
|
||||
ok(ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError());
|
||||
|
||||
dir = RtlImageDirectoryEntryToData(ptr, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size);
|
||||
@@ -26,7 +26,7 @@ index 4e7a15970cb..ec173c94a8e 100644
|
||||
|
||||
names = RVAToAddr(dir->AddressOfNames, ptr);
|
||||
ordinals = RVAToAddr(dir->AddressOfNameOrdinals, ptr);
|
||||
@@ -1591,17 +1589,20 @@ todo_wine
|
||||
@@ -1627,17 +1625,20 @@ todo_wine
|
||||
/* check position in memory */
|
||||
dll_rva = (DWORD_PTR)dll_func - (DWORD_PTR)module;
|
||||
map_rva = funcs[ordinals[i]];
|
||||
@@ -47,7 +47,7 @@ index 4e7a15970cb..ec173c94a8e 100644
|
||||
ok(!memcmp(map_func, dll_func, 0x20), "%s: Function content does not match!\n", func_name);
|
||||
|
||||
if (!strcmp(func_name, "NtSetEvent"))
|
||||
@@ -1615,10 +1616,11 @@ todo_wine
|
||||
@@ -1651,10 +1652,11 @@ todo_wine
|
||||
ok(event != NULL, "CreateEvent failed with error %u\n", GetLastError());
|
||||
pNtSetEvent(event, 0);
|
||||
ok(WaitForSingleObject(event, 0) == WAIT_OBJECT_0, "Event was not signaled\n");
|
||||
@@ -60,15 +60,15 @@ index 4e7a15970cb..ec173c94a8e 100644
|
||||
UnmapViewOfFile(ptr);
|
||||
CloseHandle(map);
|
||||
CloseHandle(file);
|
||||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index 04fdaf564b3..1dcc54895dc 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -479,6 +479,39 @@ static wine_signal_handler handlers[256];
|
||||
extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
|
||||
extern NTSTATUS WINAPI __syscall_NtGetContextThread( HANDLE handle, CONTEXT *context );
|
||||
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
|
||||
index edd6c4dfa99..678af513264 100644
|
||||
--- a/dlls/ntdll/thread.c
|
||||
+++ b/dlls/ntdll/thread.c
|
||||
@@ -214,6 +214,39 @@ void map_user_shared_data(void)
|
||||
|
||||
+static void* WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
|
||||
extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
|
||||
|
||||
+static void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
|
||||
+{
|
||||
+ UNICODE_STRING name;
|
||||
+ NTSTATUS status;
|
||||
@@ -101,19 +101,27 @@ index 04fdaf564b3..1dcc54895dc 100644
|
||||
+ return proc;
|
||||
+}
|
||||
+
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
@@ -2565,6 +2598,7 @@ NTSTATUS signal_alloc_thread( TEB *teb )
|
||||
else thread_data->fs = gdt_fs_sel;
|
||||
|
||||
/***********************************************************************
|
||||
* thread_init
|
||||
*
|
||||
@@ -251,6 +284,7 @@ TEB *thread_init(void)
|
||||
unix_funcs->alloc_thread( teb );
|
||||
unix_funcs->init_thread( teb );
|
||||
teb->WOW32Reserved = __wine_syscall_dispatcher;
|
||||
+ teb->Spare2 = __wine_fakedll_dispatcher;
|
||||
+ teb->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
peb = teb->Peb;
|
||||
peb->FastPebLock = &peb_lock;
|
||||
@@ -497,6 +531,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
|
||||
teb->Tib.StackLimit = stack.StackLimit;
|
||||
teb->DeallocationStack = stack.DeallocationStack;
|
||||
teb->WOW32Reserved = __wine_syscall_dispatcher;
|
||||
+ teb->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher;
|
||||
|
||||
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
|
||||
thread_data->request_fd = request_pipe[1];
|
||||
diff --git a/include/winternl.h b/include/winternl.h
|
||||
index 26ee5b601fb..03f86dae253 100644
|
||||
index 065f3d24f52..199b8fc52f2 100644
|
||||
--- a/include/winternl.h
|
||||
+++ b/include/winternl.h
|
||||
@@ -398,7 +398,7 @@ typedef struct _TEB
|
||||
@@ -126,7 +134,7 @@ index 26ee5b601fb..03f86dae253 100644
|
||||
PVOID ReservedForPerf; /* f7c/1750 */
|
||||
PVOID ReservedForOle; /* f80/1758 */
|
||||
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
|
||||
index 210324406a9..1d296d42463 100644
|
||||
index 8930df408d3..44113bad28a 100644
|
||||
--- a/tools/winebuild/build.h
|
||||
+++ b/tools/winebuild/build.h
|
||||
@@ -358,6 +358,7 @@ extern void put_word( unsigned short val );
|
||||
@@ -394,7 +402,7 @@ index c38f1fe663c..bf82ca497c0 100644
|
||||
/* .reloc contents */
|
||||
align_output_rva( file_align, section_align );
|
||||
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
|
||||
index 64e1fa51455..edb983a65c9 100644
|
||||
index 80dec6db29e..d394a1382c6 100644
|
||||
--- a/tools/winebuild/utils.c
|
||||
+++ b/tools/winebuild/utils.c
|
||||
@@ -549,7 +549,7 @@ size_t output_buffer_size;
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
From c605ff6f4bcab597bd9769f49b95d009d561b68d Mon Sep 17 00:00:00 2001
|
||||
From fa2f2b41cb6af594457b76ba90c042387c368ef6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 7 Sep 2017 00:38:09 +0200
|
||||
Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/loader.c | 7 +-
|
||||
dlls/ntdll/signal_x86_64.c | 2 +
|
||||
dlls/ntdll/thread.c | 13 +-
|
||||
libs/wine/loader.c | 4 +
|
||||
server/mapping.c | 6 +-
|
||||
tools/winebuild/parser.c | 2 +-
|
||||
tools/winebuild/spec32.c | 285 ++++++++++++++++++++++++++++++++++-
|
||||
7 files changed, 308 insertions(+), 11 deletions(-)
|
||||
6 files changed, 306 insertions(+), 11 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)
|
||||
{
|
||||
@@ -26,7 +25,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);
|
||||
@@ -40,31 +39,11 @@ index 1f525194ce7..21af7b4ce7a 100644
|
||||
{
|
||||
todo_wine ok(0, "%s: Export is a stub-function, skipping\n", func_name);
|
||||
continue;
|
||||
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
|
||||
index 5defcd6a7af..c2936045c5d 100644
|
||||
--- a/dlls/ntdll/signal_x86_64.c
|
||||
+++ b/dlls/ntdll/signal_x86_64.c
|
||||
@@ -354,6 +354,7 @@ static inline void set_sigcontext( const CONTEXT *context, ucontext_t *sigcontex
|
||||
#endif
|
||||
}
|
||||
|
||||
+extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
|
||||
|
||||
/***********************************************************************
|
||||
* Definitions for Win32 unwind tables
|
||||
@@ -3142,6 +3143,7 @@ void signal_init_threading(void)
|
||||
*/
|
||||
NTSTATUS signal_alloc_thread( TEB *teb )
|
||||
{
|
||||
+ teb->WOW32Reserved = __wine_syscall_dispatcher;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
|
||||
index e5ff24f34f1..ddaf41637d0 100644
|
||||
index 678af513264..297893d8898 100644
|
||||
--- a/dlls/ntdll/thread.c
|
||||
+++ b/dlls/ntdll/thread.c
|
||||
@@ -56,6 +56,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread);
|
||||
@@ -54,6 +54,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread);
|
||||
|
||||
struct _KUSER_SHARED_DATA *user_shared_data = NULL;
|
||||
|
||||
@@ -73,7 +52,7 @@ index e5ff24f34f1..ddaf41637d0 100644
|
||||
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
|
||||
|
||||
/* info passed to a starting thread */
|
||||
@@ -281,9 +283,9 @@ TEB *thread_init(void)
|
||||
@@ -267,9 +269,9 @@ TEB *thread_init(void)
|
||||
/* reserve space for shared user data */
|
||||
|
||||
addr = (void *)0x7ffe0000;
|
||||
@@ -85,7 +64,7 @@ index e5ff24f34f1..ddaf41637d0 100644
|
||||
if (status)
|
||||
{
|
||||
MESSAGE( "wine: failed to map the shared user data: %08x\n", status );
|
||||
@@ -291,6 +293,13 @@ TEB *thread_init(void)
|
||||
@@ -277,6 +279,13 @@ TEB *thread_init(void)
|
||||
}
|
||||
user_shared_data = addr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user