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
0bce76d8
Commit
0bce76d8
authored
Aug 04, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the loading of the global options to the Unix side.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7458219e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
40 deletions
+105
-40
process.c
dlls/kernel32/tests/process.c
+14
-4
heap.c
dlls/ntdll/heap.c
+2
-2
loader.c
dlls/ntdll/loader.c
+0
-22
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+0
-1
env.c
dlls/ntdll/unix/env.c
+89
-11
No files found.
dlls/kernel32/tests/process.c
View file @
0bce76d8
...
...
@@ -3384,7 +3384,7 @@ static void test_SuspendProcessState(void)
ULONG
pipe_magic
,
numb
;
BOOL
ret
;
void
*
user_thread_start
,
*
start_ptr
,
*
entry_ptr
,
*
peb_ptr
;
PEB
child_peb
;
PEB
child_peb
,
*
peb
=
NtCurrentTeb
()
->
Peb
;
exit_process_ptr
=
GetProcAddress
(
hkernel32
,
"ExitProcess"
);
ok
(
exit_process_ptr
!=
NULL
,
"GetProcAddress ExitProcess failed
\n
"
);
...
...
@@ -3515,9 +3515,19 @@ static void test_SuspendProcessState(void)
ok
(
!
child_peb
.
ProcessHeap
,
"ProcessHeap set %p
\n
"
,
child_peb
.
ProcessHeap
);
ok
(
!
child_peb
.
CSDVersion
.
Buffer
,
"CSDVersion set %s
\n
"
,
debugstr_w
(
child_peb
.
CSDVersion
.
Buffer
)
);
ok
(
child_peb
.
OSMajorVersion
,
"OSMajorVersion not set %u
\n
"
,
child_peb
.
OSMajorVersion
);
ok
(
child_peb
.
OSPlatformId
==
VER_PLATFORM_WIN32_NT
,
"OSPlatformId not set %u
\n
"
,
child_peb
.
OSPlatformId
);
ok
(
child_peb
.
SessionId
==
1
,
"SessionId not set %u
\n
"
,
child_peb
.
SessionId
);
ok
(
child_peb
.
OSMajorVersion
==
peb
->
OSMajorVersion
,
"OSMajorVersion not set %u
\n
"
,
child_peb
.
OSMajorVersion
);
ok
(
child_peb
.
OSPlatformId
==
peb
->
OSPlatformId
,
"OSPlatformId not set %u
\n
"
,
child_peb
.
OSPlatformId
);
ok
(
child_peb
.
SessionId
==
peb
->
SessionId
,
"SessionId not set %u
\n
"
,
child_peb
.
SessionId
);
ok
(
child_peb
.
CriticalSectionTimeout
.
QuadPart
,
"CriticalSectionTimeout not set %s
\n
"
,
wine_dbgstr_longlong
(
child_peb
.
CriticalSectionTimeout
.
QuadPart
)
);
ok
(
child_peb
.
HeapSegmentReserve
==
peb
->
HeapSegmentReserve
,
"HeapSegmentReserve not set %lu
\n
"
,
child_peb
.
HeapSegmentReserve
);
ok
(
child_peb
.
HeapSegmentCommit
==
peb
->
HeapSegmentCommit
,
"HeapSegmentCommit not set %lu
\n
"
,
child_peb
.
HeapSegmentCommit
);
ok
(
child_peb
.
HeapDeCommitTotalFreeThreshold
==
peb
->
HeapDeCommitTotalFreeThreshold
,
"HeapDeCommitTotalFreeThreshold not set %lu
\n
"
,
child_peb
.
HeapDeCommitTotalFreeThreshold
);
ok
(
child_peb
.
HeapDeCommitFreeBlockThreshold
==
peb
->
HeapDeCommitFreeBlockThreshold
,
"HeapDeCommitFreeBlockThreshold not set %lu
\n
"
,
child_peb
.
HeapDeCommitFreeBlockThreshold
);
if
(
pNtQueryInformationThread
)
{
...
...
dlls/ntdll/heap.c
View file @
0bce76d8
...
...
@@ -1440,7 +1440,7 @@ static BOOL validate_block_pointer( HEAP *heap, SUBHEAP **ret_subheap, const ARE
/***********************************************************************
* heap_set_debug_flags
*/
void
heap_set_debug_flags
(
HANDLE
handle
)
static
void
heap_set_debug_flags
(
HANDLE
handle
)
{
HEAP
*
heap
=
HEAP_GetPtr
(
handle
);
ULONG
global_flags
=
RtlGetNtGlobalFlags
();
...
...
@@ -1508,7 +1508,7 @@ void heap_set_debug_flags( HANDLE handle )
if
((
heap
->
flags
&
HEAP_GROWABLE
)
&&
!
heap
->
pending_free
&&
((
flags
&
HEAP_FREE_CHECKING_ENABLED
)
||
RUNNING_ON_VALGRIND
))
{
heap
->
pending_free
=
RtlAllocateHeap
(
GetProcessHeap
()
,
HEAP_ZERO_MEMORY
,
heap
->
pending_free
=
RtlAllocateHeap
(
handle
,
HEAP_ZERO_MEMORY
,
MAX_FREE_PENDING
*
sizeof
(
*
heap
->
pending_free
)
);
heap
->
pending_pos
=
0
;
}
...
...
dlls/ntdll/loader.c
View file @
0bce76d8
...
...
@@ -3662,7 +3662,6 @@ static void load_global_options(void)
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
name_str
,
val_str
;
HANDLE
hkey
;
ULONG
value
;
RtlInitUnicodeString
(
&
name_str
,
L"WINEBOOTSTRAPMODE"
);
val_str
.
MaximumLength
=
0
;
...
...
@@ -3678,31 +3677,10 @@ static void load_global_options(void)
if
(
!
NtOpenKey
(
&
hkey
,
KEY_QUERY_VALUE
,
&
attr
))
{
query_dword_option
(
hkey
,
L"GlobalFlag"
,
&
NtCurrentTeb
()
->
Peb
->
NtGlobalFlag
);
query_dword_option
(
hkey
,
L"SafeProcessSearchMode"
,
&
path_safe_mode
);
query_dword_option
(
hkey
,
L"SafeDllSearchMode"
,
&
dll_safe_mode
);
if
(
!
query_dword_option
(
hkey
,
L"CriticalSectionTimeout"
,
&
value
))
NtCurrentTeb
()
->
Peb
->
CriticalSectionTimeout
.
QuadPart
=
(
ULONGLONG
)
value
*
-
10000000
;
if
(
!
query_dword_option
(
hkey
,
L"HeapSegmentReserve"
,
&
value
))
NtCurrentTeb
()
->
Peb
->
HeapSegmentReserve
=
value
;
if
(
!
query_dword_option
(
hkey
,
L"HeapSegmentCommit"
,
&
value
))
NtCurrentTeb
()
->
Peb
->
HeapSegmentCommit
=
value
;
if
(
!
query_dword_option
(
hkey
,
L"HeapDeCommitTotalFreeThreshold"
,
&
value
))
NtCurrentTeb
()
->
Peb
->
HeapDeCommitTotalFreeThreshold
=
value
;
if
(
!
query_dword_option
(
hkey
,
L"HeapDeCommitFreeBlockThreshold"
,
&
value
))
NtCurrentTeb
()
->
Peb
->
HeapDeCommitFreeBlockThreshold
=
value
;
NtClose
(
hkey
);
}
LdrQueryImageFileExecutionOptions
(
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
ImagePathName
,
L"GlobalFlag"
,
REG_DWORD
,
&
NtCurrentTeb
()
->
Peb
->
NtGlobalFlag
,
sizeof
(
DWORD
),
NULL
);
heap_set_debug_flags
(
GetProcessHeap
()
);
}
...
...
dlls/ntdll/ntdll_misc.h
View file @
0bce76d8
...
...
@@ -64,7 +64,6 @@ extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN;
extern
void
version_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
debug_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
actctx_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
heap_set_debug_flags
(
HANDLE
handle
)
DECLSPEC_HIDDEN
;
extern
void
init_user_process_params
(
void
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
DECLSPEC_NORETURN
signal_start_thread
(
CONTEXT
*
ctx
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/env.c
View file @
0bce76d8
...
...
@@ -1931,6 +1931,76 @@ static inline void dup_unicode_string( const UNICODE_STRING *src, WCHAR **dst, U
/*************************************************************************
* get_dword_option
*/
static
ULONG
get_dword_option
(
HANDLE
key
,
const
WCHAR
*
name
,
ULONG
defval
)
{
UNICODE_STRING
str
;
ULONG
size
;
WCHAR
buffer
[
64
];
KEY_VALUE_PARTIAL_INFORMATION
*
info
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
buffer
;
init_unicode_string
(
&
str
,
name
);
size
=
sizeof
(
buffer
)
-
sizeof
(
WCHAR
);
if
(
NtQueryValueKey
(
key
,
&
str
,
KeyValuePartialInformation
,
buffer
,
size
,
&
size
))
return
defval
;
if
(
info
->
Type
!=
REG_DWORD
)
return
defval
;
return
*
(
ULONG
*
)
info
->
Data
;
}
/*************************************************************************
* load_global_options
*/
static
void
load_global_options
(
const
UNICODE_STRING
*
image
)
{
static
const
WCHAR
optionsW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'N'
,
'T'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'I'
,
'm'
,
'a'
,
'g'
,
'e'
,
' '
,
'F'
,
'i'
,
'l'
,
'e'
,
' '
,
'E'
,
'x'
,
'e'
,
'c'
,
'u'
,
't'
,
'i'
,
'o'
,
'n'
,
' '
,
'O'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
's'
,
0
};
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
critsectionW
[]
=
{
'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
heapreserveW
[]
=
{
'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
heapdecommittotalW
[]
=
{
'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
heapdecommitblockW
[]
=
{
'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
nameW
;
HANDLE
key
;
ULONG
i
;
InitializeObjectAttributes
(
&
attr
,
&
nameW
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
init_unicode_string
(
&
nameW
,
sessionW
);
if
(
!
NtOpenKey
(
&
key
,
KEY_QUERY_VALUE
,
&
attr
))
{
peb
->
NtGlobalFlag
=
get_dword_option
(
key
,
globalflagW
,
0
);
peb
->
CriticalSectionTimeout
.
QuadPart
=
get_dword_option
(
key
,
critsectionW
,
30
*
24
*
60
*
60
)
*
(
ULONGLONG
)
-
10000000
;
peb
->
HeapSegmentReserve
=
get_dword_option
(
key
,
heapreserveW
,
0x100000
);
peb
->
HeapSegmentCommit
=
get_dword_option
(
key
,
heapcommitW
,
0x10000
);
peb
->
HeapDeCommitTotalFreeThreshold
=
get_dword_option
(
key
,
heapdecommittotalW
,
0x10000
);
peb
->
HeapDeCommitFreeBlockThreshold
=
get_dword_option
(
key
,
heapdecommitblockW
,
0x1000
);
NtClose
(
key
);
}
init_unicode_string
(
&
nameW
,
optionsW
);
if
(
!
NtOpenKey
(
&
key
,
KEY_QUERY_VALUE
,
&
attr
))
{
attr
.
RootDirectory
=
key
;
for
(
i
=
image
->
Length
/
sizeof
(
WCHAR
);
i
;
i
--
)
if
(
image
->
Buffer
[
i
-
1
]
==
'\\'
)
break
;
nameW
.
Buffer
=
image
->
Buffer
+
i
;
nameW
.
Length
=
image
->
Length
-
i
*
sizeof
(
WCHAR
);
if
(
!
NtOpenKey
(
&
key
,
KEY_QUERY_VALUE
,
&
attr
))
{
peb
->
NtGlobalFlag
=
get_dword_option
(
key
,
globalflagW
,
peb
->
NtGlobalFlag
);
NtClose
(
key
);
}
NtClose
(
attr
.
RootDirectory
);
}
}
/*************************************************************************
* build_wow64_parameters
*/
static
void
*
build_wow64_parameters
(
const
RTL_USER_PROCESS_PARAMETERS
*
params
)
...
...
@@ -2008,6 +2078,8 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
peb
->
ImageSubSystemMajorVersion
=
main_image_info
.
MajorSubsystemVersion
;
peb
->
ImageSubSystemMinorVersion
=
main_image_info
.
MinorSubsystemVersion
;
load_global_options
(
&
params
->
ImagePathName
);
if
(
NtCurrentTeb
()
->
WowTebOffset
)
{
void
*
wow64_params
=
build_wow64_parameters
(
params
);
...
...
@@ -2016,17 +2088,23 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
#else
PEB64
*
wow64_peb
=
(
PEB64
*
)((
char
*
)
peb
-
page_size
);
#endif
wow64_peb
->
ImageBaseAddress
=
PtrToUlong
(
peb
->
ImageBaseAddress
);
wow64_peb
->
ProcessParameters
=
PtrToUlong
(
wow64_params
);
wow64_peb
->
NumberOfProcessors
=
peb
->
NumberOfProcessors
;
wow64_peb
->
OSMajorVersion
=
peb
->
OSMajorVersion
;
wow64_peb
->
OSMinorVersion
=
peb
->
OSMinorVersion
;
wow64_peb
->
OSBuildNumber
=
peb
->
OSBuildNumber
;
wow64_peb
->
OSPlatformId
=
peb
->
OSPlatformId
;
wow64_peb
->
ImageSubSystem
=
peb
->
ImageSubSystem
;
wow64_peb
->
ImageSubSystemMajorVersion
=
peb
->
ImageSubSystemMajorVersion
;
wow64_peb
->
ImageSubSystemMinorVersion
=
peb
->
ImageSubSystemMinorVersion
;
wow64_peb
->
SessionId
=
peb
->
SessionId
;
wow64_peb
->
ImageBaseAddress
=
PtrToUlong
(
peb
->
ImageBaseAddress
);
wow64_peb
->
ProcessParameters
=
PtrToUlong
(
wow64_params
);
wow64_peb
->
NumberOfProcessors
=
peb
->
NumberOfProcessors
;
wow64_peb
->
NtGlobalFlag
=
peb
->
NtGlobalFlag
;
wow64_peb
->
CriticalSectionTimeout
.
QuadPart
=
peb
->
CriticalSectionTimeout
.
QuadPart
;
wow64_peb
->
HeapSegmentReserve
=
peb
->
HeapSegmentReserve
;
wow64_peb
->
HeapSegmentCommit
=
peb
->
HeapSegmentCommit
;
wow64_peb
->
HeapDeCommitTotalFreeThreshold
=
peb
->
HeapDeCommitTotalFreeThreshold
;
wow64_peb
->
HeapDeCommitFreeBlockThreshold
=
peb
->
HeapDeCommitFreeBlockThreshold
;
wow64_peb
->
OSMajorVersion
=
peb
->
OSMajorVersion
;
wow64_peb
->
OSMinorVersion
=
peb
->
OSMinorVersion
;
wow64_peb
->
OSBuildNumber
=
peb
->
OSBuildNumber
;
wow64_peb
->
OSPlatformId
=
peb
->
OSPlatformId
;
wow64_peb
->
ImageSubSystem
=
peb
->
ImageSubSystem
;
wow64_peb
->
ImageSubSystemMajorVersion
=
peb
->
ImageSubSystemMajorVersion
;
wow64_peb
->
ImageSubSystemMinorVersion
=
peb
->
ImageSubSystemMinorVersion
;
wow64_peb
->
SessionId
=
peb
->
SessionId
;
}
}
...
...
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