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
87894c5f
Commit
87894c5f
authored
Oct 15, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Use the PWD variable to set the initial current directory.
parent
a54ba871
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
process.c
dlls/kernel32/process.c
+15
-2
No files found.
dlls/kernel32/process.c
View file @
87894c5f
...
...
@@ -759,6 +759,7 @@ static BOOL build_command_line( WCHAR **argv )
static
void
init_current_directory
(
CURDIR
*
cur_dir
)
{
UNICODE_STRING
dir_str
;
const
char
*
pwd
;
char
*
cwd
;
int
size
;
...
...
@@ -781,13 +782,25 @@ static void init_current_directory( CURDIR *cur_dir )
break
;
}
/* try to use PWD if it is valid, so that we don't resolve symlinks */
pwd
=
getenv
(
"PWD"
);
if
(
cwd
)
{
struct
stat
st1
,
st2
;
if
(
!
pwd
||
stat
(
pwd
,
&
st1
)
==
-
1
||
(
!
stat
(
cwd
,
&
st2
)
&&
(
st1
.
st_dev
!=
st2
.
st_dev
||
st1
.
st_ino
!=
st2
.
st_ino
)))
pwd
=
cwd
;
}
if
(
pwd
)
{
WCHAR
*
dirW
;
int
lenW
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
c
wd
,
-
1
,
NULL
,
0
);
int
lenW
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
p
wd
,
-
1
,
NULL
,
0
);
if
((
dirW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
)
)))
{
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
c
wd
,
-
1
,
dirW
,
lenW
);
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
p
wd
,
-
1
,
dirW
,
lenW
);
RtlInitUnicodeString
(
&
dir_str
,
dirW
);
RtlSetCurrentDirectory_U
(
&
dir_str
);
RtlFreeUnicodeString
(
&
dir_str
);
...
...
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