You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
ntdll-Syscall_Wrappers: Run directory initialization early during process startup instead of wrapping syscalls.
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
From dd80beb72d31aa4cb1713e669e0030cfbc246a71 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 16 Oct 2015 05:54:08 +0200
|
||||
Subject: ntdll: Call implementation instead of thunk wrappers in init_options.
|
||||
|
||||
---
|
||||
dlls/ntdll/directory.c | 6 +++---
|
||||
dlls/ntdll/ntdll_misc.h | 3 +++
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
|
||||
index 770cd3f..5c595c8 100644
|
||||
--- a/dlls/ntdll/directory.c
|
||||
+++ b/dlls/ntdll/directory.c
|
||||
@@ -1188,15 +1188,15 @@ static DWORD WINAPI init_options( RTL_RUN_ONCE *once, void *param, void **contex
|
||||
RtlInitUnicodeString( &nameW, WineW );
|
||||
|
||||
/* @@ Wine registry key: HKCU\Software\Wine */
|
||||
- if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
|
||||
+ if (!SYSCALL(NtOpenKey)( &hkey, KEY_ALL_ACCESS, &attr ))
|
||||
{
|
||||
RtlInitUnicodeString( &nameW, ShowDotFilesW );
|
||||
- if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
|
||||
+ if (!SYSCALL(NtQueryValueKey)( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
|
||||
{
|
||||
WCHAR *str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
|
||||
show_dot_files = IS_OPTION_TRUE( str[0] );
|
||||
}
|
||||
- NtClose( hkey );
|
||||
+ SYSCALL(NtClose)( hkey );
|
||||
}
|
||||
NtClose( root );
|
||||
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index 11099c5..cf2b33b 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -273,13 +273,16 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
|
||||
extern typeof( name ) __syscall_ ## name
|
||||
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtAllocateVirtualMemory );
|
||||
+DECLARE_SYSCALL_ENTRYPOINT( NtClose );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtFlushVirtualMemory );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtFreeVirtualMemory );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtLockVirtualMemory );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtMapViewOfSection );
|
||||
+DECLARE_SYSCALL_ENTRYPOINT( NtOpenKey );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtOpenProcessTokenEx );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtOpenThreadTokenEx );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtProtectVirtualMemory );
|
||||
+DECLARE_SYSCALL_ENTRYPOINT( NtQueryValueKey );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtQueryVirtualMemory );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtUnlockVirtualMemory );
|
||||
DECLARE_SYSCALL_ENTRYPOINT( NtUnmapViewOfSection );
|
||||
--
|
||||
2.6.1
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
From 3a40ae6b1e3cd67ea606a7af6938788fe470773e Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 16 Oct 2015 05:54:08 +0200
|
||||
Subject: ntdll: Run directory initialization function early during the process
|
||||
startup.
|
||||
|
||||
---
|
||||
dlls/ntdll/directory.c | 10 ++--------
|
||||
dlls/ntdll/loader.c | 1 +
|
||||
dlls/ntdll/ntdll_misc.h | 1 +
|
||||
3 files changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
|
||||
index 770cd3f..94b6d77 100644
|
||||
--- a/dlls/ntdll/directory.c
|
||||
+++ b/dlls/ntdll/directory.c
|
||||
@@ -176,7 +176,6 @@ union file_directory_info
|
||||
};
|
||||
|
||||
static BOOL show_dot_files;
|
||||
-static RTL_RUN_ONCE init_once = RTL_RUN_ONCE_INIT;
|
||||
|
||||
/* at some point we may want to allow Winelib apps to set this */
|
||||
static const BOOL is_case_sensitive = FALSE;
|
||||
@@ -1164,11 +1163,11 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir )
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
- * init_options
|
||||
+ * DIR_init_options
|
||||
*
|
||||
* Initialize the show_dot_files options.
|
||||
*/
|
||||
-static DWORD WINAPI init_options( RTL_RUN_ONCE *once, void *param, void **context )
|
||||
+void DIR_init_options(void)
|
||||
{
|
||||
static const WCHAR WineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
|
||||
static const WCHAR ShowDotFilesW[] = {'S','h','o','w','D','o','t','F','i','l','e','s',0};
|
||||
@@ -1207,7 +1206,6 @@ static DWORD WINAPI init_options( RTL_RUN_ONCE *once, void *param, void **contex
|
||||
#ifdef linux
|
||||
ignore_file( "/sys" );
|
||||
#endif
|
||||
- return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1220,8 +1218,6 @@ BOOL DIR_is_hidden_file( const UNICODE_STRING *name )
|
||||
{
|
||||
WCHAR *p, *end;
|
||||
|
||||
- RtlRunOnceExecuteOnce( &init_once, init_options, NULL, NULL );
|
||||
-
|
||||
if (show_dot_files) return FALSE;
|
||||
|
||||
end = p = name->Buffer + name->Length/sizeof(WCHAR);
|
||||
@@ -2278,8 +2274,6 @@ NTSTATUS WINAPI SYSCALL(NtQueryDirectoryFile)( HANDLE handle, HANDLE event,
|
||||
|
||||
io->Information = 0;
|
||||
|
||||
- RtlRunOnceExecuteOnce( &init_once, init_options, NULL, NULL );
|
||||
-
|
||||
RtlEnterCriticalSection( &dir_section );
|
||||
|
||||
cwd = open( ".", O_RDONLY );
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index ecbc885..04cbb63 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -3283,6 +3283,7 @@ void __wine_process_init(void)
|
||||
umask( FILE_umask );
|
||||
|
||||
load_global_options();
|
||||
+ DIR_init_options();
|
||||
|
||||
/* setup the load callback and create ntdll modref */
|
||||
wine_dll_set_callback( load_builtin_callback );
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index 11099c5..5ba1308 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -153,6 +153,7 @@ extern int get_file_info( const char *path, struct stat *st, ULONG *attr ) DECLS
|
||||
extern NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
|
||||
FILE_INFORMATION_CLASS class ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
|
||||
+extern void DIR_init_options(void) DECLSPEC_HIDDEN;
|
||||
extern void DIR_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir ) DECLSPEC_HIDDEN;
|
||||
extern BOOL DIR_is_hidden_file( const UNICODE_STRING *name ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS DIR_unmount_device( HANDLE handle ) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.6.1
|
||||
|
||||
Reference in New Issue
Block a user