Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
39a1227c
Commit
39a1227c
authored
Jan 20, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Load the various PEB global options at startup.
parent
1c119dad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
51 deletions
+55
-51
loader.c
dlls/ntdll/loader.c
+55
-0
thread.c
dlls/ntdll/thread.c
+0
-51
No files found.
dlls/ntdll/loader.c
View file @
39a1227c
...
...
@@ -2552,6 +2552,59 @@ static NTSTATUS attach_process_dlls( void *wm )
/***********************************************************************
* load_global_options
*/
static
void
load_global_options
(
void
)
{
static
const
WCHAR
sessionW
[]
=
{
'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'
,
0
};
static
const
WCHAR
globalflagW
[]
=
{
'G'
,
'l'
,
'o'
,
'b'
,
'a'
,
'l'
,
'F'
,
'l'
,
'a'
,
'g'
,
0
};
static
const
WCHAR
critsectW
[]
=
{
'C'
,
'r'
,
'i'
,
't'
,
'i'
,
'c'
,
'a'
,
'l'
,
'S'
,
'e'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
'T'
,
'i'
,
'm'
,
'e'
,
'o'
,
'u'
,
't'
,
0
};
static
const
WCHAR
heapresW
[]
=
{
'H'
,
'e'
,
'a'
,
'p'
,
'S'
,
'e'
,
'g'
,
'm'
,
'e'
,
'n'
,
't'
,
'R'
,
'e'
,
's'
,
'e'
,
'r'
,
'v'
,
'e'
,
0
};
static
const
WCHAR
heapcommitW
[]
=
{
'H'
,
'e'
,
'a'
,
'p'
,
'S'
,
'e'
,
'g'
,
'm'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'm'
,
'm'
,
'i'
,
't'
,
0
};
static
const
WCHAR
decommittotalW
[]
=
{
'H'
,
'e'
,
'a'
,
'p'
,
'D'
,
'e'
,
'C'
,
'o'
,
'm'
,
'm'
,
'i'
,
't'
,
'T'
,
'o'
,
't'
,
'a'
,
'l'
,
'F'
,
'r'
,
'e'
,
'e'
,
'T'
,
'h'
,
'r'
,
'e'
,
's'
,
'h'
,
'o'
,
'l'
,
'd'
,
0
};
static
const
WCHAR
decommitfreeW
[]
=
{
'H'
,
'e'
,
'a'
,
'p'
,
'D'
,
'e'
,
'C'
,
'o'
,
'm'
,
'm'
,
'i'
,
't'
,
'F'
,
'r'
,
'e'
,
'e'
,
'B'
,
'l'
,
'o'
,
'c'
,
'k'
,
'T'
,
'h'
,
'r'
,
'e'
,
's'
,
'h'
,
'o'
,
'l'
,
'd'
,
0
};
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
name_str
;
HANDLE
hkey
;
ULONG
value
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
name_str
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
name_str
,
sessionW
);
if
(
NtOpenKey
(
&
hkey
,
KEY_QUERY_VALUE
,
&
attr
))
return
;
query_dword_option
(
hkey
,
globalflagW
,
&
NtCurrentTeb
()
->
Peb
->
NtGlobalFlag
);
query_dword_option
(
hkey
,
critsectW
,
&
value
);
NtCurrentTeb
()
->
Peb
->
CriticalSectionTimeout
.
QuadPart
=
(
ULONGLONG
)
value
*
-
10000000
;
query_dword_option
(
hkey
,
heapresW
,
&
value
);
NtCurrentTeb
()
->
Peb
->
HeapSegmentReserve
=
value
;
query_dword_option
(
hkey
,
heapcommitW
,
&
value
);
NtCurrentTeb
()
->
Peb
->
HeapSegmentCommit
=
value
;
query_dword_option
(
hkey
,
decommittotalW
,
&
value
);
NtCurrentTeb
()
->
Peb
->
HeapDeCommitTotalFreeThreshold
=
value
;
query_dword_option
(
hkey
,
decommitfreeW
,
&
value
);
NtCurrentTeb
()
->
Peb
->
HeapDeCommitFreeBlockThreshold
=
value
;
NtClose
(
hkey
);
}
/***********************************************************************
* start_process
*/
static
void
start_process
(
void
*
kernel_start
)
...
...
@@ -2799,6 +2852,8 @@ void __wine_process_init(void)
FILE_umask
=
umask
(
0777
);
umask
(
FILE_umask
);
load_global_options
();
/* setup the load callback and create ntdll modref */
wine_dll_set_callback
(
load_builtin_callback
);
...
...
dlls/ntdll/thread.c
View file @
39a1227c
...
...
@@ -183,54 +183,6 @@ done:
}
/***********************************************************************
* get_global_flag
*
* This is called before the process heap is created,
* but after the connection to the server is established.
* No windows heap allocation is permitted.
*/
static
DWORD
get_global_flag
(
void
)
{
static
const
WCHAR
sessionman_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'
,
0
};
static
const
WCHAR
global_flagW
[]
=
{
'G'
,
'l'
,
'o'
,
'b'
,
'a'
,
'l'
,
'F'
,
'l'
,
'a'
,
'g'
,
0
};
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
,
valueW
;
HANDLE
hkey
;
char
tmp
[
32
];
DWORD
count
;
KEY_VALUE_PARTIAL_INFORMATION
*
info
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
;
NTSTATUS
status
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
sessionman_keyW
);
status
=
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
);
if
(
status
!=
STATUS_SUCCESS
)
return
0
;
RtlInitUnicodeString
(
&
valueW
,
global_flagW
);
status
=
NtQueryValueKey
(
hkey
,
&
valueW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
)
-
1
,
&
count
);
if
(
status
!=
STATUS_SUCCESS
)
return
0
;
/* Some documents say this can be a string, so handle either type */
if
(
info
->
Type
==
REG_DWORD
)
return
*
(
DWORD
*
)
info
->
Data
;
if
(
info
->
Type
==
REG_SZ
)
return
strtol
((
char
*
)
info
->
Data
,
NULL
,
16
);
return
0
;
}
/***********************************************************************
* thread_init
*
* Setup the initial thread.
...
...
@@ -310,9 +262,6 @@ HANDLE thread_init(void)
server_init_process
();
info_size
=
server_init_thread
(
peb
);
/* retrieve the global flags settings from the registry */
peb
->
NtGlobalFlag
=
get_global_flag
();
/* create the process heap */
if
(
!
(
peb
->
ProcessHeap
=
RtlCreateHeap
(
HEAP_GROWABLE
,
NULL
,
0
,
0
,
NULL
,
NULL
)))
{
...
...
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