ntdll: Add a helper function to retrieve the NT headers of the main exe.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9ec262ebcc
commit
eccd21e387
|
@ -1454,7 +1454,7 @@ void server_init_process(void)
|
|||
void CDECL server_init_process_done( void *relay )
|
||||
{
|
||||
PEB *peb = NtCurrentTeb()->Peb;
|
||||
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( peb->ImageBaseAddress );
|
||||
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
|
||||
void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEntryPoint;
|
||||
NTSTATUS status;
|
||||
int suspend;
|
||||
|
|
|
@ -264,6 +264,12 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
|||
while (len--) *dst++ = (unsigned char)*src++;
|
||||
}
|
||||
|
||||
static inline IMAGE_NT_HEADERS *get_exe_nt_header(void)
|
||||
{
|
||||
IMAGE_DOS_HEADER *module = (IMAGE_DOS_HEADER *)NtCurrentTeb()->Peb->ImageBaseAddress;
|
||||
return (IMAGE_NT_HEADERS *)((char *)module + module->e_lfanew);
|
||||
}
|
||||
|
||||
static inline size_t ntdll_wcslen( const WCHAR *str )
|
||||
{
|
||||
const WCHAR *s = str;
|
||||
|
|
|
@ -2728,7 +2728,7 @@ NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_si
|
|||
|
||||
if (!reserve_size || !commit_size)
|
||||
{
|
||||
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
|
||||
if (!reserve_size) reserve_size = nt->OptionalHeader.SizeOfStackReserve;
|
||||
if (!commit_size) commit_size = nt->OptionalHeader.SizeOfStackCommit;
|
||||
}
|
||||
|
@ -3325,7 +3325,7 @@ void CDECL virtual_release_address_space(void)
|
|||
*/
|
||||
void CDECL virtual_set_large_address_space(void)
|
||||
{
|
||||
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
|
||||
|
||||
if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) return;
|
||||
/* no large address space on win9x */
|
||||
|
|
Loading…
Reference in New Issue