Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
7700467a
Commit
7700467a
authored
3 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
ntdll/tests: Add tests for 64-bit modules in Wow64 mode.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
20c19903
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/ntdll/tests/wow64.c
+89
-0
89 additions, 0 deletions
dlls/ntdll/tests/wow64.c
with
89 additions
and
0 deletions
dlls/ntdll/tests/wow64.c
+
89
−
0
View file @
7700467a
...
...
@@ -463,6 +463,94 @@ static void test_cpu_area(void)
#else
/* _WIN64 */
static
ULONG64
main_module
,
ntdll_module
,
wow64_module
,
wow64cpu_module
,
wow64win_module
;
static
void
enum_modules64
(
void
(
*
func
)(
ULONG64
,
const
WCHAR
*
)
)
{
typedef
struct
{
LIST_ENTRY64
InLoadOrderLinks
;
LIST_ENTRY64
InMemoryOrderLinks
;
LIST_ENTRY64
InInitializationOrderLinks
;
ULONG64
DllBase
;
ULONG64
EntryPoint
;
ULONG
SizeOfImage
;
UNICODE_STRING64
FullDllName
;
UNICODE_STRING64
BaseDllName
;
/* etc. */
}
LDR_DATA_TABLE_ENTRY64
;
TEB64
*
teb64
=
(
TEB64
*
)
NtCurrentTeb
()
->
GdiBatchCount
;
PEB64
peb64
;
ULONG64
ptr
;
PEB_LDR_DATA64
ldr
;
LDR_DATA_TABLE_ENTRY64
entry
;
NTSTATUS
status
;
HANDLE
process
;
process
=
OpenProcess
(
PROCESS_ALL_ACCESS
,
FALSE
,
GetCurrentProcessId
()
);
ok
(
process
!=
0
,
"failed to open current process %u
\n
"
,
GetLastError
()
);
status
=
pNtWow64ReadVirtualMemory64
(
process
,
teb64
->
Peb
,
&
peb64
,
sizeof
(
peb64
),
NULL
);
ok
(
!
status
,
"NtWow64ReadVirtualMemory64 failed %x
\n
"
,
status
);
todo_wine
ok
(
peb64
.
LdrData
,
"LdrData not initialized
\n
"
);
if
(
!
peb64
.
LdrData
)
goto
done
;
status
=
pNtWow64ReadVirtualMemory64
(
process
,
peb64
.
LdrData
,
&
ldr
,
sizeof
(
ldr
),
NULL
);
ok
(
!
status
,
"NtWow64ReadVirtualMemory64 failed %x
\n
"
,
status
);
ptr
=
ldr
.
InLoadOrderModuleList
.
Flink
;
for
(;;)
{
WCHAR
buffer
[
256
];
status
=
pNtWow64ReadVirtualMemory64
(
process
,
ptr
,
&
entry
,
sizeof
(
entry
),
NULL
);
ok
(
!
status
,
"NtWow64ReadVirtualMemory64 failed %x
\n
"
,
status
);
status
=
pNtWow64ReadVirtualMemory64
(
process
,
entry
.
BaseDllName
.
Buffer
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
!
status
,
"NtWow64ReadVirtualMemory64 failed %x
\n
"
,
status
);
if
(
status
)
break
;
func
(
entry
.
DllBase
,
buffer
);
ptr
=
entry
.
InLoadOrderLinks
.
Flink
;
if
(
ptr
==
peb64
.
LdrData
+
offsetof
(
PEB_LDR_DATA64
,
InLoadOrderModuleList
))
break
;
}
done:
NtClose
(
process
);
}
static
void
check_module
(
ULONG64
base
,
const
WCHAR
*
name
)
{
if
(
base
==
(
ULONG_PTR
)
GetModuleHandleW
(
0
))
{
WCHAR
*
p
,
module
[
MAX_PATH
];
GetModuleFileNameW
(
0
,
module
,
MAX_PATH
);
if
((
p
=
wcsrchr
(
module
,
'\\'
)))
p
++
;
else
p
=
module
;
ok
(
!
wcsicmp
(
name
,
p
),
"wrong name %s / %s
\n
"
,
debugstr_w
(
name
),
debugstr_w
(
module
));
main_module
=
base
;
return
;
}
#define CHECK_MODULE(mod) if (!wcsicmp( name, L"" #mod ".dll" )) { mod ## _module = base; return; }
CHECK_MODULE
(
ntdll
);
CHECK_MODULE
(
wow64
);
CHECK_MODULE
(
wow64cpu
);
CHECK_MODULE
(
wow64win
);
#undef CHECK_MODULE
ok
(
0
,
"unknown module %s %s found
\n
"
,
wine_dbgstr_longlong
(
base
),
wine_dbgstr_w
(
name
));
}
static
void
test_modules
(
void
)
{
if
(
!
is_wow64
)
return
;
if
(
!
pNtWow64ReadVirtualMemory64
)
return
;
enum_modules64
(
check_module
);
todo_wine
{
ok
(
main_module
,
"main module not found
\n
"
);
ok
(
ntdll_module
,
"64-bit ntdll not found
\n
"
);
ok
(
wow64_module
,
"wow64.dll not found
\n
"
);
ok
(
wow64cpu_module
,
"wow64cpu.dll not found
\n
"
);
ok
(
wow64win_module
,
"wow64win.dll not found
\n
"
);
}
}
static
void
test_nt_wow64
(
void
)
{
const
char
str
[]
=
"hello wow64"
;
...
...
@@ -574,5 +662,6 @@ START_TEST(wow64)
test_cpu_area
();
#else
test_nt_wow64
();
test_modules
();
#endif
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment