Commit 36203f1b authored by Alexandre Julliard's avatar Alexandre Julliard

include: Update the PEB and TEB structures.

According to Geoff Chappell's information.
parent b7f6620c
......@@ -1268,7 +1268,7 @@ static BOOL alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod )
if (old) memcpy( new, old, tls_module_count * sizeof(*new) );
teb->ThreadLocalStoragePointer = new;
#ifdef __x86_64__ /* macOS-specific hack */
if (teb->Reserved5[0]) ((TEB *)teb->Reserved5[0])->ThreadLocalStoragePointer = new;
if (teb->Instrumentation[0]) ((TEB *)teb->Instrumentation[0])->ThreadLocalStoragePointer = new;
#endif
TRACE( "thread %04lx tls block %p -> %p\n", HandleToULong(teb->ClientId.UniqueThread), old, new );
/* FIXME: can't free old block here, should be freed at thread exit */
......@@ -1520,8 +1520,8 @@ static NTSTATUS alloc_thread_tls(void)
}
NtCurrentTeb()->ThreadLocalStoragePointer = pointers;
#ifdef __x86_64__ /* macOS-specific hack */
if (NtCurrentTeb()->Reserved5[0])
((TEB *)NtCurrentTeb()->Reserved5[0])->ThreadLocalStoragePointer = pointers;
if (NtCurrentTeb()->Instrumentation[0])
((TEB *)NtCurrentTeb()->Instrumentation[0])->ThreadLocalStoragePointer = pointers;
#endif
return STATUS_SUCCESS;
}
......
......@@ -2072,9 +2072,9 @@ NTSTATUS WINAPI RtlSetThreadErrorMode( DWORD mode, LPDWORD oldmode )
return STATUS_INVALID_PARAMETER_1;
if (oldmode)
*oldmode = NtCurrentTeb()->HardErrorDisabled;
*oldmode = NtCurrentTeb()->HardErrorMode;
NtCurrentTeb()->HardErrorDisabled = mode;
NtCurrentTeb()->HardErrorMode = mode;
return STATUS_SUCCESS;
}
......@@ -2091,7 +2091,7 @@ NTSTATUS WINAPI RtlSetThreadErrorMode( DWORD mode, LPDWORD oldmode )
*/
DWORD WINAPI RtlGetThreadErrorMode( void )
{
return NtCurrentTeb()->HardErrorDisabled;
return NtCurrentTeb()->HardErrorMode;
}
/******************************************************************************
......
......@@ -683,9 +683,9 @@ static void test_RtlThreadErrorMode(void)
"RtlGetThreadErrorMode returned 0x%lx, expected 0x%x\n", mode, 0x70);
if (!is_wow64)
{
ok(NtCurrentTeb()->HardErrorDisabled == 0x70,
ok(NtCurrentTeb()->HardErrorMode == 0x70,
"The TEB contains 0x%lx, expected 0x%x\n",
NtCurrentTeb()->HardErrorDisabled, 0x70);
NtCurrentTeb()->HardErrorMode, 0x70);
}
status = pRtlSetThreadErrorMode(0, &mode);
......@@ -699,9 +699,9 @@ static void test_RtlThreadErrorMode(void)
"RtlGetThreadErrorMode returned 0x%lx, expected 0x%x\n", mode, 0);
if (!is_wow64)
{
ok(NtCurrentTeb()->HardErrorDisabled == 0,
ok(NtCurrentTeb()->HardErrorMode == 0,
"The TEB contains 0x%lx, expected 0x%x\n",
NtCurrentTeb()->HardErrorDisabled, 0);
NtCurrentTeb()->HardErrorMode, 0);
}
for (mode = 1; mode; mode <<= 1)
......
......@@ -2531,7 +2531,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
/* alloc_tls_slot() needs to poke a value to an address relative to each
thread's gsbase. Have each thread record its gsbase pointer into its
TEB so alloc_tls_slot() can find it. */
teb->Reserved5[0] = amd64_thread_data()->pthread_teb;
teb->Instrumentation[0] = amd64_thread_data()->pthread_teb;
#else
# error Please define setting %gs for your architecture
#endif
......
......@@ -944,7 +944,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
for (;;)
{
NtCurrentTeb()->Reserved5[1] = NULL;
NtCurrentTeb()->Instrumentation[1] = NULL;
if (!context.in_buff && !(context.in_buff = HeapAlloc( GetProcessHeap(), 0, context.in_size )))
{
ERR( "failed to allocate buffer\n" );
......@@ -995,7 +995,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
context.params = reply->params;
context.in_size = reply->in_size;
client_tid = reply->client_tid;
NtCurrentTeb()->Reserved5[1] = wine_server_get_ptr( reply->client_thread );
NtCurrentTeb()->Instrumentation[1] = wine_server_get_ptr( reply->client_thread );
}
else
{
......@@ -2527,7 +2527,7 @@ POBJECT_TYPE PsThreadType = &thread_type;
*/
PRKTHREAD WINAPI KeGetCurrentThread(void)
{
struct _KTHREAD *thread = NtCurrentTeb()->Reserved5[1];
struct _KTHREAD *thread = NtCurrentTeb()->Instrumentation[1];
if (!thread)
{
......@@ -2540,7 +2540,7 @@ PRKTHREAD WINAPI KeGetCurrentThread(void)
kernel_object_from_handle( handle, PsThreadType, (void**)&thread );
if (handle != GetCurrentThread()) NtClose( handle );
NtCurrentTeb()->Reserved5[1] = thread;
NtCurrentTeb()->Instrumentation[1] = thread;
}
return thread;
......
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