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
43d14fd8
Commit
43d14fd8
authored
Sep 29, 2021
by
Paul Gofman
Committed by
Alexandre Julliard
Sep 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use LdrGetDllFullName() in GetModuleFileNameW().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
39a35490
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
loader.c
dlls/kernelbase/loader.c
+7
-18
No files found.
dlls/kernelbase/loader.c
View file @
43d14fd8
...
...
@@ -298,9 +298,9 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetModuleFileNameA( HMODULE module, LPSTR filenam
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetModuleFileNameW
(
HMODULE
module
,
LPWSTR
filename
,
DWORD
size
)
{
ULONG
len
=
0
;
ULONG_PTR
magic
;
LDR_DATA_TABLE_ENTRY
*
pldr
;
WIN16_SUBSYSTEM_TIB
*
win16_tib
;
UNICODE_STRING
name
;
NTSTATUS
status
;
if
(
!
module
&&
((
win16_tib
=
NtCurrentTeb
()
->
Tib
.
SubSystemTib
))
&&
win16_tib
->
exe_name
)
{
...
...
@@ -310,22 +310,11 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetModuleFileNameW( HMODULE module, LPWSTR filena
goto
done
;
}
LdrLockLoaderLock
(
0
,
NULL
,
&
magic
);
if
(
!
module
)
module
=
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
;
if
(
set_ntstatus
(
LdrFindEntryForAddress
(
module
,
&
pldr
)))
{
len
=
min
(
size
,
pldr
->
FullDllName
.
Length
/
sizeof
(
WCHAR
)
);
memcpy
(
filename
,
pldr
->
FullDllName
.
Buffer
,
len
*
sizeof
(
WCHAR
)
);
if
(
len
<
size
)
{
filename
[
len
]
=
0
;
SetLastError
(
0
);
}
else
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
LdrUnlockLoaderLock
(
0
,
magic
);
name
.
Buffer
=
filename
;
name
.
MaximumLength
=
size
*
sizeof
(
WCHAR
);
status
=
LdrGetDllFullName
(
module
,
&
name
);
if
(
!
status
||
status
==
STATUS_BUFFER_TOO_SMALL
)
len
=
name
.
Length
/
sizeof
(
WCHAR
);
SetLastError
(
RtlNtStatusToDosError
(
status
));
done:
TRACE
(
"%s
\n
"
,
debugstr_wn
(
filename
,
len
)
);
return
len
;
...
...
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