Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sam Joan Roque-Worcel
wine
Commits
0a19a07e
Commit
0a19a07e
authored
20 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Set additional environment variables at startup from
HKLM\System\CurrentControlSet\Control\Session Manager\Environment.
parent
0040ba95
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/kernel/process.c
+52
-0
52 additions, 0 deletions
dlls/kernel/process.c
with
52 additions
and
0 deletions
dlls/kernel/process.c
+
52
−
0
View file @
0a19a07e
...
...
@@ -400,6 +400,56 @@ static BOOL build_initial_environment( char **environ )
}
/***********************************************************************
* set_registry_environment
*
* Set the environment variables specified in the registry.
*/
static
void
set_registry_environment
(
void
)
{
static
const
WCHAR
env_keyW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'\\'
,
'S'
,
'e'
,
's'
,
's'
,
'i'
,
'o'
,
'n'
,
' '
,
'M'
,
'a'
,
'n'
,
'a'
,
'g'
,
'e'
,
'r'
,
'\\'
,
'E'
,
'n'
,
'v'
,
'i'
,
'r'
,
'o'
,
'n'
,
'm'
,
'e'
,
'n'
,
't'
,
0
};
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
,
env_name
,
env_value
;
NTSTATUS
status
;
HKEY
hkey
;
DWORD
size
;
int
index
;
char
buffer
[
1024
+
sizeof
(
KEY_VALUE_FULL_INFORMATION
)];
KEY_VALUE_FULL_INFORMATION
*
info
=
(
KEY_VALUE_FULL_INFORMATION
*
)
buffer
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
env_keyW
);
if
(
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
)
!=
STATUS_SUCCESS
)
return
;
for
(
index
=
0
;
;
index
++
)
{
status
=
NtEnumerateValueKey
(
hkey
,
index
,
KeyValueFullInformation
,
buffer
,
sizeof
(
buffer
),
&
size
);
if
(
status
==
STATUS_BUFFER_OVERFLOW
)
continue
;
if
(
status
!=
STATUS_SUCCESS
)
break
;
if
(
info
->
Type
!=
REG_SZ
)
continue
;
/* FIXME: handle REG_EXPAND_SZ */
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
;
if
(
env_value
.
Length
&&
!
env_value
.
Buffer
[
env_value
.
Length
/
sizeof
(
WCHAR
)
-
1
])
env_value
.
Length
--
;
/* don't count terminating null if any */
RtlSetEnvironmentVariable
(
NULL
,
&
env_name
,
&
env_value
);
}
NtClose
(
hkey
);
}
/***********************************************************************
* set_library_wargv
*
...
...
@@ -750,6 +800,8 @@ static BOOL process_init( char *argv[], char **environ )
}
SERVER_END_REQ
;
if
(
!
info_size
)
set_registry_environment
();
return
TRUE
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment