mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Rebase against 0c7a09cb1f92d55d8381ff6460e13ed085d434db.
This commit is contained in:
parent
7d2672183d
commit
9486ca2543
@ -1,144 +0,0 @@
|
||||
From ed725c78b5deb6c482a60ac26eda5f5d58ab531c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Tue, 26 Oct 2021 19:07:26 +0300
|
||||
Subject: [PATCH] ntdll: Don't use Wine frames during exception processing on
|
||||
x64.
|
||||
|
||||
CW-Bug-ID: #19570
|
||||
---
|
||||
dlls/ntdll/signal_x86_64.c | 65 +++++++++++++++++++++++++++-----------
|
||||
1 file changed, 46 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
|
||||
index ac543338893..f2c7cad5675 100644
|
||||
--- a/dlls/ntdll/signal_x86_64.c
|
||||
+++ b/dlls/ntdll/signal_x86_64.c
|
||||
@@ -348,15 +348,32 @@ __ASM_GLOBAL_FUNC( RtlCaptureContext,
|
||||
"fxsave 0x100(%rcx)\n\t" /* context->FltSave */
|
||||
"ret" );
|
||||
|
||||
-static DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
|
||||
+DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
|
||||
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
|
||||
{
|
||||
+ TRACE( "exception flags %#x.\n", rec->ExceptionFlags );
|
||||
+
|
||||
if (!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))
|
||||
- rec->ExceptionFlags |= EH_NESTED_CALL;
|
||||
+ return ExceptionNestedException;
|
||||
|
||||
return ExceptionContinueSearch;
|
||||
}
|
||||
|
||||
+/***********************************************************************
|
||||
+ * exception_handler_call_wrapper
|
||||
+ */
|
||||
+DWORD exception_handler_call_wrapper( EXCEPTION_RECORD *rec, void *frame,
|
||||
+ CONTEXT *context, DISPATCHER_CONTEXT *dispatch );
|
||||
+__ASM_GLOBAL_FUNC( exception_handler_call_wrapper,
|
||||
+ __ASM_SEH(".seh_endprologue\n\t")
|
||||
+ "subq $0x28, %rsp\n\t"
|
||||
+ __ASM_SEH(".seh_stackalloc 0x28\n\t")
|
||||
+ __ASM_SEH(".seh_handler nested_exception_handler, @except\n\t")
|
||||
+ "callq *0x30(%r9)\n\t" /* dispatch->LanguageHandler */
|
||||
+ "nop\n\t"
|
||||
+ "addq $0x28, %rsp\n\t"
|
||||
+ "ret" );
|
||||
+
|
||||
/**********************************************************************
|
||||
* call_handler
|
||||
*
|
||||
@@ -365,19 +382,19 @@ static DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_
|
||||
*/
|
||||
static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_CONTEXT *dispatch )
|
||||
{
|
||||
- EXCEPTION_REGISTRATION_RECORD frame;
|
||||
DWORD res;
|
||||
|
||||
- frame.Handler = nested_exception_handler;
|
||||
- __wine_push_frame( &frame );
|
||||
-
|
||||
TRACE_(seh)( "calling handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
|
||||
dispatch->LanguageHandler, rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
|
||||
- res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, context, dispatch );
|
||||
+ res = exception_handler_call_wrapper( rec, (void *)dispatch->EstablisherFrame, context, dispatch );
|
||||
TRACE_(seh)( "handler at %p returned %lu\n", dispatch->LanguageHandler, res );
|
||||
|
||||
rec->ExceptionFlags &= EH_NONCONTINUABLE;
|
||||
- __wine_pop_frame( &frame );
|
||||
+ if (res == ExceptionNestedException)
|
||||
+ {
|
||||
+ rec->ExceptionFlags |= EH_NESTED_CALL;
|
||||
+ res = ExceptionContinueSearch;
|
||||
+ }
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -992,7 +1009,8 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc,
|
||||
|
||||
struct unwind_exception_frame
|
||||
{
|
||||
- EXCEPTION_REGISTRATION_RECORD frame;
|
||||
+ BYTE dummy[0x28];
|
||||
+ void *rip;
|
||||
DISPATCHER_CONTEXT *dispatch;
|
||||
};
|
||||
|
||||
@@ -1001,7 +1019,7 @@ struct unwind_exception_frame
|
||||
*
|
||||
* Handler for exceptions happening while calling an unwind handler.
|
||||
*/
|
||||
-static DWORD __cdecl unwind_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
|
||||
+DWORD __cdecl unwind_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
|
||||
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
|
||||
{
|
||||
struct unwind_exception_frame *unwind_frame = (struct unwind_exception_frame *)frame;
|
||||
@@ -1021,27 +1039,36 @@ static DWORD __cdecl unwind_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_
|
||||
return ExceptionCollidedUnwind;
|
||||
}
|
||||
|
||||
+/***********************************************************************
|
||||
+ * exception_handler_call_wrapper
|
||||
+ */
|
||||
+DWORD unwind_handler_call_wrapper( EXCEPTION_RECORD *rec, void *frame,
|
||||
+ CONTEXT *context, DISPATCHER_CONTEXT *dispatch );
|
||||
+__ASM_GLOBAL_FUNC( unwind_handler_call_wrapper,
|
||||
+ __ASM_SEH(".seh_endprologue\n\t")
|
||||
+ "movq %r9, 0x8(%rsp)\n\t"
|
||||
+ "subq $0x28, %rsp\n\t"
|
||||
+ __ASM_SEH(".seh_stackalloc 0x28\n\t")
|
||||
+ __ASM_SEH(".seh_handler unwind_exception_handler, @except, @unwind\n\t")
|
||||
+ "callq *0x30(%r9)\n\t" /* dispatch->LanguageHandler */
|
||||
+ "nop\n\t"
|
||||
+ "addq $0x28, %rsp\n\t"
|
||||
+ "ret" );
|
||||
+
|
||||
/**********************************************************************
|
||||
* call_unwind_handler
|
||||
*
|
||||
* Call a single unwind handler.
|
||||
*/
|
||||
-static DWORD call_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT *dispatch )
|
||||
+DWORD call_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT *dispatch )
|
||||
{
|
||||
- struct unwind_exception_frame frame;
|
||||
DWORD res;
|
||||
|
||||
- frame.frame.Handler = unwind_exception_handler;
|
||||
- frame.dispatch = dispatch;
|
||||
- __wine_push_frame( &frame.frame );
|
||||
-
|
||||
TRACE( "calling handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
|
||||
dispatch->LanguageHandler, rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
|
||||
- res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
|
||||
+ res = unwind_handler_call_wrapper( rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
|
||||
TRACE( "handler %p returned %lx\n", dispatch->LanguageHandler, res );
|
||||
|
||||
- __wine_pop_frame( &frame.frame );
|
||||
-
|
||||
switch (res)
|
||||
{
|
||||
case ExceptionContinueSearch:
|
||||
--
|
||||
2.38.1
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [52396] ntdll: Don't use Wine frames during exception processing on x64.
|
@ -1,4 +1,4 @@
|
||||
From f8f76a379516681dd481dd6634f2ea8a4b0f130e Mon Sep 17 00:00:00 2001
|
||||
From 71e7aebe51554503f7f1837104cf178d8073cb41 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sun, 7 May 2023 22:34:15 -0600
|
||||
Subject: [PATCH] winemenubuilder: Create .desktop files for programs that open
|
||||
@ -6,11 +6,11 @@ Subject: [PATCH] winemenubuilder: Create .desktop files for programs that open
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22904
|
||||
---
|
||||
programs/winemenubuilder/winemenubuilder.c | 163 ++++++++++++---------
|
||||
1 file changed, 95 insertions(+), 68 deletions(-)
|
||||
programs/winemenubuilder/winemenubuilder.c | 157 ++++++++++++---------
|
||||
1 file changed, 92 insertions(+), 65 deletions(-)
|
||||
|
||||
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
|
||||
index 9459b77b502..77acf943c42 100644
|
||||
index 82fece62eb5..e97a6612b63 100644
|
||||
--- a/programs/winemenubuilder/winemenubuilder.c
|
||||
+++ b/programs/winemenubuilder/winemenubuilder.c
|
||||
@@ -1831,10 +1831,13 @@ static BOOL has_association_changed(LPCWSTR extensionW, const WCHAR *mimeType, c
|
||||
@ -40,28 +40,27 @@ index 9459b77b502..77acf943c42 100644
|
||||
RegSetValueExW(subkey, L"AppName", 0, REG_SZ, (const BYTE*) appName, (lstrlenW(appName) + 1) * sizeof(WCHAR));
|
||||
RegSetValueExW(subkey, L"DesktopFile", 0, REG_SZ, (const BYTE*) desktopFile, (lstrlenW(desktopFile) + 1) * sizeof(WCHAR));
|
||||
if (openWithIcon)
|
||||
@@ -1962,12 +1965,16 @@ static BOOL write_freedesktop_mime_type_entry(const WCHAR *packages_dir, const W
|
||||
@@ -1962,7 +1965,7 @@ static BOOL write_freedesktop_mime_type_entry(const WCHAR *packages_dir, const W
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static BOOL is_extension_banned(LPCWSTR extension)
|
||||
+static BOOL is_type_banned(const WCHAR *win_type)
|
||||
+static BOOL is_type_banned(LPCWSTR extension)
|
||||
{
|
||||
/* These are managed through external tools like wine.desktop, to evade malware created file type associations */
|
||||
- if (!wcsicmp(extension, L".com") ||
|
||||
- !wcsicmp(extension, L".exe") ||
|
||||
- !wcsicmp(extension, L".msi"))
|
||||
+ if (!wcsicmp(win_type, L".com") ||
|
||||
+ !wcsicmp(win_type, L".exe") ||
|
||||
+ !wcsicmp(win_type, L".msi"))
|
||||
+ return TRUE;
|
||||
if (!wcsicmp(extension, L".bat") ||
|
||||
@@ -1970,6 +1973,10 @@ static BOOL is_extension_banned(LPCWSTR extension)
|
||||
!wcsicmp(extension, L".exe") ||
|
||||
!wcsicmp(extension, L".msi"))
|
||||
return TRUE;
|
||||
+ /* Associating a program with the file URI scheme is like associating it with all file types, which is not allowed
|
||||
+ * for the same reasons */
|
||||
+ if (!wcsicmp(win_type, L"file"))
|
||||
return TRUE;
|
||||
+ if (!wcsicmp(extension, L"file"))
|
||||
+ return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2041,11 +2048,15 @@ static BOOL write_freedesktop_association_entry(const WCHAR *desktopPath, const
|
||||
|
||||
@@ -2042,11 +2049,15 @@ static BOOL write_freedesktop_association_entry(const WCHAR *desktopPath, const
|
||||
if (prefix)
|
||||
{
|
||||
char *path = wine_get_unix_file_name( prefix );
|
||||
@ -79,7 +78,7 @@ index 9459b77b502..77acf943c42 100644
|
||||
fprintf(desktop, "NoDisplay=true\n");
|
||||
fprintf(desktop, "StartupNotify=true\n");
|
||||
if (openWithIcon)
|
||||
@@ -2073,12 +2084,19 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
@@ -2074,12 +2085,19 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
@ -102,7 +101,7 @@ index 9459b77b502..77acf943c42 100644
|
||||
{
|
||||
WCHAR *commandW = NULL;
|
||||
WCHAR *executableW = NULL;
|
||||
@@ -2092,7 +2110,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
@@ -2093,7 +2111,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
WCHAR *mimeProgId = NULL;
|
||||
struct rb_string_entry *entry;
|
||||
|
||||
@ -111,7 +110,7 @@ index 9459b77b502..77acf943c42 100644
|
||||
if (commandW == NULL)
|
||||
/* no command => no application is associated */
|
||||
goto end;
|
||||
@@ -2101,78 +2119,87 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
@@ -2102,78 +2120,87 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
/* command is on the exclude list => desktop integration is not desirable */
|
||||
goto end;
|
||||
|
||||
@ -251,7 +250,7 @@ index 9459b77b502..77acf943c42 100644
|
||||
}
|
||||
free(desktopPath);
|
||||
}
|
||||
@@ -2189,7 +2216,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
@@ -2190,7 +2217,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||
free(mimeType);
|
||||
free(progIdW);
|
||||
}
|
||||
@ -261,5 +260,5 @@ index 9459b77b502..77acf943c42 100644
|
||||
|
||||
wine_rb_destroy(&mimeProgidTree, winemenubuilder_rb_destroy, NULL);
|
||||
--
|
||||
2.40.1
|
||||
2.42.0
|
||||
|
||||
|
@ -1 +1 @@
|
||||
de66ea9df6746917cada71d2c27b5cc38cbdd2f0
|
||||
0c7a09cb1f92d55d8381ff6460e13ed085d434db
|
||||
|
Loading…
Reference in New Issue
Block a user