Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b98c2e38
Commit
b98c2e38
authored
Nov 23, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Append .dll extension in all cases (spotted by Mike Hearn).
parent
5c38e1b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
40 deletions
+29
-40
loader.c
dlls/ntdll/loader.c
+29
-40
No files found.
dlls/ntdll/loader.c
View file @
b98c2e38
...
...
@@ -1354,45 +1354,42 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
UNICODE_STRING
nt_name
;
WCHAR
*
file_part
,
*
ext
;
WCHAR
*
file_part
,
*
ext
,
*
dllname
;
ULONG
len
;
/* first append .dll if needed */
dllname
=
NULL
;
if
(
!
(
ext
=
strrchrW
(
libname
,
'.'
))
||
strchrW
(
ext
,
'/'
)
||
strchrW
(
ext
,
'\\'
))
{
if
(
!
(
dllname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
libname
)
*
sizeof
(
WCHAR
))
+
sizeof
(
dllW
)
)))
return
STATUS_NO_MEMORY
;
strcpyW
(
dllname
,
libname
);
strcatW
(
dllname
,
dllW
);
libname
=
dllname
;
}
nt_name
.
Buffer
=
NULL
;
if
(
RtlDetermineDosPathNameType_U
(
libname
)
==
RELATIVE_PATH
)
{
/* we need to search for it */
/* but first append .dll because RtlDosSearchPath extension handling is broken */
if
(
!
(
ext
=
strrchrW
(
libname
,
'.'
))
||
strchrW
(
ext
,
'/'
)
||
strchrW
(
ext
,
'\\'
))
{
WCHAR
*
dllname
;
if
(
!
(
dllname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
libname
)
*
sizeof
(
WCHAR
))
+
sizeof
(
dllW
)
)))
return
STATUS_NO_MEMORY
;
strcpyW
(
dllname
,
libname
);
strcatW
(
dllname
,
dllW
);
len
=
RtlDosSearchPath_U
(
load_path
,
dllname
,
NULL
,
*
size
,
filename
,
&
file_part
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
dllname
);
}
else
len
=
RtlDosSearchPath_U
(
load_path
,
libname
,
NULL
,
*
size
,
filename
,
&
file_part
);
len
=
RtlDosSearchPath_U
(
load_path
,
libname
,
NULL
,
*
size
,
filename
,
&
file_part
);
if
(
len
)
{
if
(
len
>=
*
size
)
{
*
size
=
len
+
sizeof
(
WCHAR
);
return
STATUS_BUFFER_TOO_SMALL
;
}
if
((
*
pwm
=
find_fullname_module
(
filename
))
!=
NULL
)
return
STATUS_SUCCESS
;
if
(
len
>=
*
size
)
goto
overflow
;
if
((
*
pwm
=
find_fullname_module
(
filename
))
!=
NULL
)
goto
found
;
/* check for already loaded module in a different path */
if
(
!
contains_path
(
libname
))
{
if
((
*
pwm
=
find_basename_module
(
file_part
))
!=
NULL
)
return
STATUS_SUCCESS
;
if
((
*
pwm
=
find_basename_module
(
file_part
))
!=
NULL
)
goto
found
;
}
if
(
!
RtlDosPathNameToNtPathName_U
(
filename
,
&
nt_name
,
NULL
,
NULL
))
{
RtlFreeHeap
(
GetProcessHeap
(),
0
,
dllname
);
return
STATUS_NO_MEMORY
;
}
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
...
...
@@ -1400,8 +1397,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
if
(
NtOpenFile
(
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_DELETE
,
0
))
*
handle
=
0
;
RtlFreeUnicodeString
(
&
nt_name
);
return
STATUS_SUCCESS
;
goto
found
;
}
/* not found */
...
...
@@ -1413,31 +1409,21 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
len
=
strlenW
(
libname
)
*
sizeof
(
WCHAR
);
if
(
len
>=
*
size
)
goto
overflow
;
strcpyW
(
filename
,
libname
);
if
(
!
strchrW
(
filename
,
'.'
))
{
len
+=
sizeof
(
dllW
)
-
sizeof
(
WCHAR
);
if
(
len
>=
*
size
)
goto
overflow
;
strcatW
(
filename
,
dllW
);
}
*
pwm
=
find_basename_module
(
filename
);
return
STATUS_SUCCESS
;
goto
found
;
}
}
/* absolute path name, or relative path name but not found above */
if
(
!
RtlDosPathNameToNtPathName_U
(
libname
,
&
nt_name
,
&
file_part
,
NULL
))
{
RtlFreeHeap
(
GetProcessHeap
(),
0
,
dllname
);
return
STATUS_NO_MEMORY
;
}
len
=
nt_name
.
Length
-
4
*
sizeof
(
WCHAR
);
/* for \??\ prefix */
if
(
len
>=
*
size
)
goto
overflow
;
memcpy
(
filename
,
nt_name
.
Buffer
+
4
,
len
+
sizeof
(
WCHAR
)
);
if
(
file_part
&&
!
strchrW
(
file_part
,
'.'
))
{
len
+=
sizeof
(
dllW
)
-
sizeof
(
WCHAR
);
if
(
len
>=
*
size
)
goto
overflow
;
strcatW
(
filename
,
dllW
);
}
if
(
!
(
*
pwm
=
find_fullname_module
(
filename
)))
{
attr
.
Length
=
sizeof
(
attr
);
...
...
@@ -1448,11 +1434,14 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
attr
.
SecurityQualityOfService
=
NULL
;
if
(
NtOpenFile
(
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_DELETE
,
0
))
*
handle
=
0
;
}
found:
RtlFreeUnicodeString
(
&
nt_name
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
dllname
);
return
STATUS_SUCCESS
;
overflow:
RtlFreeUnicodeString
(
&
nt_name
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
dllname
);
*
size
=
len
+
sizeof
(
WCHAR
);
return
STATUS_BUFFER_TOO_SMALL
;
}
...
...
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