Rebase against 359ee2ecc21b08e4118f0f77b3a208e4b5e1e63d.

This commit is contained in:
Zebediah Figura 2020-06-30 17:11:27 -05:00
parent 4995d0d3af
commit 70f6f6d7e4
11 changed files with 127 additions and 191 deletions

View File

@ -1,4 +1,4 @@
From 478b58d0ff4d333f25b30a506d779fd2395b2b04 Mon Sep 17 00:00:00 2001
From 2588eb4eb5fe56aca7d229ea42b0eaa3786ff600 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 01:45:29 +0200
Subject: [PATCH] ntdll: Add function to create new tokens for elevation
@ -14,7 +14,7 @@ Subject: [PATCH] ntdll: Add function to create new tokens for elevation
6 files changed, 117 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 9fc12485592..f3e765e25a1 100644
index e5db07f0a4e..d52f6b76aa4 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1594,6 +1594,9 @@
@ -25,13 +25,13 @@ index 9fc12485592..f3e765e25a1 100644
+@ cdecl __wine_create_default_token(long)
+
# Version
@ cdecl wine_get_version() NTDLL_wine_get_version
@ cdecl wine_get_build_id() NTDLL_wine_get_build_id
@ cdecl wine_get_version()
@ cdecl wine_get_build_id()
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index f36929c5acb..1afda71c3ad 100644
index 92fcde95a8a..80be882e76d 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -71,6 +71,9 @@ extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
@@ -69,6 +69,9 @@ extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
extern void init_user_process_params(void) DECLSPEC_HIDDEN;
extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status ) DECLSPEC_HIDDEN;
@ -42,10 +42,10 @@ index f36929c5acb..1afda71c3ad 100644
extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index b1cc307d2ae..2e5fee216ef 100644
index 992721d133f..24cb8f53de2 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -85,6 +85,24 @@ HANDLE CDECL __wine_make_process_system(void)
@@ -82,6 +82,24 @@ HANDLE CDECL __wine_make_process_system(void)
return ret;
}
@ -71,10 +71,10 @@ index b1cc307d2ae..2e5fee216ef 100644
* NtQueryInformationProcess [NTDLL.@]
* ZwQueryInformationProcess [NTDLL.@]
diff --git a/server/protocol.def b/server/protocol.def
index 62c93423104..4001b3cd095 100644
index 96bc9250ab0..14b811684d8 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3757,6 +3757,14 @@ struct handle_info
@@ -3759,6 +3759,14 @@ struct handle_info
@END

View File

@ -1,4 +1,4 @@
From cd8b9cfdbc4ab1c7120c411b65ac079eddd3a675 Mon Sep 17 00:00:00 2001
From 7595b344c4fc7d03f07a163b3f2f0b38123f7264 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 9 Jul 2019 14:13:28 +1000
Subject: [PATCH] user32: Improve GetKeyboardLayoutList
@ -59,10 +59,10 @@ index 6d916c7d65d..b9e0dc60e7c 100644
if (baselayout != 0)
{
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 9ec829860af..56fbc558de2 100644
index bab0fd97536..ea0cac6d18a 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -3385,6 +3385,40 @@ static void test_UnregisterDeviceNotification(void)
@@ -3706,6 +3706,40 @@ static void test_UnregisterDeviceNotification(void)
ok(ret == FALSE, "Unregistering NULL Device Notification returned: %d\n", ret);
}
@ -103,14 +103,14 @@ index 9ec829860af..56fbc558de2 100644
START_TEST(input)
{
char **argv;
@@ -3417,6 +3451,7 @@ START_TEST(input)
test_GetKeyState();
test_OemKeyScan();
test_GetRawInputData();
+ test_GetKeyboardLayoutList();
@@ -3741,6 +3775,7 @@ START_TEST(input)
test_GetRawInputBuffer();
test_RegisterRawInputDevices();
test_rawinput(argv[0]);
+ test_GetKeyboardLayoutList();
if(pGetMouseMovePointsEx)
test_GetMouseMovePointsEx();
--
2.27.0

View File

@ -1,18 +1,18 @@
From bb92d36109c9d4931051c69c0ab789b5c1396e66 Mon Sep 17 00:00:00 2001
From fea92ad5c12ddb8d0a4d2363f21afe9c199359d1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Aug 2017 03:38:38 +0200
Subject: [PATCH] ntdll: Add inline versions of RtlEnterCriticalSection /
RtlLeaveCriticalSections.
---
dlls/ntdll/ntdll_misc.h | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
dlls/ntdll/ntdll_misc.h | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 27e7141bc65..d1fe4ba99d0 100644
index 92fcde95a8a..51a9069e290 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -28,6 +28,7 @@
@@ -26,6 +26,7 @@
#include "winnt.h"
#include "winternl.h"
#include "unixlib.h"
@ -20,12 +20,10 @@ index 27e7141bc65..d1fe4ba99d0 100644
#include "wine/server.h"
#include "wine/asm.h"
@@ -237,6 +238,43 @@ extern int ntdll_wcstoumbs( const WCHAR* src, DWORD srclen, char* dst, DWORD dst
@@ -103,6 +104,39 @@ extern int ntdll_wcstoumbs( const WCHAR* src, DWORD srclen, char* dst, DWORD dst
extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN;
extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;
+#ifdef __WINE_WINE_PORT_H
+
+/* inline version of RtlEnterCriticalSection */
+static inline void enter_critical_section( RTL_CRITICAL_SECTION *crit )
+{
@ -58,12 +56,10 @@ index 27e7141bc65..d1fe4ba99d0 100644
+ RtlpUnWaitCriticalSection( crit );
+ }
+}
+
+#endif /* __WINE_WINE_PORT_H */
+
/* load order */
enum loadorder
--
2.26.2
2.27.0

View File

@ -1,32 +1,19 @@
From d39ff3852f684bd9c0ca3c08d7e82e4e50be239d Mon Sep 17 00:00:00 2001
From fcb28ef6b7e083e5b5d0992efc60a9bef6f08708 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 21 Aug 2015 06:39:47 +0800
Subject: [PATCH] ntdll: Do not allow to deallocate thread stack for current
thread.
---
dlls/ntdll/ntdll_misc.h | 1 +
dlls/ntdll/unix/unix_private.h | 1 +
dlls/ntdll/unix/virtual.c | 12 ++++++++++++
3 files changed, 14 insertions(+)
2 files changed, 13 insertions(+)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 47800db41b1..be285013afc 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -154,6 +154,7 @@ struct ntdll_thread_data
int wait_fd[2]; /* fd for sleeping server requests */
BOOL wow64_redir; /* Wow64 filesystem redirection flag */
pthread_t pthread_id; /* pthread thread id */
+ void *pthread_stack; /* pthread stack */
};
C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) );
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 9904ef7bfd5..232dea18bee 100644
index 71d6ee7d4f2..33326deea20 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -46,6 +46,7 @@ struct ntdll_thread_data
@@ -56,6 +56,7 @@ struct ntdll_thread_data
int wait_fd[2]; /* fd for sleeping server requests */
BOOL wow64_redir; /* Wow64 filesystem redirection flag */
pthread_t pthread_id; /* pthread thread id */
@ -35,10 +22,10 @@ index 9904ef7bfd5..232dea18bee 100644
};
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 6166507871c..0bb8cef6d3b 100644
index d998966b5fa..086eaa0b34e 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -2772,6 +2772,8 @@ NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_si
@@ -2781,6 +2781,8 @@ NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_si
stack->DeallocationStack = view->base;
stack->StackBase = (char *)view->base + view->size;
stack->StackLimit = (char *)view->base + 2 * page_size;
@ -47,7 +34,7 @@ index 6166507871c..0bb8cef6d3b 100644
done:
server_leave_uninterrupted_section( &csVirtual, &sigset );
return status;
@@ -3521,6 +3523,16 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
@@ -3530,6 +3532,16 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
/* Free the pages */
if (size || (base != view->base)) status = STATUS_INVALID_PARAMETER;

View File

@ -1,16 +1,16 @@
From 54796a7cba6fd2017c4826874ccd09a9662aff00 Mon Sep 17 00:00:00 2001
From 1532ada677d566e60146cbe246f31d133b4dc955 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 3 Apr 2017 05:30:27 +0200
Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
---
dlls/kernel32/tests/loader.c | 76 ++++++++++++++++++++++++++++++++++++
dlls/kernel32/tests/loader.c | 75 ++++++++++++++++++++++++++++++++++++
dlls/ntdll/loader.c | 64 ++++++++++++++++++++++++++++++
include/winternl.h | 2 +-
3 files changed, 141 insertions(+), 1 deletion(-)
3 files changed, 140 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 59965984a67..95f18fb71e3 100644
index 757a230ae15..466e5a444f4 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -30,6 +30,7 @@
@ -21,7 +21,7 @@ index 59965984a67..95f18fb71e3 100644
#include "wine/test.h"
#include "delayloadhandler.h"
@@ -3968,6 +3969,79 @@ static void test_LoadPackagedLibrary(void)
@@ -3970,6 +3971,79 @@ static void test_LoadPackagedLibrary(void)
h, GetLastError());
}
@ -101,24 +101,19 @@ index 59965984a67..95f18fb71e3 100644
START_TEST(loader)
{
int argc;
@@ -4040,10 +4114,12 @@ START_TEST(loader)
@@ -4042,6 +4116,7 @@ START_TEST(loader)
test_InMemoryOrderModuleList();
test_LoadPackagedLibrary();
test_wow64_redirection();
+ test_HashLinks();
test_dll_file( "ntdll.dll" );
test_dll_file( "kernel32.dll" );
test_dll_file( "advapi32.dll" );
test_dll_file( "user32.dll" );
+
/* loader test must be last, it can corrupt the internal loader state on Windows */
test_Loader();
}
test_dll_file( "ntdll.dll", FALSE );
test_dll_file( "kernel32.dll", TRUE );
test_dll_file( "advapi32.dll", TRUE );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index efacc0c081e..b0b5c93b41b 100644
index 3513102b6f0..485fd895787 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -121,6 +121,9 @@ struct file_id
@@ -118,6 +118,9 @@ struct file_id
BYTE ObjectId[16];
};
@ -128,7 +123,7 @@ index efacc0c081e..b0b5c93b41b 100644
/* internal representation of loaded modules */
typedef struct _wine_modref
{
@@ -460,6 +463,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
@@ -457,6 +460,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
}
}
@ -181,7 +176,7 @@ index efacc0c081e..b0b5c93b41b 100644
/*************************************************************************
* get_modref
*
@@ -1202,7 +1251,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1198,7 +1247,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
&wm->ldr.InLoadOrderLinks);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderLinks);
@ -194,7 +189,7 @@ index efacc0c081e..b0b5c93b41b 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1908,6 +1962,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -1903,6 +1957,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@ -202,7 +197,7 @@ index efacc0c081e..b0b5c93b41b 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3244,6 +3299,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3239,6 +3294,7 @@ static void free_modref( WINE_MODREF *wm )
{
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@ -210,7 +205,7 @@ index efacc0c081e..b0b5c93b41b 100644
if (wm->ldr.InInitializationOrderLinks.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderLinks);
@@ -3937,6 +3993,7 @@ void __wine_process_init(void)
@@ -3931,6 +3987,7 @@ void __wine_process_init(void)
ULONG_PTR val;
TEB *teb = NtCurrentTeb();
PEB *peb = teb->Peb;
@ -218,7 +213,7 @@ index efacc0c081e..b0b5c93b41b 100644
peb->LdrData = &ldr;
peb->FastPebLock = &peb_lock;
@@ -3974,6 +4031,10 @@ void __wine_process_init(void)
@@ -3968,6 +4025,10 @@ void __wine_process_init(void)
load_global_options();
version_init();
@ -228,8 +223,8 @@ index efacc0c081e..b0b5c93b41b 100644
+
/* setup the load callback and create ntdll modref */
RtlInitUnicodeString( &nt_name, ntdllW );
status = build_so_dll_module( params->DllPath.Buffer, &nt_name, ntdll_module, 0, &wm );
@@ -4047,6 +4108,9 @@ void __wine_process_init(void)
NtQueryVirtualMemory( GetCurrentProcess(), __wine_process_init, MemoryBasicInformation,
@@ -4043,6 +4104,9 @@ void __wine_process_init(void)
teb->Tib.StackLimit = stack.StackLimit;
teb->DeallocationStack = stack.DeallocationStack;

View File

@ -1,35 +1,14 @@
From d7997c1fffbf407f08fc18464c2fe3f17a3038a4 Mon Sep 17 00:00:00 2001
From a64bc7c1b8d5625fcb7b1b666d95aced4009341b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 22 Jul 2017 07:21:45 +0200
Subject: [PATCH] ntdll: Improve heap allocation performance. (v2)
---
configure.ac | 9 ++
dlls/ntdll/heap.c | 321 ++++++++++++++++++++++++++++++++--------------
2 files changed, 234 insertions(+), 96 deletions(-)
dlls/ntdll/heap.c | 306 +++++++++++++++++++++++++++++++---------------
1 file changed, 210 insertions(+), 96 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0ce3cb5c573..2fa1c7d4223 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2790,6 +2790,15 @@ AC_CHECK_FUNCS(\
)
LIBS="$ac_save_LIBS"
+dnl Check for __builtin_ctzl
+AC_CACHE_CHECK([for __builtin_ctzl], ac_cv_have___builtin_ctzl,
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(,[[return __builtin_ctzl(1)]])],
+ [ac_cv_have___builtin_ctzl="yes"], [ac_cv_have___builtin_ctzl="no"]))
+if test "$ac_cv_have___builtin_ctzl" = "yes"
+then
+ AC_DEFINE(HAVE___BUILTIN_CTZL, 1, [Define to 1 if you have the `__builtin_ctzl' built-in function.])
+fi
+
dnl Check for __builtin_popcount
AC_CACHE_CHECK([for __builtin_popcount], ac_cv_have___builtin_popcount,
AC_LINK_IFELSE([AC_LANG_PROGRAM(,[[return __builtin_popcount(1)]])],
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index db5c039bb76..f51dc63f371 100644
index 3cbbff2de35..fc669d9dc4d 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -3,6 +3,7 @@
@ -40,7 +19,7 @@ index db5c039bb76..f51dc63f371 100644
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -41,6 +42,7 @@
@@ -35,6 +36,7 @@
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/list.h"
@ -48,7 +27,7 @@ index db5c039bb76..f51dc63f371 100644
#include "wine/debug.h"
#include "wine/server.h"
@@ -62,7 +64,11 @@ typedef struct tagARENA_FREE
@@ -56,7 +58,11 @@ typedef struct tagARENA_FREE
{
DWORD size; /* Block size; must be the first field */
DWORD magic; /* Magic number */
@ -61,7 +40,7 @@ index db5c039bb76..f51dc63f371 100644
} ARENA_FREE;
typedef struct
@@ -75,9 +81,11 @@ typedef struct
@@ -69,9 +75,11 @@ typedef struct
DWORD magic; /* these must remain at the end of the structure */
} ARENA_LARGE;
@ -76,7 +55,7 @@ index db5c039bb76..f51dc63f371 100644
#define ARENA_LARGE_SIZE 0xfedcba90 /* magic value for 'size' field in large blocks */
/* Value for arena 'magic' field */
@@ -95,6 +103,8 @@ typedef struct
@@ -89,6 +97,8 @@ typedef struct
#define LARGE_ALIGNMENT 16 /* large blocks have stricter alignment */
#define ARENA_OFFSET (ALIGNMENT - sizeof(ARENA_INUSE))
@ -85,7 +64,7 @@ index db5c039bb76..f51dc63f371 100644
C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
#define ROUND_SIZE(size) ((((size) + ALIGNMENT - 1) & ~(ALIGNMENT-1)) + ARENA_OFFSET)
@@ -103,9 +113,7 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
@@ -97,9 +107,7 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
#define NOISY 0 /* Report all errors */
/* minimum data size (without arenas) of an allocated block */
@ -96,7 +75,7 @@ index db5c039bb76..f51dc63f371 100644
/* minimum size that must remain to shrink an allocated block */
#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(ARENA_FREE))
/* minimum size to start allocating large blocks */
@@ -114,23 +122,14 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
@@ -108,23 +116,14 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
#define HEAP_TAIL_EXTRA_SIZE(flags) \
((flags & HEAP_TAIL_CHECKING_ENABLED) || RUNNING_ON_VALGRIND ? ALIGNMENT : 0)
@ -128,17 +107,17 @@ index db5c039bb76..f51dc63f371 100644
struct tagHEAP;
@@ -163,9 +162,17 @@ typedef struct tagHEAP
@@ -157,9 +156,17 @@ typedef struct tagHEAP
DWORD pending_pos; /* Position in pending free requests ring */
ARENA_INUSE **pending_free; /* Ring buffer for pending free requests */
RTL_CRITICAL_SECTION critSection; /* Critical section for serialization */
- FREE_LIST_ENTRY *freeList; /* Free lists */
+ struct list *freeList; /* Free lists */
+ struct wine_rb_tree freeTree; /* Free tree */
+ unsigned long freeMask[HEAP_NB_FREE_LISTS / (8 * sizeof(unsigned long))];
+ DWORD freeMask[HEAP_NB_FREE_LISTS / (8 * sizeof(DWORD))];
} HEAP;
+#define HEAP_FREEMASK_BLOCK (8 * sizeof(unsigned long))
+#define HEAP_FREEMASK_BLOCK (8 * sizeof(DWORD))
+#define HEAP_FREEMASK_INDEX(x) ((x) / HEAP_FREEMASK_BLOCK)
+#define HEAP_FREEMASK_BIT(x) (1UL << ((x) & (HEAP_FREEMASK_BLOCK - 1)))
+
@ -147,7 +126,7 @@ index db5c039bb76..f51dc63f371 100644
#define HEAP_MAGIC ((DWORD)('H' | ('E'<<8) | ('A'<<16) | ('P'<<24)))
#define HEAP_DEF_SIZE 0x110000 /* Default heap size = 1Mb + 64Kb */
@@ -182,6 +189,30 @@ static HEAP *processHeap; /* main process heap */
@@ -176,6 +183,13 @@ static HEAP *processHeap; /* main process heap */
static BOOL HEAP_IsRealArena( HEAP *heapPtr, DWORD flags, LPCVOID block, BOOL quiet );
@ -157,28 +136,11 @@ index db5c039bb76..f51dc63f371 100644
+ ARENA_FREE *arena = WINE_RB_ENTRY_VALUE( entry, ARENA_FREE, entry.tree );
+ return (arena->size & ARENA_SIZE_MASK);
+}
+
+/* return number of trailing 0-bits in x */
+static inline int ctzl(unsigned long x)
+{
+#ifdef HAVE___BUILTIN_CTZL
+ return __builtin_ctzl(x);
+#else
+ int c = 1;
+ if (!(x & 0xffffffff)) { x >>= 32; c += 32; }
+ if (!(x & 0x0000ffff)) { x >>= 16; c += 16; }
+ if (!(x & 0x000000ff)) { x >>= 8; c += 8; }
+ if (!(x & 0x0000000f)) { x >>= 4; c += 4; }
+ if (!(x & 0x00000003)) { x >>= 2; c += 2; }
+ c -= (x & 0x00000001);
+ return c;
+#endif
+}
+
/* mark a block of memory as free for debugging purposes */
static inline void mark_block_free( void *ptr, SIZE_T size, DWORD flags )
{
@@ -303,20 +334,6 @@ static void subheap_notify_free_all(SUBHEAP const *subheap)
@@ -297,20 +311,6 @@ static void subheap_notify_free_all(SUBHEAP const *subheap)
#endif
}
@ -199,7 +161,7 @@ index db5c039bb76..f51dc63f371 100644
/* get the memory protection type to use for a given heap */
static inline ULONG get_protection_type( DWORD flags )
{
@@ -344,13 +361,31 @@ static void HEAP_Dump( HEAP *heap )
@@ -338,13 +338,31 @@ static void HEAP_Dump( HEAP *heap )
TRACE( "Next: %p Sub-heaps:", LIST_ENTRY( heap->entry.next, HEAP, entry ) );
LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry ) TRACE( " %p", subheap );
@ -237,7 +199,7 @@ index db5c039bb76..f51dc63f371 100644
LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry )
{
@@ -365,11 +400,32 @@ static void HEAP_Dump( HEAP *heap )
@@ -359,11 +377,32 @@ static void HEAP_Dump( HEAP *heap )
if (*(DWORD *)ptr & ARENA_FLAG_FREE)
{
ARENA_FREE *pArena = (ARENA_FREE *)ptr;
@ -275,7 +237,7 @@ index db5c039bb76..f51dc63f371 100644
ptr += sizeof(*pArena) + (pArena->size & ARENA_SIZE_MASK);
arenaSize += sizeof(ARENA_FREE);
freeSize += pArena->size & ARENA_SIZE_MASK;
@@ -477,20 +533,19 @@ static HEAP *HEAP_GetPtr(
@@ -471,20 +510,19 @@ static HEAP *HEAP_GetPtr(
*/
static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL last )
{
@ -304,7 +266,7 @@ index db5c039bb76..f51dc63f371 100644
}
@@ -501,7 +556,19 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
@@ -495,7 +533,19 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
*/
static inline void HEAP_DeleteFreeBlock( HEAP *heap, ARENA_FREE *pArena )
{
@ -325,7 +287,7 @@ index db5c039bb76..f51dc63f371 100644
}
@@ -880,6 +947,15 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
@@ -875,6 +925,15 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
}
@ -341,7 +303,7 @@ index db5c039bb76..f51dc63f371 100644
/***********************************************************************
* HEAP_CreateSubHeap
*/
@@ -887,7 +963,6 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -882,7 +941,6 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
SIZE_T commitSize, SIZE_T totalSize )
{
SUBHEAP *subheap;
@ -349,7 +311,7 @@ index db5c039bb76..f51dc63f371 100644
unsigned int i;
if (!address)
@@ -948,17 +1023,21 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -943,17 +1001,21 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
subheap->headerSize = ROUND_SIZE( sizeof(HEAP) );
list_add_head( &heap->subheap_list, &subheap->entry );
@ -376,12 +338,12 @@ index db5c039bb76..f51dc63f371 100644
+
+ /* Initialize the free mask */
+
+ for (i = 0; i < sizeof(heap->freeMask) / sizeof(heap->freeMask[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(heap->freeMask); i++)
+ heap->freeMask[i] = 0;
/* Initialize critical section */
@@ -1001,6 +1080,34 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -996,6 +1058,34 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
}
@ -416,12 +378,12 @@ index db5c039bb76..f51dc63f371 100644
/***********************************************************************
* HEAP_FindFreeBlock
*
@@ -1010,26 +1117,39 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -1005,26 +1095,41 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
SUBHEAP **ppSubHeap )
{
+ struct wine_rb_entry *ptr;
+ unsigned long mask;
+ DWORD mask;
+ ARENA_FREE *arena;
SUBHEAP *subheap;
- struct list *ptr;
@ -445,7 +407,9 @@ index db5c039bb76..f51dc63f371 100644
{
- subheap = HEAP_FindSubHeap( heap, pArena );
- if (!HEAP_Commit( subheap, (ARENA_INUSE *)pArena, size )) return NULL;
+ index = (index & ~(HEAP_FREEMASK_BLOCK - 1)) | ctzl( mask );
+ DWORD ctz;
+ BitScanForward( &ctz, mask );
+ index = (index & ~(HEAP_FREEMASK_BLOCK - 1)) | ctz;
+ arena = LIST_ENTRY( heap->freeList[index].next, ARENA_FREE, entry.list );
+ subheap = HEAP_FindSubHeap( heap, arena );
+ if (!HEAP_Commit( subheap, (ARENA_INUSE *)arena, size )) return NULL;
@ -468,7 +432,7 @@ index db5c039bb76..f51dc63f371 100644
}
/* If no block was found, attempt to grow the heap */
@@ -1075,13 +1195,10 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
@@ -1070,13 +1175,10 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
*/
static BOOL HEAP_IsValidArenaPtr( const HEAP *heap, const ARENA_FREE *ptr )
{
@ -482,7 +446,7 @@ index db5c039bb76..f51dc63f371 100644
return FALSE;
}
@@ -1093,7 +1210,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
@@ -1088,7 +1190,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
{
DWORD flags = subheap->heap->flags;
SIZE_T size;
@ -491,7 +455,7 @@ index db5c039bb76..f51dc63f371 100644
char *heapEnd = (char *)subheap->base + subheap->size;
/* Check for unaligned pointers */
@@ -1110,7 +1227,8 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
@@ -1105,7 +1207,8 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
return FALSE;
}
/* Check size flags */
@ -501,7 +465,7 @@ index db5c039bb76..f51dc63f371 100644
(pArena->size & ARENA_FLAG_PREV_FREE))
{
ERR("Heap %p: bad flags %08x for free arena %p\n",
@@ -1124,34 +1242,45 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
@@ -1119,34 +1222,45 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
ERR("Heap %p: bad size %08lx for free arena %p\n", subheap->heap, size, pArena );
return FALSE;
}
@ -556,5 +520,5 @@ index db5c039bb76..f51dc63f371 100644
subheap->heap, prev, pArena );
return FALSE;
--
2.24.0.rc1
2.27.0

View File

@ -1,27 +1,19 @@
From dceb199f694af989df0655f7846a40ae29c67ea0 Mon Sep 17 00:00:00 2001
From 2afb2a42779c13459bf07921b57fe0d0e5cc65c6 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 30 May 2015 02:23:15 +0200
Subject: [PATCH] ntdll: Add support for hiding wine version information from
applications.
---
dlls/ntdll/loader.c | 100 +++++++++++++++++++++++++++++++++++++++-
dlls/ntdll/ntdll_misc.h | 5 ++
2 files changed, 104 insertions(+), 1 deletion(-)
dlls/ntdll/loader.c | 99 ++++++++++++++++++++++++++++++++++++++++-
dlls/ntdll/ntdll_misc.h | 5 +++
2 files changed, 103 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index c471755139f..e36764d9a3e 100644
index 3b68f6685d0..63c7109a763 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -71,6 +71,7 @@ const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
const WCHAR syswow64_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','w','o','w','6','4','\\',0};
+
/* system search path */
static const WCHAR system_path[] =
{'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',';',
@@ -79,6 +80,9 @@ static const WCHAR system_path[] =
@@ -76,6 +76,9 @@ static const WCHAR system_path[] =
static const WCHAR dotW[] = {'.',0};
@ -31,7 +23,7 @@ index c471755139f..e36764d9a3e 100644
static BOOL imports_fixup_done = FALSE; /* set once the imports have been fixed up, before attaching them */
static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */
static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
@@ -95,6 +99,8 @@ struct dll_dir_entry
@@ -92,6 +95,8 @@ struct dll_dir_entry
static struct list dll_dir_list = LIST_INIT( dll_dir_list ); /* extra dirs from LdrAddDllDirectory */
@ -40,7 +32,7 @@ index c471755139f..e36764d9a3e 100644
struct ldr_notification
{
struct list entry;
@@ -1709,6 +1715,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
@@ -1704,6 +1709,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
}
@ -128,16 +120,16 @@ index c471755139f..e36764d9a3e 100644
+ */
+static BOOL is_hidden_export( void *proc )
+{
+ return hide_wine_exports && (proc == &NTDLL_wine_get_version ||
+ proc == &NTDLL_wine_get_build_id ||
+ proc == &NTDLL_wine_get_host_version);
+ return hide_wine_exports && (proc == &wine_get_version ||
+ proc == &wine_get_build_id ||
+ proc == &wine_get_host_version);
+}
+
+
/******************************************************************
* LdrGetProcedureAddress (NTDLL.@)
*/
@@ -1729,7 +1825,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
@@ -1724,7 +1819,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, load_path )
: find_ordinal_export( module, exports, exp_size, ord - exports->Base, load_path );
@ -146,7 +138,7 @@ index c471755139f..e36764d9a3e 100644
{
*address = proc;
ret = STATUS_SUCCESS;
@@ -4061,6 +4157,8 @@ void __wine_process_init(void)
@@ -4057,6 +4152,8 @@ void __wine_process_init(void)
NtTerminateProcess( GetCurrentProcess(), status );
}
@ -156,21 +148,21 @@ index c471755139f..e36764d9a3e 100644
/* elevate process if necessary */
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 1afda71c3ad..d489b850963 100644
index 80be882e76d..783c5499d46 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -153,6 +153,11 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
@@ -150,6 +150,11 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
#define InterlockedCompareExchange64(dest,xchg,cmp) RtlInterlockedCompareExchange64(dest,xchg,cmp)
#endif
+/* version */
+extern const char * CDECL NTDLL_wine_get_version(void);
+extern const char * CDECL NTDLL_wine_get_build_id(void);
+extern void CDECL NTDLL_wine_get_host_version( const char **sysname, const char **release );
+extern const char * CDECL wine_get_version(void);
+extern const char * CDECL wine_get_build_id(void);
+extern void CDECL wine_get_host_version( const char **sysname, const char **release );
+
/* string functions */
void * __cdecl NTDLL_memchr( const void *ptr, int c, size_t n );
char * __cdecl NTDLL_strcat( char *dst, const char *src );
/* convert from straight ASCII to Unicode without depending on the current codepage */
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
{
--
2.27.0

View File

@ -1,2 +1,4 @@
Fixes: Return correct thread creation time in SystemProcessInformation
Fixes: Fill process virtual memory counters in NtQuerySystemInformation
# Patch 6 is broken. We should really be returning this information from the
# server, but that needs a bit more work.

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "ec9e556d31278d2de28b8ba82a063dc9fffdb440"
echo "359ee2ecc21b08e4118f0f77b3a208e4b5e1e63d"
}
# Show version information
@ -3479,7 +3479,7 @@ fi
# Patchset ntdll-Dealloc_Thread_Stack
# |
# | Modified files:
# | * dlls/ntdll/ntdll_misc.h, dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c
# | * dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c
# |
if test "$enable_ntdll_Dealloc_Thread_Stack" -eq 1; then
patch_apply ntdll-Dealloc_Thread_Stack/0001-ntdll-Do-not-allow-to-allocate-thread-stack-for-curr.patch
@ -3626,7 +3626,7 @@ fi
# | * [#38656] Add support for hiding wine version information from applications
# |
# | Modified files:
# | * dlls/ntdll/loader.c, dlls/ntdll/ntdll_misc.h
# | * dlls/ntdll/loader.c
# |
if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
patch_apply ntdll-Hide_Wine_Exports/0001-ntdll-Add-support-for-hiding-wine-version-informatio.patch

View File

@ -1,4 +1,4 @@
From a7ae70a05ac6fe683dabd546cca5b8be184428b5 Mon Sep 17 00:00:00 2001
From 92baf5607eaef9fe15b1da85f4879677504b7e4f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 29 May 2017 06:04:18 +0200
Subject: [PATCH] user32/tests: Add tests for window region of layered windows.
@ -8,26 +8,26 @@ Subject: [PATCH] user32/tests: Add tests for window region of layered windows.
1 file changed, 70 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 4efca268f..ddb203710 100644
index 233826b5ccd..13107c13e81 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -83,6 +83,7 @@ static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEP
@@ -86,6 +86,7 @@ static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEP
static UINT (WINAPI *pGetRawInputDeviceList) (PRAWINPUTDEVICELIST, PUINT, UINT);
static UINT (WINAPI *pGetRawInputDeviceInfoW) (HANDLE, UINT, void *, UINT *);
static UINT (WINAPI *pGetRawInputDeviceInfoA) (HANDLE, UINT, void *, UINT *);
+static int (WINAPI *pGetWindowRgnBox)(HWND, LPRECT);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
#define MAXKEYEVENTS 12
#define MAXKEYMESSAGES MAXKEYEVENTS /* assuming a key event generates one
@@ -169,6 +170,7 @@ static void init_function_pointers(void)
@@ -165,6 +166,7 @@ static void init_function_pointers(void)
GET_PROC(GetRawInputDeviceList);
GET_PROC(GetRawInputDeviceInfoW);
GET_PROC(GetRawInputDeviceInfoA);
+ GET_PROC(GetWindowRgnBox);
#undef GET_PROC
}
@@ -2054,6 +2056,9 @@ static void test_Input_mouse(void)
hdll = GetModuleHandleA("kernel32");
GET_PROC(IsWow64Process);
@@ -2923,6 +2925,9 @@ static void test_Input_mouse(void)
DWORD thread_id;
WNDCLASSA wclass;
POINT pt, pt_org;
@ -37,7 +37,7 @@ index 4efca268f..ddb203710 100644
MSG msg;
BOOL ret;
@@ -2292,6 +2297,12 @@ static void test_Input_mouse(void)
@@ -3161,6 +3166,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
@ -50,7 +50,7 @@ index 4efca268f..ddb203710 100644
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -2318,6 +2329,12 @@ static void test_Input_mouse(void)
@@ -3187,6 +3198,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
@ -63,7 +63,7 @@ index 4efca268f..ddb203710 100644
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -2346,6 +2363,12 @@ static void test_Input_mouse(void)
@@ -3215,6 +3232,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
@ -76,7 +76,7 @@ index 4efca268f..ddb203710 100644
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -2372,6 +2395,12 @@ static void test_Input_mouse(void)
@@ -3241,6 +3264,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
@ -89,7 +89,7 @@ index 4efca268f..ddb203710 100644
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -2399,6 +2428,12 @@ static void test_Input_mouse(void)
@@ -3268,6 +3297,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
@ -102,7 +102,7 @@ index 4efca268f..ddb203710 100644
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -2420,6 +2455,41 @@ static void test_Input_mouse(void)
@@ -3289,6 +3324,41 @@ static void test_Input_mouse(void)
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
@ -145,5 +145,5 @@ index 4efca268f..ddb203710 100644
SetCursorPos(pt_org.x, pt_org.y);
--
2.20.1
2.27.0

View File

@ -1 +1 @@
ec9e556d31278d2de28b8ba82a063dc9fffdb440
359ee2ecc21b08e4118f0f77b3a208e4b5e1e63d