4 * Copyright 1996 Alexandre Julliard
10 #include <sys/socket.h>
12 #include "wine/winbase16.h"
20 #include "selectors.h"
24 #include "stackframe.h"
25 #include "debugtools.h"
29 DEFAULT_DEBUG_CHANNEL(thread
)
31 /* THDB of the initial thread */
32 static THDB initial_thdb
;
34 /* Global thread list (FIXME: not thread-safe) */
35 THDB
*THREAD_First
= &initial_thdb
;
37 /***********************************************************************
40 BOOL
THREAD_IsWin16( THDB
*thdb
)
42 return !thdb
|| !(thdb
->teb
.flags
& TEBF_WIN32
);
45 /***********************************************************************
48 * Convert a thread id to a THDB, making sure it is valid.
50 THDB
*THREAD_IdToTHDB( DWORD id
)
52 THDB
*thdb
= THREAD_First
;
54 if (!id
) return THREAD_Current();
57 if ((DWORD
)thdb
->teb
.tid
== id
) return thdb
;
60 /* Allow task handles to be used; convert to main thread */
63 TDB
*pTask
= (TDB
*)GlobalLock16( id
);
64 if (pTask
) return pTask
->thdb
;
66 SetLastError( ERROR_INVALID_PARAMETER
);
71 /***********************************************************************
74 * Initialization of a newly created THDB.
76 static BOOL
THREAD_InitTHDB( THDB
*thdb
, DWORD stack_size
, BOOL alloc_stack16
,
77 LPSECURITY_ATTRIBUTES sa
)
81 /* Allocate the stack */
84 * If stacksize smaller than 1 MB, allocate 1MB
85 * (one program wanted only 10 kB, which is recommendable, but some WINE
86 * functions, noteably in the files subdir, push HUGE structures and
87 * arrays on the stack. They probably shouldn't.)
88 * If stacksize larger than 16 MB, warn the user. (We could shrink the stack
89 * but this could give more or less unexplainable crashes.)
91 if (stack_size
<1024*1024)
92 stack_size
= 1024 * 1024;
93 if (stack_size
>= 16*1024*1024)
94 WARN("Thread stack size is %ld MB.\n",stack_size
/1024/1024);
95 thdb
->stack_base
= VirtualAlloc(NULL
, stack_size
+ SIGNAL_STACK_SIZE
+
96 (alloc_stack16
? 0x10000 : 0),
97 MEM_COMMIT
, PAGE_EXECUTE_READWRITE
);
98 if (!thdb
->stack_base
) goto error
;
99 /* Set a guard page at the bottom of the stack */
100 VirtualProtect( thdb
->stack_base
, 1, PAGE_EXECUTE_READWRITE
| PAGE_GUARD
,
102 thdb
->teb
.stack_top
= (char *)thdb
->stack_base
+ stack_size
;
103 thdb
->teb
.stack_low
= thdb
->stack_base
;
104 thdb
->signal_stack
= thdb
->teb
.stack_top
; /* start of signal stack */
106 /* Allocate the 16-bit stack selector */
110 thdb
->teb
.stack_sel
= SELECTOR_AllocBlock( thdb
->teb
.stack_top
,
111 0x10000, SEGMENT_DATA
,
113 if (!thdb
->teb
.stack_sel
) goto error
;
114 thdb
->cur_stack
= PTR_SEG_OFF_TO_SEGPTR( thdb
->teb
.stack_sel
,
115 0x10000 - sizeof(STACK16FRAME
) );
116 thdb
->signal_stack
= (char *)thdb
->signal_stack
+ 0x10000;
119 /* Create the thread event */
121 if (!(thdb
->event
= CreateEventA( NULL
, FALSE
, FALSE
, NULL
))) goto error
;
122 thdb
->event
= ConvertToGlobalHandle( thdb
->event
);
126 if (thdb
->event
) CloseHandle( thdb
->event
);
127 if (thdb
->teb
.stack_sel
) SELECTOR_FreeBlock( thdb
->teb
.stack_sel
, 1 );
128 if (thdb
->stack_base
) VirtualFree( thdb
->stack_base
, 0, MEM_RELEASE
);
133 /***********************************************************************
136 * Free data structures associated with a thread.
137 * Must be called from the context of another thread.
139 void CALLBACK
THREAD_FreeTHDB( ULONG_PTR arg
)
141 THDB
*thdb
= (THDB
*)arg
;
142 THDB
**pptr
= &THREAD_First
;
144 TRACE("(%p) called\n", thdb
);
145 SERVICE_Delete( thdb
->cleanup
);
147 PROCESS_CallUserSignalProc( USIG_THREAD_EXIT
, 0 );
149 CloseHandle( thdb
->event
);
150 while (*pptr
&& (*pptr
!= thdb
)) pptr
= &(*pptr
)->next
;
151 if (*pptr
) *pptr
= thdb
->next
;
153 /* Free the associated memory */
155 if (thdb
->teb
.stack_sel
) SELECTOR_FreeBlock( thdb
->teb
.stack_sel
, 1 );
156 SELECTOR_FreeBlock( thdb
->teb_sel
, 1 );
157 close( thdb
->socket
);
158 VirtualFree( thdb
->stack_base
, 0, MEM_RELEASE
);
159 HeapFree( SystemHeap
, HEAP_NO_SERIALIZE
, thdb
);
163 /***********************************************************************
164 * THREAD_CreateInitialThread
166 * Create the initial thread.
168 THDB
*THREAD_CreateInitialThread( PDB
*pdb
, int server_fd
)
170 initial_thdb
.process
= pdb
;
171 initial_thdb
.teb
.except
= (void *)-1;
172 initial_thdb
.teb
.self
= &initial_thdb
.teb
;
173 initial_thdb
.teb
.flags
= /* TEBF_WIN32 */ 0;
174 initial_thdb
.teb
.tls_ptr
= initial_thdb
.tls_array
;
175 initial_thdb
.teb
.process
= pdb
;
176 initial_thdb
.exit_code
= 0x103; /* STILL_ACTIVE */
177 initial_thdb
.socket
= server_fd
;
179 /* Allocate the TEB selector (%fs register) */
181 if (!(initial_thdb
.teb_sel
= SELECTOR_AllocBlock( &initial_thdb
.teb
, 0x1000,
182 SEGMENT_DATA
, TRUE
, FALSE
)))
184 MESSAGE("Could not allocate fs register for initial thread\n" );
187 SYSDEPS_SetCurThread( &initial_thdb
);
189 /* Now proceed with normal initialization */
191 if (CLIENT_InitThread()) return NULL
;
192 if (!THREAD_InitTHDB( &initial_thdb
, 0, TRUE
, NULL
)) return NULL
;
193 return &initial_thdb
;
197 /***********************************************************************
200 THDB
*THREAD_Create( PDB
*pdb
, DWORD flags
, DWORD stack_size
, BOOL alloc_stack16
,
201 LPSECURITY_ATTRIBUTES sa
, int *server_handle
)
203 struct new_thread_request request
;
204 struct new_thread_reply reply
= { NULL
, -1 };
207 THDB
*thdb
= HeapAlloc( SystemHeap
, HEAP_ZERO_MEMORY
, sizeof(THDB
) );
208 if (!thdb
) return NULL
;
210 thdb
->teb
.except
= (void *)-1;
211 thdb
->teb
.htask16
= pdb
->task
;
212 thdb
->teb
.self
= &thdb
->teb
;
213 thdb
->teb
.flags
= (pdb
->flags
& PDB32_WIN16_PROC
)? 0 : TEBF_WIN32
;
214 thdb
->teb
.tls_ptr
= thdb
->tls_array
;
215 thdb
->teb
.process
= pdb
;
216 thdb
->exit_code
= 0x103; /* STILL_ACTIVE */
220 /* Allocate the TEB selector (%fs register) */
222 thdb
->teb_sel
= SELECTOR_AllocBlock( &thdb
->teb
, 0x1000, SEGMENT_DATA
,
224 if (!thdb
->teb_sel
) goto error
;
226 /* Create the socket pair for server communication */
228 if (socketpair( AF_UNIX
, SOCK_STREAM
, 0, fd
) == -1)
230 SetLastError( ERROR_TOO_MANY_OPEN_FILES
); /* FIXME */
233 thdb
->socket
= fd
[0];
234 fcntl( fd
[0], F_SETFD
, 1 ); /* set close on exec flag */
236 /* Create the thread on the server side */
238 request
.pid
= thdb
->process
->server_pid
;
239 request
.suspend
= ((thdb
->flags
& CREATE_SUSPENDED
) != 0);
240 request
.inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
241 CLIENT_SendRequest( REQ_NEW_THREAD
, fd
[1], 1, &request
, sizeof(request
) );
242 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) goto error
;
243 thdb
->teb
.tid
= reply
.tid
;
244 *server_handle
= reply
.handle
;
246 /* Do the rest of the initialization */
248 if (!THREAD_InitTHDB( thdb
, stack_size
, alloc_stack16
, sa
)) goto error
;
249 thdb
->next
= THREAD_First
;
252 /* Install cleanup handler */
254 thdb
->cleanup
= SERVICE_AddObject( *server_handle
,
255 THREAD_FreeTHDB
, (ULONG_PTR
)thdb
);
259 if (reply
.handle
!= -1) CloseHandle( reply
.handle
);
260 if (thdb
->teb_sel
) SELECTOR_FreeBlock( thdb
->teb_sel
, 1 );
261 HeapFree( SystemHeap
, 0, thdb
);
262 if (thdb
->socket
!= -1) close( thdb
->socket
);
267 /***********************************************************************
270 * Start execution of a newly created thread. Does not return.
272 static void THREAD_Start(void)
274 THDB
*thdb
= THREAD_Current();
275 LPTHREAD_START_ROUTINE func
= (LPTHREAD_START_ROUTINE
)thdb
->entry_point
;
276 PROCESS_CallUserSignalProc( USIG_THREAD_INIT
, 0 );
278 MODULE_DllThreadAttach( NULL
);
280 if (thdb
->process
->flags
& PDB32_DEBUGGED
) DEBUG_SendCreateThreadEvent( func
);
282 ExitThread( func( thdb
->entry_arg
) );
286 /***********************************************************************
287 * CreateThread (KERNEL32.63)
289 HANDLE WINAPI
CreateThread( SECURITY_ATTRIBUTES
*sa
, DWORD stack
,
290 LPTHREAD_START_ROUTINE start
, LPVOID param
,
291 DWORD flags
, LPDWORD id
)
294 THDB
*thread
= THREAD_Create( PROCESS_Current(), flags
, stack
, TRUE
, sa
, &handle
);
295 if (!thread
) return INVALID_HANDLE_VALUE
;
296 thread
->teb
.flags
|= TEBF_WIN32
;
297 thread
->entry_point
= start
;
298 thread
->entry_arg
= param
;
299 thread
->startup
= THREAD_Start
;
300 if (SYSDEPS_SpawnThread( thread
) == -1)
302 CloseHandle( handle
);
303 return INVALID_HANDLE_VALUE
;
305 if (id
) *id
= (DWORD
)thread
->teb
.tid
;
310 /***********************************************************************
311 * ExitThread [KERNEL32.215] Ends a thread
316 void WINAPI
ExitThread( DWORD code
) /* [in] Exit code for this thread */
318 MODULE_DllThreadDetach( NULL
);
319 TerminateThread( GetCurrentThread(), code
);
323 /***********************************************************************
324 * GetCurrentThread [KERNEL32.200] Gets pseudohandle for current thread
327 * Pseudohandle for the current thread
329 HANDLE WINAPI
GetCurrentThread(void)
331 return CURRENT_THREAD_PSEUDOHANDLE
;
335 /***********************************************************************
336 * GetCurrentThreadId [KERNEL32.201] Returns thread identifier.
339 * Thread identifier of calling thread
341 DWORD WINAPI
GetCurrentThreadId(void)
343 return (DWORD
)CURRENT()->tid
;
347 /**********************************************************************
348 * GetLastError [KERNEL.148] [KERNEL32.227] Returns last-error code.
351 * Calling thread's last error code value.
353 DWORD WINAPI
GetLastError(void)
355 THDB
*thread
= THREAD_Current();
356 DWORD ret
= thread
->last_error
;
357 TRACE("0x%lx\n",ret
);
362 /**********************************************************************
363 * SetLastError [KERNEL.147] [KERNEL32.497] Sets the last-error code.
368 void WINAPI
SetLastError(
369 DWORD error
) /* [in] Per-thread error code */
371 THDB
*thread
= THREAD_Current();
372 TRACE("%p error=0x%lx\n",thread
,error
);
373 thread
->last_error
= error
;
377 /**********************************************************************
378 * SetLastErrorEx [USER32.485] Sets the last-error code.
383 void WINAPI
SetLastErrorEx(
384 DWORD error
, /* [in] Per-thread error code */
385 DWORD type
) /* [in] Error type */
387 TRACE("(0x%08lx, 0x%08lx)\n", error
,type
);
394 /* Fall through for now */
396 FIXME("(error=%08lx, type=%08lx): Unhandled type\n", error
,type
);
399 SetLastError( error
);
403 /**********************************************************************
404 * TlsAlloc [KERNEL32.530] Allocates a TLS index.
406 * Allocates a thread local storage index
410 * Failure: 0xFFFFFFFF
412 DWORD WINAPI
TlsAlloc( void )
414 THDB
*thread
= THREAD_Current();
415 DWORD i
, mask
, ret
= 0;
416 DWORD
*bits
= thread
->process
->tls_bits
;
417 EnterCriticalSection( &thread
->process
->crit_section
);
418 if (*bits
== 0xffffffff)
422 if (*bits
== 0xffffffff)
424 LeaveCriticalSection( &thread
->process
->crit_section
);
425 SetLastError( ERROR_NO_MORE_ITEMS
);
429 for (i
= 0, mask
= 1; i
< 32; i
++, mask
<<= 1) if (!(*bits
& mask
)) break;
431 LeaveCriticalSection( &thread
->process
->crit_section
);
436 /**********************************************************************
437 * TlsFree [KERNEL32.531] Releases a TLS index.
439 * Releases a thread local storage index, making it available for reuse
446 DWORD index
) /* [in] TLS Index to free */
449 THDB
*thread
= THREAD_Current();
450 DWORD
*bits
= thread
->process
->tls_bits
;
453 SetLastError( ERROR_INVALID_PARAMETER
);
456 EnterCriticalSection( &thread
->process
->crit_section
);
457 if (index
>= 32) bits
++;
458 mask
= (1 << (index
& 31));
459 if (!(*bits
& mask
)) /* already free? */
461 LeaveCriticalSection( &thread
->process
->crit_section
);
462 SetLastError( ERROR_INVALID_PARAMETER
);
466 thread
->tls_array
[index
] = 0;
467 /* FIXME: should zero all other thread values */
468 LeaveCriticalSection( &thread
->process
->crit_section
);
473 /**********************************************************************
474 * TlsGetValue [KERNEL32.532] Gets value in a thread's TLS slot
477 * Success: Value stored in calling thread's TLS slot for index
478 * Failure: 0 and GetLastError returns NO_ERROR
480 LPVOID WINAPI
TlsGetValue(
481 DWORD index
) /* [in] TLS index to retrieve value for */
483 THDB
*thread
= THREAD_Current();
486 SetLastError( ERROR_INVALID_PARAMETER
);
489 SetLastError( ERROR_SUCCESS
);
490 return thread
->tls_array
[index
];
494 /**********************************************************************
495 * TlsSetValue [KERNEL32.533] Stores a value in the thread's TLS slot.
501 BOOL WINAPI
TlsSetValue(
502 DWORD index
, /* [in] TLS index to set value for */
503 LPVOID value
) /* [in] Value to be stored */
505 THDB
*thread
= THREAD_Current();
508 SetLastError( ERROR_INVALID_PARAMETER
);
511 thread
->tls_array
[index
] = value
;
516 /***********************************************************************
517 * SetThreadContext [KERNEL32.670] Sets context of thread.
523 BOOL WINAPI
SetThreadContext(
524 HANDLE handle
, /* [in] Handle to thread with context */
525 CONTEXT
*context
) /* [out] Address of context structure */
527 FIXME("not implemented\n" );
531 /***********************************************************************
532 * GetThreadContext [KERNEL32.294] Retrieves context of thread.
538 BOOL WINAPI
GetThreadContext(
539 HANDLE handle
, /* [in] Handle to thread with context */
540 CONTEXT
*context
) /* [out] Address of context structure */
544 FIXME("returning dummy info\n" );
546 /* make up some plausible values for segment registers */
559 /**********************************************************************
560 * GetThreadPriority [KERNEL32.296] Returns priority for thread.
563 * Success: Thread's priority level.
564 * Failure: THREAD_PRIORITY_ERROR_RETURN
566 INT WINAPI
GetThreadPriority(
567 HANDLE hthread
) /* [in] Handle to thread */
569 struct get_thread_info_request req
;
570 struct get_thread_info_reply reply
;
571 req
.handle
= hthread
;
572 CLIENT_SendRequest( REQ_GET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
573 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
))
574 return THREAD_PRIORITY_ERROR_RETURN
;
575 return reply
.priority
;
579 /**********************************************************************
580 * SetThreadPriority [KERNEL32.514] Sets priority for thread.
586 BOOL WINAPI
SetThreadPriority(
587 HANDLE hthread
, /* [in] Handle to thread */
588 INT priority
) /* [in] Thread priority level */
590 struct set_thread_info_request req
;
591 req
.handle
= hthread
;
592 req
.priority
= priority
;
593 req
.mask
= SET_THREAD_INFO_PRIORITY
;
594 CLIENT_SendRequest( REQ_SET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
595 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
599 /**********************************************************************
600 * SetThreadAffinityMask (KERNEL32.669)
602 DWORD WINAPI
SetThreadAffinityMask( HANDLE hThread
, DWORD dwThreadAffinityMask
)
604 struct set_thread_info_request req
;
605 req
.handle
= hThread
;
606 req
.affinity
= dwThreadAffinityMask
;
607 req
.mask
= SET_THREAD_INFO_AFFINITY
;
608 CLIENT_SendRequest( REQ_SET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
609 if (CLIENT_WaitReply( NULL
, NULL
, 0 )) return 0;
610 return 1; /* FIXME: should return previous value */
614 /**********************************************************************
615 * TerminateThread [KERNEL32.685] Terminates a thread
621 BOOL WINAPI
TerminateThread(
622 HANDLE handle
, /* [in] Handle to thread */
623 DWORD exitcode
) /* [in] Exit code for thread */
625 struct terminate_thread_request req
;
627 req
.exit_code
= exitcode
;
628 CLIENT_SendRequest( REQ_TERMINATE_THREAD
, -1, 1, &req
, sizeof(req
) );
629 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
633 /**********************************************************************
634 * GetExitCodeThread [KERNEL32.???] Gets termination status of thread.
640 BOOL WINAPI
GetExitCodeThread(
641 HANDLE hthread
, /* [in] Handle to thread */
642 LPDWORD exitcode
) /* [out] Address to receive termination status */
644 struct get_thread_info_request req
;
645 struct get_thread_info_reply reply
;
646 req
.handle
= hthread
;
647 CLIENT_SendRequest( REQ_GET_THREAD_INFO
, -1, 1, &req
, sizeof(req
) );
648 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return FALSE
;
649 if (exitcode
) *exitcode
= reply
.exit_code
;
654 /**********************************************************************
655 * ResumeThread [KERNEL32.587] Resumes a thread.
657 * Decrements a thread's suspend count. When count is zero, the
658 * execution of the thread is resumed.
661 * Success: Previous suspend count
662 * Failure: 0xFFFFFFFF
665 DWORD WINAPI
ResumeThread(
666 HANDLE hthread
) /* [in] Identifies thread to restart */
668 struct resume_thread_request req
;
669 struct resume_thread_reply reply
;
670 req
.handle
= hthread
;
671 CLIENT_SendRequest( REQ_RESUME_THREAD
, -1, 1, &req
, sizeof(req
) );
672 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return 0xffffffff;
677 /**********************************************************************
678 * SuspendThread [KERNEL32.681] Suspends a thread.
681 * Success: Previous suspend count
682 * Failure: 0xFFFFFFFF
684 DWORD WINAPI
SuspendThread(
685 HANDLE hthread
) /* [in] Handle to the thread */
687 struct suspend_thread_request req
;
688 struct suspend_thread_reply reply
;
689 req
.handle
= hthread
;
690 CLIENT_SendRequest( REQ_SUSPEND_THREAD
, -1, 1, &req
, sizeof(req
) );
691 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return 0xffffffff;
696 /***********************************************************************
697 * QueueUserAPC (KERNEL32.566)
699 DWORD WINAPI
QueueUserAPC( PAPCFUNC func
, HANDLE hthread
, ULONG_PTR data
)
701 struct queue_apc_request req
;
702 req
.handle
= hthread
;
704 req
.param
= (void *)data
;
705 CLIENT_SendRequest( REQ_QUEUE_APC
, -1, 1, &req
, sizeof(req
) );
706 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
710 /**********************************************************************
711 * GetThreadTimes [KERNEL32.???] Obtains timing information.
714 * What are the fields where these values are stored?
720 BOOL WINAPI
GetThreadTimes(
721 HANDLE thread
, /* [in] Specifies the thread of interest */
722 LPFILETIME creationtime
, /* [out] When the thread was created */
723 LPFILETIME exittime
, /* [out] When the thread was destroyed */
724 LPFILETIME kerneltime
, /* [out] Time thread spent in kernel mode */
725 LPFILETIME usertime
) /* [out] Time thread spent in user mode */
727 FIXME("(0x%08x): stub\n",thread
);
728 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
733 /**********************************************************************
734 * AttachThreadInput [KERNEL32.8] Attaches input of 1 thread to other
736 * Attaches the input processing mechanism of one thread to that of
744 * 1. Reset the Key State (currenly per thread key state is not maintained)
746 BOOL WINAPI
AttachThreadInput(
747 DWORD idAttach
, /* [in] Thread to attach */
748 DWORD idAttachTo
, /* [in] Thread to attach to */
749 BOOL fAttach
) /* [in] Attach or detach */
751 MESSAGEQUEUE
*pSrcMsgQ
= 0, *pTgtMsgQ
= 0;
754 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
756 /* A thread cannot attach to itself */
757 if ( idAttach
== idAttachTo
)
760 /* According to the docs this method should fail if a
761 * "Journal record" hook is installed. (attaches all input queues together)
763 if ( HOOK_IsHooked( WH_JOURNALRECORD
) )
766 /* Retrieve message queues corresponding to the thread id's */
767 pTgtMsgQ
= (MESSAGEQUEUE
*)QUEUE_Lock( GetThreadQueue16( idAttach
) );
768 pSrcMsgQ
= (MESSAGEQUEUE
*)QUEUE_Lock( GetThreadQueue16( idAttachTo
) );
770 /* Ensure we have message queues and that Src and Tgt threads
771 * are not system threads.
773 if ( !pSrcMsgQ
|| !pTgtMsgQ
|| !pSrcMsgQ
->pQData
|| !pTgtMsgQ
->pQData
)
776 if (fAttach
) /* Attach threads */
778 /* Only attach if currently detached */
779 if ( pTgtMsgQ
->pQData
!= pSrcMsgQ
->pQData
)
781 /* First release the target threads perQData */
782 PERQDATA_Release( pTgtMsgQ
->pQData
);
784 /* Share a reference to the source threads perQDATA */
785 PERQDATA_Addref( pSrcMsgQ
->pQData
);
786 pTgtMsgQ
->pQData
= pSrcMsgQ
->pQData
;
789 else /* Detach threads */
791 /* Only detach if currently attached */
792 if ( pTgtMsgQ
->pQData
== pSrcMsgQ
->pQData
)
794 /* First release the target threads perQData */
795 PERQDATA_Release( pTgtMsgQ
->pQData
);
797 /* Give the target thread its own private perQDATA once more */
798 pTgtMsgQ
->pQData
= PERQDATA_CreateInstance();
802 /* TODO: Reset the Key State */
804 bRet
= 1; /* Success */
808 /* Unlock the queues before returning */
810 QUEUE_Unlock( pSrcMsgQ
);
812 QUEUE_Unlock( pTgtMsgQ
);
817 /**********************************************************************
818 * VWin32_BoostThreadGroup [KERNEL.535]
820 VOID WINAPI
VWin32_BoostThreadGroup( DWORD threadId
, INT boost
)
822 FIXME("(0x%08lx,%d): stub\n", threadId
, boost
);
825 /**********************************************************************
826 * VWin32_BoostThreadStatic [KERNEL.536]
828 VOID WINAPI
VWin32_BoostThreadStatic( DWORD threadId
, INT boost
)
830 FIXME("(0x%08lx,%d): stub\n", threadId
, boost
);
833 /**********************************************************************
834 * SetThreadLocale [KERNEL32.671] Sets the calling threads current locale.
841 * Implemented in NT only (3.1 and above according to MS
843 BOOL WINAPI
SetThreadLocale(
844 LCID lcid
) /* [in] Locale identifier */
846 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);