From 6347bdd1fcb600dd41779baf23176d920d4f1632 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 8 Feb 2021 16:01:40 -0600 Subject: [PATCH] Rebase against 7a9745022b1bfcc235b922be98a8fdc91976c587. --- ...-treat-zero-access-mask-in-duplicate.patch | 81 ----------- ...valid-paramater-handling-in-NtAccess.patch | 74 ---------- patches/ntdll-NtAccessCheck/definition | 1 - ...ite-watches-before-passing-userdata-.patch | 21 +-- patches/patchinstall.sh | 34 +---- ...t-namespace-parameter-to-find_type_o.patch | 126 ---------------- ...t-namespace-parameter-for-qualified-.patch | 134 ------------------ ...allow-qualified-types-in-expressions.patch | 86 ----------- ...move-aNAMESPACE-token-from-the-lexer.patch | 84 ----------- ...t-cases-by-using-typename-rule-in-qu.patch | 38 ----- ...eferencing-qualified-interface-names.patch | 60 -------- staging/upstream-commit | 2 +- 12 files changed, 12 insertions(+), 729 deletions(-) delete mode 100644 patches/advapi32-Token_Integrity_Level/0003-server-Correctly-treat-zero-access-mask-in-duplicate.patch delete mode 100644 patches/ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch delete mode 100644 patches/ntdll-NtAccessCheck/definition delete mode 100644 patches/widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch delete mode 100644 patches/widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch delete mode 100644 patches/widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch delete mode 100644 patches/widl-winrt-support/0009-widl-Remove-aNAMESPACE-token-from-the-lexer.patch delete mode 100644 patches/widl-winrt-support/0010-widl-Fold-inherit-cases-by-using-typename-rule-in-qu.patch delete mode 100644 patches/widl-winrt-support/0011-widl-Support-referencing-qualified-interface-names.patch diff --git a/patches/advapi32-Token_Integrity_Level/0003-server-Correctly-treat-zero-access-mask-in-duplicate.patch b/patches/advapi32-Token_Integrity_Level/0003-server-Correctly-treat-zero-access-mask-in-duplicate.patch deleted file mode 100644 index e044be5e..00000000 --- a/patches/advapi32-Token_Integrity_Level/0003-server-Correctly-treat-zero-access-mask-in-duplicate.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 7e73f449d158f0d6a6b6b421d073dbaf1741e1c7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Mon, 7 Aug 2017 02:22:11 +0200 -Subject: server: Correctly treat zero access mask in duplicate_token - wineserver call. - ---- - dlls/advapi32/tests/security.c | 14 +++++++------- - server/token.c | 3 ++- - 2 files changed, 9 insertions(+), 8 deletions(-) - -diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index 4a03db27e69..f1a64e29dea 100644 ---- a/dlls/advapi32/tests/security.c -+++ b/dlls/advapi32/tests/security.c -@@ -7438,7 +7438,7 @@ static void test_token_security_descriptor(void) - ret = DuplicateTokenEx(token4, 0, NULL, SecurityImpersonation, TokenImpersonation, &token5); - ok(ret, "DuplicateTokenEx failed with error %u\n", GetLastError()); - ret = SetThreadToken(NULL, token5); -- todo_wine ok(ret, "SetThreadToken failed with error %u\n", GetLastError()); -+ ok(ret, "SetThreadToken failed with error %u\n", GetLastError()); - CloseHandle(token4); - - /* Restrict current process token while impersonating a medium integrity token */ -@@ -7503,16 +7503,16 @@ static void test_token_security_descriptor(void) - - size = 0; - ret = GetKernelObjectSecurity(token6, LABEL_SECURITY_INFORMATION, NULL, 0, &size); -- todo_wine ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, -+ ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "Unexpected GetKernelObjectSecurity return value %u, error %u\n", ret, GetLastError()); - - sd3 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - ret = GetKernelObjectSecurity(token6, LABEL_SECURITY_INFORMATION, sd3, size, &size); -- todo_wine ok(ret, "GetKernelObjectSecurity failed with error %u\n", GetLastError()); -+ ok(ret, "GetKernelObjectSecurity failed with error %u\n", GetLastError()); - - sacl = NULL; - ret = GetSecurityDescriptorSacl(sd3, &present, &sacl, &defaulted); -- todo_wine ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError()); -+ ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError()); - todo_wine ok(present, "No SACL in the security descriptor\n"); - todo_wine ok(sacl != NULL, "NULL SACL in the security descriptor\n"); - -@@ -7606,16 +7606,16 @@ static void test_token_security_descriptor(void) - - size = 0; - ret = GetKernelObjectSecurity(token4, LABEL_SECURITY_INFORMATION, NULL, 0, &size); -- todo_wine ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, -+ ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "Unexpected GetKernelObjectSecurity return value %u, error %u\n", ret, GetLastError()); - - sd3 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - ret = GetKernelObjectSecurity(token4, LABEL_SECURITY_INFORMATION, sd3, size, &size); -- todo_wine ok(ret, "GetKernelObjectSecurity failed with error %u\n", GetLastError()); -+ ok(ret, "GetKernelObjectSecurity failed with error %u\n", GetLastError()); - - sacl = NULL; - ret = GetSecurityDescriptorSacl(sd3, &present, &sacl, &defaulted); -- todo_wine ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError()); -+ ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError()); - todo_wine ok(present, "No SACL in the security descriptor\n"); - todo_wine ok(sacl != NULL, "NULL SACL in the security descriptor\n"); - -diff --git a/server/token.c b/server/token.c -index 6a1085bae12..292e1df80fd 100644 ---- a/server/token.c -+++ b/server/token.c -@@ -1376,7 +1376,8 @@ DECL_HANDLER(duplicate_token) - struct token *token = token_duplicate( src_token, req->primary, req->impersonation_level, sd, NULL, 0, NULL, 0 ); - if (token) - { -- reply->new_handle = alloc_handle_no_access_check( current->process, token, req->access, objattr->attributes ); -+ unsigned int access = req->access ? req->access : get_handle_access( current->process, req->handle ); -+ reply->new_handle = alloc_handle_no_access_check( current->process, token, access, objattr->attributes ); - release_object( token ); - } - release_object( src_token ); --- -2.13.1 - diff --git a/patches/ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch b/patches/ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch deleted file mode 100644 index 2de35b5d..00000000 --- a/patches/ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 81bd9eaa0466b7adc763d4302ca70141f8aa3947 Mon Sep 17 00:00:00 2001 -From: Qian Hong -Date: Tue, 16 Feb 2016 04:53:12 +0800 -Subject: [PATCH] ntdll: Improve invalid paramater handling in NtAccessCheck. - -Signed-off-by: Qian Hong ---- - dlls/advapi32/tests/security.c | 8 -------- - dlls/ntdll/unix/security.c | 8 +++++++- - 2 files changed, 7 insertions(+), 9 deletions(-) - -diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index 825f8451904..ca6e735c1c6 100644 ---- a/dlls/advapi32/tests/security.c -+++ b/dlls/advapi32/tests/security.c -@@ -1466,10 +1466,8 @@ static void test_AccessCheck(void) - ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, - 0, &PrivSetLen, &Access, &AccessStatus); - err = GetLastError(); --todo_wine - ok(!ret && err == ERROR_INSUFFICIENT_BUFFER, "AccessCheck should have " - "failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err); --todo_wine - ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d\n", PrivSetLen); - ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, - "Access and/or AccessStatus were changed!\n"); -@@ -1520,12 +1518,9 @@ todo_wine - ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, - PrivSet, &PrivSetLen, &Access, &AccessStatus); - err = GetLastError(); --todo_wine - ok(!ret && err == ERROR_INSUFFICIENT_BUFFER, "AccessCheck should have " - "failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err); --todo_wine - ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d\n", PrivSetLen); --todo_wine - ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, - "Access and/or AccessStatus were changed!\n"); - -@@ -1637,12 +1632,9 @@ todo_wine - ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, - PrivSet, &PrivSetLen, &Access, &AccessStatus); - err = GetLastError(); -- todo_wine - ok(!ret && err == ERROR_INSUFFICIENT_BUFFER, "AccessCheck should have " - "failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err); -- todo_wine - ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d\n", PrivSetLen); -- todo_wine - ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, - "Access and/or AccessStatus were changed!\n"); - -diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c -index daecc5e0591..c1237859784 100644 ---- a/dlls/ntdll/unix/security.c -+++ b/dlls/ntdll/unix/security.c -@@ -650,7 +650,13 @@ NTSTATUS WINAPI NtAccessCheck( PSECURITY_DESCRIPTOR descr, HANDLE token, ACCESS_ - TRACE( "(%p, %p, %08x, %p, %p, %p, %p, %p)\n", - descr, token, access, mapping, privs, retlen, access_granted, access_status ); - -- if (!privs || !retlen) return STATUS_ACCESS_VIOLATION; -+ if (!retlen) return STATUS_ACCESS_VIOLATION; -+ if (!*retlen) -+ { -+ *retlen = sizeof(PRIVILEGE_SET); -+ return STATUS_BUFFER_TOO_SMALL; -+ } -+ if (!privs) return STATUS_ACCESS_VIOLATION; - - /* reuse the object attribute SD marshalling */ - InitializeObjectAttributes( &attr, NULL, 0, 0, descr ); --- -2.27.0 - diff --git a/patches/ntdll-NtAccessCheck/definition b/patches/ntdll-NtAccessCheck/definition deleted file mode 100644 index 6bd65e81..00000000 --- a/patches/ntdll-NtAccessCheck/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: Improve invalid paramater handling in NtAccessCheck diff --git a/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch b/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch index 703f6334..c1490760 100644 --- a/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch +++ b/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch @@ -1,28 +1,15 @@ -From 967a59e4a02f5aa9a607e52b3cbc91a0d268c064 Mon Sep 17 00:00:00 2001 +From 00a5e4e8b55ad439d5c3d8faa876d08df8be759f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 4 Oct 2014 02:35:44 +0200 Subject: [PATCH] ntdll: Trigger write watches before passing userdata pointer to wait_reply. --- - dlls/advapi32/tests/security.c | 1 - - dlls/ntdll/unix/server.c | 8 ++++++++ - 2 files changed, 8 insertions(+), 1 deletion(-) + dlls/ntdll/unix/server.c | 8 ++++++++ + 1 file changed, 8 insertions(+) -diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index ab572421a735..01f7a8783b18 100644 ---- a/dlls/advapi32/tests/security.c -+++ b/dlls/advapi32/tests/security.c -@@ -1557,7 +1557,6 @@ todo_wine - "failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err); - todo_wine - ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d\n", PrivSetLen); --todo_wine - ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, - "Access and/or AccessStatus were changed!\n"); - diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c -index 452094ff5dc0..3c0d29a00624 100644 +index 6af8effe9e1..6dbd9cb3ea0 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -282,9 +282,17 @@ unsigned int server_call_unlocked( void *req_ptr ) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 3b96b43d..010879ef 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "4f1b297a14bbd304fb20da7c4b64266c14d110e5" + echo "7a9745022b1bfcc235b922be98a8fdc91976c587" } # Show version information @@ -167,7 +167,6 @@ patch_enable_all () enable_ntdll_Hide_Wine_Exports="$1" enable_ntdll_Junction_Points="$1" enable_ntdll_Manifest_Range="$1" - enable_ntdll_NtAccessCheck="$1" enable_ntdll_NtAlertThreadByThreadId="$1" enable_ntdll_NtDevicePath="$1" enable_ntdll_NtQueryEaFile="$1" @@ -583,9 +582,6 @@ patch_enable () ntdll-Manifest_Range) enable_ntdll_Manifest_Range="$2" ;; - ntdll-NtAccessCheck) - enable_ntdll_NtAccessCheck="$2" - ;; ntdll-NtAlertThreadByThreadId) enable_ntdll_NtAlertThreadByThreadId="$2" ;; @@ -3094,10 +3090,9 @@ fi # | Empires II, MSYS2) # | # | Modified files: -# | * dlls/advapi32/tests/security.c, dlls/kernel32/tests/virtual.c, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/server.c, -# | dlls/ntdll/unix/signal_arm.c, dlls/ntdll/unix/signal_arm64.c, dlls/ntdll/unix/signal_i386.c, -# | dlls/ntdll/unix/signal_x86_64.c, dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c, -# | dlls/psapi/tests/psapi_main.c +# | * dlls/kernel32/tests/virtual.c, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/server.c, dlls/ntdll/unix/signal_arm.c, +# | dlls/ntdll/unix/signal_arm64.c, dlls/ntdll/unix/signal_i386.c, dlls/ntdll/unix/signal_x86_64.c, +# | dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c, dlls/psapi/tests/psapi_main.c # | if test "$enable_ntdll_WRITECOPY" -eq 1; then patch_apply ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch @@ -3213,15 +3208,6 @@ if test "$enable_ntdll_Manifest_Range" -eq 1; then patch_apply ntdll-Manifest_Range/0001-ntdll-Support-ISOLATIONAWARE_MANIFEST_RESOURCE_ID-ra.patch fi -# Patchset ntdll-NtAccessCheck -# | -# | Modified files: -# | * dlls/advapi32/tests/security.c, dlls/ntdll/unix/security.c -# | -if test "$enable_ntdll_NtAccessCheck" -eq 1; then - patch_apply ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch -fi - # Patchset ntdll-NtAlertThreadByThreadId # | # | This patchset fixes the following Wine bugs: @@ -4379,17 +4365,11 @@ fi # | # | Modified files: # | * include/windows.foundation.idl, include/windows.media.speechsynthesis.idl, tools/widl/expr.c, tools/widl/hash.c, -# | tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.h, tools/widl/parser.l, tools/widl/parser.y, -# | tools/widl/typegen.c, tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c, -# | tools/widl/utils.h, tools/widl/widltypes.h +# | tools/widl/hash.h, tools/widl/header.c, tools/widl/parser.l, tools/widl/parser.y, tools/widl/typegen.c, +# | tools/widl/typelib.c, tools/widl/typetree.c, tools/widl/typetree.h, tools/widl/utils.c, tools/widl/utils.h, +# | tools/widl/widltypes.h # | if test "$enable_widl_winrt_support" -eq 1; then - patch_apply widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch - patch_apply widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch - patch_apply widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch - patch_apply widl-winrt-support/0009-widl-Remove-aNAMESPACE-token-from-the-lexer.patch - patch_apply widl-winrt-support/0010-widl-Fold-inherit-cases-by-using-typename-rule-in-qu.patch - patch_apply widl-winrt-support/0011-widl-Support-referencing-qualified-interface-names.patch patch_apply widl-winrt-support/0012-widl-Support-WinRT-activatable-attribute-parsing.patch patch_apply widl-winrt-support/0013-widl-Support-WinRT-static-attribute-parsing.patch patch_apply widl-winrt-support/0014-include-Add-Windows.Media.SpeechSynthesis.SpeechSynt.patch diff --git a/patches/widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch b/patches/widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch deleted file mode 100644 index b16169b0..00000000 --- a/patches/widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch +++ /dev/null @@ -1,126 +0,0 @@ -From f3dedfb67b596ff167e464bc2469be8a00f01be2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Thu, 4 Feb 2021 00:20:02 +0100 -Subject: [PATCH] widl: Add explicit namespace parameter to find_type_or_error. - ---- - tools/widl/parser.y | 37 ++++++++++++++++++------------------- - 1 file changed, 18 insertions(+), 19 deletions(-) - -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 2d527805c14..17a3727b114 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -75,7 +75,7 @@ static void append_chain_callconv(type_t *chain, char *callconv); - static warning_list_t *append_warning(warning_list_t *, int); - - static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); --static type_t *find_type_or_error(const char *name); -+static type_t *find_type_or_error(struct namespace *parent, const char *name); - - static var_t *reg_const(var_t *var); - -@@ -858,17 +858,17 @@ typename: aIDENTIFIER - ident: typename { $$ = make_var($1); } - ; - --base_type: tBYTE { $$ = find_type_or_error($1); } -- | tWCHAR { $$ = find_type_or_error($1); } -+base_type: tBYTE { $$ = find_type_or_error(NULL, $1); } -+ | tWCHAR { $$ = find_type_or_error(NULL, $1); } - | int_std - | tSIGNED int_std { $$ = type_new_int(type_basic_get_type($2), -1); } - | tUNSIGNED int_std { $$ = type_new_int(type_basic_get_type($2), 1); } - | tUNSIGNED { $$ = type_new_int(TYPE_BASIC_INT, 1); } -- | tFLOAT { $$ = find_type_or_error($1); } -- | tDOUBLE { $$ = find_type_or_error($1); } -- | tBOOLEAN { $$ = find_type_or_error($1); } -- | tERRORSTATUST { $$ = find_type_or_error($1); } -- | tHANDLET { $$ = find_type_or_error($1); } -+ | tFLOAT { $$ = find_type_or_error(NULL, $1); } -+ | tDOUBLE { $$ = find_type_or_error(NULL, $1); } -+ | tBOOLEAN { $$ = find_type_or_error(NULL, $1); } -+ | tERRORSTATUST { $$ = find_type_or_error(NULL, $1); } -+ | tHANDLET { $$ = find_type_or_error(NULL, $1); } - ; - - m_int: -@@ -887,12 +887,12 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); } - ; - - qualified_seq: -- aKNOWNTYPE { $$ = find_type_or_error($1); } -+ aKNOWNTYPE { $$ = find_type_or_error(lookup_namespace, $1); } - | aIDENTIFIER '.' { push_lookup_namespace($1); } qualified_seq { $$ = $4; } - ; - - qualified_type: -- aKNOWNTYPE { $$ = find_type_or_error($1); } -+ aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } - | aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; } - ; - -@@ -965,7 +965,7 @@ interfacedef: attributes interface inherit - * definition of a derived class, I'll try to support it with this rule */ - | attributes interface ':' aIDENTIFIER - '{' import int_statements '}' -- semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error($4), $7); } -+ semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error(current_namespace, $4), $7); } - | dispinterfacedef semicolon_opt { $$ = $1; } - ; - -@@ -1189,14 +1189,14 @@ acf_int_statements - - acf_int_statement - : tTYPEDEF acf_attributes aKNOWNTYPE ';' -- { type_t *type = find_type_or_error($3); -+ { type_t *type = find_type_or_error(current_namespace, $3); - type->attrs = append_attr_list(type->attrs, $2); - } - ; - - acf_interface - : acf_attributes tINTERFACE aKNOWNTYPE '{' acf_int_statements '}' -- { type_t *iface = find_type_or_error($3); -+ { type_t *iface = find_type_or_error(current_namespace, $3); - if (type_get_type(iface) != TYPE_INTERFACE) - error_loc("%s is not an interface\n", iface->name); - iface->attrs = append_attr_list(iface->attrs, $1); -@@ -2034,13 +2034,12 @@ type_t *find_type(const char *name, struct namespace *namespace, int t) - return NULL; - } - --static type_t *find_type_or_error(const char *name) -+static type_t *find_type_or_error(struct namespace *namespace, const char *name) - { - type_t *type; -- if (!(type = find_type(name, current_namespace, 0)) && -- !(type = find_type(name, lookup_namespace, 0))) -+ if (!(type = find_type(name, namespace, 0))) - { -- error_loc("type '%s' not found\n", name); -+ error_loc("type '%s' not found in %s namespace\n", name, namespace && namespace->name ? namespace->name : "global"); - return NULL; - } - return type; -@@ -2851,7 +2850,7 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func) - * function */ - var_t *idl_handle = make_var(xstrdup("IDL_handle")); - idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); -- idl_handle->declspec.type = find_type_or_error("handle_t"); -+ idl_handle->declspec.type = find_type_or_error(NULL, "handle_t"); - type_function_add_head_arg(func->declspec.type, idl_handle); - } - } -@@ -3141,7 +3140,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl - LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry ) - { - var_t *var = decl->var; -- type_t *type = find_type_or_error(var->name); -+ type_t *type = find_type_or_error(current_namespace, var->name); - *type_list = xmalloc(sizeof(type_list_t)); - (*type_list)->type = type; - (*type_list)->next = NULL; --- -2.20.1 - diff --git a/patches/widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch b/patches/widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch deleted file mode 100644 index 8257fe03..00000000 --- a/patches/widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 5d47a8f72439a481b5f7ae1700488d9447bf74eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Thu, 4 Feb 2021 00:33:21 +0100 -Subject: [PATCH] widl: Use explicit namespace parameter for qualified names. - -Instead of buggy alternate lookup namespace stack. ---- - tools/widl/parser.y | 52 ++++++++++++++++++++++----------------------- - 1 file changed, 25 insertions(+), 27 deletions(-) - -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 17a3727b114..e4834a06e23 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -76,13 +76,12 @@ static warning_list_t *append_warning(warning_list_t *, int); - - static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); - static type_t *find_type_or_error(struct namespace *parent, const char *name); -+static struct namespace *find_namespace_or_error(struct namespace *namespace, const char *name); - - static var_t *reg_const(var_t *var); - - static void push_namespace(const char *name); - static void pop_namespace(const char *name); --static void init_lookup_namespace(const char *name); --static void push_lookup_namespace(const char *name); - - static void check_arg_attrs(const var_t *arg); - static void check_statements(const statement_list_t *stmts, int is_inside_library); -@@ -120,7 +119,6 @@ static struct namespace global_namespace = { - }; - - static struct namespace *current_namespace = &global_namespace; --static struct namespace *lookup_namespace = &global_namespace; - - static typelib_t *current_typelib; - -@@ -152,6 +150,7 @@ static typelib_t *current_typelib; - enum storage_class stgclass; - enum type_qualifier type_qualifier; - enum function_specifier function_specifier; -+ struct namespace *namespace; - } - - %token aIDENTIFIER aPRAGMA -@@ -288,7 +287,7 @@ static typelib_t *current_typelib; - %type namespacedef - %type base_type int_std - %type enumdef structdef uniondef typedecl --%type type qualified_seq qualified_type -+%type type qualified_type - %type class_interface - %type class_interfaces - %type arg ne_union_field union_field s_field case enum enum_member declaration -@@ -314,6 +313,7 @@ static typelib_t *current_typelib; - %type gbl_statements imp_statements int_statements - %type warnings - %type allocate_option_list allocate_option -+%type namespace_pfx - - %left ',' - %right '?' ':' -@@ -886,15 +886,16 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); } - | tINT3264 { $$ = type_new_int(TYPE_BASIC_INT3264, 0); } - ; - --qualified_seq: -- aKNOWNTYPE { $$ = find_type_or_error(lookup_namespace, $1); } -- | aIDENTIFIER '.' { push_lookup_namespace($1); } qualified_seq { $$ = $4; } -- ; -+namespace_pfx: -+ aNAMESPACE '.' { $$ = find_namespace_or_error(&global_namespace, $1); } -+ | namespace_pfx aNAMESPACE '.' { $$ = find_namespace_or_error($1, $2); } -+ | namespace_pfx aIDENTIFIER '.' { $$ = find_namespace_or_error($1, $2); } -+ ; - - qualified_type: -- aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } -- | aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; } -- ; -+ aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } -+ | namespace_pfx typename { $$ = find_type_or_error($1, $2); } -+ ; - - coclass: tCOCLASS typename { $$ = type_coclass_declare($2); } - ; -@@ -1911,20 +1912,6 @@ static void pop_namespace(const char *name) - current_namespace = current_namespace->parent; - } - --static void init_lookup_namespace(const char *name) --{ -- if (!(lookup_namespace = find_sub_namespace(&global_namespace, name))) -- error_loc("namespace '%s' not found\n", name); --} -- --static void push_lookup_namespace(const char *name) --{ -- struct namespace *namespace; -- if (!(namespace = find_sub_namespace(lookup_namespace, name))) -- error_loc("namespace '%s' not found\n", name); -- lookup_namespace = namespace; --} -- - struct rtype { - const char *name; - type_t *type; -@@ -2045,10 +2032,21 @@ static type_t *find_type_or_error(struct namespace *namespace, const char *name) - return type; - } - -+static struct namespace *find_namespace_or_error(struct namespace *parent, const char *name) -+{ -+ struct namespace *namespace = NULL; -+ -+ if (!winrt_mode) -+ error_loc("namespaces are only supported in winrt mode.\n"); -+ else if (!(namespace = find_sub_namespace(parent, name))) -+ error_loc("namespace '%s' not found in '%s'\n", name, parent->name); -+ -+ return namespace; -+} -+ - int is_type(const char *name) - { -- return find_type(name, current_namespace, 0) != NULL || -- find_type(name, lookup_namespace, 0) != NULL; -+ return find_type(name, current_namespace, 0) != NULL; - } - - int is_namespace(const char *name) --- -2.20.1 - diff --git a/patches/widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch b/patches/widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch deleted file mode 100644 index a6d9a58a..00000000 --- a/patches/widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 170f789b5924560ff2a80565880d73a76ea6c021 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Thu, 4 Feb 2021 11:35:33 +0100 -Subject: [PATCH] widl: Disallow qualified types in expressions. - -MIDL WinRT mode only supports a limited subset of original IDL syntax -anyway, and this will save some conflicts when removing the lexer trick -for namespaces. ---- - tools/widl/parser.y | 24 ++++++++++++++++++------ - 1 file changed, 18 insertions(+), 6 deletions(-) - -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index e4834a06e23..9fb6772ba33 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -279,7 +279,7 @@ static typelib_t *current_typelib; - %type storage_cls_spec - %type type_qualifier m_type_qual_list - %type function_specifier --%type decl_spec decl_spec_no_type m_decl_spec_no_type -+%type decl_spec unqualified_decl_spec decl_spec_no_type m_decl_spec_no_type - %type inherit interface interfacedef - %type interfaceref - %type dispinterface dispinterfacedef -@@ -287,7 +287,7 @@ static typelib_t *current_typelib; - %type namespacedef - %type base_type int_std - %type enumdef structdef uniondef typedecl --%type type qualified_type -+%type type unqualified_type qualified_type - %type class_interface - %type class_interfaces - %type arg ne_union_field union_field s_field case enum enum_member declaration -@@ -763,9 +763,9 @@ expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); } - | '*' expr %prec PPTR { $$ = make_expr1(EXPR_PPTR, $2); } - | expr MEMBERPTR aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, $1), make_exprs(EXPR_IDENTIFIER, $3)); } - | expr '.' aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, $1, make_exprs(EXPR_IDENTIFIER, $3)); } -- | '(' decl_spec m_abstract_declarator ')' expr %prec CAST -+ | '(' unqualified_decl_spec m_abstract_declarator ')' expr %prec CAST - { $$ = make_exprt(EXPR_CAST, declare_var(NULL, $2, $3, 0), $5); free($2); free($3); } -- | tSIZEOF '(' decl_spec m_abstract_declarator ')' -+ | tSIZEOF '(' unqualified_decl_spec m_abstract_declarator ')' - { $$ = make_exprt(EXPR_SIZEOF, declare_var(NULL, $3, $4, 0), NULL); free($3); free($4); } - | expr '[' expr ']' { $$ = make_expr2(EXPR_ARRAY, $1, $3); } - | '(' expr ')' { $$ = $2; } -@@ -1005,6 +1005,12 @@ decl_spec: type m_decl_spec_no_type { $$ = make_decl_spec($1, $2, NULL, STG_NON - { $$ = make_decl_spec($2, $1, $3, STG_NONE, 0, 0); } - ; - -+unqualified_decl_spec: unqualified_type m_decl_spec_no_type -+ { $$ = make_decl_spec($1, $2, NULL, STG_NONE, 0, 0); } -+ | decl_spec_no_type unqualified_type m_decl_spec_no_type -+ { $$ = make_decl_spec($2, $1, $3, STG_NONE, 0, 0); } -+ ; -+ - m_decl_spec_no_type: { $$ = NULL; } - | decl_spec_no_type - ; -@@ -1146,8 +1152,8 @@ pointer_type: - structdef: tSTRUCT m_typename '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); } - ; - --type: tVOID { $$ = type_new_void(); } -- | qualified_type { $$ = $1; } -+unqualified_type: -+ tVOID { $$ = type_new_void(); } - | base_type { $$ = $1; } - | enumdef { $$ = $1; } - | tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); } -@@ -1156,6 +1162,12 @@ type: tVOID { $$ = type_new_void(); } - | uniondef { $$ = $1; } - | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); } - | tSAFEARRAY '(' type ')' { $$ = make_safearray($3); } -+ | aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } -+ ; -+ -+type: -+ unqualified_type -+ | namespace_pfx typename { $$ = find_type_or_error($1, $2); } - ; - - typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list --- -2.20.1 - diff --git a/patches/widl-winrt-support/0009-widl-Remove-aNAMESPACE-token-from-the-lexer.patch b/patches/widl-winrt-support/0009-widl-Remove-aNAMESPACE-token-from-the-lexer.patch deleted file mode 100644 index 82bc7579..00000000 --- a/patches/widl-winrt-support/0009-widl-Remove-aNAMESPACE-token-from-the-lexer.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 7eafbb307b59167e9af8ceb683990a2f3b44b0cc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Thu, 4 Feb 2021 00:40:58 +0100 -Subject: [PATCH] widl: Remove aNAMESPACE token from the lexer. - ---- - tools/widl/parser.h | 1 - - tools/widl/parser.l | 2 +- - tools/widl/parser.y | 13 ++----------- - 3 files changed, 3 insertions(+), 13 deletions(-) - -diff --git a/tools/widl/parser.h b/tools/widl/parser.h -index a6dc94ae6b8..a67b160d48a 100644 ---- a/tools/widl/parser.h -+++ b/tools/widl/parser.h -@@ -38,7 +38,6 @@ void pop_import(void); - #define parse_only import_stack_ptr - - int is_type(const char *name); --int is_namespace(const char *name); - - int do_warning(char *toggle, warning_list_t *wnum); - int is_warning_enabled(int warning); -diff --git a/tools/widl/parser.l b/tools/widl/parser.l -index 7e20d30e7f0..8acc9c9590c 100644 ---- a/tools/widl/parser.l -+++ b/tools/widl/parser.l -@@ -468,7 +468,7 @@ static int kw_token(const char *kw) - return kwp->token; - } - parser_lval.str = xstrdup(kw); -- return is_type(kw) ? aKNOWNTYPE : is_namespace(kw) ? aNAMESPACE : aIDENTIFIER; -+ return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER; - } - - static int attr_token(const char *kw) -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index 9fb6772ba33..d3a79e9fcb7 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -154,7 +154,7 @@ static typelib_t *current_typelib; - } - - %token aIDENTIFIER aPRAGMA --%token aKNOWNTYPE aNAMESPACE -+%token aKNOWNTYPE - %token aNUM aHEXNUM - %token aDOUBLE - %token aSTRING aWSTRING aSQSTRING -@@ -887,8 +887,7 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); } - ; - - namespace_pfx: -- aNAMESPACE '.' { $$ = find_namespace_or_error(&global_namespace, $1); } -- | namespace_pfx aNAMESPACE '.' { $$ = find_namespace_or_error($1, $2); } -+ aIDENTIFIER '.' { $$ = find_namespace_or_error(&global_namespace, $1); } - | namespace_pfx aIDENTIFIER '.' { $$ = find_namespace_or_error($1, $2); } - ; - -@@ -919,7 +918,6 @@ apicontract_def: attributes apicontract '{' '}' semicolon_opt - ; - - namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; } -- | tNAMESPACE aNAMESPACE { $$ = $2; } - ; - - class_interfaces: { $$ = NULL; } -@@ -2061,13 +2059,6 @@ int is_type(const char *name) - return find_type(name, current_namespace, 0) != NULL; - } - --int is_namespace(const char *name) --{ -- if (!winrt_mode) return 0; -- return find_sub_namespace(current_namespace, name) != NULL || -- find_sub_namespace(&global_namespace, name) != NULL; --} -- - type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t) - { - type_t *tp; --- -2.20.1 - diff --git a/patches/widl-winrt-support/0010-widl-Fold-inherit-cases-by-using-typename-rule-in-qu.patch b/patches/widl-winrt-support/0010-widl-Fold-inherit-cases-by-using-typename-rule-in-qu.patch deleted file mode 100644 index a53b0db7..00000000 --- a/patches/widl-winrt-support/0010-widl-Fold-inherit-cases-by-using-typename-rule-in-qu.patch +++ /dev/null @@ -1,38 +0,0 @@ -From fcb515de7ef61b806c7da1fc57875fb60edb59db Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Thu, 4 Feb 2021 13:40:11 +0100 -Subject: [PATCH] widl: Fold inherit cases by using typename rule in - qualified_type. - ---- - tools/widl/parser.y | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index d3a79e9fcb7..bbf71a2e3ef 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -892,7 +892,7 @@ namespace_pfx: - ; - - qualified_type: -- aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } -+ typename { $$ = find_type_or_error(current_namespace, $1); } - | namespace_pfx typename { $$ = find_type_or_error($1, $2); } - ; - -@@ -960,11 +960,6 @@ interfacedef: attributes interface inherit - '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $5); - check_async_uuid($$); - } --/* MIDL is able to import the definition of a base class from inside the -- * definition of a derived class, I'll try to support it with this rule */ -- | attributes interface ':' aIDENTIFIER -- '{' import int_statements '}' -- semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error(current_namespace, $4), $7); } - | dispinterfacedef semicolon_opt { $$ = $1; } - ; - --- -2.20.1 - diff --git a/patches/widl-winrt-support/0011-widl-Support-referencing-qualified-interface-names.patch b/patches/widl-winrt-support/0011-widl-Support-referencing-qualified-interface-names.patch deleted file mode 100644 index d9329b36..00000000 --- a/patches/widl-winrt-support/0011-widl-Support-referencing-qualified-interface-names.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0a610b81e85384af6c3fe086b50adcf7bc6f77cc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Thu, 4 Feb 2021 12:20:26 +0100 -Subject: [PATCH] widl: Support referencing qualified interface names. - -And split the dispinterface case, which is not supported in WinRT mode. ---- - include/windows.media.speechsynthesis.idl | 2 +- - tools/widl/parser.y | 8 +++++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/include/windows.media.speechsynthesis.idl b/include/windows.media.speechsynthesis.idl -index 71c51b74c0c..502261f79c6 100644 ---- a/include/windows.media.speechsynthesis.idl -+++ b/include/windows.media.speechsynthesis.idl -@@ -64,7 +64,7 @@ namespace Windows { - ] - runtimeclass VoiceInformation - { -- [default] interface IVoiceInformation; -+ [default] interface Windows.Media.SpeechSynthesis.IVoiceInformation; - } - } - } -diff --git a/tools/widl/parser.y b/tools/widl/parser.y -index bbf71a2e3ef..b43a1cdd5f2 100644 ---- a/tools/widl/parser.y -+++ b/tools/widl/parser.y -@@ -282,6 +282,7 @@ static typelib_t *current_typelib; - %type decl_spec unqualified_decl_spec decl_spec_no_type m_decl_spec_no_type - %type inherit interface interfacedef - %type interfaceref -+%type dispinterfaceref - %type dispinterface dispinterfacedef - %type module moduledef - %type namespacedef -@@ -926,6 +927,7 @@ class_interfaces: { $$ = NULL; } - - class_interface: - m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; } -+ | m_attributes dispinterfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; } - ; - - dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); } -@@ -965,7 +967,11 @@ interfacedef: attributes interface inherit - - interfaceref: - tINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } -- | tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } -+ | tINTERFACE namespace_pfx typename { $$ = get_type(TYPE_INTERFACE, $3, $2, 0); } -+ ; -+ -+dispinterfaceref: -+ tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } - ; - - module: tMODULE typename { $$ = type_module_declare($2); } --- -2.20.1 - diff --git a/staging/upstream-commit b/staging/upstream-commit index 967c8959..6c1903b0 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -4f1b297a14bbd304fb20da7c4b64266c14d110e5 +7a9745022b1bfcc235b922be98a8fdc91976c587