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
36e55720
Commit
36e55720
authored
Jun 24, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store home directory and username at init time in the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
59ff149a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
9 deletions
+31
-9
loader.c
dlls/ntdll/unix/loader.c
+29
-9
unix_private.h
dlls/ntdll/unix/unix_private.h
+2
-0
No files found.
dlls/ntdll/unix/loader.c
View file @
36e55720
...
...
@@ -123,9 +123,11 @@ static const char *dll_dir;
static
const
char
**
dll_paths
;
static
SIZE_T
dll_path_maxlen
;
const
char
*
home_dir
=
NULL
;
const
char
*
data_dir
=
NULL
;
const
char
*
build_dir
=
NULL
;
const
char
*
config_dir
=
NULL
;
const
char
*
user_name
=
NULL
;
HMODULE
ntdll_module
=
NULL
;
struct
file_id
...
...
@@ -285,6 +287,29 @@ static void set_dll_path(void)
}
static
void
set_home_dir
(
void
)
{
const
char
*
home
=
getenv
(
"HOME"
);
const
char
*
name
=
getenv
(
"USER"
);
const
char
*
p
;
if
(
!
home
||
!
name
)
{
struct
passwd
*
pwd
=
getpwuid
(
getuid
()
);
if
(
pwd
)
{
if
(
!
home
)
home
=
pwd
->
pw_dir
;
if
(
!
name
)
name
=
pwd
->
pw_name
;
}
if
(
!
name
)
name
=
"wine"
;
}
if
((
p
=
strrchr
(
name
,
'/'
)))
name
=
p
+
1
;
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
home_dir
=
strdup
(
home
);
user_name
=
strdup
(
name
);
}
static
void
set_config_dir
(
void
)
{
char
*
p
,
*
dir
;
...
...
@@ -299,15 +324,9 @@ static void set_config_dir(void)
}
else
{
const
char
*
home
=
getenv
(
"HOME"
);
if
(
!
home
)
{
struct
passwd
*
pwd
=
getpwuid
(
getuid
()
);
if
(
pwd
)
home
=
pwd
->
pw_dir
;
}
if
(
!
home
)
fatal_error
(
"could not determine your home directory
\n
"
);
if
(
home
[
0
]
!=
'/'
)
fatal_error
(
"your home directory %s is not an absolute path
\n
"
,
home
);
config_dir
=
build_path
(
home
,
".wine"
);
if
(
!
home_dir
)
fatal_error
(
"could not determine your home directory
\n
"
);
if
(
home_dir
[
0
]
!=
'/'
)
fatal_error
(
"the home directory %s is not an absolute path
\n
"
,
home_dir
);
config_dir
=
build_path
(
home_dir
,
".wine"
);
}
}
...
...
@@ -334,6 +353,7 @@ static void init_paths( int argc, char *argv[], char *envp[] )
}
set_dll_path
();
set_home_dir
();
set_config_dir
();
}
...
...
dlls/ntdll/unix/unix_private.h
View file @
36e55720
...
...
@@ -124,9 +124,11 @@ extern NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_ST
extern
NTSTATUS
CDECL
unix_to_nt_file_name
(
const
ANSI_STRING
*
name
,
UNICODE_STRING
*
nt
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
set_show_dot_files
(
BOOL
enable
)
DECLSPEC_HIDDEN
;
extern
const
char
*
home_dir
DECLSPEC_HIDDEN
;
extern
const
char
*
data_dir
DECLSPEC_HIDDEN
;
extern
const
char
*
build_dir
DECLSPEC_HIDDEN
;
extern
const
char
*
config_dir
DECLSPEC_HIDDEN
;
extern
const
char
*
user_name
DECLSPEC_HIDDEN
;
extern
HMODULE
ntdll_module
DECLSPEC_HIDDEN
;
extern
USHORT
*
uctable
DECLSPEC_HIDDEN
;
extern
USHORT
*
lctable
DECLSPEC_HIDDEN
;
...
...
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