Dimitrie O. Paun wrote:
On February 1, 2003 02:10 am, David Fraser wrote:
Could we go straight down to the underlying win32 api and do a GetThreadContext there? Is that cheating?
I don't know the Cygwin threading model, but calling the real [GS]etThreadContext is a good first order approximation. If interested in this task, I'd bring it up on the Cygwin mailing list...
Just as a start, I tried this ... compiles fine but don't know how to test it ... Does this look right? (just done for get_thread_context) David Index: server/context_i386.c =================================================================== RCS file: /home/wine/wine/server/context_i386.c,v retrieving revision 1.24 diff -u -r1.24 context_i386.c --- server/context_i386.c 8 Nov 2002 18:55:31 -0000 1.24 +++ server/context_i386.c 4 Feb 2003 17:53:57 -0000 @@ -76,7 +76,31 @@ #define PTRACE_SETDBREGS PT_SETDBREGS #endif -#ifdef linux +#if defined(__CYGWIN__) + +/* need to access handles... */ +#include "handle.h" + +/* retrieve a thread context */ +static void get_thread_context( struct thread *thread, unsigned int flags, CONTEXT *context ) +{ + /* get a handle to the thread with all access, not inheritable */ + HANDLE hThread = alloc_handle(thread->process, thread, THREAD_ALL_ACCESS, 0); + /* cheat and call underlying Windows GetThreadContext directly... */ + BOOL success = GetThreadContext(hThread, context); + /* now release the handle... */ + close_handle(thread->process, hThread, NULL); +} + + +/* set a thread context */ +static void set_thread_context( struct thread *thread, unsigned int flags, const CONTEXT *context ) +{ + /* FIXME: implement this */ + file_set_error(); +} + +#elif defined(linux) #ifdef HAVE_SYS_USER_H # include <sys/user.h> #endif