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
12276796
Commit
12276796
authored
Feb 19, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Hardcode the windows and system directories.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e0f7fbfa
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
59 deletions
+16
-59
process.c
dlls/kernel32/process.c
+0
-5
directory.c
dlls/ntdll/directory.c
+2
-8
loader.c
dlls/ntdll/loader.c
+7
-39
loadorder.c
dlls/ntdll/loadorder.c
+2
-4
ntdll.spec
dlls/ntdll/ntdll.spec
+0
-1
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-2
rtlstr.c
dlls/ntdll/rtlstr.c
+1
-0
thread.c
dlls/ntdll/thread.c
+2
-0
No files found.
dlls/kernel32/process.c
View file @
12276796
...
...
@@ -958,8 +958,6 @@ done:
*/
static
void
init_windows_dirs
(
void
)
{
extern
void
CDECL
__wine_init_windows_dir
(
const
WCHAR
*
windir
,
const
WCHAR
*
sysdir
);
static
const
WCHAR
windirW
[]
=
{
'w'
,
'i'
,
'n'
,
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
winsysdirW
[]
=
{
'w'
,
'i'
,
'n'
,
's'
,
'y'
,
's'
,
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
default_windirW
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
0
};
...
...
@@ -1013,9 +1011,6 @@ static void init_windows_dirs(void)
TRACE_
(
file
)(
"WindowsDir = %s
\n
"
,
debugstr_w
(
DIR_Windows
)
);
TRACE_
(
file
)(
"SystemDir = %s
\n
"
,
debugstr_w
(
DIR_System
)
);
/* set the directories in ntdll too */
__wine_init_windows_dir
(
DIR_Windows
,
DIR_System
);
}
...
...
dlls/ntdll/directory.c
View file @
12276796
...
...
@@ -205,8 +205,6 @@ static RTL_RUN_ONCE init_once = RTL_RUN_ONCE_INIT;
/* at some point we may want to allow Winelib apps to set this */
static
const
BOOL
is_case_sensitive
=
FALSE
;
UNICODE_STRING
system_dir
=
{
0
,
0
,
NULL
};
/* system directory */
static
struct
file_identity
windir
;
static
RTL_CRITICAL_SECTION
dir_section
;
...
...
@@ -2378,14 +2376,10 @@ static int get_redirect_path( char *unix_name, int pos, const WCHAR *name, int l
#endif
/***********************************************************************
*
DIR_init_windows_dir
*
init_directories
*/
void
DIR_init_windows_dir
(
const
WCHAR
*
win
,
const
WCHAR
*
sys
)
void
init_directories
(
void
)
{
/* FIXME: should probably store paths as NT file names */
RtlCreateUnicodeString
(
&
system_dir
,
sys
);
#ifndef _WIN64
if
(
is_wow64
)
init_redirects
();
#endif
...
...
dlls/ntdll/loader.c
View file @
12276796
...
...
@@ -63,6 +63,10 @@ WINE_DECLARE_DEBUG_CHANNEL(imports);
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC
)(
HMODULE
,
DWORD
,
LPVOID
);
typedef
void
(
CALLBACK
*
LDRENUMPROC
)(
LDR_MODULE
*
,
void
*
,
BOOLEAN
*
);
/* system directory with trailing backslash */
const
WCHAR
system_dir
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'2'
,
'\\'
,
0
};
static
BOOL
imports_fixup_done
=
FALSE
;
/* set once the imports have been fixed up, before attaching them */
static
BOOL
process_detaching
=
FALSE
;
/* set on process detach to avoid deadlocks with thread detach */
static
int
free_lib_count
;
/* recursion depth of LdrUnloadDll calls */
...
...
@@ -1521,12 +1525,10 @@ static WCHAR *get_builtin_fullname( const WCHAR *path, const char *filename )
}
if
((
fullname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
system_dir
.
MaximumLength
+
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
(
strlenW
(
system_dir
)
+
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
memcpy
(
fullname
,
system_dir
.
Buffer
,
system_dir
.
Length
);
p
=
fullname
+
system_dir
.
Length
/
sizeof
(
WCHAR
);
if
(
p
>
fullname
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
ascii_to_unicode
(
p
,
filename
,
len
+
1
);
strcpyW
(
fullname
,
system_dir
);
ascii_to_unicode
(
fullname
+
strlenW
(
fullname
),
filename
,
len
+
1
);
}
return
fullname
;
}
...
...
@@ -3284,40 +3286,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
}
/******************************************************************
* __wine_init_windows_dir (NTDLL.@)
*
* Windows and system dir initialization once kernel32 has been loaded.
*/
void
CDECL
__wine_init_windows_dir
(
const
WCHAR
*
windir
,
const
WCHAR
*
sysdir
)
{
PLIST_ENTRY
mark
,
entry
;
LPWSTR
buffer
,
p
;
strcpyW
(
user_shared_data
->
NtSystemRoot
,
windir
);
DIR_init_windows_dir
(
windir
,
sysdir
);
/* prepend the system dir to the name of the already created modules */
mark
=
&
NtCurrentTeb
()
->
Peb
->
LdrData
->
InLoadOrderModuleList
;
for
(
entry
=
mark
->
Flink
;
entry
!=
mark
;
entry
=
entry
->
Flink
)
{
LDR_MODULE
*
mod
=
CONTAINING_RECORD
(
entry
,
LDR_MODULE
,
InLoadOrderModuleList
);
assert
(
mod
->
Flags
&
LDR_WINE_INTERNAL
);
buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
system_dir
.
Length
+
mod
->
FullDllName
.
Length
+
2
*
sizeof
(
WCHAR
)
);
if
(
!
buffer
)
continue
;
strcpyW
(
buffer
,
system_dir
.
Buffer
);
p
=
buffer
+
strlenW
(
buffer
);
if
(
p
>
buffer
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
strcpyW
(
p
,
mod
->
FullDllName
.
Buffer
);
RtlInitUnicodeString
(
&
mod
->
FullDllName
,
buffer
);
RtlInitUnicodeString
(
&
mod
->
BaseDllName
,
p
);
}
}
/***********************************************************************
* __wine_process_init
*/
...
...
dlls/ntdll/loadorder.c
View file @
12276796
...
...
@@ -434,7 +434,6 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
enum
loadorder
ret
=
LO_INVALID
;
HANDLE
std_key
,
app_key
=
0
;
WCHAR
*
module
,
*
basename
;
UNICODE_STRING
path_str
;
int
len
;
if
(
!
init_done
)
init_load_order
();
...
...
@@ -445,10 +444,9 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
/* Strip path information if the module resides in the system directory
*/
RtlInitUnicodeString
(
&
path_str
,
path
);
if
(
RtlPrefixUnicodeString
(
&
system_dir
,
&
path_str
,
TRUE
))
if
(
!
strncmpiW
(
system_dir
,
path
,
strlenW
(
system_dir
)))
{
const
WCHAR
*
p
=
path
+
s
ystem_dir
.
Length
/
sizeof
(
WCHAR
);
const
WCHAR
*
p
=
path
+
s
trlenW
(
system_dir
);
while
(
*
p
==
'\\'
||
*
p
==
'/'
)
p
++
;
if
(
!
strchrW
(
p
,
'\\'
)
&&
!
strchrW
(
p
,
'/'
))
path
=
p
;
}
...
...
dlls/ntdll/ntdll.spec
View file @
12276796
...
...
@@ -1496,4 +1496,3 @@
# Filesystem
@ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
@ cdecl wine_unix_to_nt_file_name(ptr ptr)
@ cdecl __wine_init_windows_dir(wstr wstr)
dlls/ntdll/ntdll_misc.h
View file @
12276796
...
...
@@ -113,7 +113,7 @@ extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY
FARPROC
origfun
,
DWORD
ordinal
,
const
WCHAR
*
user
)
DECLSPEC_HIDDEN
;
extern
void
RELAY_SetupDLL
(
HMODULE
hmod
)
DECLSPEC_HIDDEN
;
extern
void
SNOOP_SetupDLL
(
HMODULE
hmod
)
DECLSPEC_HIDDEN
;
extern
UNICODE_STRING
system_dir
DECLSPEC_HIDDEN
;
extern
const
WCHAR
system_dir
[]
DECLSPEC_HIDDEN
;
typedef
LONG
(
WINAPI
*
PUNHANDLED_EXCEPTION_FILTER
)(
PEXCEPTION_POINTERS
);
extern
PUNHANDLED_EXCEPTION_FILTER
unhandled_exception_filter
DECLSPEC_HIDDEN
;
...
...
@@ -155,7 +155,7 @@ extern int get_file_info( const char *path, struct stat *st, ULONG *attr ) DECLS
extern
NTSTATUS
fill_file_info
(
const
struct
stat
*
st
,
ULONG
attr
,
void
*
ptr
,
FILE_INFORMATION_CLASS
class
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
server_get_unix_name
(
HANDLE
handle
,
ANSI_STRING
*
unix_name
)
DECLSPEC_HIDDEN
;
extern
void
DIR_init_windows_dir
(
const
WCHAR
*
windir
,
const
WCHAR
*
sysdir
)
DECLSPEC_HIDDEN
;
extern
void
init_directories
(
void
)
DECLSPEC_HIDDEN
;
extern
BOOL
DIR_is_hidden_file
(
const
UNICODE_STRING
*
name
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
DIR_unmount_device
(
HANDLE
handle
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
DIR_get_unix_cwd
(
char
**
cwd
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/rtlstr.c
View file @
12276796
...
...
@@ -61,6 +61,7 @@ void CDECL __wine_init_codepages( const union cptable *ansi, const union cptable
oem_table
=
oem
;
unix_table
=
ucp
;
NlsAnsiCodePage
=
ansi
->
info
.
codepage
;
init_directories
();
}
int
ntdll_umbstowcs
(
DWORD
flags
,
const
char
*
src
,
int
srclen
,
WCHAR
*
dst
,
int
dstlen
)
...
...
dlls/ntdll/thread.c
View file @
12276796
...
...
@@ -53,6 +53,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread);
#endif
struct
_KUSER_SHARED_DATA
*
user_shared_data
=
NULL
;
static
const
WCHAR
default_windirW
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
0
};
PUNHANDLED_EXCEPTION_FILTER
unhandled_exception_filter
=
NULL
;
void
(
WINAPI
*
kernel32_start_process
)(
LPTHREAD_START_ROUTINE
,
void
*
)
=
NULL
;
...
...
@@ -298,6 +299,7 @@ HANDLE thread_init(void)
exit
(
1
);
}
user_shared_data
=
addr
;
memcpy
(
user_shared_data
->
NtSystemRoot
,
default_windirW
,
sizeof
(
default_windirW
)
);
/* allocate and initialize the PEB */
...
...
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