Commit b7db0b52 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Initialize earlier things that need the executable name.

parent b95c4c22
...@@ -3832,8 +3832,8 @@ static void load_global_options(void) ...@@ -3832,8 +3832,8 @@ static void load_global_options(void)
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &name_str, sessionW ); RtlInitUnicodeString( &name_str, sessionW );
if (NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr )) return; if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr ))
{
query_dword_option( hkey, globalflagW, &NtCurrentTeb()->Peb->NtGlobalFlag ); query_dword_option( hkey, globalflagW, &NtCurrentTeb()->Peb->NtGlobalFlag );
query_dword_option( hkey, safesearchW, &path_safe_mode ); query_dword_option( hkey, safesearchW, &path_safe_mode );
query_dword_option( hkey, safedllmodeW, &dll_safe_mode ); query_dword_option( hkey, safedllmodeW, &dll_safe_mode );
...@@ -3854,6 +3854,11 @@ static void load_global_options(void) ...@@ -3854,6 +3854,11 @@ static void load_global_options(void)
NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value; NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value;
NtClose( hkey ); NtClose( hkey );
}
LdrQueryImageFileExecutionOptions( &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName,
globalflagW, REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag,
sizeof(DWORD), NULL );
heap_set_debug_flags( GetProcessHeap() );
} }
...@@ -4223,8 +4228,6 @@ void __wine_process_init(void) ...@@ -4223,8 +4228,6 @@ void __wine_process_init(void)
static const WCHAR kernel32W[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\', static const WCHAR kernel32W[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\', 's','y','s','t','e','m','3','2','\\',
'k','e','r','n','e','l','3','2','.','d','l','l',0}; 'k','e','r','n','e','l','3','2','.','d','l','l',0};
static const WCHAR globalflagW[] = {'G','l','o','b','a','l','F','l','a','g',0};
WINE_MODREF *wm; WINE_MODREF *wm;
NTSTATUS status; NTSTATUS status;
ANSI_STRING func_name; ANSI_STRING func_name;
...@@ -4239,6 +4242,7 @@ void __wine_process_init(void) ...@@ -4239,6 +4242,7 @@ void __wine_process_init(void)
umask( FILE_umask ); umask( FILE_umask );
load_global_options(); load_global_options();
version_init();
/* setup the load callback and create ntdll modref */ /* setup the load callback and create ntdll modref */
wine_dll_set_callback( load_builtin_callback ); wine_dll_set_callback( load_builtin_callback );
...@@ -4268,13 +4272,8 @@ void __wine_process_init(void) ...@@ -4268,13 +4272,8 @@ void __wine_process_init(void)
} }
NtCurrentTeb()->Peb->LoaderLock = &loader_section; NtCurrentTeb()->Peb->LoaderLock = &loader_section;
version_init( wm->ldr.FullDllName.Buffer );
virtual_set_large_address_space(); virtual_set_large_address_space();
LdrQueryImageFileExecutionOptions( &wm->ldr.FullDllName, globalflagW, REG_DWORD,
&NtCurrentTeb()->Peb->NtGlobalFlag, sizeof(DWORD), NULL );
heap_set_debug_flags( GetProcessHeap() );
/* the main exe needs to be the first in the load order list */ /* the main exe needs to be the first in the load order list */
RemoveEntryList( &wm->ldr.InLoadOrderModuleList ); RemoveEntryList( &wm->ldr.InLoadOrderModuleList );
InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderModuleList ); InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderModuleList );
......
...@@ -77,7 +77,7 @@ extern void signal_start_thread( LPTHREAD_START_ROUTINE entry, void *arg, BOOL s ...@@ -77,7 +77,7 @@ extern void signal_start_thread( LPTHREAD_START_ROUTINE entry, void *arg, BOOL s
extern void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend ) DECLSPEC_HIDDEN; extern void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_process( int status ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN signal_exit_process( int status ) DECLSPEC_HIDDEN;
extern void version_init( const WCHAR *appname ) DECLSPEC_HIDDEN; extern void version_init(void) DECLSPEC_HIDDEN;
extern void debug_init(void) DECLSPEC_HIDDEN; extern void debug_init(void) DECLSPEC_HIDDEN;
extern void thread_init(void) DECLSPEC_HIDDEN; extern void thread_init(void) DECLSPEC_HIDDEN;
extern void actctx_init(void) DECLSPEC_HIDDEN; extern void actctx_init(void) DECLSPEC_HIDDEN;
......
...@@ -485,7 +485,7 @@ static BOOL parse_win_version( HANDLE hkey ) ...@@ -485,7 +485,7 @@ static BOOL parse_win_version( HANDLE hkey )
/********************************************************************** /**********************************************************************
* version_init * version_init
*/ */
void version_init( const WCHAR *appname ) void version_init(void)
{ {
static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0}; static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0}; static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
...@@ -493,6 +493,8 @@ void version_init( const WCHAR *appname ) ...@@ -493,6 +493,8 @@ void version_init( const WCHAR *appname )
UNICODE_STRING nameW; UNICODE_STRING nameW;
HANDLE root, hkey, config_key; HANDLE root, hkey, config_key;
BOOL got_win_ver = FALSE; BOOL got_win_ver = FALSE;
const WCHAR *p, *appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
WCHAR appversion[MAX_PATH+20];
current_version = &VersionData[WIN7]; current_version = &VersionData[WIN7];
...@@ -511,10 +513,6 @@ void version_init( const WCHAR *appname ) ...@@ -511,10 +513,6 @@ void version_init( const WCHAR *appname )
if (!config_key) goto done; if (!config_key) goto done;
/* open AppDefaults\\appname key */ /* open AppDefaults\\appname key */
if (appname && *appname)
{
const WCHAR *p;
WCHAR appversion[MAX_PATH+20];
if ((p = strrchrW( appname, '/' ))) appname = p + 1; if ((p = strrchrW( appname, '/' ))) appname = p + 1;
if ((p = strrchrW( appname, '\\' ))) appname = p + 1; if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
...@@ -531,7 +529,6 @@ void version_init( const WCHAR *appname ) ...@@ -531,7 +529,6 @@ void version_init( const WCHAR *appname )
got_win_ver = parse_win_version( hkey ); got_win_ver = parse_win_version( hkey );
NtClose( hkey ); NtClose( hkey );
} }
}
if (!got_win_ver) if (!got_win_ver)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment