ntdll: Initialize earlier things that need the executable name.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b95c4c229c
commit
b7db0b52ce
|
@ -3832,28 +3832,33 @@ static void load_global_options(void)
|
|||
attr.SecurityQualityOfService = NULL;
|
||||
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, safesearchW, &path_safe_mode );
|
||||
query_dword_option( hkey, safedllmodeW, &dll_safe_mode );
|
||||
|
||||
query_dword_option( hkey, globalflagW, &NtCurrentTeb()->Peb->NtGlobalFlag );
|
||||
query_dword_option( hkey, safesearchW, &path_safe_mode );
|
||||
query_dword_option( hkey, safedllmodeW, &dll_safe_mode );
|
||||
if (!query_dword_option( hkey, critsectW, &value ))
|
||||
NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart = (ULONGLONG)value * -10000000;
|
||||
|
||||
if (!query_dword_option( hkey, critsectW, &value ))
|
||||
NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart = (ULONGLONG)value * -10000000;
|
||||
if (!query_dword_option( hkey, heapresW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapSegmentReserve = value;
|
||||
|
||||
if (!query_dword_option( hkey, heapresW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapSegmentReserve = value;
|
||||
if (!query_dword_option( hkey, heapcommitW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapSegmentCommit = value;
|
||||
|
||||
if (!query_dword_option( hkey, heapcommitW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapSegmentCommit = value;
|
||||
if (!query_dword_option( hkey, decommittotalW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapDeCommitTotalFreeThreshold = value;
|
||||
|
||||
if (!query_dword_option( hkey, decommittotalW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapDeCommitTotalFreeThreshold = value;
|
||||
if (!query_dword_option( hkey, decommitfreeW, &value ))
|
||||
NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value;
|
||||
|
||||
if (!query_dword_option( hkey, decommitfreeW, &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)
|
|||
static const WCHAR kernel32W[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
|
||||
's','y','s','t','e','m','3','2','\\',
|
||||
'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;
|
||||
NTSTATUS status;
|
||||
ANSI_STRING func_name;
|
||||
|
@ -4239,6 +4242,7 @@ void __wine_process_init(void)
|
|||
umask( FILE_umask );
|
||||
|
||||
load_global_options();
|
||||
version_init();
|
||||
|
||||
/* setup the load callback and create ntdll modref */
|
||||
wine_dll_set_callback( load_builtin_callback );
|
||||
|
@ -4268,13 +4272,8 @@ void __wine_process_init(void)
|
|||
}
|
||||
|
||||
NtCurrentTeb()->Peb->LoaderLock = &loader_section;
|
||||
version_init( wm->ldr.FullDllName.Buffer );
|
||||
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 */
|
||||
RemoveEntryList( &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
|
|||
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_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 thread_init(void) DECLSPEC_HIDDEN;
|
||||
extern void actctx_init(void) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -485,7 +485,7 @@ static BOOL parse_win_version( HANDLE hkey )
|
|||
/**********************************************************************
|
||||
* 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 appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
|
||||
|
@ -493,6 +493,8 @@ void version_init( const WCHAR *appname )
|
|||
UNICODE_STRING nameW;
|
||||
HANDLE root, hkey, config_key;
|
||||
BOOL got_win_ver = FALSE;
|
||||
const WCHAR *p, *appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
|
||||
WCHAR appversion[MAX_PATH+20];
|
||||
|
||||
current_version = &VersionData[WIN7];
|
||||
|
||||
|
@ -511,26 +513,21 @@ void version_init( const WCHAR *appname )
|
|||
if (!config_key) goto done;
|
||||
|
||||
/* open AppDefaults\\appname key */
|
||||
if (appname && *appname)
|
||||
|
||||
if ((p = strrchrW( appname, '/' ))) appname = p + 1;
|
||||
if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
|
||||
|
||||
strcpyW( appversion, appdefaultsW );
|
||||
strcatW( appversion, appname );
|
||||
RtlInitUnicodeString( &nameW, appversion );
|
||||
attr.RootDirectory = config_key;
|
||||
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
|
||||
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
|
||||
{
|
||||
const WCHAR *p;
|
||||
WCHAR appversion[MAX_PATH+20];
|
||||
|
||||
if ((p = strrchrW( appname, '/' ))) appname = p + 1;
|
||||
if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
|
||||
|
||||
strcpyW( appversion, appdefaultsW );
|
||||
strcatW( appversion, appname );
|
||||
RtlInitUnicodeString( &nameW, appversion );
|
||||
attr.RootDirectory = config_key;
|
||||
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
|
||||
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
|
||||
{
|
||||
TRACE( "getting version from %s\n", debugstr_w(appversion) );
|
||||
got_win_ver = parse_win_version( hkey );
|
||||
NtClose( hkey );
|
||||
}
|
||||
TRACE( "getting version from %s\n", debugstr_w(appversion) );
|
||||
got_win_ver = parse_win_version( hkey );
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
if (!got_win_ver)
|
||||
|
|
Loading…
Reference in New Issue