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
6beb82e2
Commit
6beb82e2
authored
Jan 28, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Append the user PATH value to the system one.
parent
17dea24f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
process.c
dlls/kernel32/process.c
+20
-10
No files found.
dlls/kernel32/process.c
View file @
6beb82e2
...
...
@@ -358,13 +358,20 @@ static BOOL build_initial_environment(void)
*/
static
void
set_registry_variables
(
HANDLE
hkey
,
ULONG
type
)
{
static
const
WCHAR
pathW
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
};
static
const
WCHAR
sep
[]
=
{
';'
,
0
};
UNICODE_STRING
env_name
,
env_value
;
NTSTATUS
status
;
DWORD
size
;
int
index
;
char
buffer
[
1024
*
sizeof
(
WCHAR
)
+
sizeof
(
KEY_VALUE_FULL_INFORMATION
)];
WCHAR
tmpbuf
[
1024
];
UNICODE_STRING
tmp
;
KEY_VALUE_FULL_INFORMATION
*
info
=
(
KEY_VALUE_FULL_INFORMATION
*
)
buffer
;
tmp
.
Buffer
=
tmpbuf
;
tmp
.
MaximumLength
=
sizeof
(
tmpbuf
);
for
(
index
=
0
;
;
index
++
)
{
status
=
NtEnumerateValueKey
(
hkey
,
index
,
KeyValueFullInformation
,
...
...
@@ -376,24 +383,27 @@ static void set_registry_variables( HANDLE hkey, ULONG type )
env_name
.
Buffer
=
info
->
Name
;
env_name
.
Length
=
env_name
.
MaximumLength
=
info
->
NameLength
;
env_value
.
Buffer
=
(
WCHAR
*
)(
buffer
+
info
->
DataOffset
);
env_value
.
Length
=
env_value
.
MaximumLength
=
info
->
DataLength
;
env_value
.
Length
=
info
->
DataLength
;
env_value
.
MaximumLength
=
sizeof
(
buffer
)
-
info
->
DataOffset
;
if
(
env_value
.
Length
&&
!
env_value
.
Buffer
[
env_value
.
Length
/
sizeof
(
WCHAR
)
-
1
])
env_value
.
Length
-=
sizeof
(
WCHAR
);
/* don't count terminating null if any */
if
(
!
env_value
.
Length
)
continue
;
if
(
info
->
Type
==
REG_EXPAND_SZ
)
{
WCHAR
buf_expanded
[
1024
];
UNICODE_STRING
env_expanded
;
env_expanded
.
Length
=
env_expanded
.
MaximumLength
=
sizeof
(
buf_expanded
);
env_expanded
.
Buffer
=
buf_expanded
;
status
=
RtlExpandEnvironmentStrings_U
(
NULL
,
&
env_value
,
&
env_expanded
,
NULL
);
if
(
status
==
STATUS_SUCCESS
||
status
==
STATUS_BUFFER_OVERFLOW
)
RtlSetEnvironmentVariable
(
NULL
,
&
env_name
,
&
env_expanded
);
status
=
RtlExpandEnvironmentStrings_U
(
NULL
,
&
env_value
,
&
tmp
,
NULL
);
if
(
status
!=
STATUS_SUCCESS
&&
status
!=
STATUS_BUFFER_OVERFLOW
)
continue
;
RtlCopyUnicodeString
(
&
env_value
,
&
tmp
);
}
else
/* PATH is magic */
if
(
env_name
.
Length
==
sizeof
(
pathW
)
&&
!
memicmpW
(
env_name
.
Buffer
,
pathW
,
sizeof
(
pathW
)
/
sizeof
(
WCHAR
)
)
&&
!
RtlQueryEnvironmentVariable_U
(
NULL
,
&
env_name
,
&
tmp
))
{
RtlSetEnvironmentVariable
(
NULL
,
&
env_name
,
&
env_value
);
RtlAppendUnicodeToString
(
&
tmp
,
sep
);
if
(
RtlAppendUnicodeStringToString
(
&
tmp
,
&
env_value
))
continue
;
RtlCopyUnicodeString
(
&
env_value
,
&
tmp
);
}
RtlSetEnvironmentVariable
(
NULL
,
&
env_name
,
&
env_value
);
}
}
...
...
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