If a Wow64 process is in emulation mode (e.g. CS points to 32-bit compat segment on x86-64), the Wow64 register context is synonymous to the native register context. The client should indicate this condition by omitting the Wow64 context when issuing a select request. Then, the wineserver automatically redirects Wow64 context writes to the native context.
From: Jinoh Kang jinoh.kang.kr@gmail.com
Today, the wineserver does not discard the stale Wow64 context when the client sends its new register context via the select request.
If a Wow64 process is in emulation mode (e.g. CS points to 32-bit compat segment on x86-64), the Wow64 register context is synonymous to the native register context. The client can indicate this condition by omitting the Wow64 context when issuing a select request.
If the client does omit the Wow64 context, the server shall discard the old Wow64 context which has now become stale; however, the server leaves the Wow64 context slot unchanged. This becomes an issue if the Wow64 context slot has already been populated by a prior select request (e.g. a debug event).
Fix this by clearing the 'machine' and 'flags' fields of the Wow64 context slot unless a new Wow64 context is provided by the client.
Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- server/thread.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/server/thread.c b/server/thread.c index 467ccd1f0db..c795df8ffa1 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1616,11 +1616,16 @@ DECL_HANDLER(select) ctx->regs[CTX_WOW].machine = current->process->machine; copy_context( &ctx->regs[CTX_WOW], wow_context, wow_context->flags & ~ctx->regs[CTX_WOW].flags ); } - else if (ctx->regs[CTX_PENDING].flags) + else { - unsigned int flags = ctx->regs[CTX_PENDING].flags & ~ctx->regs[CTX_NATIVE].flags; - copy_context( &ctx->regs[CTX_NATIVE], &ctx->regs[CTX_PENDING], flags ); - ctx->regs[CTX_NATIVE].flags |= flags; + ctx->regs[CTX_WOW].machine = 0; + ctx->regs[CTX_WOW].flags = 0; + if (ctx->regs[CTX_PENDING].flags) + { + unsigned int flags = ctx->regs[CTX_PENDING].flags & ~ctx->regs[CTX_NATIVE].flags; + copy_context( &ctx->regs[CTX_NATIVE], &ctx->regs[CTX_PENDING], flags ); + ctx->regs[CTX_NATIVE].flags |= flags; + } } ctx->regs[CTX_PENDING].flags = 0; ctx->status = STATUS_SUCCESS;
From: Jinoh Kang jinoh.kang.kr@gmail.com
This reverts commit ee99bd4bc1b7ef4c18d5254a76d72d3bd38f41e8.
If a Wow64 process is in emulation mode (e.g. CS points to 32-bit compat segment on x86-64), the Wow64 register context is synonymous to the native register context. The client should indicate this condition by omitting the Wow64 context when issuing a select request. Then, the wineserver automatically redirects Wow64 context writes to the native context.
Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- dlls/ntdll/unix/thread.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 6d937675bcb..8de8e68a8e7 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1011,9 +1011,6 @@ static void contexts_to_server( context_t server_contexts[2], CONTEXT *context ) context_to_server( &server_contexts[count++], native_machine, native_context, native_machine ); if (wow_context) context_to_server( &server_contexts[count++], main_image_info.Machine, wow_context, main_image_info.Machine ); - else if (native_machine != main_image_info.Machine) - context_to_server( &server_contexts[count++], main_image_info.Machine, - native_context, native_machine ); } else context_to_server( &server_contexts[count++], native_machine,