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
8abbfbbe
Commit
8abbfbbe
authored
Aug 29, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add helper functions for building the load path.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
12167d2e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
25 deletions
+35
-25
module.c
dlls/kernel32/module.c
+35
-25
No files found.
dlls/kernel32/module.c
View file @
8abbfbbe
...
...
@@ -888,6 +888,32 @@ static inline const WCHAR *get_module_path_end(const WCHAR *module)
return
mod_end
;
}
/******************************************************************
* append_path_len
*
* Append a counted string to the load path. Helper for MODULE_get_dll_load_path.
*/
static
inline
WCHAR
*
append_path_len
(
WCHAR
*
p
,
const
WCHAR
*
str
,
DWORD
len
)
{
if
(
!
len
)
return
p
;
memcpy
(
p
,
str
,
len
*
sizeof
(
WCHAR
)
);
p
[
len
]
=
';'
;
return
p
+
len
+
1
;
}
/******************************************************************
* append_path
*
* Append a string to the load path. Helper for MODULE_get_dll_load_path.
*/
static
inline
WCHAR
*
append_path
(
WCHAR
*
p
,
const
WCHAR
*
str
)
{
return
append_path_len
(
p
,
str
,
strlenW
(
str
)
);
}
/******************************************************************
* MODULE_get_dll_load_path
*
...
...
@@ -897,6 +923,7 @@ static inline const WCHAR *get_module_path_end(const WCHAR *module)
WCHAR
*
MODULE_get_dll_load_path
(
LPCWSTR
module
)
{
static
const
WCHAR
pathW
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
,
0
};
static
const
WCHAR
dotW
[]
=
{
'.'
,
0
};
const
WCHAR
*
system_path
=
get_dll_system_path
();
const
WCHAR
*
mod_end
=
NULL
;
...
...
@@ -935,31 +962,14 @@ WCHAR *MODULE_get_dll_load_path( LPCWSTR module )
else
len
+=
2
;
/* current directory */
if
((
p
=
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
path_len
+
len
*
sizeof
(
WCHAR
)
)))
{
if
(
module
)
{
memcpy
(
ret
,
module
,
(
mod_end
-
module
)
*
sizeof
(
WCHAR
)
);
p
+=
(
mod_end
-
module
);
*
p
++
=
';'
;
}
if
(
dll_directory
)
{
strcpyW
(
p
,
dll_directory
);
p
+=
strlenW
(
p
);
*
p
++
=
';'
;
}
else
if
(
!
safe_mode
)
{
*
p
++
=
'.'
;
*
p
++
=
';'
;
}
strcpyW
(
p
,
system_path
);
p
+=
strlenW
(
p
);
*
p
++
=
';'
;
if
(
!
dll_directory
&&
safe_mode
)
{
*
p
++
=
'.'
;
*
p
++
=
';'
;
}
if
(
module
)
p
=
append_path_len
(
p
,
module
,
mod_end
-
module
);
if
(
dll_directory
)
p
=
append_path
(
p
,
dll_directory
);
else
if
(
!
safe_mode
)
p
=
append_path
(
p
,
dotW
);
p
=
append_path
(
p
,
system_path
);
if
(
!
dll_directory
&&
safe_mode
)
p
=
append_path
(
p
,
dotW
);
}
RtlLeaveCriticalSection
(
&
dlldir_section
);
if
(
!
ret
)
return
NULL
;
...
...
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