From 2da0d341f684a012649f9a0862d4fbaa6b7db8cd Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 4 Sep 2019 08:23:20 +1000 Subject: [PATCH] Rebase against 363b8809f37b3ea5915ea4240b3d397fd2355e2e --- ....drv-Fix-build-with-older-macOS-SDKs.patch | 141 -------------- ...mplement-RtlIpv4StringToAddress-Ex-W.patch | 182 ------------------ ...mplement-RtlIpv4StringToAddress-Ex-A.patch | 74 ------- patches/patchinstall.sh | 22 +-- 4 files changed, 1 insertion(+), 418 deletions(-) delete mode 100644 patches/macos-compile/0002-winemac.drv-Fix-build-with-older-macOS-SDKs.patch delete mode 100644 patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv4StringToAddress-Ex-W.patch delete mode 100644 patches/ntdll-RtlIpv4StringToAddress/0002-ntdll-Implement-RtlIpv4StringToAddress-Ex-A.patch diff --git a/patches/macos-compile/0002-winemac.drv-Fix-build-with-older-macOS-SDKs.patch b/patches/macos-compile/0002-winemac.drv-Fix-build-with-older-macOS-SDKs.patch deleted file mode 100644 index 18d54efb..00000000 --- a/patches/macos-compile/0002-winemac.drv-Fix-build-with-older-macOS-SDKs.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 0d23ecd9ec8a0c24e5444e0fc9cf6933cc39c960 Mon Sep 17 00:00:00 2001 -From: Zhiyi Zhang -Date: Mon, 2 Sep 2019 12:04:21 +0800 -Subject: [PATCH] winemac.drv: Fix build with older macOS SDKs. - -macOS SDKs older than 10.11 doesn't support Metal. -macOS 10.11 and 10.12 SDK support Metal but don't -support registryID in MTLDevice protocol. Recommend -using 10.13+ SDK. - -Signed-off-by: Zhiyi Zhang -Signed-off-by: Ken Thomases -Signed-off-by: Alexandre Julliard ---- - configure | 40 ++++++++++++++++++++++++++++++++ - configure.ac | 12 ++++++++++ - dlls/winemac.drv/cocoa_display.m | 5 ++-- - include/config.h.in | 3 +++ - 4 files changed, 57 insertions(+), 3 deletions(-) - -diff --git a/configure b/configure -index a52e346b68..0c54e27f5f 100755 ---- a/configure -+++ b/configure -@@ -8952,6 +8952,46 @@ rm -f core conftest.err conftest.$ac_objext \ - then - METAL_LIBS="-framework Metal -framework QuartzCore" - -+ fi -+ -+ if test "$ac_cv_header_Metal_Metal_h" = "yes" -+ then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether MTLDevice protocol supports registryID property" >&5 -+$as_echo_n "checking whether MTLDevice protocol supports registryID property... " >&6; } -+ ac_ext=m -+ac_cpp='$OBJCPP $CPPFLAGS' -+ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_objc_compiler_gnu -+ -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+id device; device.registryID; -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_objc_try_compile "$LINENO"; then : -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -+$as_echo "yes" >&6; } -+ -+$as_echo "#define HAVE_MTLDEVICE_REGISTRYID 1" >>confdefs.h -+ -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ ac_ext=c -+ac_cpp='$CPP $CPPFLAGS' -+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_c_compiler_gnu -+ - fi - - if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes" -diff --git a/configure.ac b/configure.ac -index 1592812bf7..b39b6b2c90 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -859,6 +859,18 @@ case $host_os in - AC_SUBST(METAL_LIBS,"-framework Metal -framework QuartzCore") - fi - -+ dnl Check for MTLDevice registryID property -+ if test "$ac_cv_header_Metal_Metal_h" = "yes" -+ then -+ AC_MSG_CHECKING([whether MTLDevice protocol supports registryID property]) -+ AC_LANG_PUSH([Objective C]) -+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[id device; device.registryID;]])], -+ [AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_MTLDEVICE_REGISTRYID, 1, [Define if MTLDevice protocol has registryID property.])], -+ [AC_MSG_RESULT(no)]) -+ AC_LANG_POP([Objective C]) -+ fi -+ - dnl Enable Mac driver on Mac OS X 10.6 or later - if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes" - then -diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m -index 3863557d96..9d95eee99a 100644 ---- a/dlls/winemac.drv/cocoa_display.m -+++ b/dlls/winemac.drv/cocoa_display.m -@@ -21,7 +21,7 @@ - #include "config.h" - - #import --#ifdef HAVE_METAL_METAL_H -+#ifdef HAVE_MTLDEVICE_REGISTRYID - #import - #endif - #include "macdrv_cocoa.h" -@@ -234,7 +234,7 @@ static int macdrv_get_gpu_info_from_entry(struct macdrv_gpu* gpu, io_registry_en - return ret; - } - --#ifdef HAVE_METAL_METAL_H -+#ifdef HAVE_MTLDEVICE_REGISTRYID - - /*********************************************************************** - * macdrv_get_gpu_info_from_registry_id -@@ -337,7 +337,6 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count) - - static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count) - { -- TRACE("Metal support not compiled in\n"); - return -1; - } - -diff --git a/include/config.h.in b/include/config.h.in -index 924e11eac0..5f690df7b0 100644 ---- a/include/config.h.in -+++ b/include/config.h.in -@@ -584,6 +584,9 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_MPG123_H - -+/* Define if MTLDevice protocol has registryID property. */ -+#undef HAVE_MTLDEVICE_REGISTRYID -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_NCURSES_H - --- -2.23.0.rc1 - diff --git a/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv4StringToAddress-Ex-W.patch b/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv4StringToAddress-Ex-W.patch deleted file mode 100644 index b9c902a1..00000000 --- a/patches/ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv4StringToAddress-Ex-W.patch +++ /dev/null @@ -1,182 +0,0 @@ -From e180b88a8c4c1d2d43cd084264fea48b93c17b3a Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sun, 25 Aug 2019 18:02:28 -0600 -Subject: [PATCH 1/4] ntdll: Implement RtlIpv4StringToAddress(Ex)W - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46149 -Signed-off-by: Alex Henrie ---- - dlls/ntdll/rtl.c | 145 +++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 141 insertions(+), 4 deletions(-) - -diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c -index e0d855138f..72ecfd937a 100644 ---- a/dlls/ntdll/rtl.c -+++ b/dlls/ntdll/rtl.c -@@ -884,13 +884,150 @@ void WINAPI RtlCopyLuidAndAttributesArray( - for (i = 0; i < Count; i++) Dest[i] = Src[i]; - } - -+static BOOL parse_ipv4_component(const WCHAR **str, BOOL strict, ULONG *value) -+{ -+ static const int hex_table[] = { -+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0F */ -+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1F */ -+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x20-0x2F */ -+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, /* 0x30-0x3F */ -+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x40-0x4F */ -+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x50-0x5F */ -+ -1, 10, 11, 12, 13, 14, 15 /* 0x60-0x66 */ -+ }; -+ int base = 10, d; -+ WCHAR c; -+ ULONG cur_value, prev_value = 0; -+ BOOL success = FALSE; -+ -+ if (**str == '.') -+ { -+ *str += 1; -+ return FALSE; -+ } -+ -+ if ((*str)[0] == '0') -+ { -+ if ((*str)[1] == 'x' || (*str)[1] == 'X') -+ { -+ *str += 2; -+ if (strict) return FALSE; -+ base = 16; -+ } -+ else if ((*str)[1] >= '0' && (*str)[1] <= '9') -+ { -+ *str += 1; -+ if (strict) return FALSE; -+ base = 8; -+ } -+ } -+ -+ for (cur_value = 0; **str; *str += 1) -+ { -+ c = **str; -+ if (c >= ARRAY_SIZE(hex_table)) break; -+ d = hex_table[c]; -+ if (d == -1 || d >= base) break; -+ cur_value = cur_value * base + d; -+ success = TRUE; -+ if (cur_value < prev_value) return FALSE; /* overflow */ -+ prev_value = cur_value; -+ } -+ -+ if (success) *value = cur_value; -+ return success; -+} -+ -+static NTSTATUS ipv4_string_to_address(const WCHAR *str, BOOL strict, -+ const WCHAR **terminator, IN_ADDR *address, USHORT *port) -+{ -+ ULONG fields[4]; -+ int n = 0; -+ -+ for (;;) -+ { -+ if (!parse_ipv4_component(&str, strict, &fields[n])) -+ goto error; -+ n++; -+ if (*str != '.') -+ break; -+ if (n == 4) -+ goto error; -+ str++; -+ } -+ -+ if (strict && n < 4) -+ goto error; -+ -+ switch (n) -+ { -+ case 4: -+ if (fields[0] > 0xFF || fields[1] > 0xFF || fields[2] > 0xFF || fields[3] > 0xFF) -+ goto error; -+ address->S_un.S_un_b.s_b1 = fields[0]; -+ address->S_un.S_un_b.s_b2 = fields[1]; -+ address->S_un.S_un_b.s_b3 = fields[2]; -+ address->S_un.S_un_b.s_b4 = fields[3]; -+ break; -+ case 3: -+ if (fields[0] > 0xFF || fields[1] > 0xFF || fields[2] > 0xFFFF) -+ goto error; -+ address->S_un.S_un_b.s_b1 = fields[0]; -+ address->S_un.S_un_b.s_b2 = fields[1]; -+ address->S_un.S_un_b.s_b3 = (fields[2] & 0xFF00) >> 8; -+ address->S_un.S_un_b.s_b4 = (fields[2] & 0x00FF); -+ break; -+ case 2: -+ if (fields[0] > 0xFF || fields[1] > 0xFFFFFF) -+ goto error; -+ address->S_un.S_un_b.s_b1 = fields[0]; -+ address->S_un.S_un_b.s_b2 = (fields[1] & 0xFF0000) >> 16; -+ address->S_un.S_un_b.s_b3 = (fields[1] & 0x00FF00) >> 8; -+ address->S_un.S_un_b.s_b4 = (fields[1] & 0x0000FF); -+ break; -+ case 1: -+ address->S_un.S_un_b.s_b1 = (fields[0] & 0xFF000000) >> 24; -+ address->S_un.S_un_b.s_b2 = (fields[0] & 0x00FF0000) >> 16; -+ address->S_un.S_un_b.s_b3 = (fields[0] & 0x0000FF00) >> 8; -+ address->S_un.S_un_b.s_b4 = (fields[0] & 0x000000FF); -+ break; -+ default: -+ goto error; -+ } -+ -+ if (terminator) *terminator = str; -+ -+ if (*str == ':') -+ { -+ str++; -+ if (!parse_ipv4_component(&str, FALSE, &fields[0])) -+ goto error; -+ if (!fields[0] || fields[0] > 0xFFFF || *str) -+ goto error; -+ if (port) -+ { -+ *port = htons(fields[0]); -+ if (terminator) *terminator = str; -+ } -+ } -+ -+ if (!terminator && *str) -+ return STATUS_INVALID_PARAMETER; -+ return STATUS_SUCCESS; -+ -+error: -+ if (terminator) *terminator = str; -+ return STATUS_INVALID_PARAMETER; -+} -+ - /*********************************************************************** - * RtlIpv4StringToAddressExW [NTDLL.@] - */ - NTSTATUS WINAPI RtlIpv4StringToAddressExW(const WCHAR *str, BOOLEAN strict, IN_ADDR *address, USHORT *port) - { -- FIXME("(%s, %u, %p, %p): stub\n", debugstr_w(str), strict, address, port); -- return STATUS_NOT_IMPLEMENTED; -+ TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, address, port); -+ if (!str || !address || !port) return STATUS_INVALID_PARAMETER; -+ return ipv4_string_to_address(str, strict, NULL, address, port); - } - - /*********************************************************************** -@@ -898,8 +1035,8 @@ NTSTATUS WINAPI RtlIpv4StringToAddressExW(const WCHAR *str, BOOLEAN strict, IN_A - */ - NTSTATUS WINAPI RtlIpv4StringToAddressW(const WCHAR *str, BOOLEAN strict, const WCHAR **terminator, IN_ADDR *address) - { -- FIXME("(%s, %u, %p, %p): stub\n", debugstr_w(str), strict, terminator, address); -- return STATUS_NOT_IMPLEMENTED; -+ TRACE("(%s, %u, %p, %p)\n", debugstr_w(str), strict, terminator, address); -+ return ipv4_string_to_address(str, strict, terminator, address, NULL); - } - - /*********************************************************************** --- -2.23.0 - diff --git a/patches/ntdll-RtlIpv4StringToAddress/0002-ntdll-Implement-RtlIpv4StringToAddress-Ex-A.patch b/patches/ntdll-RtlIpv4StringToAddress/0002-ntdll-Implement-RtlIpv4StringToAddress-Ex-A.patch deleted file mode 100644 index 872a85bd..00000000 --- a/patches/ntdll-RtlIpv4StringToAddress/0002-ntdll-Implement-RtlIpv4StringToAddress-Ex-A.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 2f39a185e26072c7c776a1475236d798ebf267f0 Mon Sep 17 00:00:00 2001 -From: Alex Henrie -Date: Sun, 25 Aug 2019 17:18:06 -0600 -Subject: [PATCH 2/4] ntdll: Implement RtlIpv4StringToAddress(Ex)A - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46149 -Signed-off-by: Alex Henrie ---- - dlls/ntdll/ntdll.spec | 4 ++-- - dlls/ntdll/rtl.c | 33 +++++++++++++++++++++++++++++++++ - 2 files changed, 35 insertions(+), 2 deletions(-) - -diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 82c78f6e78..8cacc97ec4 100644 ---- a/dlls/ntdll/ntdll.spec -+++ b/dlls/ntdll/ntdll.spec -@@ -760,8 +760,8 @@ - @ stdcall RtlIpv4AddressToStringExA(ptr long ptr ptr) - @ stdcall RtlIpv4AddressToStringExW(ptr long ptr ptr) - @ stdcall RtlIpv4AddressToStringW(ptr ptr) --# @ stub RtlIpv4StringToAddressA --# @ stub RtlIpv4StringToAddressExA -+@ stdcall RtlIpv4StringToAddressA(str long ptr ptr) -+@ stdcall RtlIpv4StringToAddressExA(str long ptr ptr) - @ stdcall RtlIpv4StringToAddressExW(wstr long ptr ptr) - @ stdcall RtlIpv4StringToAddressW(wstr long ptr ptr) - # @ stub RtlIpv6AddressToStringA -diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c -index 72ecfd937a..1604513e7e 100644 ---- a/dlls/ntdll/rtl.c -+++ b/dlls/ntdll/rtl.c -@@ -1039,6 +1039,39 @@ NTSTATUS WINAPI RtlIpv4StringToAddressW(const WCHAR *str, BOOLEAN strict, const - return ipv4_string_to_address(str, strict, terminator, address, NULL); - } - -+/*********************************************************************** -+ * RtlIpv4StringToAddressExA [NTDLL.@] -+ */ -+NTSTATUS WINAPI RtlIpv4StringToAddressExA(const char *str, BOOLEAN strict, IN_ADDR *address, USHORT *port) -+{ -+ WCHAR wstr[32]; -+ -+ TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, address, port); -+ -+ if (!str || !address || !port) -+ return STATUS_INVALID_PARAMETER; -+ -+ RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1); -+ return ipv4_string_to_address(wstr, strict, NULL, address, port); -+} -+ -+/*********************************************************************** -+ * RtlIpv4StringToAddressA [NTDLL.@] -+ */ -+NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const char **terminator, IN_ADDR *address) -+{ -+ WCHAR wstr[32]; -+ const WCHAR *wterminator; -+ NTSTATUS ret; -+ -+ TRACE("(%s, %u, %p, %p)\n", debugstr_a(str), strict, terminator, address); -+ -+ RtlMultiByteToUnicodeN(wstr, sizeof(wstr), NULL, str, strlen(str) + 1); -+ ret = ipv4_string_to_address(wstr, strict, &wterminator, address, NULL); -+ if (terminator) *terminator = str + (wterminator - wstr); -+ return ret; -+} -+ - /*********************************************************************** - * RtlIpv6StringToAddressExW [NTDLL.@] - */ --- -2.23.0 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 8f7af50a..9de99a98 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "0c2f5f8b15a4f7bb7008c3efb12b4cd3c774a3a1" + echo "363b8809f37b3ea5915ea4240b3d397fd2355e2e" } # Show version information @@ -169,7 +169,6 @@ patch_enable_all () enable_libs_Debug_Channel="$1" enable_libs_Unicode_Collation="$1" enable_loader_KeyboardLayouts="$1" - enable_macos_compile="$1" enable_mmsystem_dll16_MIDIHDR_Refcount="$1" enable_mountmgr_DosDevices="$1" enable_mscoree_CorValidateImage="$1" @@ -633,9 +632,6 @@ patch_enable () loader-KeyboardLayouts) enable_loader_KeyboardLayouts="$2" ;; - macos-compile) - enable_macos_compile="$2" - ;; mmsystem.dll16-MIDIHDR_Refcount) enable_mmsystem_dll16_MIDIHDR_Refcount="$2" ;; @@ -4361,18 +4357,6 @@ if test "$enable_loader_KeyboardLayouts" -eq 1; then ) >> "$patchlist" fi -# Patchset macos-compile -# | -# | Modified files: -# | * configure, configure.ac, dlls/winemac.drv/cocoa_display.m, include/config.h.in -# | -if test "$enable_macos_compile" -eq 1; then - patch_apply macos-compile/0002-winemac.drv-Fix-build-with-older-macOS-SDKs.patch - ( - printf '%s\n' '+ { "Zhiyi Zhang", "winemac.drv: Fix build with older macOS SDKs.", 1 },'; - ) >> "$patchlist" -fi - # Patchset mmsystem.dll16-MIDIHDR_Refcount # | # | This patchset fixes the following Wine bugs: @@ -4928,13 +4912,9 @@ fi # | * dlls/ntdll/ntdll.spec, dlls/ntdll/rtl.c, dlls/ntdll/tests/rtl.c # | if test "$enable_ntdll_RtlIpv4StringToAddress" -eq 1; then - patch_apply ntdll-RtlIpv4StringToAddress/0001-ntdll-Implement-RtlIpv4StringToAddress-Ex-W.patch - patch_apply ntdll-RtlIpv4StringToAddress/0002-ntdll-Implement-RtlIpv4StringToAddress-Ex-A.patch patch_apply ntdll-RtlIpv4StringToAddress/0003-ntdll-Add-semi-stub-for-RtlIpv6AddressToString-Ex-A.patch patch_apply ntdll-RtlIpv4StringToAddress/0004-ntdll-Implement-RtlIpv6AddressToString-Ex-W.patch ( - printf '%s\n' '+ { "Alex Henrie", "ntdll: Implement RtlIpv4StringToAddress(Ex)W.", 1 },'; - printf '%s\n' '+ { "Alex Henrie", "ntdll: Implement RtlIpv4StringToAddress(Ex)A.", 1 },'; printf '%s\n' '+ { "Alex Henrie", "ntdll: Add semi-stub for RtlIpv6AddressToString(Ex)A.", 1 },'; printf '%s\n' '+ { "Alex Henrie", "ntdll: Implement RtlIpv6AddressToString(Ex)W.", 1 },'; ) >> "$patchlist"