Commit 02f28139 authored by Alexandre Julliard's avatar Alexandre Julliard

Renamed a few TEB fields to use the "official" names.

parent fca4a8f8
...@@ -461,7 +461,7 @@ HTASK16 TASK_GetTaskFromThread( DWORD thread ) ...@@ -461,7 +461,7 @@ HTASK16 TASK_GetTaskFromThread( DWORD thread )
TDB *p = TASK_GetPtr( hFirstTask ); TDB *p = TASK_GetPtr( hFirstTask );
while (p) while (p)
{ {
if (p->teb->tid == thread) return p->hSelf; if (p->teb->ClientId.UniqueThread == (HANDLE)thread) return p->hSelf;
p = TASK_GetPtr( p->hNext ); p = TASK_GetPtr( p->hNext );
} }
return 0; return 0;
...@@ -620,7 +620,7 @@ BOOL16 WINAPI WaitEvent16( HTASK16 hTask ) ...@@ -620,7 +620,7 @@ BOOL16 WINAPI WaitEvent16( HTASK16 hTask )
if (pTask->flags & TDBF_WIN32) if (pTask->flags & TDBF_WIN32)
{ {
FIXME("called for Win32 thread (%04lx)!\n", NtCurrentTeb()->tid); FIXME("called for Win32 thread (%04lx)!\n", GetCurrentThreadId());
return TRUE; return TRUE;
} }
...@@ -659,7 +659,7 @@ void WINAPI PostEvent16( HTASK16 hTask ) ...@@ -659,7 +659,7 @@ void WINAPI PostEvent16( HTASK16 hTask )
if (pTask->flags & TDBF_WIN32) if (pTask->flags & TDBF_WIN32)
{ {
FIXME("called for Win32 thread (%04lx)!\n", pTask->teb->tid ); FIXME("called for Win32 thread (%04lx)!\n", (DWORD)pTask->teb->ClientId.UniqueThread );
return; return;
} }
......
...@@ -376,7 +376,7 @@ HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type ) ...@@ -376,7 +376,7 @@ HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type )
return (HANDLE)(ULONG_PTR)handle; return (HANDLE)(ULONG_PTR)handle;
case WOW_TYPE_HTASK: case WOW_TYPE_HTASK:
return (HANDLE)((TDB *)GlobalLock16(handle))->teb->tid; return ((TDB *)GlobalLock16(handle))->teb->ClientId.UniqueThread;
case WOW_TYPE_FULLHWND: case WOW_TYPE_FULLHWND:
FIXME( "conversion of full window handles not supported yet\n" ); FIXME( "conversion of full window handles not supported yet\n" );
......
...@@ -294,7 +294,7 @@ static int NTDLL_dbg_vlog( unsigned int cls, const char *channel, ...@@ -294,7 +294,7 @@ static int NTDLL_dbg_vlog( unsigned int cls, const char *channel,
if (info->out_pos == info->output || info->out_pos[-1] == '\n') if (info->out_pos == info->output || info->out_pos[-1] == '\n')
{ {
if (TRACE_ON(tid)) if (TRACE_ON(tid))
ret = wine_dbg_printf( "%04lx:", NtCurrentTeb()->tid ); ret = wine_dbg_printf( "%04lx:", GetCurrentThreadId() );
if (cls < sizeof(classes)/sizeof(classes[0])) if (cls < sizeof(classes)/sizeof(classes[0]))
ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function ); ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
} }
......
...@@ -516,7 +516,7 @@ static NTSTATUS alloc_thread_tls(void) ...@@ -516,7 +516,7 @@ static NTSTATUS alloc_thread_tls(void)
memset( data, 0, dir->SizeOfZeroFill ); memset( data, 0, dir->SizeOfZeroFill );
data += dir->SizeOfZeroFill; data += dir->SizeOfZeroFill;
} }
NtCurrentTeb()->tls_ptr = pointers; NtCurrentTeb()->ThreadLocalStoragePointer = pointers;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
...@@ -298,7 +298,7 @@ void SYSDEPS_ExitThread( int status ) ...@@ -298,7 +298,7 @@ void SYSDEPS_ExitThread( int status )
SIGNAL_Block(); SIGNAL_Block();
size = 0; size = 0;
NtFreeVirtualMemory( GetCurrentProcess(), &teb->stack_base, &size, MEM_RELEASE | MEM_SYSTEM ); NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE | MEM_SYSTEM );
close( teb->wait_fd[0] ); close( teb->wait_fd[0] );
close( teb->wait_fd[1] ); close( teb->wait_fd[1] );
close( teb->reply_fd ); close( teb->reply_fd );
......
...@@ -829,7 +829,7 @@ DWORD VIRTUAL_HandleFault( LPCVOID addr ) ...@@ -829,7 +829,7 @@ DWORD VIRTUAL_HandleFault( LPCVOID addr )
{ {
BYTE vprot = view->prot[((char *)addr - (char *)view->base) >> page_shift]; BYTE vprot = view->prot[((char *)addr - (char *)view->base) >> page_shift];
void *page = (void *)((UINT_PTR)addr & ~page_mask); void *page = (void *)((UINT_PTR)addr & ~page_mask);
char *stack = (char *)NtCurrentTeb()->stack_base + SIGNAL_STACK_SIZE + page_mask + 1; char *stack = (char *)NtCurrentTeb()->DeallocationStack + SIGNAL_STACK_SIZE + page_mask + 1;
if (vprot & VPROT_GUARD) if (vprot & VPROT_GUARD)
{ {
VIRTUAL_SetProt( view, page, page_mask + 1, vprot & ~VPROT_GUARD ); VIRTUAL_SetProt( view, page, page_mask + 1, vprot & ~VPROT_GUARD );
......
...@@ -207,7 +207,7 @@ static APARTMENT* COM_CreateApartment(DWORD model) ...@@ -207,7 +207,7 @@ static APARTMENT* COM_CreateApartment(DWORD model)
apt->next = apts; apt->next = apts;
apts = apt; apts = apt;
LeaveCriticalSection(&csApartment); LeaveCriticalSection(&csApartment);
NtCurrentTeb()->ErrorInfo = apt; NtCurrentTeb()->ReservedForOle = apt;
return apt; return apt;
} }
...@@ -379,7 +379,7 @@ HRESULT WINAPI CoInitializeEx( ...@@ -379,7 +379,7 @@ HRESULT WINAPI CoInitializeEx(
ERR("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved); ERR("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved);
} }
apt = NtCurrentTeb()->ErrorInfo; apt = NtCurrentTeb()->ReservedForOle;
if (apt && dwCoInit != apt->model) return RPC_E_CHANGED_MODE; if (apt && dwCoInit != apt->model) return RPC_E_CHANGED_MODE;
hr = apt ? S_FALSE : S_OK; hr = apt ? S_FALSE : S_OK;
...@@ -404,7 +404,7 @@ HRESULT WINAPI CoInitializeEx( ...@@ -404,7 +404,7 @@ HRESULT WINAPI CoInitializeEx(
if (!apt) apt = COM_CreateApartment(dwCoInit); if (!apt) apt = COM_CreateApartment(dwCoInit);
InterlockedIncrement(&apt->inits); InterlockedIncrement(&apt->inits);
if (hr == S_OK) NtCurrentTeb()->ErrorInfo = apt; if (hr == S_OK) NtCurrentTeb()->ReservedForOle = apt;
return hr; return hr;
} }
...@@ -423,10 +423,10 @@ void WINAPI CoUninitialize(void) ...@@ -423,10 +423,10 @@ void WINAPI CoUninitialize(void)
TRACE("()\n"); TRACE("()\n");
apt = NtCurrentTeb()->ErrorInfo; apt = NtCurrentTeb()->ReservedForOle;
if (!apt) return; if (!apt) return;
if (InterlockedDecrement(&apt->inits)==0) { if (InterlockedDecrement(&apt->inits)==0) {
NtCurrentTeb()->ErrorInfo = NULL; NtCurrentTeb()->ReservedForOle = NULL;
COM_DestroyApartment(apt); COM_DestroyApartment(apt);
apt = NULL; apt = NULL;
} }
......
...@@ -200,7 +200,7 @@ HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id); ...@@ -200,7 +200,7 @@ HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
static inline APARTMENT* COM_CurrentInfo(void) WINE_UNUSED; static inline APARTMENT* COM_CurrentInfo(void) WINE_UNUSED;
static inline APARTMENT* COM_CurrentInfo(void) static inline APARTMENT* COM_CurrentInfo(void)
{ {
APARTMENT* apt = NtCurrentTeb()->ErrorInfo; APARTMENT* apt = NtCurrentTeb()->ReservedForOle;
return apt; return apt;
} }
static inline APARTMENT* COM_CurrentApt(void) WINE_UNUSED; static inline APARTMENT* COM_CurrentApt(void) WINE_UNUSED;
......
...@@ -66,11 +66,10 @@ typedef struct _TEB ...@@ -66,11 +66,10 @@ typedef struct _TEB
struct _TEB *self; /* 12- 18 Pointer to this structure */ struct _TEB *self; /* 12- 18 Pointer to this structure */
WORD tibflags; /* 1!n 1c Flags (NT: EnvironmentPointer) */ WORD tibflags; /* 1!n 1c Flags (NT: EnvironmentPointer) */
WORD mutex_count; /* 1-n 1e Win16 mutex count */ WORD mutex_count; /* 1-n 1e Win16 mutex count */
DWORD pid; /* !2- 20 Process id (win95: debug context) */ CLIENT_ID ClientId; /* -2- 20 Process and thread id (win95: debug context) */
DWORD tid; /* -2- 24 Thread id */
HQUEUE16 queue; /* 1!- 28 Message queue (NT: DWORD ActiveRpcHandle)*/ HQUEUE16 queue; /* 1!- 28 Message queue (NT: DWORD ActiveRpcHandle)*/
WORD pad1; /* --n 2a */ WORD pad1; /* --n 2a */
LPVOID *tls_ptr; /* 1-- 2c Pointer to TLS array */ PVOID ThreadLocalStoragePointer; /* 1-- 2c Pointer to TLS array */
PEB *Peb; /* 12- 30 owning process PEB */ PEB *Peb; /* 12- 30 owning process PEB */
DWORD flags; /* 1-n 34 */ DWORD flags; /* 1-n 34 */
DWORD exit_code; /* 1-- 38 Termination status */ DWORD exit_code; /* 1-- 38 Termination status */
...@@ -130,12 +129,12 @@ typedef struct _TEB ...@@ -130,12 +129,12 @@ typedef struct _TEB
DWORD pad6[624]; /* --n 238 */ DWORD pad6[624]; /* --n 238 */
UNICODE_STRING StaticUnicodeString; /* -2- bf8 used by advapi32 */ UNICODE_STRING StaticUnicodeString; /* -2- bf8 used by advapi32 */
USHORT StaticUnicodeBuffer[261]; /* -2- c00 used by advapi32 */ USHORT StaticUnicodeBuffer[261]; /* -2- c00 used by advapi32 */
void *stack_base; /* -2- e0c Base of the stack */ PVOID DeallocationStack; /* -2- e0c Base of the stack */
LPVOID tls_array[64]; /* -2- e10 Thread local storage */ LPVOID TlsSlots[64]; /* -2- e10 Thread local storage */
DWORD pad8[3]; /* --n f10 */ DWORD pad8[3]; /* --n f10 */
PVOID ReservedForNtRpc; /* -2- f1c used by rpcrt4 */ PVOID ReservedForNtRpc; /* -2- f1c used by rpcrt4 */
DWORD pad9[24]; /* --n f20 */ DWORD pad9[24]; /* --n f20 */
PVOID ErrorInfo; /* -2- f80 used by ole32 (IErrorInfo*) */ PVOID ReservedForOle; /* -2- f80 used by ole32 (IErrorInfo*) */
} TEB; } TEB;
/* Thread exception flags */ /* Thread exception flags */
......
...@@ -34,15 +34,28 @@ extern "C" { ...@@ -34,15 +34,28 @@ extern "C" {
* TEB data structure * TEB data structure
*/ */
#if 0 #if 0
typedef struct _TEB { typedef struct _TEB
BYTE Reserved1[1952]; {
PVOID Reserved2[412]; NT_TIB Tib; /* 000 */
PVOID TlsSlots[64]; PVOID EnvironmentPointer; /* 01c */
BYTE Reserved3[8]; CLIENT_ID ClientId; /* 020 */
PVOID Reserved4[26]; PVOID ActiveRpcHandle; /* 028 */
PVOID ReservedForOle; /* Windows 2000 only */ PVOID ThreadLocalStoragePointer; /* 02c */
PVOID Reserved5[4]; PPEB Peb; /* 030 */
PVOID TlsExpansionSlots; ULONG LastErrorValue; /* 034 */
BYTE __pad038[140]; /* 038 */
ULONG CurrentLocale; /* 0c4 */
BYTE __pad0c8[1752]; /* 0c8 */
PVOID Reserved2[278]; /* 7a0 */
UNICODE_STRING StaticUnicodeString; /* bf8 used by advapi32 */
WCHAR StaticUnicodeBuffer[261]; /* c00 used by advapi32 */
PVOID DeallocationStack; /* e0c */
PVOID TlsSlots[64]; /* e10 */
BYTE Reserved3[8]; /* f10 */
PVOID Reserved4[26]; /* f18 */
PVOID ReservedForOle; /* f80 Windows 2000 only */
PVOID Reserved5[4]; /* f84 */
PVOID TlsExpansionSlots; /* f94 */
} TEB, *PTEB; } TEB, *PTEB;
#endif #endif
......
...@@ -75,7 +75,7 @@ struct cmsg_fd ...@@ -75,7 +75,7 @@ struct cmsg_fd
}; };
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */ #endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
static DWORD boot_thread_id; static HANDLE boot_thread_id;
static sigset_t block_set; /* signals to block during server calls */ static sigset_t block_set; /* signals to block during server calls */
static int fd_socket; /* socket to exchange file descriptors with the server */ static int fd_socket; /* socket to exchange file descriptors with the server */
...@@ -118,7 +118,7 @@ void server_protocol_error( const char *err, ... ) ...@@ -118,7 +118,7 @@ void server_protocol_error( const char *err, ... )
va_list args; va_list args;
va_start( args, err ); va_start( args, err );
fprintf( stderr, "wine client error:%lx: ", NtCurrentTeb()->tid ); fprintf( stderr, "wine client error:%lx: ", GetCurrentThreadId() );
vfprintf( stderr, err, args ); vfprintf( stderr, err, args );
va_end( args ); va_end( args );
SYSDEPS_AbortThread(1); SYSDEPS_AbortThread(1);
...@@ -130,7 +130,7 @@ void server_protocol_error( const char *err, ... ) ...@@ -130,7 +130,7 @@ void server_protocol_error( const char *err, ... )
*/ */
void server_protocol_perror( const char *err ) void server_protocol_perror( const char *err )
{ {
fprintf( stderr, "wine client error:%lx: ", NtCurrentTeb()->tid ); fprintf( stderr, "wine client error:%lx: ", GetCurrentThreadId() );
perror( err ); perror( err );
SYSDEPS_AbortThread(1); SYSDEPS_AbortThread(1);
} }
...@@ -708,11 +708,11 @@ void CLIENT_InitThread(void) ...@@ -708,11 +708,11 @@ void CLIENT_InitThread(void)
req->reply_fd = reply_pipe[1]; req->reply_fd = reply_pipe[1];
req->wait_fd = teb->wait_fd[1]; req->wait_fd = teb->wait_fd[1];
ret = wine_server_call( req ); ret = wine_server_call( req );
teb->pid = reply->pid; teb->ClientId.UniqueProcess = (HANDLE)reply->pid;
teb->tid = reply->tid; teb->ClientId.UniqueThread = (HANDLE)reply->tid;
version = reply->version; version = reply->version;
if (reply->boot) boot_thread_id = teb->tid; if (reply->boot) boot_thread_id = teb->ClientId.UniqueThread;
else if (boot_thread_id == teb->tid) boot_thread_id = 0; else if (boot_thread_id == teb->ClientId.UniqueThread) boot_thread_id = 0;
} }
SERVER_END_REQ; SERVER_END_REQ;
......
...@@ -144,7 +144,7 @@ LPVOID WINAPI ConvertThreadToFiberEx( LPVOID param, DWORD flags ) ...@@ -144,7 +144,7 @@ LPVOID WINAPI ConvertThreadToFiberEx( LPVOID param, DWORD flags )
fiber->except = NtCurrentTeb()->except; fiber->except = NtCurrentTeb()->except;
fiber->stack_top = NtCurrentTeb()->stack_top; fiber->stack_top = NtCurrentTeb()->stack_top;
fiber->stack_low = NtCurrentTeb()->stack_low; fiber->stack_low = NtCurrentTeb()->stack_low;
fiber->stack_base = NtCurrentTeb()->stack_base; fiber->stack_base = NtCurrentTeb()->DeallocationStack;
fiber->start = NULL; fiber->start = NULL;
fiber->flags = flags; fiber->flags = flags;
NtCurrentTeb()->fiber = fiber; NtCurrentTeb()->fiber = fiber;
...@@ -183,11 +183,11 @@ void WINAPI SwitchToFiber( LPVOID fiber ) ...@@ -183,11 +183,11 @@ void WINAPI SwitchToFiber( LPVOID fiber )
/* FIXME: should save floating point context if requested in fiber->flags */ /* FIXME: should save floating point context if requested in fiber->flags */
if (!setjmp( current_fiber->jmpbuf )) if (!setjmp( current_fiber->jmpbuf ))
{ {
NtCurrentTeb()->fiber = new_fiber; NtCurrentTeb()->fiber = new_fiber;
NtCurrentTeb()->except = new_fiber->except; NtCurrentTeb()->except = new_fiber->except;
NtCurrentTeb()->stack_top = new_fiber->stack_top; NtCurrentTeb()->stack_top = new_fiber->stack_top;
NtCurrentTeb()->stack_low = new_fiber->stack_low; NtCurrentTeb()->stack_low = new_fiber->stack_low;
NtCurrentTeb()->stack_base = new_fiber->stack_base; NtCurrentTeb()->DeallocationStack = new_fiber->stack_base;
if (new_fiber->start) /* first time */ if (new_fiber->start) /* first time */
SYSDEPS_SwitchToThreadStack( start_fiber, new_fiber ); SYSDEPS_SwitchToThreadStack( start_fiber, new_fiber );
else else
......
...@@ -1475,7 +1475,7 @@ DWORD WINAPI TlsAlloc( void ) ...@@ -1475,7 +1475,7 @@ DWORD WINAPI TlsAlloc( void )
for (i = 0, mask = 1; i < 32; i++, mask <<= 1) if (!(*bits & mask)) break; for (i = 0, mask = 1; i < 32; i++, mask <<= 1) if (!(*bits & mask)) break;
*bits |= mask; *bits |= mask;
RtlReleasePebLock(); RtlReleasePebLock();
NtCurrentTeb()->tls_array[ret+i] = 0; /* clear the value */ NtCurrentTeb()->TlsSlots[ret+i] = 0; /* clear the value */
return ret + i; return ret + i;
} }
...@@ -1508,7 +1508,7 @@ BOOL WINAPI TlsFree( ...@@ -1508,7 +1508,7 @@ BOOL WINAPI TlsFree(
return FALSE; return FALSE;
} }
*bits &= ~mask; *bits &= ~mask;
NtCurrentTeb()->tls_array[index] = 0; NtCurrentTeb()->TlsSlots[index] = 0;
/* FIXME: should zero all other thread values */ /* FIXME: should zero all other thread values */
RtlReleasePebLock(); RtlReleasePebLock();
return TRUE; return TRUE;
...@@ -1531,7 +1531,7 @@ LPVOID WINAPI TlsGetValue( ...@@ -1531,7 +1531,7 @@ LPVOID WINAPI TlsGetValue(
return NULL; return NULL;
} }
SetLastError( ERROR_SUCCESS ); SetLastError( ERROR_SUCCESS );
return NtCurrentTeb()->tls_array[index]; return NtCurrentTeb()->TlsSlots[index];
} }
...@@ -1551,6 +1551,6 @@ BOOL WINAPI TlsSetValue( ...@@ -1551,6 +1551,6 @@ BOOL WINAPI TlsSetValue(
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
NtCurrentTeb()->tls_array[index] = value; NtCurrentTeb()->TlsSlots[index] = value;
return TRUE; return TRUE;
} }
...@@ -91,9 +91,8 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock) ...@@ -91,9 +91,8 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock)
TEB *teb = NtCurrentTeb(); TEB *teb = NtCurrentTeb();
int i; int i;
TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count before %ld\n", TRACE("(%p, level %d): thread %lx count before %ld\n",
lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), lock, lock->level, GetCurrentThreadId(), teb->sys_count[lock->level] );
teb->sys_count[lock->level] );
for ( i = 3; i > lock->level; i-- ) for ( i = 3; i > lock->level; i-- )
if ( teb->sys_count[i] > 0 ) if ( teb->sys_count[i] > 0 )
...@@ -107,9 +106,8 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock) ...@@ -107,9 +106,8 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock)
teb->sys_count[lock->level]++; teb->sys_count[lock->level]++;
teb->sys_mutex[lock->level] = lock; teb->sys_mutex[lock->level] = lock;
TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count after %ld\n", TRACE("(%p, level %d): thread %lx count after %ld\n",
lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), lock, lock->level, GetCurrentThreadId(), teb->sys_count[lock->level] );
teb->sys_count[lock->level] );
if (lock == &Win16Mutex) if (lock == &Win16Mutex)
SYSLEVEL_Win16CurrentTeb = wine_get_fs(); SYSLEVEL_Win16CurrentTeb = wine_get_fs();
...@@ -123,9 +121,8 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock) ...@@ -123,9 +121,8 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock)
{ {
TEB *teb = NtCurrentTeb(); TEB *teb = NtCurrentTeb();
TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count before %ld\n", TRACE("(%p, level %d): thread %lx count before %ld\n",
lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), lock, lock->level, GetCurrentThreadId(), teb->sys_count[lock->level] );
teb->sys_count[lock->level] );
if ( teb->sys_count[lock->level] <= 0 || teb->sys_mutex[lock->level] != lock ) if ( teb->sys_count[lock->level] <= 0 || teb->sys_mutex[lock->level] != lock )
{ {
...@@ -141,9 +138,8 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock) ...@@ -141,9 +138,8 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock)
RtlLeaveCriticalSection( &lock->crst ); RtlLeaveCriticalSection( &lock->crst );
TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count after %ld\n", TRACE("(%p, level %d): thread %lx count after %ld\n",
lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), lock, lock->level, GetCurrentThreadId(), teb->sys_count[lock->level] );
teb->sys_count[lock->level] );
} }
/************************************************************************ /************************************************************************
......
...@@ -85,7 +85,7 @@ static void THREAD_FreeTEB( TEB *teb ) ...@@ -85,7 +85,7 @@ static void THREAD_FreeTEB( TEB *teb )
TRACE("(%p) called\n", teb ); TRACE("(%p) called\n", teb );
/* Free the associated memory */ /* Free the associated memory */
wine_ldt_free_fs( teb->teb_sel ); wine_ldt_free_fs( teb->teb_sel );
VirtualFree( teb->stack_base, 0, MEM_RELEASE ); VirtualFree( teb->DeallocationStack, 0, MEM_RELEASE );
} }
...@@ -111,7 +111,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size ) ...@@ -111,7 +111,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size )
if (teb) if (teb)
stack_size = 1024 * 1024; /* no parent */ stack_size = 1024 * 1024; /* no parent */
else else
stack_size = ((char *)NtCurrentTeb()->stack_top - (char *)NtCurrentTeb()->stack_base stack_size = ((char *)NtCurrentTeb()->stack_top - (char *)NtCurrentTeb()->DeallocationStack
- SIGNAL_STACK_SIZE - 3 * page_size); - SIGNAL_STACK_SIZE - 3 * page_size);
} }
...@@ -146,10 +146,10 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size ) ...@@ -146,10 +146,10 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size )
} }
} }
teb->stack_low = base; teb->stack_low = base;
teb->stack_base = base; teb->DeallocationStack = base;
teb->signal_stack = (char *)base + page_size; teb->signal_stack = (char *)base + page_size;
teb->stack_top = (char *)base + 3 * page_size + SIGNAL_STACK_SIZE + stack_size; teb->stack_top = (char *)base + 3 * page_size + SIGNAL_STACK_SIZE + stack_size;
/* Setup guard pages */ /* Setup guard pages */
...@@ -262,7 +262,7 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, SIZE_T stack, ...@@ -262,7 +262,7 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, SIZE_T stack,
} }
teb->Peb = NtCurrentTeb()->Peb; teb->Peb = NtCurrentTeb()->Peb;
teb->tid = tid; teb->ClientId.UniqueThread = (HANDLE)tid;
teb->request_fd = request_pipe[1]; teb->request_fd = request_pipe[1];
teb->entry_point = start; teb->entry_point = start;
teb->entry_arg = param; teb->entry_arg = param;
...@@ -472,7 +472,7 @@ DWORD WINAPI GetLastError(void) ...@@ -472,7 +472,7 @@ DWORD WINAPI GetLastError(void)
*/ */
DWORD WINAPI GetCurrentProcessId(void) DWORD WINAPI GetCurrentProcessId(void)
{ {
return (DWORD)NtCurrentTeb()->pid; return (DWORD)NtCurrentTeb()->ClientId.UniqueProcess;
} }
/*********************************************************************** /***********************************************************************
...@@ -483,7 +483,7 @@ DWORD WINAPI GetCurrentProcessId(void) ...@@ -483,7 +483,7 @@ DWORD WINAPI GetCurrentProcessId(void)
*/ */
DWORD WINAPI GetCurrentThreadId(void) DWORD WINAPI GetCurrentThreadId(void)
{ {
return NtCurrentTeb()->tid; return (DWORD)NtCurrentTeb()->ClientId.UniqueThread;
} }
#endif /* __i386__ */ #endif /* __i386__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment