ntdll: Store debug options in the PEB memory block.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-05-24 21:29:14 +02:00
parent 4e8fcc41ca
commit d389da0953
2 changed files with 11 additions and 3 deletions

View File

@ -292,7 +292,18 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
*/
void dbg_init(void)
{
struct __wine_debug_channel *options, default_option = { default_flags };
setbuf( stdout, NULL );
setbuf( stderr, NULL );
if (nb_debug_options == -1) init_options();
options = (struct __wine_debug_channel *)((char *)NtCurrentTeb()->Peb + (is_win64 ? 2 : 1) * page_size);
memcpy( options, debug_options, nb_debug_options * sizeof(*options) );
free( debug_options );
debug_options = options;
options[nb_debug_options] = default_option;
ntdll_get_thread_data()->debug_info = (struct debug_info *)(options + nb_debug_options + 1);
init_done = TRUE;
}

View File

@ -2894,7 +2894,6 @@ static TEB *init_teb( void *ptr, PEB *peb, BOOL is_wow )
*/
TEB *virtual_alloc_first_teb(void)
{
struct ntdll_thread_data *thread_data;
TEB *teb;
PEB *peb;
void *ptr;
@ -2921,8 +2920,6 @@ TEB *virtual_alloc_first_teb(void)
peb = init_peb( (char *)teb_block + 31 * block_size );
teb = init_teb( ptr, peb, FALSE );
*(ULONG_PTR *)&peb->CloudFileFlags = get_image_address();
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
thread_data->debug_info = (struct debug_info *)((char *)teb_block + 31 * block_size + 2 * page_size);
return teb;
}