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
72e3fdf0
Commit
72e3fdf0
authored
May 29, 2018
by
Zebediah Figura
Committed by
Alexandre Julliard
May 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Allow GetModuleBaseName() to succeed on a WoW64 process.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
54186a4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
5 deletions
+53
-5
module.c
dlls/kernel32/module.c
+47
-5
psapi_main.c
dlls/psapi/tests/psapi_main.c
+6
-0
No files found.
dlls/kernel32/module.c
View file @
72e3fdf0
...
...
@@ -1654,6 +1654,29 @@ static BOOL get_ldr_module(HANDLE process, HMODULE module, LDR_MODULE *ldr_modul
return
FALSE
;
}
static
BOOL
get_ldr_module32
(
HANDLE
process
,
HMODULE
module
,
LDR_MODULE32
*
ldr_module
)
{
MODULE_ITERATOR
iter
;
INT
ret
;
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
* the first module since our iterator uses InLoadOrderModuleList */
if
(
!
module
||
(
DWORD
)(
DWORD_PTR
)
module
==
iter
.
ldr_module32
.
BaseAddress
)
{
*
ldr_module
=
iter
.
ldr_module32
;
return
TRUE
;
}
if
(
ret
==
0
)
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
/***********************************************************************
* K32EnumProcessModules (KERNEL32.@)
*
...
...
@@ -1720,14 +1743,33 @@ DWORD WINAPI K32GetModuleBaseNameW(HANDLE process, HMODULE module,
LPWSTR
base_name
,
DWORD
size
)
{
LDR_MODULE
ldr_module
;
BOOL
wow64
;
if
(
!
get_ldr_module
(
process
,
module
,
&
ldr_module
))
if
(
!
IsWow64Process
(
process
,
&
wow64
))
return
0
;
size
=
min
(
ldr_module
.
BaseDllName
.
Length
/
sizeof
(
WCHAR
),
size
);
if
(
!
ReadProcessMemory
(
process
,
ldr_module
.
BaseDllName
.
Buffer
,
base_name
,
size
*
sizeof
(
WCHAR
),
NULL
))
return
0
;
if
(
sizeof
(
void
*
)
==
8
&&
wow64
)
{
LDR_MODULE32
ldr_module32
;
if
(
!
get_ldr_module32
(
process
,
module
,
&
ldr_module32
))
return
0
;
size
=
min
(
ldr_module32
.
BaseDllName
.
Length
/
sizeof
(
WCHAR
),
size
);
if
(
!
ReadProcessMemory
(
process
,
(
void
*
)(
DWORD_PTR
)
ldr_module32
.
BaseDllName
.
Buffer
,
base_name
,
size
*
sizeof
(
WCHAR
),
NULL
))
return
0
;
}
else
{
if
(
!
get_ldr_module
(
process
,
module
,
&
ldr_module
))
return
0
;
size
=
min
(
ldr_module
.
BaseDllName
.
Length
/
sizeof
(
WCHAR
),
size
);
if
(
!
ReadProcessMemory
(
process
,
ldr_module
.
BaseDllName
.
Buffer
,
base_name
,
size
*
sizeof
(
WCHAR
),
NULL
))
return
0
;
}
base_name
[
size
]
=
0
;
return
size
;
...
...
dlls/psapi/tests/psapi_main.c
View file @
72e3fdf0
...
...
@@ -182,6 +182,8 @@ static void test_EnumProcessModules(void)
if
(
sizeof
(
void
*
)
==
8
)
{
char
name
[
40
];
strcpy
(
buffer
,
"C:
\\
windows
\\
syswow64
\\
notepad.exe"
);
ret
=
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
ok
(
ret
,
"CreateProcess failed: %u
\n
"
,
GetLastError
());
...
...
@@ -196,6 +198,10 @@ static void test_EnumProcessModules(void)
ok
(
!!
hMod
,
"expected non-NULL module
\n
"
);
ok
(
cbNeeded
%
sizeof
(
hMod
)
==
0
,
"got %u
\n
"
,
cbNeeded
);
ret
=
GetModuleBaseNameA
(
pi
.
hProcess
,
hMod
,
name
,
sizeof
(
name
));
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
name
,
"notepad.exe"
),
"got %s
\n
"
,
name
);
TerminateProcess
(
pi
.
hProcess
,
0
);
}
else
if
(
wow64
)
...
...
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