- implemented Get/SetThreadLocale

- added comment about OleErrorInfo field in TEB
This commit is contained in:
Juergen Schmied 2000-06-12 21:56:02 +00:00 committed by Alexandre Julliard
parent 45bd6123f7
commit 79d850f2d7
4 changed files with 31 additions and 15 deletions

View File

@ -3,6 +3,9 @@
*
* Copyright 2000 Patrik Stridvall
*
*
* The errorinfo is a per-thread object. The reference is stored in the
* TEB at offset 0xf80
*/
#include "debugtools.h"

View File

@ -75,7 +75,7 @@ typedef struct _TEB
WORD thunk_ss; /* --n 84 Yet another 16-bit stack selector */
WORD pad3; /* --n 86 */
DWORD pad4[15]; /* --n 88 */
ULONG CurrentLocale; /* -2n C4 */
ULONG CurrentLocale; /* -2- C4 */
DWORD pad5[48]; /* --n C8 */
DWORD delta_priority; /* 1-n 188 Priority delta */
DWORD unknown4[7]; /* d-n 18c Unknown */
@ -107,7 +107,7 @@ typedef struct _TEB
DWORD pad8[3]; /* --n f10 */
PVOID ReservedForNtRpc; /* -2- f1c used by rpcrt4 */
DWORD pad9[24]; /* --n f20 */
PVOID ReservedForOle; /* -2- f80 used by ole32 */
PVOID ReservedForOle; /* -2- f80 used by ole32 (IErrorInfo*) */
} TEB;
/* Thread exception flags */

View File

@ -1006,15 +1006,6 @@ DWORD WINAPI MapProcessHandle( HANDLE handle )
return ret;
}
/***********************************************************************
* GetThreadLocale (KERNEL32.295)
*/
LCID WINAPI GetThreadLocale(void)
{
return PROCESS_Current()->locale;
}
/***********************************************************************
* SetPriorityClass (KERNEL32.503)
*/

View File

@ -30,6 +30,7 @@
#include "debugtools.h"
#include "queue.h"
#include "hook.h"
#include "winnls.h"
DEFAULT_DEBUG_CHANNEL(thread);
@ -296,6 +297,7 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, DWORD stack,
teb->entry_arg = param;
teb->startup = THREAD_Start;
teb->htask16 = GetCurrentTask();
teb->CurrentLocale = GetUserDefaultLCID(); /* for threads in user context */
if (id) *id = (DWORD)tid;
if (SYSDEPS_SpawnThread( teb ) == -1)
{
@ -810,6 +812,16 @@ VOID WINAPI VWin32_BoostThreadStatic( DWORD threadId, INT boost )
FIXME("(0x%08lx,%d): stub\n", threadId, boost);
}
/***********************************************************************
* GetThreadLocale (KERNEL32.295)
*/
LCID WINAPI GetThreadLocale(void)
{
return NtCurrentTeb()->CurrentLocale;
}
/**********************************************************************
* SetThreadLocale [KERNEL32.671] Sets the calling threads current locale.
*
@ -817,14 +829,24 @@ VOID WINAPI VWin32_BoostThreadStatic( DWORD threadId, INT boost )
* Success: TRUE
* Failure: FALSE
*
* NOTES
* Implemented in NT only (3.1 and above according to MS
* FIXME
* check if lcid is a valid cp
*/
BOOL WINAPI SetThreadLocale(
LCID lcid) /* [in] Locale identifier */
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
switch (lcid)
{
case LOCALE_SYSTEM_DEFAULT:
lcid = GetSystemDefaultLCID();
break;
case LOCALE_USER_DEFAULT:
case LOCALE_NEUTRAL:
lcid = GetUserDefaultLCID();
break;
}
NtCurrentTeb()->CurrentLocale = lcid;
return TRUE;
}