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
19c48204
Commit
19c48204
authored
Apr 14, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Allow the module file name to not be null-terminated.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fd799297
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
loader.c
dlls/ntdll/loader.c
+11
-3
No files found.
dlls/ntdll/loader.c
View file @
19c48204
...
@@ -1174,6 +1174,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
...
@@ -1174,6 +1174,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
*/
*/
static
WINE_MODREF
*
alloc_module
(
HMODULE
hModule
,
const
UNICODE_STRING
*
nt_name
,
BOOL
builtin
)
static
WINE_MODREF
*
alloc_module
(
HMODULE
hModule
,
const
UNICODE_STRING
*
nt_name
,
BOOL
builtin
)
{
{
WCHAR
*
buffer
;
WINE_MODREF
*
wm
;
WINE_MODREF
*
wm
;
const
WCHAR
*
p
;
const
WCHAR
*
p
;
const
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
hModule
);
const
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
hModule
);
...
@@ -1186,9 +1187,16 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
...
@@ -1186,9 +1187,16 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
wm
->
ldr
.
TlsIndex
=
-
1
;
wm
->
ldr
.
TlsIndex
=
-
1
;
wm
->
ldr
.
LoadCount
=
1
;
wm
->
ldr
.
LoadCount
=
1
;
RtlCreateUnicodeString
(
&
wm
->
ldr
.
FullDllName
,
nt_name
->
Buffer
+
4
/* \??\ prefix */
);
if
(
!
(
buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
nt_name
->
Length
-
3
*
sizeof
(
WCHAR
)
)))
if
((
p
=
wcsrchr
(
wm
->
ldr
.
FullDllName
.
Buffer
,
'\\'
)))
p
++
;
{
else
p
=
wm
->
ldr
.
FullDllName
.
Buffer
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
wm
);
return
NULL
;
}
memcpy
(
buffer
,
nt_name
->
Buffer
+
4
/* \??\ prefix */
,
nt_name
->
Length
-
4
*
sizeof
(
WCHAR
)
);
buffer
[
nt_name
->
Length
/
sizeof
(
WCHAR
)
-
4
]
=
0
;
if
((
p
=
wcsrchr
(
buffer
,
'\\'
)))
p
++
;
else
p
=
buffer
;
RtlInitUnicodeString
(
&
wm
->
ldr
.
FullDllName
,
buffer
);
RtlInitUnicodeString
(
&
wm
->
ldr
.
BaseDllName
,
p
);
RtlInitUnicodeString
(
&
wm
->
ldr
.
BaseDllName
,
p
);
if
(
!
is_dll_native_subsystem
(
&
wm
->
ldr
,
nt
,
p
))
if
(
!
is_dll_native_subsystem
(
&
wm
->
ldr
,
nt
,
p
))
...
...
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