diff --git a/patches/eventfd_synchronization/0006-ntdll-Close-esync-objects.patch b/patches/eventfd_synchronization/0006-ntdll-Close-esync-objects.patch index f370121c..524bf64d 100644 --- a/patches/eventfd_synchronization/0006-ntdll-Close-esync-objects.patch +++ b/patches/eventfd_synchronization/0006-ntdll-Close-esync-objects.patch @@ -1,7 +1,7 @@ -From d101cc56af09470319046d570891e861d0a6154a Mon Sep 17 00:00:00 2001 +From 2aba7f5090f92b609f6d2763603dbeb761f9c65a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 7 Jun 2018 21:07:51 -0500 -Subject: [PATCH 06/83] ntdll: Close esync objects. +Subject: [PATCH] ntdll: Close esync objects. --- dlls/ntdll/esync.c | 19 +++++++++++++++++++ @@ -10,7 +10,7 @@ Subject: [PATCH 06/83] ntdll: Close esync objects. 3 files changed, 24 insertions(+) diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c -index bca95b9b2..f7a427425 100644 +index bca95b9b2d9..f7a427425b7 100644 --- a/dlls/ntdll/esync.c +++ b/dlls/ntdll/esync.c @@ -136,6 +136,25 @@ static void *esync_get_object( HANDLE handle ) @@ -40,7 +40,7 @@ index bca95b9b2..f7a427425 100644 static NTSTATUS create_esync(int *fd, HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval, int flags) diff --git a/dlls/ntdll/esync.h b/dlls/ntdll/esync.h -index fec0b68e8..a22618de8 100644 +index fec0b68e8d5..a22618de849 100644 --- a/dlls/ntdll/esync.h +++ b/dlls/ntdll/esync.h @@ -19,6 +19,7 @@ @@ -52,7 +52,7 @@ index fec0b68e8..a22618de8 100644 extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c -index b9fe302b1..ef2cb8b94 100644 +index f8f0760de70..b8d73a982b2 100644 --- a/dlls/ntdll/om.c +++ b/dlls/ntdll/om.c @@ -34,6 +34,7 @@ @@ -62,8 +62,8 @@ index b9fe302b1..ef2cb8b94 100644 +#include "esync.h" #include "wine/server.h" #include "wine/exception.h" - #include "wine/unicode.h" -@@ -446,6 +447,9 @@ NTSTATUS close_handle( HANDLE handle ) + +@@ -387,6 +388,9 @@ NTSTATUS close_handle( HANDLE handle ) NTSTATUS ret; int fd = server_remove_fd_from_cache( handle ); @@ -74,5 +74,5 @@ index b9fe302b1..ef2cb8b94 100644 { req->handle = wine_server_obj_handle( handle ); -- -2.20.1 +2.26.0 diff --git a/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch b/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch index 49af5fc5..ce30d61f 100644 --- a/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch +++ b/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch @@ -1,4 +1,4 @@ -From 4e37abb696f99ea4727a4fb6bb31f5543f2a7b86 Mon Sep 17 00:00:00 2001 +From 5633db2ec821eac01998f6bb1012372865f3db40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 3 Apr 2017 05:30:27 +0200 Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data. @@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data. 3 files changed, 145 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c -index 35c6b3c09..17d742daa 100644 +index 35c6b3c0996..17d742daaa7 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -30,6 +30,7 @@ @@ -115,10 +115,10 @@ index 35c6b3c09..17d742daa 100644 test_Loader(); } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 85eb29768..644f599a7 100644 +index b946416734a..5037318eb98 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -115,6 +115,9 @@ static const char * const reason_names[] = +@@ -114,6 +114,9 @@ static const char * const reason_names[] = static const WCHAR dllW[] = {'.','d','l','l',0}; @@ -128,7 +128,7 @@ index 85eb29768..644f599a7 100644 /* internal representation of 32bit modules. per process. */ typedef struct _wine_modref { -@@ -458,6 +461,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module ) +@@ -451,6 +454,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module ) } } @@ -146,15 +146,15 @@ index 85eb29768..644f599a7 100644 + if (version >= 0x0602) + { + for (; *basename; basename++) -+ hash = hash * 65599 + toupperW(*basename); ++ hash = hash * 65599 + towupper(*basename); + } + else if (version == 0x0601) + { + for (; *basename; basename++) -+ hash = hash + 65599 * toupperW(*basename); ++ hash = hash + 65599 * towupper(*basename); + } + else -+ hash = toupperW(basename[0]) - 'A'; ++ hash = towupper(basename[0]) - 'A'; + + return hash & (HASH_MAP_SIZE-1); +} @@ -181,7 +181,7 @@ index 85eb29768..644f599a7 100644 /************************************************************************* * get_modref * -@@ -1205,7 +1254,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name +@@ -1201,7 +1250,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name &wm->ldr.InLoadOrderModuleList); InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList); @@ -194,7 +194,7 @@ index 85eb29768..644f599a7 100644 if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT)) { -@@ -1860,6 +1914,7 @@ static void load_builtin_callback( void *module, const char *filename ) +@@ -1857,6 +1911,7 @@ static void load_builtin_callback( void *module, const char *filename ) /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -202,7 +202,7 @@ index 85eb29768..644f599a7 100644 /* FIXME: free the modref */ builtin_load_info->status = STATUS_DLL_NOT_FOUND; return; -@@ -2383,6 +2438,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam +@@ -2380,6 +2435,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -210,7 +210,7 @@ index 85eb29768..644f599a7 100644 /* FIXME: there are several more dangling references * left. Including dlls loaded by this dll before the -@@ -3569,6 +3625,7 @@ static void free_modref( WINE_MODREF *wm ) +@@ -3568,6 +3624,7 @@ static void free_modref( WINE_MODREF *wm ) { RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -218,7 +218,7 @@ index 85eb29768..644f599a7 100644 if (wm->ldr.InInitializationOrderModuleList.Flink) RemoveEntryList(&wm->ldr.InInitializationOrderModuleList); -@@ -4246,6 +4303,7 @@ void __wine_process_init(void) +@@ -4245,6 +4302,7 @@ void __wine_process_init(void) SIZE_T info_size; TEB *teb = thread_init(); PEB *peb = teb->Peb; @@ -226,7 +226,7 @@ index 85eb29768..644f599a7 100644 /* setup the server connection */ server_init_process(); -@@ -4267,6 +4325,10 @@ void __wine_process_init(void) +@@ -4266,6 +4324,10 @@ void __wine_process_init(void) load_global_options(); version_init(); @@ -237,7 +237,7 @@ index 85eb29768..644f599a7 100644 /* setup the load callback and create ntdll modref */ wine_dll_set_callback( load_builtin_callback ); -@@ -4339,5 +4401,8 @@ void __wine_process_init(void) +@@ -4338,5 +4400,8 @@ void __wine_process_init(void) teb->Tib.StackLimit = stack.StackLimit; teb->DeallocationStack = stack.DeallocationStack; @@ -247,10 +247,10 @@ index 85eb29768..644f599a7 100644 server_init_process_done(); } diff --git a/include/winternl.h b/include/winternl.h -index 02a55c1e2..837a08eb7 100644 +index b9fac4bfca3..6ec99aab8fd 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -2266,8 +2266,8 @@ typedef struct _LDR_MODULE +@@ -2268,8 +2268,8 @@ typedef struct _LDR_MODULE ULONG Flags; SHORT LoadCount; SHORT TlsIndex; @@ -260,7 +260,7 @@ index 02a55c1e2..837a08eb7 100644 ULONG TimeDateStamp; HANDLE ActivationContext; PVOID PatchInformation; -@@ -2277,6 +2277,9 @@ typedef struct _LDR_MODULE +@@ -2279,6 +2279,9 @@ typedef struct _LDR_MODULE PVOID ContextInformation; ULONG_PTR OriginalBase; LARGE_INTEGER LoadTime; @@ -271,5 +271,5 @@ index 02a55c1e2..837a08eb7 100644 typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA -- -2.25.0 +2.26.0 diff --git a/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch b/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch index 961d5b00..0a34fb39 100644 --- a/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch +++ b/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch @@ -1,18 +1,18 @@ -From ed78d7dd56fe29c5a310dc228576ce683730727a Mon Sep 17 00:00:00 2001 +From 934a7712600b45fa584386b4ada2a73af88ee072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 26 May 2017 05:17:17 +0200 Subject: ntdll: Implement opening files through nt device paths. --- - dlls/ntdll/directory.c | 134 ++++++++++++++++++++++++++++++++++++++++++++---- - dlls/ntdll/tests/file.c | 25 ++++++++- - 2 files changed, 149 insertions(+), 10 deletions(-) + dlls/ntdll/directory.c | 132 +++++++++++++++++++++++++++++++++++++--- + dlls/ntdll/tests/file.c | 25 +++++++- + 2 files changed, 147 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c -index 32699fe3cc4..97b42398bb0 100644 +index c6249dd8658..242dbd27b2f 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c -@@ -2811,16 +2811,10 @@ NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_STRING * +@@ -2732,16 +2732,10 @@ NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_STRING * /****************************************************************************** @@ -32,7 +32,7 @@ index 32699fe3cc4..97b42398bb0 100644 { static const WCHAR unixW[] = {'u','n','i','x'}; static const WCHAR pipeW[] = {'p','i','p','e'}; -@@ -2937,6 +2931,128 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI +@@ -2857,6 +2851,126 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI return status; } @@ -90,7 +90,7 @@ index 32699fe3cc4..97b42398bb0 100644 + while (!NtQueryDirectoryObject( handle, info, sizeof(data), TRUE, FALSE, &ctx, NULL )) + { + if (read_nt_symlink( handle, &info->ObjectName, symlinkW, MAX_DIR_ENTRY_LEN )) continue; -+ if (wcslen( symlinkW ) != length || memicmpW( symlinkW, name, length )) continue; ++ if (wcsnicmp( symlinkW, name, length )) continue; + if (info->ObjectName.Length != 2 * sizeof(WCHAR) || info->ObjectName.Buffer[1] != ':') continue; + + *device_ret = info->ObjectName.Buffer[0]; @@ -114,24 +114,22 @@ index 32699fe3cc4..97b42398bb0 100644 +NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, + UINT disposition, BOOLEAN check_case ) +{ -+ static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\'}; ++ static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0}; + static const WCHAR dosprefixW[] = {'\\','?','?','\\'}; -+ static const WCHAR deviceW[] = {'\\','D','e','v','i','c','e','\\'}; ++ static const WCHAR deviceW[] = {'\\','D','e','v','i','c','e','\\',0}; + WCHAR *name, *ptr, *prefix, buffer[3] = {'c',':',0}; + UNICODE_STRING dospathW; + size_t offset, name_len; + NTSTATUS status; + -+ if (nameW->Length >= sizeof(deviceW) && -+ !memicmpW( nameW->Buffer, deviceW, sizeof(deviceW) / sizeof(WCHAR) )) ++ if (!wcsnicmp( nameW->Buffer, deviceW, nameW->Length / sizeof(WCHAR) )) + { + offset = sizeof(deviceW) / sizeof(WCHAR); + while (offset * sizeof(WCHAR) < nameW->Length && nameW->Buffer[ offset ] != '\\') offset++; + if ((status = nt_to_dos_device( nameW->Buffer, offset, buffer ))) return status; + prefix = buffer; + } -+ else if (nameW->Length >= sizeof(systemrootW) && -+ !memicmpW( nameW->Buffer, systemrootW, sizeof(systemrootW) / sizeof(WCHAR) )) ++ else if (!wcsnicmp( nameW->Buffer, systemrootW, nameW->Length / sizeof(WCHAR) )) + { + offset = (sizeof(systemrootW) - 1) / sizeof(WCHAR); + prefix = user_shared_data->NtSystemRoot; @@ -162,10 +160,10 @@ index 32699fe3cc4..97b42398bb0 100644 /****************************************************************** * RtlWow64EnableFsRedirection (NTDLL.@) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 9de9009b10e..1751865a682 100644 +index 546795456a8..709698209d8 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c -@@ -159,18 +159,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) +@@ -135,18 +135,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) static void create_file_test(void) { @@ -189,7 +187,7 @@ index 9de9009b10e..1751865a682 100644 OBJECT_ATTRIBUTES attr; IO_STATUS_BLOCK io; UNICODE_STRING nameW; -@@ -351,6 +355,25 @@ static void create_file_test(void) +@@ -327,6 +331,25 @@ static void create_file_test(void) status = pNtQueryFullAttributesFile( &attr, &info ); ok( status == STATUS_OBJECT_NAME_INVALID, "query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); @@ -216,5 +214,5 @@ index 9de9009b10e..1751865a682 100644 static void open_file_test(void) -- -2.12.2 +2.26.0 diff --git a/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch b/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch index 18e09f8f..60a2f2c7 100644 --- a/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch +++ b/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch @@ -1,4 +1,4 @@ -From c2736168d1010e311233bfc078b75bfcd68b959d Mon Sep 17 00:00:00 2001 +From f39b7dba77e8991bc586b8102ee232842daa5c91 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 28 May 2017 11:17:26 +0200 Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name. @@ -6,15 +6,15 @@ Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name. --- dlls/ntdll/directory.c | 2 +- dlls/ntdll/ntdll_misc.h | 1 + - dlls/ntdll/virtual.c | 38 +++++++++++++++++++++++++++++------ + dlls/ntdll/virtual.c | 37 +++++++++++++++++++++++++++++------ dlls/psapi/tests/psapi_main.c | 6 +----- - 4 files changed, 35 insertions(+), 12 deletions(-) + 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c -index 6ea95037153..725c002ab62 100644 +index 242dbd27b2f..fe8b896682d 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c -@@ -2875,7 +2875,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI +@@ -2852,7 +2852,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI } /* read the contents of an NT symlink object */ @@ -24,10 +24,10 @@ index 6ea95037153..725c002ab62 100644 OBJECT_ATTRIBUTES attr; UNICODE_STRING targetW; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 59393e3a414..1b2b4e701bb 100644 +index a5fe98c8d85..93fd8a9354b 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -171,6 +171,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S +@@ -174,6 +174,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S /* virtual memory */ extern NTSTATUS virtual_alloc_aligned( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr, ULONG type, ULONG protect, ULONG alignment ) DECLSPEC_HIDDEN; @@ -36,18 +36,10 @@ index 59393e3a414..1b2b4e701bb 100644 const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type, ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index 966b2a4c386..26963020c1b 100644 +index f49127c3e85..46c070561b0 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c -@@ -56,6 +56,7 @@ - #include "wine/library.h" - #include "wine/server.h" - #include "wine/exception.h" -+#include "wine/unicode.h" - #include "wine/rbtree.h" - #include "wine/debug.h" - #include "ntdll_misc.h" -@@ -163,6 +164,8 @@ static BYTE **pages_vprot; +@@ -177,6 +177,8 @@ static BYTE **pages_vprot; static BYTE *pages_vprot; #endif @@ -56,7 +48,7 @@ index 966b2a4c386..26963020c1b 100644 static struct file_view *view_block_start, *view_block_end, *next_free_view; static const size_t view_block_size = 0x100000; static void *preload_reserve_start; -@@ -3075,12 +3078,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, +@@ -3197,12 +3199,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, MEMORY_SECTION_NAME *info, SIZE_T len, SIZE_T *res_len ) { @@ -73,7 +65,7 @@ index 966b2a4c386..26963020c1b 100644 if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER; -@@ -3139,14 +3145,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, +@@ -3261,14 +3266,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, } found: @@ -92,13 +84,13 @@ index 966b2a4c386..26963020c1b 100644 + } + } + -+ *res_len = sizeof(MEMORY_SECTION_NAME) + strlenW(symlinkW) * sizeof(WCHAR) + ++ *res_len = sizeof(MEMORY_SECTION_NAME) + wcslen(symlinkW) * sizeof(WCHAR) + + nt_name.Length - offset * sizeof(WCHAR) + sizeof(WCHAR); if (len >= *res_len) { - info->SectionFileName.Length = nt_name.Length; - info->SectionFileName.MaximumLength = nt_name.Length + sizeof(WCHAR); -+ info->SectionFileName.Length = strlenW(symlinkW) * sizeof(WCHAR) + ++ info->SectionFileName.Length = wcslen(symlinkW) * sizeof(WCHAR) + + nt_name.Length - offset * sizeof(WCHAR); + info->SectionFileName.MaximumLength = info->SectionFileName.Length + sizeof(WCHAR); info->SectionFileName.Buffer = (WCHAR *)(info + 1); @@ -106,18 +98,18 @@ index 966b2a4c386..26963020c1b 100644 - info->SectionFileName.Buffer[ nt_name.Length / sizeof(WCHAR) ] = 0; + + ptr = (WCHAR *)(info + 1); -+ strcpyW( ptr, symlinkW ); -+ ptr += strlenW(symlinkW); ++ wcscpy( ptr, symlinkW ); ++ ptr += wcslen(symlinkW); + memcpy( ptr, nt_name.Buffer + offset, nt_name.Length - offset * sizeof(WCHAR) ); + ptr[ nt_name.Length / sizeof(WCHAR) - offset ] = 0; } else status = (len < sizeof(MEMORY_SECTION_NAME)) ? STATUS_INFO_LENGTH_MISMATCH : STATUS_BUFFER_OVERFLOW; diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c -index 9143fa79e7d..80636eb74a8 100644 +index f6a7b69eca0..a8263a2f44b 100644 --- a/dlls/psapi/tests/psapi_main.c +++ b/dlls/psapi/tests/psapi_main.c -@@ -489,7 +489,6 @@ static void test_GetMappedFileName(void) +@@ -476,7 +476,6 @@ static void test_GetMappedFileName(void) ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name)); ok(ret, "GetMappedFileName error %d\n", GetLastError()); ok(ret > strlen(device_name), "map_name should be longer than device_name\n"); @@ -125,7 +117,7 @@ index 9143fa79e7d..80636eb74a8 100644 ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name); SetLastError(0xdeadbeef); -@@ -502,7 +501,6 @@ todo_wine { +@@ -489,7 +488,6 @@ todo_wine { { ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name); WideCharToMultiByte(CP_ACP, 0, map_nameW, -1, map_name, MAX_PATH, NULL, NULL); @@ -133,7 +125,7 @@ index 9143fa79e7d..80636eb74a8 100644 ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name); } -@@ -515,7 +513,6 @@ todo_wine +@@ -502,7 +500,6 @@ todo_wine { ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name); WideCharToMultiByte(CP_ACP, 0, map_nameW, -1, map_name, MAX_PATH, NULL, NULL); @@ -141,7 +133,7 @@ index 9143fa79e7d..80636eb74a8 100644 ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name); } -@@ -523,7 +520,6 @@ todo_wine +@@ -510,7 +507,6 @@ todo_wine ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name)); ok(ret, "GetMappedFileName error %d\n", GetLastError()); ok(ret > strlen(device_name), "map_name should be longer than device_name\n"); @@ -149,7 +141,7 @@ index 9143fa79e7d..80636eb74a8 100644 ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name); SetLastError(0xdeadbeef); -@@ -605,7 +601,7 @@ static void test_GetProcessImageFileName(void) +@@ -592,7 +588,7 @@ static void test_GetProcessImageFileName(void) { /* Windows returns 2*strlen-1 */ ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret); @@ -159,5 +151,5 @@ index 9143fa79e7d..80636eb74a8 100644 SetLastError(0xdeadbeef); -- -2.17.1 +2.26.0 diff --git a/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch b/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch index 472d331c..8a6246f6 100644 --- a/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch +++ b/patches/ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch @@ -1,18 +1,17 @@ -From d1dca9874d914f25f3257c850275a14c3835a7e9 Mon Sep 17 00:00:00 2001 +From 72ace2e57404a068679a703268c505c5f5ac3b12 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 28 Apr 2016 18:14:36 +0800 Subject: [PATCH] ntdll: Implement NtSetLdtEntries. --- dlls/kernel32/tests/thread.c | 79 ++++++++++++++++++++++++++++++++++++ - dlls/ntdll/nt.c | 28 ++++++++++++- - 2 files changed, 106 insertions(+), 1 deletion(-) + 1 file changed, 79 insertions(+) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c -index 180eed82419..5e9d51c24cd 100644 +index b6a65a4207c..70b22367e18 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c -@@ -107,6 +107,7 @@ static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP +@@ -99,6 +99,7 @@ static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP static NTSTATUS (WINAPI *pNtSetInformationThread)(HANDLE,THREADINFOCLASS,LPCVOID,ULONG); static HRESULT (WINAPI *pSetThreadDescription)(HANDLE,const WCHAR *); static HRESULT (WINAPI *pGetThreadDescription)(HANDLE,WCHAR **); @@ -20,8 +19,8 @@ index 180eed82419..5e9d51c24cd 100644 static HANDLE create_target_process(const char *arg) { -@@ -1223,6 +1224,82 @@ static void test_GetThreadSelectorEntry(void) - ok(entry.HighWord.Bits.Granularity == 0, "expected 0, got %u\n", entry.HighWord.Bits.Granularity); +@@ -1262,6 +1263,82 @@ static void test_GetThreadSelectorEntry(void) + ok(entry.HighWord.Bits.Granularity == 1, "expected 1, got %u\n", entry.HighWord.Bits.Granularity); } +static void test_NtSetLdtEntries(void) @@ -103,7 +102,7 @@ index 180eed82419..5e9d51c24cd 100644 #endif /* __i386__ */ static HANDLE finish_event; -@@ -2291,6 +2368,7 @@ static void init_funcs(void) +@@ -2324,6 +2401,7 @@ static void init_funcs(void) X(NtQueryInformationThread); X(RtlGetThreadErrorMode); X(NtSetInformationThread); @@ -111,7 +110,7 @@ index 180eed82419..5e9d51c24cd 100644 } #undef X } -@@ -2346,6 +2424,7 @@ START_TEST(thread) +@@ -2379,6 +2457,7 @@ START_TEST(thread) #ifdef __i386__ test_SetThreadContext(); test_GetThreadSelectorEntry(); @@ -119,52 +118,6 @@ index 180eed82419..5e9d51c24cd 100644 #endif test_QueueUserWorkItem(); test_RegisterWaitForSingleObject(); -diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c -index 85cefa638ab..fd3a7cb7eae 100644 ---- a/dlls/ntdll/nt.c -+++ b/dlls/ntdll/nt.c -@@ -75,6 +75,7 @@ - #include "winternl.h" - #include "ntdll_misc.h" - #include "wine/server.h" -+#include "wine/library.h" - #include "ddk/wdm.h" - - #ifdef __APPLE__ -@@ -3781,7 +3782,32 @@ NTSTATUS WINAPI NtSystemDebugControl(SYSDBG_COMMAND command, PVOID inbuffer, ULO - NTSTATUS WINAPI NtSetLdtEntries(ULONG selector1, ULONG entry1_low, ULONG entry1_high, - ULONG selector2, ULONG entry2_low, ULONG entry2_high) - { -- FIXME("(%u, %u, %u, %u, %u, %u): stub\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high); -+#ifdef __i386__ -+ union -+ { -+ LDT_ENTRY entry; -+ ULONG dw[2]; -+ } sel; -+ -+ TRACE("(%x,%x,%x,%x,%x,%x)\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high); - -+ if (selector1) -+ { -+ sel.dw[0] = entry1_low; -+ sel.dw[1] = entry1_high; -+ if (wine_ldt_set_entry(selector1, &sel.entry) < 0) -+ return STATUS_ACCESS_DENIED; -+ } -+ if (selector2) -+ { -+ sel.dw[0] = entry2_low; -+ sel.dw[1] = entry2_high; -+ if (wine_ldt_set_entry(selector2, &sel.entry) < 0) -+ return STATUS_ACCESS_DENIED; -+ } -+ return STATUS_SUCCESS; -+#else -+ FIXME("(%x,%x,%x,%x,%x,%x): stub\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high); - return STATUS_NOT_IMPLEMENTED; -+#endif - } -- -2.17.1 +2.26.0 diff --git a/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch b/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch index 054803a8..da37448c 100644 --- a/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch +++ b/patches/ntdll-NtSetLdtEntries/0002-libs-wine-Allow-to-modify-reserved-LDT-entries.patch @@ -1,7 +1,7 @@ -From 36cdcc900c03de3e2e27a16252242a7a5ec55513 Mon Sep 17 00:00:00 2001 +From 18e7f7c6475673f382a8d3015140383c2dd756b0 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 28 Apr 2016 17:01:16 +0200 -Subject: libs/wine: Allow to modify reserved LDT entries. +Subject: [PATCH] libs/wine: Allow to modify reserved LDT entries. Some implementation notes: @@ -17,14 +17,15 @@ entries without that flag set and NtQueryInformationThread(ThreadDescriptorTable fails. --- dlls/kernel32/tests/thread.c | 4 ---- + dlls/ntdll/signal_i386.c | 2 -- libs/wine/ldt.c | 4 +--- - 2 files changed, 1 insertion(+), 7 deletions(-) + 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c -index 981e3c4..6efc52a 100644 +index 70b22367e18..a454bf118cc 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c -@@ -1163,16 +1163,12 @@ static void test_NtSetLdtEntries(void) +@@ -1325,16 +1325,12 @@ static void test_NtSetLdtEntries(void) { memset(&sel.entry, 0x9a, sizeof(sel.entry)); ret = GetThreadSelectorEntry(GetCurrentThread(), 0x000f, &sel.entry); @@ -41,11 +42,24 @@ index 981e3c4..6efc52a 100644 ok(!memcmp(&ds_entry, &sel.entry, sizeof(ds_entry)), "entries do not match\n"); } } +diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c +index e812f634ff9..16ee93e001a 100644 +--- a/dlls/ntdll/signal_i386.c ++++ b/dlls/ntdll/signal_i386.c +@@ -2558,8 +2558,6 @@ NTSTATUS get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_ + NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_ENTRY entry2 ) + { + if (sel1 >> 16 || sel2 >> 16) return STATUS_INVALID_LDT_DESCRIPTOR; +- if (sel1 && (sel1 >> 3) < first_ldt_entry) return STATUS_INVALID_LDT_DESCRIPTOR; +- if (sel2 && (sel2 >> 3) < first_ldt_entry) return STATUS_INVALID_LDT_DESCRIPTOR; + + ldt_lock(); + if (sel1) ldt_set_entry( sel1, entry1 ); diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c -index 0946407..8ac779a 100644 +index baf12a2e3a7..b9371814ba2 100644 --- a/libs/wine/ldt.c +++ b/libs/wine/ldt.c -@@ -169,8 +169,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) +@@ -170,8 +170,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) { int ret = 0, index = sel >> 3; @@ -54,7 +68,7 @@ index 0946407..8ac779a 100644 #ifdef linux { struct modify_ldt_s ldt_info; -@@ -222,7 +220,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) +@@ -223,7 +221,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry ) wine_ldt_copy.limit[index] = wine_ldt_get_limit(entry); wine_ldt_copy.flags[index] = (entry->HighWord.Bits.Type | (entry->HighWord.Bits.Default_Big ? WINE_LDT_FLAGS_32BIT : 0) | @@ -64,5 +78,5 @@ index 0946407..8ac779a 100644 return ret; } -- -2.8.0 +2.26.0 diff --git a/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv6StringToAddress-Ex-AW.patch b/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv6StringToAddress-Ex-AW.patch index 5f141327..ad08bd39 100644 --- a/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv6StringToAddress-Ex-AW.patch +++ b/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv6StringToAddress-Ex-AW.patch @@ -1,4 +1,4 @@ -From 657b5b508badf3e4dc711ab97670b62f6d1f811d Mon Sep 17 00:00:00 2001 +From f78b1b06730406eb802afa87e602a3cf4211a170 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Thu, 19 Mar 2020 15:37:50 -0600 Subject: [PATCH] ntdll: Implement RtlIpv6StringToAddress(Ex)[AW] @@ -10,7 +10,7 @@ Signed-off-by: Alex Henrie 2 files changed, 211 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 0ea72e3aef..8b9fb18eb1 100644 +index 13b0317744a..66271f67884 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -781,10 +781,10 @@ @@ -28,10 +28,10 @@ index 0ea72e3aef..8b9fb18eb1 100644 @ stdcall RtlIsCriticalSectionLocked(ptr) @ stdcall RtlIsCriticalSectionLockedByThread(ptr) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c -index 15ff037fef..11e76ed295 100644 +index 64853369a36..6f19216e85b 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c -@@ -98,6 +98,16 @@ static const DWORD CRC_table[256] = +@@ -97,6 +97,16 @@ static const DWORD CRC_table[256] = 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; @@ -48,7 +48,7 @@ index 15ff037fef..11e76ed295 100644 /* * resource functions */ -@@ -886,15 +896,6 @@ void WINAPI RtlCopyLuidAndAttributesArray( +@@ -885,15 +895,6 @@ void WINAPI RtlCopyLuidAndAttributesArray( static BOOL parse_ipv4_component(const WCHAR **str, BOOL strict, ULONG *value) { @@ -64,7 +64,7 @@ index 15ff037fef..11e76ed295 100644 int base = 10, d; WCHAR c; ULONG cur_value, prev_value = 0; -@@ -1074,13 +1075,209 @@ NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const c +@@ -1073,13 +1074,209 @@ NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const c return ret; } @@ -72,7 +72,7 @@ index 15ff037fef..11e76ed295 100644 +{ + WCHAR *terminator; + if (**str >= ARRAY_SIZE(hex_table) || hex_table[**str] == -1) return FALSE; -+ *value = min(strtoulW(*str, &terminator, base), 0x7FFFFFFF); ++ *value = min(wcstoul(*str, &terminator, base), 0x7FFFFFFF); + if (terminator == *str) return FALSE; + *str = terminator; + return TRUE; diff --git a/patches/ntdll-SystemRoot_Symlink/0001-ntdll-Add-special-handling-for-SystemRoot-to-satisfy.patch b/patches/ntdll-SystemRoot_Symlink/0001-ntdll-Add-special-handling-for-SystemRoot-to-satisfy.patch index 54738529..96592617 100644 --- a/patches/ntdll-SystemRoot_Symlink/0001-ntdll-Add-special-handling-for-SystemRoot-to-satisfy.patch +++ b/patches/ntdll-SystemRoot_Symlink/0001-ntdll-Add-special-handling-for-SystemRoot-to-satisfy.patch @@ -1,26 +1,18 @@ -From bb213b463267c035887fbda1e5227da68705db39 Mon Sep 17 00:00:00 2001 +From e0b0ac874fbe3dcab53222f38831978f63177602 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 17 Aug 2015 06:17:33 +0200 Subject: ntdll: Add special handling for \SystemRoot to satisfy MSYS2 case-insensitive system check. --- - dlls/ntdll/om.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) + dlls/ntdll/om.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c -index 35c3672..9a2539c 100644 +index 0d66867496b..f8f0760de70 100644 --- a/dlls/ntdll/om.c +++ b/dlls/ntdll/om.c -@@ -39,6 +39,7 @@ - #include "ntdll_misc.h" - #include "wine/server.h" - #include "wine/exception.h" -+#include "wine/unicode.h" - - WINE_DEFAULT_DEBUG_CHANNEL(ntdll); - -@@ -606,6 +607,7 @@ NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE handle, PDIRECTORY_BASIC_INFORMATI +@@ -602,6 +602,7 @@ NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE handle, PDIRECTORY_BASIC_INFORMATI NTSTATUS WINAPI NtOpenSymbolicLinkObject( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr) { @@ -28,14 +20,14 @@ index 35c3672..9a2539c 100644 NTSTATUS ret; TRACE("(%p,0x%08x,%s)\n", handle, access, debugstr_ObjectAttributes(attr)); -@@ -613,6 +615,16 @@ NTSTATUS WINAPI NtOpenSymbolicLinkObject( HANDLE *handle, ACCESS_MASK access, +@@ -609,6 +610,16 @@ NTSTATUS WINAPI NtOpenSymbolicLinkObject( HANDLE *handle, ACCESS_MASK access, if (!handle) return STATUS_ACCESS_VIOLATION; if ((ret = validate_open_object_attributes( attr ))) return ret; + /* MSYS2 tries to open \\SYSTEMROOT to check for case-insensitive systems */ + if (!access && !attr->RootDirectory && + attr->ObjectName->Length == sizeof(SystemRootW) && -+ !memicmpW( attr->ObjectName->Buffer, SystemRootW, ++ !wcsnicmp( attr->ObjectName->Buffer, SystemRootW, + sizeof(SystemRootW)/sizeof(WCHAR) )) + { + TRACE( "returning STATUS_ACCESS_DENIED\n" ); @@ -46,5 +38,5 @@ index 35c3672..9a2539c 100644 { req->access = access; -- -2.8.0 +2.26.0 diff --git a/patches/ntdll-SystemRoot_Symlink/definition b/patches/ntdll-SystemRoot_Symlink/definition index 7fd9a56c..6fdba87a 100644 --- a/patches/ntdll-SystemRoot_Symlink/definition +++ b/patches/ntdll-SystemRoot_Symlink/definition @@ -1,3 +1 @@ Fixes: Fix detection of case-insensitive systems in MSYS2 -Depends: ntdll-Exception -# Depends: ntdll-Syscall_Wrappers diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 796ff6de..51951786 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "5c0e699dbad3e4b4494852c6482125bd8bda9148" + echo "12c3177ed5cae39de8a9f9111a1cb450296cc8e6" } # Show version information @@ -1876,13 +1876,6 @@ if test "$enable_server_Realtime_Priority" -eq 1; then enable_ntdll_ThreadTime=1 fi -if test "$enable_ntdll_SystemRoot_Symlink" -eq 1; then - if test "$enable_ntdll_Exception" -gt 1; then - abort "Patchset ntdll-Exception disabled, but ntdll-SystemRoot_Symlink depends on that." - fi - enable_ntdll_Exception=1 -fi - if test "$enable_ntdll_RtlCreateUserThread" -eq 1; then if test "$enable_winebuild_Fake_Dlls" -gt 1; then abort "Patchset winebuild-Fake_Dlls disabled, but ntdll-RtlCreateUserThread depends on that." @@ -3436,26 +3429,8 @@ if test "$enable_ntdll_RtlCreateUserThread" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-Exception -# | -# | This patchset fixes the following Wine bugs: -# | * [#44819] Throw second DBG_PRINTEXCEPTION_C when debugging. -# | -# | Modified files: -# | * dlls/kernelbase/debug.c, dlls/ntdll/tests/exception.c -# | -if test "$enable_ntdll_Exception" -eq 1; then - patch_apply ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch - ( - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: OutputDebugString should throw the exception a second time, if a debugger is attached.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-SystemRoot_Symlink # | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-Exception -# | # | Modified files: # | * dlls/ntdll/om.c # | @@ -3593,8 +3568,8 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll- # | Junction_Points, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll- -# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server- -# | Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup +# | RtlCreateUserThread, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server-Key_State, server- +# | PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup # | # | This patchset fixes the following Wine bugs: # | * [#36692] Many multi-threaded applications have poor performance due to heavy use of synchronization primitives @@ -4456,6 +4431,21 @@ if test "$enable_ntdll_DeviceType_Systemroot" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-Exception +# | +# | This patchset fixes the following Wine bugs: +# | * [#44819] Throw second DBG_PRINTEXCEPTION_C when debugging. +# | +# | Modified files: +# | * dlls/kernelbase/debug.c, dlls/ntdll/tests/exception.c +# | +if test "$enable_ntdll_Exception" -eq 1; then + patch_apply ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch + ( + printf '%s\n' '+ { "Sebastian Lackner", "ntdll: OutputDebugString should throw the exception a second time, if a debugger is attached.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-FileFsFullSizeInformation # | # | Modified files: @@ -4730,7 +4720,7 @@ fi # Patchset ntdll-NtSetLdtEntries # | # | Modified files: -# | * dlls/kernel32/tests/thread.c, dlls/ntdll/nt.c, libs/wine/ldt.c +# | * dlls/kernel32/tests/thread.c, dlls/ntdll/signal_i386.c, libs/wine/ldt.c # | if test "$enable_ntdll_NtSetLdtEntries" -eq 1; then patch_apply ntdll-NtSetLdtEntries/0001-ntdll-Implement-NtSetLdtEntries.patch @@ -5311,8 +5301,8 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll- # | Junction_Points, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll- -# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server- -# | Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization +# | RtlCreateUserThread, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server-Key_State, server- +# | PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization # | # | This patchset fixes the following Wine bugs: # | * [#46967] GOG Galaxy doesn't run in virtual desktop. @@ -7215,9 +7205,9 @@ fi # | This patchset has the following (direct or indirect) dependencies: # | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll- # | Junction_Points, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll- -# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server- -# | Key_State, server-PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization, -# | server-Desktop_Refcount +# | RtlCreateUserThread, ntdll-SystemRoot_Symlink, server-Realtime_Priority, ntdll-Threading, server-Key_State, server- +# | PeekMessage, server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization, server- +# | Desktop_Refcount # | # | Modified files: # | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, include/winsock.h, server/protocol.def, server/sock.c diff --git a/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch b/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch index 483d7d10..763a3fbf 100644 --- a/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch +++ b/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch @@ -1,4 +1,4 @@ -From 0dbb12f12b3637dbf512cd0c0d719c901d57e63d Mon Sep 17 00:00:00 2001 +From cc13b2bb6b823df3de62dfacabeff22ebb2cf93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 11 May 2017 05:32:55 +0200 Subject: [PATCH] winebuild: Generate syscall thunks for ntdll exports. @@ -17,10 +17,10 @@ Based on a patch by Erich E. Hoover. 9 files changed, 206 insertions(+), 27 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 93eb142ab3f..5542d4b5e8e 100644 +index ba127c00361..915b344aabe 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c -@@ -427,6 +427,9 @@ static size_t signal_stack_size; +@@ -481,6 +481,9 @@ static ULONG first_ldt_entry = 32; static wine_signal_handler handlers[256]; @@ -30,7 +30,7 @@ index 93eb142ab3f..5542d4b5e8e 100644 enum i386_trap_code { TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */ -@@ -1448,7 +1451,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, +@@ -1512,7 +1515,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, { context->Ebp = ebp; context->Esp = (DWORD)&retaddr; @@ -39,19 +39,19 @@ index 93eb142ab3f..5542d4b5e8e 100644 context->SegCs = wine_get_cs(); context->SegSs = wine_get_ss(); context->EFlags = eflags; -@@ -2335,6 +2338,7 @@ NTSTATUS signal_alloc_thread( TEB **teb ) +@@ -2599,6 +2602,7 @@ NTSTATUS signal_alloc_thread( TEB **teb ) *teb = addr; (*teb)->Tib.Self = &(*teb)->Tib; (*teb)->Tib.ExceptionList = (void *)~0UL; + (*teb)->WOW32Reserved = __wine_syscall_dispatcher; thread_data = (struct x86_thread_data *)(*teb)->SystemReserved2; - if (!(thread_data->fs = wine_ldt_alloc_fs())) + if (!(thread_data->fs = ldt_alloc_fs( *teb, first_thread ))) { diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c -index ada28c91ebd..3ed8fa08213 100644 +index 249ba9d7c39..b10e2f65553 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c -@@ -1651,6 +1651,8 @@ static void test_thread_context(void) +@@ -1643,6 +1643,8 @@ static void test_thread_context(void) ok( (char *)context.Eip >= (char *)pNtGetContextThread - 0x10000 && (char *)context.Eip <= (char *)pNtGetContextThread + 0x10000, "wrong Eip %08x/%08x\n", context.Eip, (DWORD)pNtGetContextThread ); @@ -61,10 +61,10 @@ index ada28c91ebd..3ed8fa08213 100644 ok( context.SegCs == LOWORD(expect.SegCs), "wrong SegCs %08x/%08x\n", context.SegCs, expect.SegCs ); ok( context.SegDs == LOWORD(expect.SegDs), "wrong SegDs %08x/%08x\n", context.SegDs, expect.SegDs ); diff --git a/include/winternl.h b/include/winternl.h -index 2351df010b0..68bceddef68 100644 +index 7ab105752df..e469012b236 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -357,7 +357,7 @@ typedef struct _TEB +@@ -359,7 +359,7 @@ typedef struct _TEB PVOID CsrClientThread; /* 03c/0070 */ PVOID Win32ThreadInfo; /* 040/0078 */ ULONG Win32ClientInfo[31]; /* 044/0080 used for user32 private data in Wine */ @@ -74,7 +74,7 @@ index 2351df010b0..68bceddef68 100644 ULONG FpSoftwareStatusRegister; /* 0c8/010c */ PVOID SystemReserved1[54]; /* 0cc/0110 used for krnl386.exe16 private data in Wine */ diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h -index 43a0dd20e82..eb63b661c7f 100644 +index 65493ec37fb..b701f0660e4 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -105,6 +105,7 @@ typedef struct @@ -112,7 +112,7 @@ index 43a0dd20e82..eb63b661c7f 100644 #define FLAG_CPU_MASK (FLAG_CPU(CPU_LAST + 1) - FLAG_CPU(0)) #define FLAG_CPU_WIN64 (FLAG_CPU(CPU_x86_64) | FLAG_CPU(CPU_ARM64)) #define FLAG_CPU_WIN32 (FLAG_CPU_MASK & ~FLAG_CPU_WIN64) -@@ -325,6 +330,8 @@ extern void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 ); +@@ -326,6 +331,8 @@ extern void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 ); extern int parse_spec_file( FILE *file, DLLSPEC *spec ); extern int parse_def_file( FILE *file, DLLSPEC *spec ); @@ -122,10 +122,10 @@ index 43a0dd20e82..eb63b661c7f 100644 extern int byte_swapped; diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c -index 8c32b738a23..599281674f2 100644 +index 04ab433dd65..0c6bafed8e5 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c -@@ -541,6 +541,7 @@ static void check_undefined_forwards( DLLSPEC *spec ) +@@ -531,6 +531,7 @@ static void check_undefined_forwards( DLLSPEC *spec ) /* flag the dll exports that link to an undefined symbol */ static void check_undefined_exports( DLLSPEC *spec ) { @@ -133,7 +133,7 @@ index 8c32b738a23..599281674f2 100644 int i; for (i = 0; i < spec->nb_entry_points; i++) -@@ -548,7 +549,8 @@ static void check_undefined_exports( DLLSPEC *spec ) +@@ -538,7 +539,8 @@ static void check_undefined_exports( DLLSPEC *spec ) ORDDEF *odp = &spec->entry_points[i]; if (odp->type == TYPE_STUB || odp->type == TYPE_ABS || odp->type == TYPE_VARIABLE) continue; if (odp->flags & FLAG_FORWARD) continue; @@ -143,7 +143,7 @@ index 8c32b738a23..599281674f2 100644 { switch(odp->type) { -@@ -559,14 +561,14 @@ static void check_undefined_exports( DLLSPEC *spec ) +@@ -549,14 +551,14 @@ static void check_undefined_exports( DLLSPEC *spec ) if (link_ext_symbols) { odp->flags |= FLAG_EXT_LINK; @@ -162,10 +162,10 @@ index 8c32b738a23..599281674f2 100644 } } diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c -index 3191efaf9ea..f440881a0ec 100644 +index be705c25f0f..004b6aea7ab 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c -@@ -541,6 +541,24 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp ) +@@ -543,6 +543,24 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp ) } @@ -190,7 +190,7 @@ index 3191efaf9ea..f440881a0ec 100644 /******************************************************************* * parse_spec_ordinal * -@@ -616,6 +634,14 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec ) +@@ -618,6 +636,14 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec ) assert( 0 ); } @@ -205,7 +205,7 @@ index 3191efaf9ea..f440881a0ec 100644 if ((odp->flags & FLAG_CPU_MASK) && !(odp->flags & FLAG_CPU(target_cpu))) { /* ignore this entry point */ -@@ -813,6 +839,37 @@ static void assign_ordinals( DLLSPEC *spec ) +@@ -815,6 +841,37 @@ static void assign_ordinals( DLLSPEC *spec ) } @@ -243,7 +243,7 @@ index 3191efaf9ea..f440881a0ec 100644 /******************************************************************* * add_16bit_exports * -@@ -914,6 +971,8 @@ int parse_spec_file( FILE *file, DLLSPEC *spec ) +@@ -916,6 +973,8 @@ int parse_spec_file( FILE *file, DLLSPEC *spec ) current_line = 0; /* no longer parsing the input file */ assign_names( spec ); assign_ordinals( spec ); @@ -293,10 +293,10 @@ index 3a7e457282a..a179175b8c1 100644 entry_point->u.func.nb_args = 0; assert( !spec->ordinals[0] ); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c -index 855e6d8739f..119e1079940 100644 +index ecfe4c50113..fa7984e1a38 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c -@@ -371,6 +371,109 @@ static void output_relay_debug( DLLSPEC *spec ) +@@ -374,6 +374,109 @@ static void output_relay_debug( DLLSPEC *spec ) } } @@ -406,7 +406,7 @@ index 855e6d8739f..119e1079940 100644 /******************************************************************* * output_exports * -@@ -767,6 +870,7 @@ void output_spec32_file( DLLSPEC *spec ) +@@ -770,6 +873,7 @@ void output_spec32_file( DLLSPEC *spec ) open_output_file(); output_standard_file_header(); output_module( spec ); @@ -415,10 +415,10 @@ index 855e6d8739f..119e1079940 100644 output_exports( spec ); output_imports( spec ); diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c -index 31a6b283713..74fc8a16bcf 100644 +index be877080486..63aeeca4468 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c -@@ -838,6 +838,7 @@ void free_dll_spec( DLLSPEC *spec ) +@@ -854,6 +854,7 @@ void free_dll_spec( DLLSPEC *spec ) free( odp->name ); free( odp->export_name ); free( odp->link_name ); @@ -426,7 +426,7 @@ index 31a6b283713..74fc8a16bcf 100644 } free( spec->file_name ); free( spec->dll_name ); -@@ -847,6 +848,7 @@ void free_dll_spec( DLLSPEC *spec ) +@@ -863,6 +864,7 @@ void free_dll_spec( DLLSPEC *spec ) free( spec->names ); free( spec->ordinals ); free( spec->resources ); @@ -434,7 +434,7 @@ index 31a6b283713..74fc8a16bcf 100644 free( spec ); } -@@ -1265,3 +1267,22 @@ const char *get_asm_string_section(void) +@@ -1281,3 +1283,22 @@ const char *get_asm_string_section(void) default: return ".section .rodata"; } } @@ -458,5 +458,5 @@ index 31a6b283713..74fc8a16bcf 100644 + return j + 1; +} -- -2.20.1 +2.26.0 diff --git a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch index d7ea9542..8976315d 100644 --- a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch +++ b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch @@ -1,4 +1,4 @@ -From 4855e0338f57525304221ba1c29c3926a9f16263 Mon Sep 17 00:00:00 2001 +From ef002efad2f2ef4fcbc9aab1a91acaccdb7a846e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 15 May 2017 16:27:56 +0200 Subject: [PATCH] winebuild: Add stub functions in fake dlls. @@ -61,10 +61,10 @@ index e72dea9ca51..bf3cf00f964 100644 CloseHandle(map); CloseHandle(file); diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index a0f8b3a2ec6..72285f0b456 100644 +index 915b344aabe..8cb19f68ec1 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c -@@ -445,6 +445,39 @@ static wine_signal_handler handlers[256]; +@@ -484,6 +484,39 @@ static wine_signal_handler handlers[256]; extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); extern NTSTATUS WINAPI __syscall_NtGetContextThread( HANDLE handle, CONTEXT *context ); @@ -104,16 +104,16 @@ index a0f8b3a2ec6..72285f0b456 100644 enum i386_trap_code { TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */ -@@ -2307,6 +2340,7 @@ NTSTATUS signal_alloc_thread( TEB **teb ) +@@ -2603,6 +2636,7 @@ NTSTATUS signal_alloc_thread( TEB **teb ) (*teb)->Tib.Self = &(*teb)->Tib; (*teb)->Tib.ExceptionList = (void *)~0UL; (*teb)->WOW32Reserved = __wine_syscall_dispatcher; + (*teb)->Spare2 = __wine_fakedll_dispatcher; thread_data = (struct x86_thread_data *)(*teb)->SystemReserved2; - if (!(thread_data->fs = wine_ldt_alloc_fs())) + if (!(thread_data->fs = ldt_alloc_fs( *teb, first_thread ))) { diff --git a/include/winternl.h b/include/winternl.h -index 1fbf05b0125..f44722093ba 100644 +index e469012b236..24a41a9f95d 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -398,7 +398,7 @@ typedef struct _TEB @@ -436,5 +436,5 @@ index b0be1b594b3..b1e34c5da18 100644 { size_t size = align - (output_buffer_pos % align); -- -2.25.1 +2.26.0