4 * Copyright 1996, 2003 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/server.h"
25 /***********************************************************************
26 * NtOpenThread (NTDLL.@)
27 * ZwOpenThread (NTDLL.@)
29 NTSTATUS WINAPI
NtOpenThread( HANDLE
*handle
, ACCESS_MASK access
,
30 const OBJECT_ATTRIBUTES
*attr
, const CLIENT_ID
*id
)
34 SERVER_START_REQ( open_thread
)
36 req
->tid
= (thread_id_t
)id
->UniqueThread
;
38 req
->inherit
= attr
&& (attr
->Attributes
& OBJ_INHERIT
);
39 ret
= wine_server_call( req
);
40 *handle
= reply
->handle
;
47 /******************************************************************************
48 * NtSuspendThread (NTDLL.@)
49 * ZwSuspendThread (NTDLL.@)
51 NTSTATUS WINAPI
NtSuspendThread( HANDLE handle
, PULONG count
)
55 SERVER_START_REQ( suspend_thread
)
58 if (!(ret
= wine_server_call( req
))) *count
= reply
->count
;
65 /******************************************************************************
66 * NtResumeThread (NTDLL.@)
67 * ZwResumeThread (NTDLL.@)
69 NTSTATUS WINAPI
NtResumeThread( HANDLE handle
, PULONG count
)
73 SERVER_START_REQ( resume_thread
)
76 if (!(ret
= wine_server_call( req
))) *count
= reply
->count
;
83 /******************************************************************************
84 * NtTerminateThread (NTDLL.@)
85 * ZwTerminateThread (NTDLL.@)
87 NTSTATUS WINAPI
NtTerminateThread( HANDLE handle
, LONG exit_code
)
92 SERVER_START_REQ( terminate_thread
)
95 req
->exit_code
= exit_code
;
96 ret
= wine_server_call( req
);
97 self
= !ret
&& reply
->self
;
104 if (last
) exit( exit_code
);
105 else SYSDEPS_ExitThread( exit_code
);
111 /******************************************************************************
112 * NtQueueApcThread (NTDLL.@)
114 NTSTATUS WINAPI
NtQueueApcThread( HANDLE handle
, PNTAPCFUNC func
, ULONG_PTR arg1
,
115 ULONG_PTR arg2
, ULONG_PTR arg3
)
118 SERVER_START_REQ( queue_apc
)
120 req
->handle
= handle
;
123 req
->arg1
= (void *)arg1
;
124 req
->arg2
= (void *)arg2
;
125 req
->arg3
= (void *)arg3
;
126 ret
= wine_server_call( req
);
133 /***********************************************************************
134 * NtSetContextThread (NTDLL.@)
135 * ZwSetContextThread (NTDLL.@)
137 NTSTATUS WINAPI
NtSetContextThread( HANDLE handle
, const CONTEXT
*context
)
141 SERVER_START_REQ( set_thread_context
)
143 req
->handle
= handle
;
144 req
->flags
= context
->ContextFlags
;
145 wine_server_add_data( req
, context
, sizeof(*context
) );
146 ret
= wine_server_call( req
);
153 /***********************************************************************
154 * NtGetContextThread (NTDLL.@)
155 * ZwGetContextThread (NTDLL.@)
157 NTSTATUS WINAPI
NtGetContextThread( HANDLE handle
, CONTEXT
*context
)
161 SERVER_START_REQ( get_thread_context
)
163 req
->handle
= handle
;
164 req
->flags
= context
->ContextFlags
;
165 wine_server_add_data( req
, context
, sizeof(*context
) );
166 wine_server_set_reply( req
, context
, sizeof(*context
) );
167 ret
= wine_server_call( req
);