4 * Copyright 1996 Alexandre Julliard
10 #include <sys/socket.h>
12 #include "wine/winbase16.h"
20 #include "selectors.h"
23 #include "stackframe.h"
28 DEFAULT_DEBUG_CHANNEL(thread
)
34 /* Is threading code initialized? */
35 BOOL THREAD_InitDone
= FALSE
;
37 /* THDB of the initial thread */
38 static THDB initial_thdb
;
40 /* Global thread list (FIXME: not thread-safe) */
41 THDB
*THREAD_First
= &initial_thdb
;
43 /***********************************************************************
46 * Return the current thread THDB pointer.
48 THDB
*THREAD_Current(void)
50 if (!THREAD_InitDone
) return NULL
;
51 return (THDB
*)((char *)NtCurrentTeb() - (int)&((THDB
*)0)->teb
);
54 /***********************************************************************
57 BOOL
THREAD_IsWin16( THDB
*thdb
)
59 return !thdb
|| !(thdb
->teb
.flags
& TEBF_WIN32
);
62 /***********************************************************************
65 * Convert a thread id to a THDB, making sure it is valid.
67 THDB
*THREAD_IdToTHDB( DWORD id
)
69 THDB
*thdb
= THREAD_First
;
71 if (!id
) return THREAD_Current();
74 if ((DWORD
)thdb
->server_tid
== id
) return thdb
;
77 /* Allow task handles to be used; convert to main thread */
80 TDB
*pTask
= (TDB
*)GlobalLock16( id
);
81 if (pTask
) return pTask
->thdb
;
83 SetLastError( ERROR_INVALID_PARAMETER
);
88 /***********************************************************************
91 * Initialization of a newly created THDB.
93 static BOOL
THREAD_InitTHDB( THDB
*thdb
, DWORD stack_size
, BOOL alloc_stack16
,
94 LPSECURITY_ATTRIBUTES sa
)
98 /* Allocate the stack */
101 * If stacksize smaller than 1 MB, allocate 1MB
102 * (one program wanted only 10 kB, which is recommendable, but some WINE
103 * functions, noteably in the files subdir, push HUGE structures and
104 * arrays on the stack. They probably shouldn't.)
105 * If stacksize larger than 16 MB, warn the user. (We could shrink the stack
106 * but this could give more or less unexplainable crashes.)
108 if (stack_size
<1024*1024)
109 stack_size
= 1024 * 1024;
110 if (stack_size
>= 16*1024*1024)
111 WARN(thread
,"Thread stack size is %ld MB.\n",stack_size
/1024/1024);
112 thdb
->stack_base
= VirtualAlloc(NULL
,
113 stack_size
+ (alloc_stack16
? 0x10000 : 0),
114 MEM_COMMIT
, PAGE_EXECUTE_READWRITE
);
115 if (!thdb
->stack_base
) goto error
;
116 /* Set a guard page at the bottom of the stack */
117 VirtualProtect( thdb
->stack_base
, 1, PAGE_EXECUTE_READWRITE
| PAGE_GUARD
,
119 thdb
->teb
.stack_top
= (char *)thdb
->stack_base
+ stack_size
;
120 thdb
->teb
.stack_low
= thdb
->stack_base
;
121 thdb
->exit_stack
= thdb
->teb
.stack_top
;
123 /* Allocate the 16-bit stack selector */
127 thdb
->teb
.stack_sel
= SELECTOR_AllocBlock( thdb
->teb
.stack_top
,
128 0x10000, SEGMENT_DATA
,
130 if (!thdb
->teb
.stack_sel
) goto error
;
131 thdb
->cur_stack
= PTR_SEG_OFF_TO_SEGPTR( thdb
->teb
.stack_sel
,
132 0x10000 - sizeof(STACK16FRAME
) );
135 /* Create the thread event */
137 if (!(thdb
->event
= CreateEventA( NULL
, FALSE
, FALSE
, NULL
))) goto error
;
138 thdb
->event
= ConvertToGlobalHandle( thdb
->event
);
142 if (thdb
->event
) CloseHandle( thdb
->event
);
143 if (thdb
->teb
.stack_sel
) SELECTOR_FreeBlock( thdb
->teb
.stack_sel
, 1 );
144 if (thdb
->stack_base
) VirtualFree( thdb
->stack_base
, 0, MEM_RELEASE
);
149 /***********************************************************************
152 * Free data structures associated with a thread.
153 * Must be called from the context of another thread.
155 void THREAD_FreeTHDB( THDB
*thdb
)
157 THDB
**pptr
= &THREAD_First
;
159 PROCESS_CallUserSignalProc( USIG_THREAD_EXIT
, 0, 0 );
161 CloseHandle( thdb
->event
);
162 while (*pptr
&& (*pptr
!= thdb
)) pptr
= &(*pptr
)->next
;
163 if (*pptr
) *pptr
= thdb
->next
;
165 /* Free the associated memory */
167 if (thdb
->teb
.stack_sel
) SELECTOR_FreeBlock( thdb
->teb
.stack_sel
, 1 );
168 SELECTOR_FreeBlock( thdb
->teb_sel
, 1 );
169 close( thdb
->socket
);
170 VirtualFree( thdb
->stack_base
, 0, MEM_RELEASE
);
171 HeapFree( SystemHeap
, HEAP_NO_SERIALIZE
, thdb
);
175 /***********************************************************************
176 * THREAD_CreateInitialThread
178 * Create the initial thread.
180 THDB
*THREAD_CreateInitialThread( PDB
*pdb
, int server_fd
)
182 initial_thdb
.process
= pdb
;
183 initial_thdb
.teb
.except
= (void *)-1;
184 initial_thdb
.teb
.self
= &initial_thdb
.teb
;
185 initial_thdb
.teb
.flags
= /* TEBF_WIN32 */ 0;
186 initial_thdb
.teb
.tls_ptr
= initial_thdb
.tls_array
;
187 initial_thdb
.teb
.process
= pdb
;
188 initial_thdb
.exit_code
= 0x103; /* STILL_ACTIVE */
189 initial_thdb
.socket
= server_fd
;
191 /* Allocate the TEB selector (%fs register) */
193 if (!(initial_thdb
.teb_sel
= SELECTOR_AllocBlock( &initial_thdb
.teb
, 0x1000,
194 SEGMENT_DATA
, TRUE
, FALSE
)))
196 MSG("Could not allocate fs register for initial thread\n" );
199 SET_CUR_THREAD( &initial_thdb
);
200 THREAD_InitDone
= TRUE
;
202 /* Now proceed with normal initialization */
204 if (CLIENT_InitThread()) return NULL
;
205 if (!THREAD_InitTHDB( &initial_thdb
, 0, TRUE
, NULL
)) return NULL
;
206 return &initial_thdb
;
210 /***********************************************************************
213 THDB
*THREAD_Create( PDB
*pdb
, DWORD flags
, DWORD stack_size
, BOOL alloc_stack16
,
214 LPSECURITY_ATTRIBUTES sa
, int *server_handle
)
216 struct new_thread_request request
;
217 struct new_thread_reply reply
= { NULL
, -1 };
220 THDB
*thdb
= HeapAlloc( SystemHeap
, HEAP_ZERO_MEMORY
, sizeof(THDB
) );
221 if (!thdb
) return NULL
;
223 thdb
->teb
.except
= (void *)-1;
224 thdb
->teb
.htask16
= pdb
->task
;
225 thdb
->teb
.self
= &thdb
->teb
;
226 thdb
->teb
.flags
= (pdb
->flags
& PDB32_WIN16_PROC
)? 0 : TEBF_WIN32
;
227 thdb
->teb
.tls_ptr
= thdb
->tls_array
;
228 thdb
->teb
.process
= pdb
;
229 thdb
->exit_code
= 0x103; /* STILL_ACTIVE */
233 /* Allocate the TEB selector (%fs register) */
235 thdb
->teb_sel
= SELECTOR_AllocBlock( &thdb
->teb
, 0x1000, SEGMENT_DATA
,
237 if (!thdb
->teb_sel
) goto error
;
239 /* Create the socket pair for server communication */
241 if (socketpair( AF_UNIX
, SOCK_STREAM
, 0, fd
) == -1)
243 SetLastError( ERROR_TOO_MANY_OPEN_FILES
); /* FIXME */
246 thdb
->socket
= fd
[0];
247 fcntl( fd
[0], F_SETFD
, 1 ); /* set close on exec flag */
249 /* Create the thread on the server side */
251 request
.pid
= thdb
->process
->server_pid
;
252 request
.suspend
= ((thdb
->flags
& CREATE_SUSPENDED
) != 0);
253 request
.inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
254 CLIENT_SendRequest( REQ_NEW_THREAD
, fd
[1], 1, &request
, sizeof(request
) );
255 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) goto error
;
256 thdb
->server_tid
= reply
.tid
;
257 *server_handle
= reply
.handle
;
259 /* Do the rest of the initialization */
261 if (!THREAD_InitTHDB( thdb
, stack_size
, alloc_stack16
, sa
)) goto error
;
262 thdb
->next
= THREAD_First
;
267 if (reply
.handle
!= -1) CloseHandle( reply
.handle
);
268 if (thdb
->teb_sel
) SELECTOR_FreeBlock( thdb
->teb_sel
, 1 );
269 HeapFree( SystemHeap
, 0, thdb
);
270 if (thdb
->socket
!= -1) close( thdb
->socket
);
275 /***********************************************************************
278 * Start execution of a newly created thread. Does not return.
280 static void THREAD_Start(void)
282 THDB
*thdb
= THREAD_Current();
283 LPTHREAD_START_ROUTINE func
= (LPTHREAD_START_ROUTINE
)thdb
->entry_point
;
284 PROCESS_CallUserSignalProc( USIG_THREAD_INIT
, 0, 0 );
286 MODULE_DllThreadAttach( NULL
);
287 ExitThread( func( thdb
->entry_arg
) );
291 /***********************************************************************
292 * CreateThread (KERNEL32.63)
294 HANDLE WINAPI
CreateThread( SECURITY_ATTRIBUTES
*sa
, DWORD stack
,
295 LPTHREAD_START_ROUTINE start
, LPVOID param
,
296 DWORD flags
, LPDWORD id
)
299 THDB
*thread
= THREAD_Create( PROCESS_Current(), flags
, stack
, TRUE
, sa
, &handle
);
300 if (!thread
) return INVALID_HANDLE_VALUE
;
301 thread
->teb
.flags
|= TEBF_WIN32
;
302 thread
->entry_point
= start
;
303 thread
->entry_arg
= param
;
304 thread
->startup
= THREAD_Start
;
305 if (SYSDEPS_SpawnThread( thread
) == -1)
307 CloseHandle( handle
);
308 return INVALID_HANDLE_VALUE
;
310 if (id
) *id
= (DWORD
)thread
->server_tid
;
315 /***********************************************************************
316 * ExitThread [KERNEL32.215] Ends a thread
321 void WINAPI
ExitThread( DWORD code
) /* [in] Exit code for this thread */
323 MODULE_DllThreadDetach( NULL
);
324 TerminateThread( GetCurrentThread(), code
);
328 /***********************************************************************
329 * GetCurrentThread [KERNEL32.200] Gets pseudohandle for current thread
332 * Pseudohandle for the current thread
334 HANDLE WINAPI
GetCurrentThread(void)
336 return CURRENT_THREAD_PSEUDOHANDLE
;
340 /***********************************************************************
341 * GetCurrentThreadId [KERNEL32.201] Returns thread identifier.
344 * Thread identifier of calling thread
346 DWORD WINAPI
GetCurrentThreadId(void)
348 THDB
*thdb
= THREAD_Current();
350 assert( thdb
->server_tid
);
351 return (DWORD
)thdb
->server_tid
;
355 /**********************************************************************
356 * GetLastError [KERNEL.148] [KERNEL32.227] Returns last-error code.
359 * Calling thread's last error code value.
361 DWORD WINAPI
GetLastError(void)
363 THDB
*thread
= THREAD_Current();
364 DWORD ret
= thread
->last_error
;
365 TRACE(thread
,"0x%lx\n",ret
);
370 /**********************************************************************
371 * SetLastError [KERNEL.147] [KERNEL32.497] Sets the last-error code.
376 void WINAPI
SetLastError(
377 DWORD error
) /* [in] Per-thread error code */
379 THDB
*thread
= THREAD_Current();
380 /* This one must work before we have a thread (FIXME) */
382 TRACE(thread
,"%p error=0x%lx\n",thread
,error
);
385 thread
->last_error
= error
;
389 /**********************************************************************
390 * SetLastErrorEx [USER32.485] Sets the last-error code.
395 void WINAPI
SetLastErrorEx(
396 DWORD error
, /* [in] Per-thread error code */
397 DWORD type
) /* [in] Error type */
399 TRACE(thread
, "(0x%08lx, 0x%08lx)\n", error
,type
);
406 /* Fall through for now */
408 FIXME(thread
, "(error=%08lx, type=%08lx): Unhandled type\n", error
,type
);
411 SetLastError( error
);
415 /**********************************************************************
416 * TlsAlloc [KERNEL32.530] Allocates a TLS index.
418 * Allocates a thread local storage index
422 * Failure: 0xFFFFFFFF
424 DWORD WINAPI
TlsAlloc( void )
426 THDB
*thread
= THREAD_Current();
427 DWORD i
, mask
, ret
= 0;
428 DWORD
*bits
= thread
->process
->tls_bits
;
429 EnterCriticalSection( &thread
->process
->crit_section
);
430 if (*bits
== 0xffffffff)
434 if (*bits
== 0xffffffff)
436 LeaveCriticalSection( &thread
->process
->crit_section
);
437 SetLastError( ERROR_NO_MORE_ITEMS
);
441 for (i
= 0, mask
= 1; i
< 32; i
++, mask
<<= 1) if (!(*bits
& mask
)) break;
443 LeaveCriticalSection( &thread
->process
->crit_section
);
448 /**********************************************************************
449 * TlsFree [KERNEL32.531] Releases a TLS index.
451 * Releases a thread local storage index, making it available for reuse
458 DWORD index
) /* [in] TLS Index to free */
461 THDB
*thread
= THREAD_Current();
462 DWORD
*bits
= thread
->process
->tls_bits
;
465 SetLastError( ERROR_INVALID_PARAMETER
);
468 EnterCriticalSection( &thread
->process
->crit_section
);
469 if (index
>= 32) bits
++;
470 mask
= (1 << (index
& 31));
471 if (!(*bits
& mask
)) /* already free? */
473 LeaveCriticalSection( &thread
->process
->crit_section
);
474 SetLastError( ERROR_INVALID_PARAMETER
);
478 thread
->tls_array
[index
] = 0;
479 /* FIXME: should zero all other thread values */
480 LeaveCriticalSection( &thread
->process
->crit_section
);
485 /**********************************************************************
486 * TlsGetValue [KERNEL32.532] Gets value in a thread's TLS slot
489 * Success: Value stored in calling thread's TLS slot for index
490 * Failure: 0 and GetLastError returns NO_ERROR
492 LPVOID WINAPI
TlsGetValue(
493 DWORD index
) /* [in] TLS index to retrieve value for */
495 THDB
*thread
= THREAD_Current();
498 SetLastError( ERROR_INVALID_PARAMETER
);
501 SetLastError( ERROR_SUCCESS
);
502 return thread
->tls_array
[index
];
506 /**********************************************************************
507 * TlsSetValue [KERNEL32.533] Stores a value in the thread's TLS slot.
513 BOOL WINAPI
TlsSetValue(
514 DWORD index
, /* [in] TLS index to set value for */
515 LPVOID value
) /* [in] Value to be stored */
517 THDB
*thread
= THREAD_Current();
520 SetLastError( ERROR_INVALID_PARAMETER
);
523 thread
->tls_array
[index
] = value
;
528 /***********************************************************************
529 * SetThreadContext [KERNEL32.670] Sets context of thread.
535 BOOL WINAPI
SetThreadContext(
536 HANDLE handle
, /* [in] Handle to thread with context */
537 CONTEXT
*context
) /* [out] Address of context structure */
539 FIXME( thread
, "not implemented\n" );
543 /***********************************************************************
544 * GetThreadContext [KERNEL32.294] Retrieves context of thread.
550 BOOL WINAPI
GetThreadContext(
551 HANDLE handle
, /* [in] Handle to thread with context */
552 CONTEXT
*context
) /* [out] Address of context structure */
556 FIXME( thread
, "returning dummy info\n" );
558 /* make up some plausible values for segment registers */
571 /**********************************************************************
572 * GetThreadPriority [KERNEL32.296] Returns priority for thread.
575 * Success: Thread's priority level.
576 * Failure: THREAD_PRIORITY_ERROR_RETURN
578 INT WINAPI
GetThreadPriority(
579 HANDLE hthread
) /* [in] Handle to thread */
581 struct get_thread_info_request req
;
582 struct get_thread_info_reply reply
;
583 req
.handle
= hthread
;
584 CLIENT_SendRequest( REQ_GET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
585 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
))
586 return THREAD_PRIORITY_ERROR_RETURN
;
587 return reply
.priority
;
591 /**********************************************************************
592 * SetThreadPriority [KERNEL32.514] Sets priority for thread.
598 BOOL WINAPI
SetThreadPriority(
599 HANDLE hthread
, /* [in] Handle to thread */
600 INT priority
) /* [in] Thread priority level */
602 struct set_thread_info_request req
;
603 req
.handle
= hthread
;
604 req
.priority
= priority
;
605 req
.mask
= SET_THREAD_INFO_PRIORITY
;
606 CLIENT_SendRequest( REQ_SET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
607 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
611 /**********************************************************************
612 * SetThreadAffinityMask (KERNEL32.669)
614 DWORD WINAPI
SetThreadAffinityMask( HANDLE hThread
, DWORD dwThreadAffinityMask
)
616 struct set_thread_info_request req
;
617 req
.handle
= hThread
;
618 req
.affinity
= dwThreadAffinityMask
;
619 req
.mask
= SET_THREAD_INFO_AFFINITY
;
620 CLIENT_SendRequest( REQ_SET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
621 if (CLIENT_WaitReply( NULL
, NULL
, 0 )) return 0;
622 return 1; /* FIXME: should return previous value */
626 /**********************************************************************
627 * TerminateThread [KERNEL32.685] Terminates a thread
633 BOOL WINAPI
TerminateThread(
634 HANDLE handle
, /* [in] Handle to thread */
635 DWORD exitcode
) /* [in] Exit code for thread */
637 struct terminate_thread_request req
;
639 req
.exit_code
= exitcode
;
640 CLIENT_SendRequest( REQ_TERMINATE_THREAD
, -1, 1, &req
, sizeof(req
) );
641 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
645 /**********************************************************************
646 * GetExitCodeThread [KERNEL32.???] Gets termination status of thread.
652 BOOL WINAPI
GetExitCodeThread(
653 HANDLE hthread
, /* [in] Handle to thread */
654 LPDWORD exitcode
) /* [out] Address to receive termination status */
656 struct get_thread_info_request req
;
657 struct get_thread_info_reply reply
;
658 req
.handle
= hthread
;
659 CLIENT_SendRequest( REQ_GET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
660 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return FALSE
;
661 if (exitcode
) *exitcode
= reply
.exit_code
;
666 /**********************************************************************
667 * ResumeThread [KERNEL32.587] Resumes a thread.
669 * Decrements a thread's suspend count. When count is zero, the
670 * execution of the thread is resumed.
673 * Success: Previous suspend count
674 * Failure: 0xFFFFFFFF
677 DWORD WINAPI
ResumeThread(
678 HANDLE hthread
) /* [in] Identifies thread to restart */
680 struct resume_thread_request req
;
681 struct resume_thread_reply reply
;
682 req
.handle
= hthread
;
683 CLIENT_SendRequest( REQ_RESUME_THREAD
, -1, 1, &req
, sizeof(req
) );
684 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return 0xffffffff;
689 /**********************************************************************
690 * SuspendThread [KERNEL32.681] Suspends a thread.
693 * Success: Previous suspend count
694 * Failure: 0xFFFFFFFF
696 DWORD WINAPI
SuspendThread(
697 HANDLE hthread
) /* [in] Handle to the thread */
699 struct suspend_thread_request req
;
700 struct suspend_thread_reply reply
;
701 req
.handle
= hthread
;
702 CLIENT_SendRequest( REQ_SUSPEND_THREAD
, -1, 1, &req
, sizeof(req
) );
703 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return 0xffffffff;
708 /***********************************************************************
709 * QueueUserAPC (KERNEL32.566)
711 DWORD WINAPI
QueueUserAPC( PAPCFUNC func
, HANDLE hthread
, ULONG_PTR data
)
713 struct queue_apc_request req
;
714 req
.handle
= hthread
;
716 req
.param
= (void *)data
;
717 CLIENT_SendRequest( REQ_QUEUE_APC
, -1, 1, &req
, sizeof(req
) );
718 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
722 /**********************************************************************
723 * GetThreadTimes [KERNEL32.???] Obtains timing information.
726 * What are the fields where these values are stored?
732 BOOL WINAPI
GetThreadTimes(
733 HANDLE thread
, /* [in] Specifies the thread of interest */
734 LPFILETIME creationtime
, /* [out] When the thread was created */
735 LPFILETIME exittime
, /* [out] When the thread was destroyed */
736 LPFILETIME kerneltime
, /* [out] Time thread spent in kernel mode */
737 LPFILETIME usertime
) /* [out] Time thread spent in user mode */
739 FIXME(thread
,"(0x%08x): stub\n",thread
);
740 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
745 /**********************************************************************
746 * AttachThreadInput [KERNEL32.8] Attaches input of 1 thread to other
748 * Attaches the input processing mechanism of one thread to that of
756 * 1. Reset the Key State (currenly per thread key state is not maintained)
758 BOOL WINAPI
AttachThreadInput(
759 DWORD idAttach
, /* [in] Thread to attach */
760 DWORD idAttachTo
, /* [in] Thread to attach to */
761 BOOL fAttach
) /* [in] Attach or detach */
763 MESSAGEQUEUE
*pSrcMsgQ
= 0, *pTgtMsgQ
= 0;
766 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
768 /* A thread cannot attach to itself */
769 if ( idAttach
== idAttachTo
)
772 /* According to the docs this method should fail if a
773 * "Journal record" hook is installed. (attaches all input queues together)
775 if ( HOOK_IsHooked( WH_JOURNALRECORD
) )
778 /* Retrieve message queues corresponding to the thread id's */
779 pTgtMsgQ
= (MESSAGEQUEUE
*)QUEUE_Lock( GetThreadQueue16( idAttach
) );
780 pSrcMsgQ
= (MESSAGEQUEUE
*)QUEUE_Lock( GetThreadQueue16( idAttachTo
) );
782 /* Ensure we have message queues and that Src and Tgt threads
783 * are not system threads.
785 if ( !pSrcMsgQ
|| !pTgtMsgQ
|| !pSrcMsgQ
->pQData
|| !pTgtMsgQ
->pQData
)
788 if (fAttach
) /* Attach threads */
790 /* Only attach if currently detached */
791 if ( pTgtMsgQ
->pQData
!= pSrcMsgQ
->pQData
)
793 /* First release the target threads perQData */
794 PERQDATA_Release( pTgtMsgQ
->pQData
);
796 /* Share a reference to the source threads perQDATA */
797 PERQDATA_Addref( pSrcMsgQ
->pQData
);
798 pTgtMsgQ
->pQData
= pSrcMsgQ
->pQData
;
801 else /* Detach threads */
803 /* Only detach if currently attached */
804 if ( pTgtMsgQ
->pQData
== pSrcMsgQ
->pQData
)
806 /* First release the target threads perQData */
807 PERQDATA_Release( pTgtMsgQ
->pQData
);
809 /* Give the target thread its own private perQDATA once more */
810 pTgtMsgQ
->pQData
= PERQDATA_CreateInstance();
814 /* TODO: Reset the Key State */
816 bRet
= 1; /* Success */
820 /* Unlock the queues before returning */
822 QUEUE_Unlock( pSrcMsgQ
);
824 QUEUE_Unlock( pTgtMsgQ
);
829 /**********************************************************************
830 * VWin32_BoostThreadGroup [KERNEL.535]
832 VOID WINAPI
VWin32_BoostThreadGroup( DWORD threadId
, INT boost
)
834 FIXME(thread
, "(0x%08lx,%d): stub\n", threadId
, boost
);
837 /**********************************************************************
838 * VWin32_BoostThreadStatic [KERNEL.536]
840 VOID WINAPI
VWin32_BoostThreadStatic( DWORD threadId
, INT boost
)
842 FIXME(thread
, "(0x%08lx,%d): stub\n", threadId
, boost
);
845 /**********************************************************************
846 * SetThreadLocale [KERNEL32.671] Sets the calling threads current locale.
853 * Implemented in NT only (3.1 and above according to MS
855 BOOL WINAPI
SetThreadLocale(
856 LCID lcid
) /* [in] Locale identifier */
858 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);