Moved code from CreateThread to CreateRemoteThread

Alexander Yaworsky yaworsky at migusoft.ru
Fri Sep 17 23:36:30 CDT 2004


Hello

CreateRemoteThread relies on error handling introduced in previous
patch for ntdll

ChangeLog:

Moved code from CreateThread to CreateRemoteThread

Index: dlls/kernel/thread.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/thread.c,v
retrieving revision 1.19
diff -u -r1.19 thread.c
--- dlls/kernel/thread.c 7 Jul 2004 00:49:34 -0000 1.19
+++ dlls/kernel/thread.c 18 Sep 2004 03:30:14 -0000
@@ -121,6 +121,32 @@
                             LPTHREAD_START_ROUTINE start, LPVOID param,
                             DWORD flags, LPDWORD id )
 {
+     return CreateRemoteThread( GetCurrentProcess(),
+                                sa, stack, start, param, flags, id );
+}
+
+
+/***************************************************************************
+ *                  CreateRemoteThread   (KERNEL32.@)
+ *
+ * Creates a thread that runs in the address space of another process
+ *
+ * PARAMS
+ *
+ * RETURNS
+ *   Success: Handle to the new thread.
+ *   Failure: NULL. Use GetLastError() to find the error cause.
+ *
+ * BUGS
+ *   Improper memory allocation: there's no ability to free new_thread_info
+ *   in other process.
+ *   Bad start address for RtlCreateUserThread because the library
+ *   may be loaded at different address in other process.
+ */
+HANDLE WINAPI CreateRemoteThread( HANDLE hProcess, SECURITY_ATTRIBUTES *sa, SIZE_T stack,
+                                  LPTHREAD_START_ROUTINE start, LPVOID param,
+                                  DWORD flags, LPDWORD id )
+{
     HANDLE handle;
     CLIENT_ID client_id;
     NTSTATUS status;
@@ -138,7 +164,7 @@
     if (flags & STACK_SIZE_PARAM_IS_A_RESERVATION) stack_reserve = stack;
     else stack_commit = stack;
 
-    status = RtlCreateUserThread( GetCurrentProcess(), NULL, (flags & CREATE_SUSPENDED) != 0,
+    status = RtlCreateUserThread( hProcess, NULL, (flags & CREATE_SUSPENDED) != 0,
                                   NULL, stack_reserve, stack_commit,
                                   THREAD_Start, info, &handle, &client_id );
     if (status == STATUS_SUCCESS)
@@ -154,31 +180,6 @@
         handle = 0;
     }
     return handle;
-}
-
-
-/***************************************************************************
- *                  CreateRemoteThread   (KERNEL32.@)
- *
- * Creates a thread that runs in the address space of another process
- *
- * PARAMS
- *
- * RETURNS
- *   Success: Handle to the new thread.
- *   Failure: NULL. Use GetLastError() to find the error cause.
- *
- * BUGS
- *   Unimplemented
- */
-HANDLE WINAPI CreateRemoteThread( HANDLE hProcess, SECURITY_ATTRIBUTES *sa, SIZE_T stack,
-                                  LPTHREAD_START_ROUTINE start, LPVOID param,
-                                  DWORD flags, LPDWORD id )
-{
-    FIXME("(): stub, Write Me.\n");
-
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return NULL;
 }
 
 




More information about the wine-patches mailing list