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
c2be6ecf
Commit
c2be6ecf
authored
May 13, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for Wow64 TEB and PEB information.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d1e90e15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
2 deletions
+90
-2
info.c
dlls/ntdll/tests/info.c
+90
-2
No files found.
dlls/ntdll/tests/info.c
View file @
c2be6ecf
...
...
@@ -3125,6 +3125,95 @@ static void test_thread_info(void)
static
void
test_wow64
(
void
)
{
PROCESS_BASIC_INFORMATION
proc_info
;
THREAD_BASIC_INFORMATION
info
;
PROCESS_INFORMATION
pi
;
STARTUPINFOA
si
=
{
0
};
NTSTATUS
status
;
void
*
redir
;
SIZE_T
res
;
TEB
teb
;
Wow64DisableWow64FsRedirection
(
&
redir
);
if
(
CreateProcessA
(
"C:
\\
windows
\\
syswow64
\\
notepad.exe"
,
NULL
,
NULL
,
NULL
,
FALSE
,
CREATE_SUSPENDED
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
memset
(
&
info
,
0xcc
,
sizeof
(
info
)
);
status
=
pNtQueryInformationThread
(
pi
.
hThread
,
ThreadBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
!
status
,
"ThreadBasicInformation failed %x
\n
"
,
status
);
if
(
!
ReadProcessMemory
(
pi
.
hProcess
,
info
.
TebBaseAddress
,
&
teb
,
sizeof
(
teb
),
&
res
))
res
=
0
;
ok
(
res
==
sizeof
(
teb
),
"wrong len %lx
\n
"
,
res
);
todo_wine_if
(
sizeof
(
void
*
)
>
sizeof
(
int
)
)
ok
(
teb
.
Tib
.
Self
==
info
.
TebBaseAddress
,
"wrong teb %p / %p
\n
"
,
teb
.
Tib
.
Self
,
info
.
TebBaseAddress
);
if
(
is_wow64
)
{
ok
(
!!
teb
.
GdiBatchCount
,
"GdiBatchCount not set
\n
"
);
ok
(
(
char
*
)
info
.
TebBaseAddress
+
teb
.
WowTebOffset
==
ULongToPtr
(
teb
.
GdiBatchCount
)
||
broken
(
!
NtCurrentTeb
()
->
WowTebOffset
),
/* pre-win10 */
"wrong teb offset %d
\n
"
,
teb
.
WowTebOffset
);
}
else
{
ok
(
!
teb
.
GdiBatchCount
,
"GdiBatchCount set
\n
"
);
todo_wine
ok
(
teb
.
WowTebOffset
==
0x2000
||
broken
(
!
teb
.
WowTebOffset
||
teb
.
WowTebOffset
==
1
),
/* pre-win10 */
"wrong teb offset %d
\n
"
,
teb
.
WowTebOffset
);
todo_wine
ok
(
(
char
*
)
teb
.
Tib
.
ExceptionList
==
(
char
*
)
info
.
TebBaseAddress
+
0x2000
,
"wrong Tib.ExceptionList %p / %p
\n
"
,
(
char
*
)
teb
.
Tib
.
ExceptionList
,
(
char
*
)
info
.
TebBaseAddress
+
0x2000
);
}
status
=
pNtQueryInformationProcess
(
pi
.
hProcess
,
ProcessBasicInformation
,
&
proc_info
,
sizeof
(
proc_info
),
NULL
);
ok
(
!
status
,
"ProcessBasicInformation failed %x
\n
"
,
status
);
todo_wine_if
(
sizeof
(
void
*
)
>
sizeof
(
int
)
)
ok
(
proc_info
.
PebBaseAddress
==
teb
.
Peb
,
"wrong peb %p / %p
\n
"
,
proc_info
.
PebBaseAddress
,
teb
.
Peb
);
TerminateProcess
(
pi
.
hProcess
,
0
);
CloseHandle
(
pi
.
hProcess
);
CloseHandle
(
pi
.
hThread
);
}
if
(
CreateProcessA
(
"C:
\\
windows
\\
system32
\\
notepad.exe"
,
NULL
,
NULL
,
NULL
,
FALSE
,
CREATE_SUSPENDED
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
memset
(
&
info
,
0xcc
,
sizeof
(
info
)
);
status
=
pNtQueryInformationThread
(
pi
.
hThread
,
ThreadBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
!
status
,
"ThreadBasicInformation failed %x
\n
"
,
status
);
if
(
!
is_wow64
)
{
if
(
!
ReadProcessMemory
(
pi
.
hProcess
,
info
.
TebBaseAddress
,
&
teb
,
sizeof
(
teb
),
&
res
))
res
=
0
;
ok
(
res
==
sizeof
(
teb
),
"wrong len %lx
\n
"
,
res
);
ok
(
teb
.
Tib
.
Self
==
info
.
TebBaseAddress
,
"wrong teb %p / %p
\n
"
,
teb
.
Tib
.
Self
,
info
.
TebBaseAddress
);
ok
(
!
teb
.
GdiBatchCount
,
"GdiBatchCount set
\n
"
);
ok
(
!
teb
.
WowTebOffset
||
broken
(
teb
.
WowTebOffset
==
1
),
/* vista */
"wrong teb offset %d
\n
"
,
teb
.
WowTebOffset
);
}
else
todo_wine
ok
(
!
info
.
TebBaseAddress
,
"got teb %p
\n
"
,
info
.
TebBaseAddress
);
status
=
pNtQueryInformationProcess
(
pi
.
hProcess
,
ProcessBasicInformation
,
&
proc_info
,
sizeof
(
proc_info
),
NULL
);
ok
(
!
status
,
"ProcessBasicInformation failed %x
\n
"
,
status
);
if
(
is_wow64
)
todo_wine
ok
(
!
proc_info
.
PebBaseAddress
||
broken
(
(
char
*
)
proc_info
.
PebBaseAddress
>=
(
char
*
)
0x7f000000
),
/* vista */
"wrong peb %p
\n
"
,
proc_info
.
PebBaseAddress
);
else
ok
(
proc_info
.
PebBaseAddress
==
teb
.
Peb
,
"wrong peb %p / %p
\n
"
,
proc_info
.
PebBaseAddress
,
teb
.
Peb
);
TerminateProcess
(
pi
.
hProcess
,
0
);
CloseHandle
(
pi
.
hProcess
);
CloseHandle
(
pi
.
hThread
);
}
Wow64RevertWow64FsRedirection
(
redir
);
#ifdef _WIN64
if
(
pRtlWow64GetCpuAreaInfo
)
{
...
...
@@ -3326,8 +3415,7 @@ START_TEST(info)
char
**
argv
;
int
argc
;
if
(
!
InitFunctionPtrs
())
return
;
InitFunctionPtrs
();
argc
=
winetest_get_mainargs
(
&
argv
);
if
(
argc
>=
3
)
return
;
/* Child */
...
...
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