Commit a31f3374 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add a global variable for the WoW PEB.

parent 0d092685
......@@ -60,6 +60,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(environ);
PEB *peb = NULL;
WOW_PEB *wow_peb = NULL;
USHORT *uctable = NULL, *lctable = NULL;
SIZE_T startup_info_size = 0;
BOOL is_prefix_bootstrap = FALSE;
......@@ -2129,37 +2130,34 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
{
NtCurrentTeb()->WowTebOffset = teb_offset;
NtCurrentTeb()->Tib.ExceptionList = (void *)((char *)NtCurrentTeb() + teb_offset);
wow_peb = (PEB32 *)((char *)peb + page_size);
set_thread_id( NtCurrentTeb(), GetCurrentProcessId(), GetCurrentThreadId() );
}
#endif
load_global_options( &params->ImagePathName );
if (NtCurrentTeb()->WowTebOffset)
if (wow_peb)
{
void *wow64_params = build_wow64_parameters( params );
#ifdef _WIN64
PEB32 *wow64_peb = (PEB32 *)((char *)peb + page_size);
#else
PEB64 *wow64_peb = (PEB64 *)((char *)peb - page_size);
#endif
wow64_peb->ImageBaseAddress = PtrToUlong( peb->ImageBaseAddress );
wow64_peb->ProcessParameters = PtrToUlong( wow64_params );
wow64_peb->NumberOfProcessors = peb->NumberOfProcessors;
wow64_peb->NtGlobalFlag = peb->NtGlobalFlag;
wow64_peb->CriticalSectionTimeout.QuadPart = peb->CriticalSectionTimeout.QuadPart;
wow64_peb->HeapSegmentReserve = peb->HeapSegmentReserve;
wow64_peb->HeapSegmentCommit = peb->HeapSegmentCommit;
wow64_peb->HeapDeCommitTotalFreeThreshold = peb->HeapDeCommitTotalFreeThreshold;
wow64_peb->HeapDeCommitFreeBlockThreshold = peb->HeapDeCommitFreeBlockThreshold;
wow64_peb->OSMajorVersion = peb->OSMajorVersion;
wow64_peb->OSMinorVersion = peb->OSMinorVersion;
wow64_peb->OSBuildNumber = peb->OSBuildNumber;
wow64_peb->OSPlatformId = peb->OSPlatformId;
wow64_peb->ImageSubSystem = peb->ImageSubSystem;
wow64_peb->ImageSubSystemMajorVersion = peb->ImageSubSystemMajorVersion;
wow64_peb->ImageSubSystemMinorVersion = peb->ImageSubSystemMinorVersion;
wow64_peb->SessionId = peb->SessionId;
wow_peb->ImageBaseAddress = PtrToUlong( peb->ImageBaseAddress );
wow_peb->ProcessParameters = PtrToUlong( wow64_params );
wow_peb->NumberOfProcessors = peb->NumberOfProcessors;
wow_peb->NtGlobalFlag = peb->NtGlobalFlag;
wow_peb->CriticalSectionTimeout.QuadPart = peb->CriticalSectionTimeout.QuadPart;
wow_peb->HeapSegmentReserve = peb->HeapSegmentReserve;
wow_peb->HeapSegmentCommit = peb->HeapSegmentCommit;
wow_peb->HeapDeCommitTotalFreeThreshold = peb->HeapDeCommitTotalFreeThreshold;
wow_peb->HeapDeCommitFreeBlockThreshold = peb->HeapDeCommitFreeBlockThreshold;
wow_peb->OSMajorVersion = peb->OSMajorVersion;
wow_peb->OSMinorVersion = peb->OSMinorVersion;
wow_peb->OSBuildNumber = peb->OSBuildNumber;
wow_peb->OSPlatformId = peb->OSPlatformId;
wow_peb->ImageSubSystem = peb->ImageSubSystem;
wow_peb->ImageSubSystemMajorVersion = peb->ImageSubSystemMajorVersion;
wow_peb->ImageSubSystemMinorVersion = peb->ImageSubSystemMinorVersion;
wow_peb->SessionId = peb->SessionId;
}
}
......
......@@ -1518,6 +1518,7 @@ size_t server_init_process(void)
is_wow64 = TRUE;
NtCurrentTeb()->GdiBatchCount = PtrToUlong( (char *)NtCurrentTeb() - teb_offset );
NtCurrentTeb()->WowTebOffset = -teb_offset;
wow_peb = (PEB64 *)((char *)peb - page_size);
#endif
}
else
......
......@@ -393,12 +393,16 @@ static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
#ifdef _WIN64
typedef TEB32 WOW_TEB;
typedef PEB32 WOW_PEB;
static inline TEB64 *NtCurrentTeb64(void) { return NULL; }
#else
typedef TEB64 WOW_TEB;
typedef PEB64 WOW_PEB;
static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; }
#endif
extern WOW_PEB *wow_peb DECLSPEC_HIDDEN;
static inline WOW_TEB *get_wow_teb( TEB *teb )
{
return teb->WowTebOffset ? (WOW_TEB *)((char *)teb + teb->WowTebOffset) : NULL;
......
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