From 7ad2ee4c6041879255df6e219c371b78bf58ced1 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 16 May 2017 04:52:55 +0200 Subject: [PATCH] winebuild-Fake_Dlls: Avoid conflict with 16-bit code. --- patches/patchinstall.sh | 16 +- ...-not-abuse-WOW32Reserved-field-for-1.patch | 659 ++++++++++++++++++ ...dows-7-WOW64-signature-for-syscall-.patch} | 20 +- ...tipass-label-system-to-generate-fak.patch} | 0 ...ild-Add-stub-functions-in-fake-dlls.patch} | 0 ...ild-Add-syscall-thunks-in-fake-dlls.patch} | 0 6 files changed, 687 insertions(+), 8 deletions(-) create mode 100644 patches/winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch rename patches/winebuild-Fake_Dlls/{0002-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch => 0003-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch} (75%) rename patches/winebuild-Fake_Dlls/{0003-winebuild-Use-multipass-label-system-to-generate-fak.patch => 0004-winebuild-Use-multipass-label-system-to-generate-fak.patch} (100%) rename patches/winebuild-Fake_Dlls/{0004-winebuild-Add-stub-functions-in-fake-dlls.patch => 0005-winebuild-Add-stub-functions-in-fake-dlls.patch} (100%) rename patches/winebuild-Fake_Dlls/{0005-winebuild-Add-syscall-thunks-in-fake-dlls.patch => 0006-winebuild-Add-syscall-thunks-in-fake-dlls.patch} (100%) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index a66bcafc..ea0ab861 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -8617,17 +8617,23 @@ fi # | * [#42741] Various improvements for fake dlls # | # | Modified files: -# | * dlls/ntdll/signal_i386.c, tools/winebuild/build.h, tools/winebuild/import.c, tools/winebuild/parser.c, +# | * dlls/dbghelp/cpu_i386.c, dlls/krnl386.exe16/kernel.c, dlls/krnl386.exe16/kernel16_private.h, +# | dlls/krnl386.exe16/ne_module.c, dlls/krnl386.exe16/ne_segment.c, dlls/krnl386.exe16/task.c, dlls/krnl386.exe16/thunk.c, +# | dlls/krnl386.exe16/wowthunk.c, dlls/ntdll/signal_i386.c, dlls/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, +# | 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-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch - patch_apply winebuild-Fake_Dlls/0002-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch - patch_apply winebuild-Fake_Dlls/0003-winebuild-Use-multipass-label-system-to-generate-fak.patch - patch_apply winebuild-Fake_Dlls/0004-winebuild-Add-stub-functions-in-fake-dlls.patch - patch_apply winebuild-Fake_Dlls/0005-winebuild-Add-syscall-thunks-in-fake-dlls.patch + patch_apply winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch + patch_apply winebuild-Fake_Dlls/0003-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch + patch_apply winebuild-Fake_Dlls/0004-winebuild-Use-multipass-label-system-to-generate-fak.patch + patch_apply winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch + patch_apply winebuild-Fake_Dlls/0006-winebuild-Add-syscall-thunks-in-fake-dlls.patch ( printf '%s\n' '+ { "Michael Müller", "winebuild: Generate syscall thunks for ntdll exports.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "krnl386.exe16: Do not abuse WOW32Reserved field for 16-bit stack address.", 1 },'; printf '%s\n' '+ { "Michael Müller", "winebuild: Use Windows 7 WOW64 signature for syscall thunks.", 1 },'; printf '%s\n' '+ { "Michael Müller", "winebuild: Use multipass label system to generate fake dlls.", 1 },'; printf '%s\n' '+ { "Michael Müller", "winebuild: Add stub functions in fake dlls.", 1 },'; 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 new file mode 100644 index 00000000..2ff0cb21 --- /dev/null +++ b/patches/winebuild-Fake_Dlls/0002-krnl386.exe16-Do-not-abuse-WOW32Reserved-field-for-1.patch @@ -0,0 +1,659 @@ +From 868ea83da0219cff107fbf1bd3bd1311337fb059 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Tue, 16 May 2017 04:37:52 +0200 +Subject: krnl386.exe16: Do not abuse WOW32Reserved field for 16-bit stack + address. + +--- + dlls/dbghelp/cpu_i386.c | 6 +++--- + dlls/krnl386.exe16/kernel.c | 6 +++--- + dlls/krnl386.exe16/kernel16_private.h | 11 ++++++----- + dlls/krnl386.exe16/ne_module.c | 6 +++--- + dlls/krnl386.exe16/ne_segment.c | 20 +++++++++---------- + dlls/krnl386.exe16/task.c | 14 +++++++------- + dlls/krnl386.exe16/thunk.c | 36 +++++++++++++++++------------------ + dlls/krnl386.exe16/wowthunk.c | 16 ++++++++-------- + dlls/ntdll/signal_i386.c | 2 +- + dlls/system.drv16/system.c | 2 +- + dlls/toolhelp.dll16/toolhelp.c | 6 +++--- + dlls/user.exe16/message.c | 16 ++++++++-------- + dlls/user.exe16/user.c | 4 ++-- + dlls/user.exe16/window.c | 2 +- + include/winternl.h | 2 +- + tools/winebuild/relay.c | 2 +- + 16 files changed, 76 insertions(+), 75 deletions(-) + +diff --git a/dlls/dbghelp/cpu_i386.c b/dlls/dbghelp/cpu_i386.c +index 37b2e2586e1..ed8070908a1 100644 +--- a/dlls/dbghelp/cpu_i386.c ++++ b/dlls/dbghelp/cpu_i386.c +@@ -213,16 +213,16 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO + /* Init done */ + set_curr_mode((frame->AddrPC.Mode == AddrModeFlat) ? stm_32bit : stm_16bit); + +- /* cur_switch holds address of WOW32Reserved field in TEB in debuggee ++ /* cur_switch holds address of SystemReserved1[0] field in TEB in debuggee + * address space + */ + if (NtQueryInformationThread(csw->hThread, ThreadBasicInformation, &info, + sizeof(info), NULL) == STATUS_SUCCESS) + { +- curr_switch = (DWORD_PTR)info.TebBaseAddress + FIELD_OFFSET(TEB, WOW32Reserved); ++ curr_switch = (DWORD_PTR)info.TebBaseAddress + FIELD_OFFSET(TEB, SystemReserved1[0]); + if (!sw_read_mem(csw, curr_switch, &p, sizeof(p))) + { +- WARN("Can't read TEB:WOW32Reserved\n"); ++ WARN("Can't read TEB:SystemReserved1[0]\n"); + goto done_err; + } + next_switch = p; +diff --git a/dlls/krnl386.exe16/kernel.c b/dlls/krnl386.exe16/kernel.c +index 0a66d1e611a..17b0c156c07 100644 +--- a/dlls/krnl386.exe16/kernel.c ++++ b/dlls/krnl386.exe16/kernel.c +@@ -45,8 +45,8 @@ static void thread_attach(void) + /* allocate the 16-bit stack (FIXME: should be done lazily) */ + HGLOBAL16 hstack = WOWGlobalAlloc16( GMEM_FIXED, 0x10000 ); + kernel_get_thread_data()->stack_sel = GlobalHandleToSel16( hstack ); +- NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR( kernel_get_thread_data()->stack_sel, +- 0x10000 - sizeof(STACK16FRAME) ); ++ NtCurrentTeb()->SystemReserved1[0] = (void *)MAKESEGPTR( kernel_get_thread_data()->stack_sel, ++ 0x10000 - sizeof(STACK16FRAME) ); + memset( (char *)GlobalLock16(hstack) + 0x10000 - sizeof(STACK16FRAME), 0, sizeof(STACK16FRAME) ); + } + +@@ -58,7 +58,7 @@ static void thread_detach(void) + { + /* free the 16-bit stack */ + WOWGlobalFree16( kernel_get_thread_data()->stack_sel ); +- NtCurrentTeb()->WOW32Reserved = 0; ++ NtCurrentTeb()->SystemReserved1[0] = 0; + if (NtCurrentTeb()->Tib.SubSystemTib) TASK_ExitTask(); + } + +diff --git a/dlls/krnl386.exe16/kernel16_private.h b/dlls/krnl386.exe16/kernel16_private.h +index 183c872192f..bb9a489e3df 100644 +--- a/dlls/krnl386.exe16/kernel16_private.h ++++ b/dlls/krnl386.exe16/kernel16_private.h +@@ -168,7 +168,7 @@ extern THHOOK *pThhook DECLSPEC_HIDDEN; + (((offset)+(size) <= pModule->mapping_size) ? \ + (memcpy( buffer, (const char *)pModule->mapping + (offset), (size) ), TRUE) : FALSE) + +-#define CURRENT_STACK16 ((STACK16FRAME*)MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved))) ++#define CURRENT_STACK16 ((STACK16FRAME*)MapSL(PtrToUlong(NtCurrentTeb()->SystemReserved1[0]))) + #define CURRENT_DS (CURRENT_STACK16->ds) + + /* push bytes on the 16-bit stack of a thread; return a segptr to the first pushed byte */ +@@ -176,8 +176,8 @@ static inline SEGPTR stack16_push( int size ) + { + STACK16FRAME *frame = CURRENT_STACK16; + memmove( (char*)frame - size, frame, sizeof(*frame) ); +- NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size; +- return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame)); ++ NtCurrentTeb()->SystemReserved1[0] = (char *)NtCurrentTeb()->SystemReserved1[0] - size; ++ return (SEGPTR)((char *)NtCurrentTeb()->SystemReserved1[0] + sizeof(*frame)); + } + + /* pop bytes from the 16-bit stack of a thread */ +@@ -185,7 +185,7 @@ static inline void stack16_pop( int size ) + { + STACK16FRAME *frame = CURRENT_STACK16; + memmove( (char*)frame + size, frame, sizeof(*frame) ); +- NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size; ++ NtCurrentTeb()->SystemReserved1[0] = (char *)NtCurrentTeb()->SystemReserved1[0] + size; + } + + /* dosmem.c */ +@@ -271,11 +271,12 @@ struct tagSYSLEVEL; + + struct kernel_thread_data + { ++ void *reserved; /* stack segment pointer */ + WORD stack_sel; /* 16-bit stack selector */ + WORD htask16; /* Win16 task handle */ + DWORD sys_count[4]; /* syslevel mutex entry counters */ + struct tagSYSLEVEL *sys_mutex[4]; /* syslevel mutex pointers */ +- void *pad[45]; /* change this if you add fields! */ ++ void *pad[44]; /* change this if you add fields! */ + }; + + static inline struct kernel_thread_data *kernel_get_thread_data(void) +diff --git a/dlls/krnl386.exe16/ne_module.c b/dlls/krnl386.exe16/ne_module.c +index 70f8a464673..cd706520d7d 100644 +--- a/dlls/krnl386.exe16/ne_module.c ++++ b/dlls/krnl386.exe16/ne_module.c +@@ -1244,7 +1244,7 @@ DWORD NE_StartTask(void) + sp = pSegTable[SELECTOROF(pModule->ne_sssp)-1].minsize + pModule->ne_stack; + sp &= ~1; + sp -= sizeof(STACK16FRAME); +- NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR( GlobalHandleToSel16(hInstance), sp ); ++ NtCurrentTeb()->SystemReserved1[0] = (void *)MAKESEGPTR( GlobalHandleToSel16(hInstance), sp ); + + /* Registers at initialization must be: + * ax zero +@@ -1274,8 +1274,8 @@ DWORD NE_StartTask(void) + + TRACE("Starting main program: cs:ip=%04x:%04x ds=%04x ss:sp=%04x:%04x\n", + context.SegCs, context.Eip, context.SegDs, +- SELECTOROF(NtCurrentTeb()->WOW32Reserved), +- OFFSETOF(NtCurrentTeb()->WOW32Reserved) ); ++ SELECTOROF(NtCurrentTeb()->SystemReserved1[0]), ++ OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) ); + + WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)&context ); + ExitThread( LOWORD(context.Eax) ); +diff --git a/dlls/krnl386.exe16/ne_segment.c b/dlls/krnl386.exe16/ne_segment.c +index 1ceb7143583..51b8261e8ee 100644 +--- a/dlls/krnl386.exe16/ne_segment.c ++++ b/dlls/krnl386.exe16/ne_segment.c +@@ -378,9 +378,9 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) + DWORD ret; + + selfloadheader = MapSL( MAKESEGPTR(SEL(pSegTable->hSeg),0) ); +- oldstack = NtCurrentTeb()->WOW32Reserved; +- NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR(pModule->self_loading_sel, +- 0xff00 - sizeof(STACK16FRAME)); ++ oldstack = NtCurrentTeb()->SystemReserved1[0]; ++ NtCurrentTeb()->SystemReserved1[0] = (void *)MAKESEGPTR(pModule->self_loading_sel, ++ 0xff00 - sizeof(STACK16FRAME)); + + hFile16 = NE_OpenFile( pModule ); + TRACE_(dll)("Call LoadAppSegProc(hmodule=0x%04x,hf=%x,segnum=%d)\n", +@@ -392,7 +392,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) + pSeg->hSeg = LOWORD(ret); + TRACE_(dll)("Ret LoadAppSegProc: hSeg=0x%04x\n", pSeg->hSeg); + _lclose16( hFile16 ); +- NtCurrentTeb()->WOW32Reserved = oldstack; ++ NtCurrentTeb()->SystemReserved1[0] = oldstack; + + pSeg->flags |= NE_SEGFLAGS_LOADED; + return TRUE; +@@ -484,9 +484,9 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule ) + sel = GlobalAlloc16( GMEM_ZEROINIT, 0xFF00 ); + pModule->self_loading_sel = SEL(sel); + FarSetOwner16( sel, pModule->self ); +- oldstack = NtCurrentTeb()->WOW32Reserved; +- NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR(pModule->self_loading_sel, +- 0xff00 - sizeof(STACK16FRAME) ); ++ oldstack = NtCurrentTeb()->SystemReserved1[0]; ++ NtCurrentTeb()->SystemReserved1[0] = (void *)MAKESEGPTR(pModule->self_loading_sel, ++ 0xff00 - sizeof(STACK16FRAME) ); + + hFile16 = NE_OpenFile(pModule); + TRACE_(dll)("CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n", +@@ -496,7 +496,7 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule ) + WOWCallback16Ex( (DWORD)selfloadheader->BootApp, WCB16_PASCAL, sizeof(args), args, NULL ); + TRACE_(dll)("Return from CallBootAppProc\n"); + _lclose16(hFile16); +- NtCurrentTeb()->WOW32Reserved = oldstack; ++ NtCurrentTeb()->SystemReserved1[0] = oldstack; + + for (i = 2; i <= pModule->ne_cseg; i++) + if (!NE_LoadSegment( pModule, i )) return FALSE; +@@ -693,7 +693,7 @@ static BOOL NE_InitDLL( NE_MODULE *pModule ) + context.SegGs = wine_get_gs(); + context.SegCs = SEL(pSegTable[SELECTOROF(pModule->ne_csip)-1].hSeg); + context.Eip = OFFSETOF(pModule->ne_csip); +- context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp); ++ context.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME,bp); + + pModule->ne_csip = 0; /* Don't initialize it twice */ + TRACE_(dll)("Calling LibMain for %.*s, cs:ip=%04x:%04x ds=%04x di=%04x cx=%04x\n", +@@ -798,7 +798,7 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason ) + context.SegGs = wine_get_gs(); + context.SegCs = HIWORD(entryPoint); + context.Eip = LOWORD(entryPoint); +- context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp); ++ context.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME,bp); + + args[7] = HIWORD(dwReason); + args[6] = LOWORD(dwReason); +diff --git a/dlls/krnl386.exe16/task.c b/dlls/krnl386.exe16/task.c +index 30aa8666e2c..4f82621e660 100644 +--- a/dlls/krnl386.exe16/task.c ++++ b/dlls/krnl386.exe16/task.c +@@ -630,7 +630,7 @@ void WINAPI InitTask16( CONTEXT *context ) + + /* Initialize the INSTANCEDATA structure */ + pinstance = MapSL( MAKESEGPTR(CURRENT_DS, 0) ); +- pinstance->stackmin = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + sizeof( STACK16FRAME ); ++ pinstance->stackmin = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + sizeof( STACK16FRAME ); + pinstance->stackbottom = pinstance->stackmin; /* yup, that's right. Confused me too. */ + pinstance->stacktop = ( pinstance->stackmin > LOWORD(context->Ebx) ? + pinstance->stackmin - LOWORD(context->Ebx) : 0 ) + 150; +@@ -1101,14 +1101,14 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top ) + + if (!(pData = GlobalLock16( seg ))) return; + TRACE("old=%04x:%04x new=%04x:%04x\n", +- SELECTOROF( NtCurrentTeb()->WOW32Reserved ), +- OFFSETOF( NtCurrentTeb()->WOW32Reserved ), seg, ptr ); ++ SELECTOROF( NtCurrentTeb()->SystemReserved1[0] ), ++ OFFSETOF( NtCurrentTeb()->SystemReserved1[0] ), seg, ptr ); + + /* Save the old stack */ + + oldFrame = CURRENT_STACK16; + /* pop frame + args and push bp */ +- pData->old_ss_sp = (SEGPTR)NtCurrentTeb()->WOW32Reserved + sizeof(STACK16FRAME) ++ pData->old_ss_sp = (SEGPTR)NtCurrentTeb()->SystemReserved1[0] + sizeof(STACK16FRAME) + + 2 * sizeof(WORD); + *(WORD *)MapSL(pData->old_ss_sp) = oldFrame->bp; + pData->stacktop = top; +@@ -1122,7 +1122,7 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top ) + */ + copySize = oldFrame->bp - OFFSETOF(pData->old_ss_sp); + copySize += 3 * sizeof(WORD) + sizeof(STACK16FRAME); +- NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR( seg, ptr - copySize ); ++ NtCurrentTeb()->SystemReserved1[0] = (void *)MAKESEGPTR( seg, ptr - copySize ); + newFrame = CURRENT_STACK16; + + /* Copy the stack frame and the local variables to the new stack */ +@@ -1141,7 +1141,7 @@ void WINAPI SwitchStackBack16( CONTEXT *context ) + STACK16FRAME *oldFrame, *newFrame; + INSTANCEDATA *pData; + +- if (!(pData = GlobalLock16(SELECTOROF(NtCurrentTeb()->WOW32Reserved)))) ++ if (!(pData = GlobalLock16(SELECTOROF(NtCurrentTeb()->SystemReserved1[0])))) + return; + if (!pData->old_ss_sp) + { +@@ -1160,7 +1160,7 @@ void WINAPI SwitchStackBack16( CONTEXT *context ) + + /* Switch back to the old stack */ + +- NtCurrentTeb()->WOW32Reserved = (void *)(pData->old_ss_sp - sizeof(STACK16FRAME)); ++ NtCurrentTeb()->SystemReserved1[0] = (void *)(pData->old_ss_sp - sizeof(STACK16FRAME)); + context->SegSs = SELECTOROF(pData->old_ss_sp); + 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 9e12d273241..0232f7ebe6f 100644 +--- a/dlls/krnl386.exe16/thunk.c ++++ b/dlls/krnl386.exe16/thunk.c +@@ -464,7 +464,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 */ +- context16.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp); ++ context16.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME,bp); + + /* + * used to be (problematic): +@@ -486,7 +486,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) - +- ( OFFSETOF(NtCurrentTeb()->WOW32Reserved) - argsize ); ++ ( OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) - argsize ); + } + DEFINE_REGS_ENTRYPOINT( QT_Thunk, 0 ) + +@@ -592,7 +592,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) + context16.SegGs = wine_get_gs(); + context16.SegCs = HIWORD(callTarget); + context16.Eip = LOWORD(callTarget); +- context16.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp); ++ context16.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME,bp); + + argsize = context->Ebp-context->Esp-0x40; + if (argsize > sizeof(newstack)) argsize = sizeof(newstack); +@@ -604,8 +604,8 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) + if (mapESPrelative & (1 << i)) + { + SEGPTR *arg = (SEGPTR *)newstack[i]; +- *arg = MAKESEGPTR(SELECTOROF(NtCurrentTeb()->WOW32Reserved), +- OFFSETOF(NtCurrentTeb()->WOW32Reserved) - argsize ++ *arg = MAKESEGPTR(SELECTOROF(NtCurrentTeb()->SystemReserved1[0]), ++ OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) - argsize + + (*(LPBYTE *)arg - oldstack)); + } + +@@ -615,7 +615,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT *context ) + context->Ecx = context16.Ecx; + + context->Esp += LOWORD(context16.Esp) - +- ( OFFSETOF(NtCurrentTeb()->WOW32Reserved) - argsize ); ++ ( OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) - argsize ); + + /* Copy modified buffers back to 32-bit stack */ + memcpy( oldstack, newstack, argsize ); +@@ -752,7 +752,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT *context ) + context16.Edi = LOWORD(context->Ecx); + context16.SegCs = HIWORD(context->Eax); + context16.Eip = LOWORD(context->Eax); +- context16.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp); ++ context16.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME,bp); + + argsize = HIWORD(context->Edx) * 4; + +@@ -810,7 +810,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context ) + context16.SegGs = wine_get_gs(); + context16.SegCs = HIWORD(context->Edx); + context16.Eip = LOWORD(context->Edx); +- context16.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp); ++ context16.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME,bp); + + argsize = 2 * *(WORD *)context->Esp + 2; + +@@ -823,7 +823,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT *context ) + (LPBYTE)CURRENT_STACK16 - argsize, argsize ); + + context->Esp += LOWORD(context16.Esp) - +- ( OFFSETOF(NtCurrentTeb()->WOW32Reserved) - argsize ); ++ ( OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) - argsize ); + } + DEFINE_REGS_ENTRYPOINT( OT_32ThkLSF, 0 ) + +@@ -1279,26 +1279,26 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT *context ) + DWORD argSize = context->Ebp - context->Esp; + char *stack16 = (char *)context->Esp - 4; + STACK16FRAME *frame16 = (STACK16FRAME *)stack16 - 1; +- STACK32FRAME *frame32 = NtCurrentTeb()->WOW32Reserved; ++ STACK32FRAME *frame32 = NtCurrentTeb()->SystemReserved1[0]; + char *stack32 = (char *)frame32 - argSize; + WORD stackSel = SELECTOROF(frame32->frame16); + DWORD stackBase = GetSelectorBase(stackSel); + + TRACE("before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %p\n", +- context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved); ++ context->Ebp, context->Esp, NtCurrentTeb()->SystemReserved1[0]); + + memset(frame16, '\0', sizeof(STACK16FRAME)); + frame16->frame32 = frame32; + frame16->ebp = context->Ebp; + + memcpy(stack32, stack16, argSize); +- NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR(stackSel, (DWORD)frame16 - stackBase); ++ NtCurrentTeb()->SystemReserved1[0] = (void *)MAKESEGPTR(stackSel, (DWORD)frame16 - stackBase); + + context->Esp = (DWORD)stack32 + 4; + context->Ebp = context->Esp + argSize; + + TRACE("after SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %p\n", +- context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved); ++ context->Ebp, context->Esp, NtCurrentTeb()->SystemReserved1[0]); + } + + /* entry_point is never used again once the entry point has +@@ -1321,7 +1321,7 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context ) + if ( code[5] == 0xFF && code[6] == 0x55 && code[7] == 0xFC + && code[13] == 0x66 && code[14] == 0xCB) + { +- STACK16FRAME *frame16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); ++ STACK16FRAME *frame16 = MapSL((SEGPTR)NtCurrentTeb()->SystemReserved1[0]); + char *stack16 = (char *)(frame16 + 1); + DWORD argSize = frame16->ebp - (DWORD)stack16; + char *stack32 = (char *)frame16->frame32 - argSize; +@@ -1329,15 +1329,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", +- context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved); ++ context->Ebp, context->Esp, NtCurrentTeb()->SystemReserved1[0]); + +- NtCurrentTeb()->WOW32Reserved = frame16->frame32; ++ NtCurrentTeb()->SystemReserved1[0] = frame16->frame32; + + context->Esp = (DWORD)stack16 + nArgsPopped; + context->Ebp = frame16->ebp; + + TRACE("after SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %p\n", +- context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved); ++ context->Ebp, context->Esp, NtCurrentTeb()->SystemReserved1[0]); + } + } + DEFINE_REGS_ENTRYPOINT( K32Thk1632Epilog, 0 ) +@@ -2337,7 +2337,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT *context ) + frame32 = pFrame->frame32; + while (frame32 && frame32->frame16) + { +- if (OFFSETOF(frame32->frame16) < OFFSETOF(NtCurrentTeb()->WOW32Reserved)) ++ if (OFFSETOF(frame32->frame16) < OFFSETOF(NtCurrentTeb()->SystemReserved1[0])) + break; /* Something strange is going on */ + if (OFFSETOF(frame32->frame16) > lpbuf[2]) + { +diff --git a/dlls/krnl386.exe16/wowthunk.c b/dlls/krnl386.exe16/wowthunk.c +index fa49a246ab8..bd69b844607 100644 +--- a/dlls/krnl386.exe16/wowthunk.c ++++ b/dlls/krnl386.exe16/wowthunk.c +@@ -222,7 +222,7 @@ static DWORD call16_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RE + { + /* unwinding: restore the stack pointer in the TEB, and leave the Win16 mutex */ + STACK32FRAME *frame32 = CONTAINING_RECORD(frame, STACK32FRAME, frame); +- NtCurrentTeb()->WOW32Reserved = (void *)frame32->frame16; ++ NtCurrentTeb()->SystemReserved1[0] = (void *)frame32->frame16; + _LeaveWin16Lock(); + } + else if (record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION || +@@ -543,7 +543,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, + context->SegCs, LOWORD(context->Eip), context->SegDs ); + while (count) DPRINTF( ",%04x", wstack[--count] ); + DPRINTF(") ss:sp=%04x:%04x", +- SELECTOROF(NtCurrentTeb()->WOW32Reserved), OFFSETOF(NtCurrentTeb()->WOW32Reserved) ); ++ SELECTOROF(NtCurrentTeb()->SystemReserved1[0]), OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) ); + DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x es=%04x fs=%04x\n", + (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx, + (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi, +@@ -608,8 +608,8 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, + if (TRACE_ON(relay)) + { + DPRINTF("%04x:RetFrom16() ss:sp=%04x:%04x ", +- GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->WOW32Reserved), +- OFFSETOF(NtCurrentTeb()->WOW32Reserved)); ++ GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->SystemReserved1[0]), ++ OFFSETOF(NtCurrentTeb()->SystemReserved1[0])); + DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x\n", + (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx, + (WORD)context->Edx, (WORD)context->Ebp, (WORD)context->Esp ); +@@ -627,10 +627,10 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, + + DPRINTF("%04x:CallTo16(func=%04x:%04x,ds=%04x", + GetCurrentThreadId(), HIWORD(vpfn16), LOWORD(vpfn16), +- SELECTOROF(NtCurrentTeb()->WOW32Reserved) ); ++ SELECTOROF(NtCurrentTeb()->SystemReserved1[0]) ); + while (count) DPRINTF( ",%04x", wstack[--count] ); + DPRINTF(") ss:sp=%04x:%04x\n", +- SELECTOROF(NtCurrentTeb()->WOW32Reserved), OFFSETOF(NtCurrentTeb()->WOW32Reserved) ); ++ SELECTOROF(NtCurrentTeb()->SystemReserved1[0]), OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) ); + SYSLEVEL_CheckNotLevel( 2 ); + } + +@@ -653,8 +653,8 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, + if (TRACE_ON(relay)) + { + DPRINTF("%04x:RetFrom16() ss:sp=%04x:%04x retval=%08x\n", +- GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->WOW32Reserved), +- OFFSETOF(NtCurrentTeb()->WOW32Reserved), ret); ++ GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->SystemReserved1[0]), ++ OFFSETOF(NtCurrentTeb()->SystemReserved1[0]), ret); + SYSLEVEL_CheckNotLevel( 2 ); + } + } +diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c +index d57daa7984f..f071ea3b79b 100644 +--- a/dlls/ntdll/signal_i386.c ++++ b/dlls/ntdll/signal_i386.c +@@ -990,7 +990,7 @@ static inline void *init_handler( const ucontext_t *sigcontext, WORD *fs, WORD * + * SS is still non-system segment. This is why both CS and SS + * are checked. + */ +- return teb->WOW32Reserved; ++ return teb->SystemReserved1[0]; + } + return (void *)(ESP_sig(sigcontext) & ~3); + } +diff --git a/dlls/system.drv16/system.c b/dlls/system.drv16/system.c +index 8bb5cf910df..ddd391344be 100644 +--- a/dlls/system.drv16/system.c ++++ b/dlls/system.drv16/system.c +@@ -72,7 +72,7 @@ static void CALLBACK SYSTEM_TimerTick( LPVOID arg, DWORD low, DWORD high ) + context.SegGs = wine_get_gs(); + context.SegCs = SELECTOROF( proc ); + context.Eip = OFFSETOF( proc ); +- context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME, bp); ++ context.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME, bp); + context.Eax = i + 1; + + WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)&context ); +diff --git a/dlls/toolhelp.dll16/toolhelp.c b/dlls/toolhelp.dll16/toolhelp.c +index cf5e6ef778c..531e622be82 100644 +--- a/dlls/toolhelp.dll16/toolhelp.c ++++ b/dlls/toolhelp.dll16/toolhelp.c +@@ -460,8 +460,8 @@ BOOL16 WINAPI TaskNext16( TASKENTRY *lpte ) + lpte->hTaskParent = pTask->hParent; + lpte->hInst = pTask->hInstance; + lpte->hModule = pTask->hModule; +- lpte->wSS = SELECTOROF( pTask->teb->WOW32Reserved ); +- lpte->wSP = OFFSETOF( pTask->teb->WOW32Reserved ); ++ lpte->wSS = SELECTOROF( pTask->teb->SystemReserved1[0] ); ++ lpte->wSP = OFFSETOF( pTask->teb->SystemReserved1[0] ); + lpte->wStackTop = pInstData->stacktop; + lpte->wStackMinimum = pInstData->stackmin; + lpte->wStackBottom = pInstData->stackbottom; +@@ -693,7 +693,7 @@ BOOL16 WINAPI TimerCount16( TIMERINFO *pTimerInfo ) + */ + BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo ) + { +- STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); ++ STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->SystemReserved1[0]); + HANDLE16 oldDS = stack16->ds; + WORD user = LoadLibrary16( "USER.EXE" ); + WORD gdi = LoadLibrary16( "GDI.EXE" ); +diff --git a/dlls/user.exe16/message.c b/dlls/user.exe16/message.c +index 9e07be97779..c020998b7e2 100644 +--- a/dlls/user.exe16/message.c ++++ b/dlls/user.exe16/message.c +@@ -248,13 +248,13 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA + /* Window procedures want ax = hInstance, ds = es = ss */ + + memset(&context, 0, sizeof(context)); +- context.SegDs = context.SegEs = SELECTOROF(NtCurrentTeb()->WOW32Reserved); ++ context.SegDs = context.SegEs = SELECTOROF(NtCurrentTeb()->SystemReserved1[0]); + context.SegFs = wine_get_fs(); + context.SegGs = wine_get_gs(); + if (!(context.Eax = GetWindowWord( HWND_32(hwnd), GWLP_HINSTANCE ))) context.Eax = context.SegDs; + context.SegCs = SELECTOROF(func); + context.Eip = OFFSETOF(func); +- context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME, bp); ++ context.Ebp = OFFSETOF(NtCurrentTeb()->SystemReserved1[0]) + FIELD_OFFSET(STACK16FRAME, bp); + + if (lParam) + { +@@ -277,7 +277,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA + if (size) + { + memcpy( &args.u, MapSL(lParam), size ); +- lParam = PtrToUlong(NtCurrentTeb()->WOW32Reserved) - size; ++ lParam = PtrToUlong(NtCurrentTeb()->SystemReserved1[0]) - size; + } + } + +@@ -2100,7 +2100,7 @@ static LRESULT combo_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, + + static void edit_lock_buffer( HWND hwnd ) + { +- STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); ++ STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->SystemReserved1[0])); + HLOCAL16 hloc16 = GetWindowWord( hwnd, GWW_HANDLE16 ); + HANDLE16 oldDS; + HLOCAL hloc32; +@@ -2126,7 +2126,7 @@ static void edit_lock_buffer( HWND hwnd ) + + static void edit_unlock_buffer( HWND hwnd ) + { +- STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); ++ STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->SystemReserved1[0])); + HLOCAL16 hloc16 = GetWindowWord( hwnd, GWW_HANDLE16 ); + HANDLE16 oldDS; + HLOCAL hloc32; +@@ -2163,7 +2163,7 @@ static HLOCAL16 edit_get_handle( HWND hwnd ) + if (!(hloc = (HLOCAL)wow_handlers32.edit_proc( hwnd, EM_GETHANDLE, 0, 0, FALSE ))) return 0; + alloc_size = LocalSize( hloc ); + +- stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); ++ stack16 = MapSL(PtrToUlong(NtCurrentTeb()->SystemReserved1[0])); + oldDS = stack16->ds; + stack16->ds = GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); + +@@ -2201,7 +2201,7 @@ done: + + static void edit_set_handle( HWND hwnd, HLOCAL16 hloc16 ) + { +- STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); ++ STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->SystemReserved1[0])); + HINSTANCE16 hInstance = GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); + HANDLE16 oldDS = stack16->ds; + HLOCAL hloc32; +@@ -2231,7 +2231,7 @@ static void edit_destroy_handle( HWND hwnd ) + HLOCAL16 hloc16 = GetWindowWord( hwnd, GWW_HANDLE16 ); + if (hloc16) + { +- STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); ++ STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->SystemReserved1[0])); + HANDLE16 oldDS = stack16->ds; + + stack16->ds = GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); +diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c +index aba797debc1..44e6f49e1a3 100644 +--- a/dlls/user.exe16/user.c ++++ b/dlls/user.exe16/user.c +@@ -1388,7 +1388,7 @@ DWORD WINAPI GetTabbedTextExtent16( HDC16 hdc, LPCSTR lpstr, INT16 count, + */ + DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wParam3) + { +- STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); ++ STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->SystemReserved1[0]); + HANDLE16 oldDS = stack16->ds; + DWORD ret = (DWORD)-1; + +@@ -1761,7 +1761,7 @@ UINT16 WINAPI RealizePalette16( HDC16 hdc ) + */ + WORD WINAPI GetFreeSystemResources16( WORD resType ) + { +- STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); ++ STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->SystemReserved1[0]); + HANDLE16 oldDS = stack16->ds; + int userPercent, gdiPercent; + +diff --git a/dlls/user.exe16/window.c b/dlls/user.exe16/window.c +index e81d9ace3ae..afe40b2df98 100644 +--- a/dlls/user.exe16/window.c ++++ b/dlls/user.exe16/window.c +@@ -455,7 +455,7 @@ HWND16 WINAPI GetParent16( HWND16 hwnd ) + */ + BOOL16 WINAPI IsWindow16( HWND16 hwnd ) + { +- STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->WOW32Reserved ); ++ STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->SystemReserved1[0] ); + frame->es = USER_HeapSel; + /* 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 5cd1664f1fe..ae3163daeac 100644 +--- a/include/winternl.h ++++ b/include/winternl.h +@@ -325,7 +325,7 @@ typedef struct _TEB + PVOID WOW32Reserved; /* 0c0/0100 */ + ULONG CurrentLocale; /* 0c4/0108 */ + ULONG FpSoftwareStatusRegister; /* 0c8/010c */ +- PVOID SystemReserved1[54]; /* 0cc/0110 used for kernel32 private data in Wine */ ++ PVOID SystemReserved1[54]; /* 0cc/0110 used for krnl386.exe16 private data in Wine */ + LONG ExceptionCode; /* 1a4/02c0 */ + ACTIVATION_CONTEXT_STACK ActivationContextStack; /* 1a8/02c8 */ + BYTE SpareBytes1[24]; /* 1bc/02e8 used for ntdll private data in Wine */ +diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c +index e9228a00d48..63ae977a0ae 100644 +--- a/tools/winebuild/relay.c ++++ b/tools/winebuild/relay.c +@@ -31,7 +31,7 @@ + #include "build.h" + + /* offset of the stack pointer relative to %fs:(0) */ +-#define STACKOFFSET 0xc0 /* FIELD_OFFSET(TEB,WOW32Reserved) */ ++#define STACKOFFSET 0xcc /* FIELD_OFFSET(TEB,SystemReserved1[0]) */ + + /* fix this if the ntdll_thread_regs structure is changed */ + #define GS_OFFSET 0x1d8 /* FIELD_OFFSET(TEB,SpareBytes1) + FIELD_OFFSET(ntdll_thread_data,gs) */ +-- +2.12.2 + diff --git a/patches/winebuild-Fake_Dlls/0002-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch b/patches/winebuild-Fake_Dlls/0003-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch similarity index 75% rename from patches/winebuild-Fake_Dlls/0002-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch rename to patches/winebuild-Fake_Dlls/0003-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch index 267f6898..5c3af50b 100644 --- a/patches/winebuild-Fake_Dlls/0002-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch +++ b/patches/winebuild-Fake_Dlls/0003-winebuild-Use-Windows-7-WOW64-signature-for-syscall-.patch @@ -1,15 +1,16 @@ -From 03c327c90dcdf127c25c32872eb70d907a87a83d Mon Sep 17 00:00:00 2001 +From a905d238bf7bdfa11ba1a78cea673bd7c835ee19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 12 May 2017 04:05:24 +0200 Subject: winebuild: Use Windows 7 WOW64 signature for syscall thunks. --- dlls/ntdll/signal_i386.c | 2 ++ + include/winternl.h | 2 +- tools/winebuild/spec32.c | 32 ++++++++++++++++++++++++++------ - 2 files changed, 28 insertions(+), 6 deletions(-) + 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index d57daa7984f..ffa9c1bbb0f 100644 +index f071ea3b79b..602688820a1 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -481,6 +481,7 @@ static wine_signal_handler handlers[256]; @@ -28,6 +29,19 @@ index d57daa7984f..ffa9c1bbb0f 100644 thread_data = (struct ntdll_thread_data *)(*teb)->SpareBytes1; if (!(thread_data->fs = wine_ldt_alloc_fs())) { +diff --git a/include/winternl.h b/include/winternl.h +index ae3163daeac..6b0624290fa 100644 +--- a/include/winternl.h ++++ b/include/winternl.h +@@ -322,7 +322,7 @@ typedef struct _TEB + PVOID CsrClientThread; /* 03c/0070 */ + PVOID Win32ThreadInfo; /* 040/0078 */ + ULONG Win32ClientInfo[31]; /* 044/0080 used for user32 private data in Wine */ +- PVOID WOW32Reserved; /* 0c0/0100 */ ++ PVOID WOW32Reserved; /* 0c0/0100 used for ntdll syscall thunks */ + ULONG CurrentLocale; /* 0c4/0108 */ + ULONG FpSoftwareStatusRegister; /* 0c8/010c */ + PVOID SystemReserved1[54]; /* 0cc/0110 used for krnl386.exe16 private data in Wine */ diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index fbde7ce6937..452e26fa949 100644 --- a/tools/winebuild/spec32.c diff --git a/patches/winebuild-Fake_Dlls/0003-winebuild-Use-multipass-label-system-to-generate-fak.patch b/patches/winebuild-Fake_Dlls/0004-winebuild-Use-multipass-label-system-to-generate-fak.patch similarity index 100% rename from patches/winebuild-Fake_Dlls/0003-winebuild-Use-multipass-label-system-to-generate-fak.patch rename to patches/winebuild-Fake_Dlls/0004-winebuild-Use-multipass-label-system-to-generate-fak.patch diff --git a/patches/winebuild-Fake_Dlls/0004-winebuild-Add-stub-functions-in-fake-dlls.patch b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch similarity index 100% rename from patches/winebuild-Fake_Dlls/0004-winebuild-Add-stub-functions-in-fake-dlls.patch rename to patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch diff --git a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-syscall-thunks-in-fake-dlls.patch b/patches/winebuild-Fake_Dlls/0006-winebuild-Add-syscall-thunks-in-fake-dlls.patch similarity index 100% rename from patches/winebuild-Fake_Dlls/0005-winebuild-Add-syscall-thunks-in-fake-dlls.patch rename to patches/winebuild-Fake_Dlls/0006-winebuild-Add-syscall-thunks-in-fake-dlls.patch