Commit b58a9135 authored by Tk-Glitch's avatar Tk-Glitch

community-patches: wine-tkg-git: Update the Monster Hunter World patch with...

community-patches: wine-tkg-git: Update the Monster Hunter World patch with latest version from Guy1524. It doesn't work for me, but it works for him.. So..
parent 2cb0e84f
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index ff11b7fa8d..971cbdb99f 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -2124,13 +2124,13 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
BOOL self = (handle == GetCurrentThread());
diff --git a/server/thread.c b/server/thread.c
index edf70c61bd..b9e6bca916 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -265,6 +265,11 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
thread->affinity = process->affinity;
if (!current) current = thread;
/* debug registers require a server call */
- if (self && (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)))
+ /*if (self && (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)))
self = (amd64_thread_data()->dr0 == context->Dr0 &&
amd64_thread_data()->dr1 == context->Dr1 &&
amd64_thread_data()->dr2 == context->Dr2 &&
amd64_thread_data()->dr3 == context->Dr3 &&
amd64_thread_data()->dr6 == context->Dr6 &&
- amd64_thread_data()->dr7 == context->Dr7);
+ amd64_thread_data()->dr7 == context->Dr7);*/
+ thread->fake_dbg_ctx = mem_alloc( sizeof(context_t) );
+ memset(thread->fake_dbg_ctx, 0, sizeof(context_t));
+ thread->fake_dbg_ctx->cpu = current->process->cpu;
+ thread->fake_dbg_ctx->flags = SERVER_CTX_DEBUG_REGISTERS;
+
list_add_head( &thread_list, &thread->entry );
if (!self)
{
@@ -2158,7 +2158,15 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
needed_flags = context->ContextFlags;
if (sd && !set_sd_defaults_from_token( &thread->obj, sd,
@@ -326,6 +331,7 @@ static void cleanup_thread( struct thread *thread )
if (thread->reply_fd) release_object( thread->reply_fd );
if (thread->wait_fd) release_object( thread->wait_fd );
free( thread->suspend_context );
+ free( thread->fake_dbg_ctx );
cleanup_clipboard_thread(thread);
destroy_thread_windows( thread );
free_msg_queue( thread );
@@ -346,6 +352,7 @@ static void cleanup_thread( struct thread *thread )
thread->wait_fd = NULL;
thread->context = NULL;
thread->suspend_context = NULL;
+ thread->fake_dbg_ctx = NULL;
thread->desktop = 0;
thread->desc = NULL;
thread->desc_len = 0;
@@ -1723,6 +1730,18 @@ DECL_HANDLER(get_thread_context)
if (!(thread = get_thread_from_handle( req->handle, THREAD_GET_CONTEXT ))) return;
reply->self = (thread == current);
/* debug registers require a server call */
- if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) self = FALSE;
+ if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) //self = FALSE;
+ if (req->flags == SERVER_CTX_DEBUG_REGISTERS)
+ {
+ context->Dr0 = amd64_thread_data()->dr0;
+ context->Dr1 = amd64_thread_data()->dr1;
+ context->Dr2 = amd64_thread_data()->dr2;
+ context->Dr3 = amd64_thread_data()->dr3;
+ context->Dr6 = amd64_thread_data()->dr6;
+ context->Dr7 = amd64_thread_data()->dr7;
+ if ((context = set_reply_data_size( sizeof(context_t) )))
+ {
+ memset( context, 0, sizeof(context_t) );
+ context->cpu = thread->process->cpu;
+ copy_context(context, thread->fake_dbg_ctx, req->flags );
+ }
+ release_object( thread );
+ return;
+ }
+
if (thread != current && !thread->context)
{
/* thread is not suspended, retry (if it's still running) */
@@ -1765,6 +1784,13 @@ DECL_HANDLER(set_thread_context)
if (!(thread = get_thread_from_handle( req->handle, THREAD_SET_CONTEXT ))) return;
reply->self = (thread == current);
if (!self)
+ if (context->flags == SERVER_CTX_DEBUG_REGISTERS)
+ {
+ copy_context(thread->fake_dbg_ctx, context, context->flags);
+ release_object( thread );
+ return;
+ }
+
if (thread != current && !thread->context)
{
/* thread is not suspended, retry (if it's still running) */
diff --git a/server/thread.h b/server/thread.h
index 66e35603d3..c360ab8b9b 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -77,6 +77,7 @@ struct thread
int unix_tid; /* Unix tid of client */
context_t *context; /* current context if in an exception handler */
context_t *suspend_context; /* current context if suspended */
+ context_t *fake_dbg_ctx; /* Holds the cached debug registers */
client_ptr_t teb; /* TEB address (in client address space) */
client_ptr_t entry_point; /* entry point (in client address space) */
affinity_t affinity; /* affinity mask */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment