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
Ekaterine Papava
wine
Commits
7261aca1
Commit
7261aca1
authored
1 year ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
kernelbase: Use ProcessWow64Information to retrieve the 32-bit PEB.
parent
b1f603d8
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/kernelbase/debug.c
+30
-28
30 additions, 28 deletions
dlls/kernelbase/debug.c
with
30 additions
and
28 deletions
dlls/kernelbase/debug.c
+
30
−
28
View file @
7261aca1
...
...
@@ -824,37 +824,39 @@ struct module_iterator
};
/* Caller must ensure that wow64=TRUE is only passed from 64bit for 'process' being a wow64 process */
static
BOOL
init_module_iterator
(
struct
module_iterator
*
iter
,
HANDLE
process
,
BOOL
wow64
)
static
BOOL
init_module_iterator_wow64
(
struct
module_iterator
*
iter
,
HANDLE
process
)
{
PEB_LDR_DATA32
*
ldr_data32_ptr
;
DWORD
ldr_data32
,
first_module
;
PEB32
*
peb32
;
iter
->
wow64
=
TRUE
;
if
(
!
set_ntstatus
(
NtQueryInformationProcess
(
process
,
ProcessWow64Information
,
&
peb32
,
sizeof
(
peb32
),
NULL
)))
return
FALSE
;
if
(
!
ReadProcessMemory
(
process
,
&
peb32
->
LdrData
,
&
ldr_data32
,
sizeof
(
ldr_data32
),
NULL
))
return
FALSE
;
ldr_data32_ptr
=
(
PEB_LDR_DATA32
*
)(
DWORD_PTR
)
ldr_data32
;
if
(
!
ReadProcessMemory
(
process
,
&
ldr_data32_ptr
->
InLoadOrderModuleList
.
Flink
,
&
first_module
,
sizeof
(
first_module
),
NULL
))
return
FALSE
;
iter
->
head
=
(
LIST_ENTRY
*
)
&
ldr_data32_ptr
->
InLoadOrderModuleList
;
iter
->
current
=
(
LIST_ENTRY
*
)(
DWORD_PTR
)
first_module
;
iter
->
process
=
process
;
return
TRUE
;
}
static
BOOL
init_module_iterator
(
struct
module_iterator
*
iter
,
HANDLE
process
)
{
PROCESS_BASIC_INFORMATION
pbi
;
PPEB_LDR_DATA
ldr_data
;
/* get address of PEB */
iter
->
wow64
=
FALSE
;
if
(
!
set_ntstatus
(
NtQueryInformationProcess
(
process
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
)))
return
FALSE
;
iter
->
wow64
=
wow64
;
if
(
wow64
)
{
PEB_LDR_DATA32
*
ldr_data32_ptr
;
DWORD
ldr_data32
,
first_module
;
PEB32
*
peb32
;
peb32
=
(
PEB32
*
)((
char
*
)
pbi
.
PebBaseAddress
+
0x1000
);
if
(
!
ReadProcessMemory
(
process
,
&
peb32
->
LdrData
,
&
ldr_data32
,
sizeof
(
ldr_data32
),
NULL
))
return
FALSE
;
ldr_data32_ptr
=
(
PEB_LDR_DATA32
*
)(
DWORD_PTR
)
ldr_data32
;
if
(
!
ReadProcessMemory
(
process
,
&
ldr_data32_ptr
->
InLoadOrderModuleList
.
Flink
,
&
first_module
,
sizeof
(
first_module
),
NULL
))
return
FALSE
;
iter
->
head
=
(
LIST_ENTRY
*
)
&
ldr_data32_ptr
->
InLoadOrderModuleList
;
iter
->
current
=
(
LIST_ENTRY
*
)(
DWORD_PTR
)
first_module
;
iter
->
process
=
process
;
return
TRUE
;
}
/* read address of LdrData from PEB */
if
(
!
ReadProcessMemory
(
process
,
&
pbi
.
PebBaseAddress
->
LdrData
,
&
ldr_data
,
sizeof
(
ldr_data
),
NULL
))
return
FALSE
;
...
...
@@ -907,7 +909,7 @@ static BOOL get_ldr_module( HANDLE process, HMODULE module, LDR_DATA_TABLE_ENTRY
struct
module_iterator
iter
;
INT
ret
;
if
(
!
init_module_iterator
(
&
iter
,
process
,
FALSE
))
return
FALSE
;
if
(
!
init_module_iterator
(
&
iter
,
process
))
return
FALSE
;
while
((
ret
=
module_iterator_next
(
&
iter
))
>
0
)
/* When hModule is NULL we return the process image - which will be
...
...
@@ -935,7 +937,7 @@ static BOOL get_ldr_module32( HANDLE process, HMODULE module, LDR_DATA_TABLE_ENT
return
FALSE
;
}
#endif
if
(
!
init_module_iterator
(
&
iter
,
process
,
TRUE
))
return
FALSE
;
if
(
!
init_module_iterator
_wow64
(
&
iter
,
process
))
return
FALSE
;
while
((
ret
=
module_iterator_next
(
&
iter
))
>
0
)
/* When hModule is NULL we return the process image - which will be
...
...
@@ -1101,12 +1103,12 @@ BOOL WINAPI EnumProcessModulesEx( HANDLE process, HMODULE *module, DWORD count,
if
(
is_win64
&&
target_wow64
&&
(
list_mode
&
LIST_MODULES_32BIT
))
{
if
(
!
init_module_iterator
(
&
iter
,
process
,
TRUE
)
||
module_push_all
(
&
mp
,
&
iter
)
<
0
)
if
(
!
init_module_iterator
_wow64
(
&
iter
,
process
)
||
module_push_all
(
&
mp
,
&
iter
)
<
0
)
return
FALSE
;
}
if
(
!
(
is_win64
&&
list_mode
==
LIST_MODULES_32BIT
))
{
if
(
init_module_iterator
(
&
iter
,
process
,
FALSE
))
if
(
init_module_iterator
(
&
iter
,
process
))
{
if
(
is_win64
&&
target_wow64
&&
(
list_mode
&
LIST_MODULES_64BIT
))
/* Don't add main module twice in _ALL mode */
...
...
@@ -1120,7 +1122,7 @@ BOOL WINAPI EnumProcessModulesEx( HANDLE process, HMODULE *module, DWORD count,
*/
if
(
list_mode
==
LIST_MODULES_DEFAULT
)
{
if
(
init_module_iterator
(
&
iter
,
process
,
TRUE
)
&&
module_iterator_next
(
&
iter
)
>
0
)
if
(
init_module_iterator
_wow64
(
&
iter
,
process
)
&&
module_iterator_next
(
&
iter
)
>
0
)
module_push_iter
(
&
mp
,
&
iter
);
else
ret
=
-
1
;
...
...
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