Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cda02cdd
Commit
cda02cdd
authored
Apr 27, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Always allocate space for both 32- and 64-bit PEB.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
79a148e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
virtual.c
dlls/ntdll/unix/virtual.c
+18
-12
No files found.
dlls/ntdll/unix/virtual.c
View file @
cda02cdd
...
...
@@ -2818,13 +2818,21 @@ NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_nam
/* set some initial values in the new PEB */
static
void
init_peb
(
PEB
*
peb
)
static
PEB
*
init_peb
(
void
*
ptr
)
{
peb
->
OSMajorVersion
=
6
;
peb
->
OSMinorVersion
=
1
;
peb
->
OSBuildNumber
=
0x1db1
;
peb
->
OSPlatformId
=
VER_PLATFORM_WIN32_NT
;
peb
->
SessionId
=
1
;
PEB32
*
peb32
=
ptr
;
PEB64
*
peb64
=
(
PEB64
*
)((
char
*
)
ptr
+
page_size
);
peb32
->
OSMajorVersion
=
peb64
->
OSMajorVersion
=
6
;
peb32
->
OSMinorVersion
=
peb64
->
OSMinorVersion
=
1
;
peb32
->
OSBuildNumber
=
peb64
->
OSBuildNumber
=
0x1db1
;
peb32
->
OSPlatformId
=
peb64
->
OSPlatformId
=
VER_PLATFORM_WIN32_NT
;
peb32
->
SessionId
=
peb64
->
SessionId
=
1
;
#ifdef _WIN64
return
(
PEB
*
)
peb64
;
#else
return
(
PEB
*
)
peb32
;
#endif
}
...
...
@@ -2872,7 +2880,6 @@ TEB *virtual_alloc_first_teb(void)
void
*
ptr
;
NTSTATUS
status
;
SIZE_T
data_size
=
page_size
;
SIZE_T
peb_size
=
page_size
*
(
is_win64
?
1
:
2
);
SIZE_T
block_size
=
signal_stack_mask
+
1
;
SIZE_T
total
=
32
*
block_size
;
...
...
@@ -2888,12 +2895,11 @@ TEB *virtual_alloc_first_teb(void)
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
teb_block
,
0
,
&
total
,
MEM_RESERVE
|
MEM_TOP_DOWN
,
PAGE_READWRITE
);
teb_block_pos
=
30
;
ptr
=
(
(
char
*
)
teb_block
+
30
*
block_size
)
;
ptr
=
(
char
*
)
teb_block
+
30
*
block_size
;
teb
=
(
TEB
*
)((
char
*
)
ptr
+
teb_offset
);
peb
=
(
PEB
*
)((
char
*
)
teb_block
+
32
*
block_size
-
peb_size
);
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
ptr
,
0
,
&
block_size
,
MEM_COMMIT
,
PAGE_READWRITE
);
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
peb
,
0
,
&
peb_size
,
MEM_COMMIT
,
PAGE_READWRITE
);
init_peb
(
peb
);
data_size
=
2
*
block_size
;
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
ptr
,
0
,
&
data_size
,
MEM_COMMIT
,
PAGE_READWRITE
);
peb
=
init_peb
(
(
char
*
)
teb_block
+
31
*
block_size
);
init_teb
(
teb
,
peb
);
*
(
ULONG_PTR
*
)
&
peb
->
CloudFileFlags
=
get_image_address
();
return
teb
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment