Rebase against 055bddab4f14a1f73e887b88b86408d654382c2b.

This commit is contained in:
Elizabeth Figura 2024-08-30 17:38:53 -05:00
parent acfbb64262
commit fdd5079133
7 changed files with 31 additions and 445 deletions

View File

@ -1,15 +1,15 @@
From 6a4be6a3089d37ff825853d2644d826d80d59e4f Mon Sep 17 00:00:00 2001
From 601da0ae0c6b22f37d20e6e0f10558093277eca9 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 2 Oct 2014 19:44:31 +0200
Subject: [PATCH] ntdll: Print a warning message specifying the wine-staging
branch name and version.
---
dlls/ntdll/loader.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
dlls/ntdll/loader.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index bad1492e138..6f80e7b3a28 100644
index 5f84ca7e23b..fabf394fbe5 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -43,6 +43,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
@ -20,7 +20,7 @@ index bad1492e138..6f80e7b3a28 100644
#ifdef _WIN64
#define DEFAULT_SECURITY_COOKIE_64 (((ULONGLONG)0x00002b99 << 32) | 0x2ddfa232)
@@ -3823,6 +3824,7 @@ void WINAPI LdrShutdownProcess(void)
@@ -3828,6 +3829,7 @@ void WINAPI LdrShutdownProcess(void)
process_detach();
}
@ -28,7 +28,7 @@ index bad1492e138..6f80e7b3a28 100644
/******************************************************************
* RtlExitUserProcess (NTDLL.@)
@@ -4317,6 +4319,9 @@ static void release_address_space(void)
@@ -4322,6 +4324,9 @@ static void release_address_space(void)
*/
void loader_init( CONTEXT *context, void **entry )
{
@ -38,10 +38,13 @@ index bad1492e138..6f80e7b3a28 100644
static int attach_done;
NTSTATUS status;
ULONG_PTR cookie, port = 0;
@@ -4397,6 +4402,16 @@ void loader_init( CONTEXT *context, void **entry )
@@ -4407,7 +4412,18 @@ void loader_init( CONTEXT *context, void **entry )
arm64ec_thread_init();
#endif
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
+ /* This hunk occasionally applies in the wrong place;
+ * add a comment here to try to prevent that. */
}
+ RtlInitUnicodeString( &staging_event_string, L"\\__wine_staging_warn_event" );
+ InitializeObjectAttributes( &staging_event_attr, &staging_event_string, OBJ_OPENIF, NULL, NULL );
+ if (NtCreateEvent( &staging_event, EVENT_ALL_ACCESS, &staging_event_attr, NotificationEvent, FALSE ) == STATUS_SUCCESS)
@ -51,10 +54,9 @@ index bad1492e138..6f80e7b3a28 100644
+ }
+ else
+ WARN_(winediag)("wine-staging %s is a testing version containing experimental patches.\n", wine_get_version());
+
RtlAcquirePebLock();
InsertHeadList( &tls_links, &NtCurrentTeb()->TlsLinks );
RtlReleasePebLock();
NtCurrentTeb()->FlsSlots = fls_alloc_data();
--
2.43.0
2.45.2

View File

@ -1,4 +1,4 @@
From 7b59a735bf21a4db50669c360666191493767909 Mon Sep 17 00:00:00 2001
From ee26472916e2196456c0c59fb8ca04ee362f148a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 3 Apr 2017 05:30:27 +0200
Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
@ -9,7 +9,7 @@ Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
2 files changed, 117 insertions(+)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 8f418ef09a9..30f089bd64f 100644
index 8b332e479e6..08cb3d3f8ce 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -28,6 +28,7 @@
@ -20,7 +20,7 @@ index 8f418ef09a9..30f089bd64f 100644
#include "wine/test.h"
#include "delayloadhandler.h"
@@ -4205,6 +4206,79 @@ static void test_Wow64Transition(void)
@@ -4641,6 +4642,79 @@ static void test_Wow64Transition(void)
debugstr_wn(name->SectionFileName.Buffer, name->SectionFileName.Length / sizeof(WCHAR)));
}
@ -100,7 +100,7 @@ index 8f418ef09a9..30f089bd64f 100644
START_TEST(loader)
{
int argc;
@@ -4286,6 +4360,7 @@ START_TEST(loader)
@@ -4723,6 +4797,7 @@ START_TEST(loader)
test_InMemoryOrderModuleList();
test_LoadPackagedLibrary();
test_wow64_redirection();
@ -109,10 +109,10 @@ index 8f418ef09a9..30f089bd64f 100644
test_dll_file( "kernel32.dll" );
test_dll_file( "advapi32.dll" );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 714d3f17ff0..415fcbb1aa6 100644
index 5f84ca7e23b..4da48a82d74 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -133,6 +133,9 @@ struct file_id
@@ -128,6 +128,9 @@ struct file_id
BYTE ObjectId[16];
};
@ -122,7 +122,7 @@ index 714d3f17ff0..415fcbb1aa6 100644
/* internal representation of loaded modules */
typedef struct _wine_modref
{
@@ -548,6 +551,33 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
@@ -556,6 +559,33 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
}
}
@ -156,7 +156,7 @@ index 714d3f17ff0..415fcbb1aa6 100644
/*************************************************************************
* get_modref
*
@@ -1528,7 +1558,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1557,7 +1587,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
&wm->ldr.InLoadOrderLinks);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderLinks);
@ -169,7 +169,7 @@ index 714d3f17ff0..415fcbb1aa6 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -2226,6 +2261,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -2253,6 +2288,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@ -177,7 +177,7 @@ index 714d3f17ff0..415fcbb1aa6 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3908,6 +3944,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3916,6 +3952,7 @@ static void free_modref( WINE_MODREF *wm )
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@ -185,7 +185,7 @@ index 714d3f17ff0..415fcbb1aa6 100644
if (wm->ldr.InInitializationOrderLinks.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderLinks);
@@ -4263,6 +4300,7 @@ void loader_init( CONTEXT *context, void **entry )
@@ -4336,6 +4373,7 @@ void loader_init( CONTEXT *context, void **entry )
ANSI_STRING ctrl_routine = RTL_CONSTANT_STRING( "CtrlRoutine" );
WINE_MODREF *kernel32;
PEB *peb = NtCurrentTeb()->Peb;
@ -193,9 +193,9 @@ index 714d3f17ff0..415fcbb1aa6 100644
peb->LdrData = &ldr;
peb->FastPebLock = &peb_lock;
@@ -4278,6 +4316,10 @@ void loader_init( CONTEXT *context, void **entry )
RtlSetBits( peb->TlsBitmap, 0, NtCurrentTeb()->WowTebOffset ? WOW64_TLS_MAX_NUMBER : 1 );
RtlSetBits( peb->TlsBitmap, NTDLL_TLS_ERRNO, 1 );
@@ -4354,6 +4392,10 @@ void loader_init( CONTEXT *context, void **entry )
if (!(tls_dirs = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, tls_module_count * sizeof(*tls_dirs) )))
NtTerminateProcess( GetCurrentProcess(), STATUS_NO_MEMORY );
+ /* initialize hash table */
+ for (i = 0; i < HASH_MAP_SIZE; i++)
@ -205,5 +205,5 @@ index 714d3f17ff0..415fcbb1aa6 100644
load_global_options();
version_init();
--
2.43.0
2.45.2

View File

@ -1,23 +0,0 @@
From bc118983b67f87ed7858711d03cff34050b92770 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 6 Aug 2017 02:50:23 +0200
Subject: [PATCH] packager: Prefer native version.
---
dlls/packager/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/packager/Makefile.in b/dlls/packager/Makefile.in
index 5fc89d807a8..3589b37be9c 100644
--- a/dlls/packager/Makefile.in
+++ b/dlls/packager/Makefile.in
@@ -1,5 +1,6 @@
MODULE = packager.dll
IMPORTS = uuid shell32 shlwapi user32
+EXTRADLLFLAGS = -Wb,--prefer-native
SOURCES = \
packager.rc \
--
2.42.0

View File

@ -1 +0,0 @@
Fixes: [43472] Prefer native version of packager.dll

View File

@ -1,391 +0,0 @@
From 3699802cf7dd4a6afa594530f5802fa84a720dbf Mon Sep 17 00:00:00 2001
From: Jeremy White <jwhite@codeweavers.com>
Date: Thu, 29 Mar 2018 11:58:25 +1100
Subject: [PATCH] winemapi: Directly use xdg-email if available, enabling file
attachments.
v2:
Use new heap_* function.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=11770
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
---
dlls/winemapi/Makefile.in | 3 +-
dlls/winemapi/sendmail.c | 48 ++++--
dlls/winemapi/winemapi_private.h | 27 ++++
dlls/winemapi/xdg-email.c | 241 +++++++++++++++++++++++++++++++
4 files changed, 304 insertions(+), 15 deletions(-)
create mode 100644 dlls/winemapi/winemapi_private.h
create mode 100644 dlls/winemapi/xdg-email.c
diff --git a/dlls/winemapi/Makefile.in b/dlls/winemapi/Makefile.in
index c9c5a5152f4..99aea124605 100644
--- a/dlls/winemapi/Makefile.in
+++ b/dlls/winemapi/Makefile.in
@@ -3,4 +3,5 @@ IMPORTS = shlwapi shell32 mapi32
SOURCES = \
main.c \
- sendmail.c
+ sendmail.c \
+ xdg-email.c
diff --git a/dlls/winemapi/sendmail.c b/dlls/winemapi/sendmail.c
index 1bd3908ef6d..053d39b009d 100644
--- a/dlls/winemapi/sendmail.c
+++ b/dlls/winemapi/sendmail.c
@@ -34,6 +34,8 @@
#include "winternl.h"
#include "wine/debug.h"
+#include "winemapi_private.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(winemapi);
/* Escapes a string for use in mailto: URL */
@@ -68,23 +70,12 @@ static char *escape_string(char *in, char *empty_string)
}
/**************************************************************************
- * MAPISendMail
- *
- * Send a message using a native mail client.
- *
- * PARAMS
- * session [I] Handle to a MAPI session.
- * uiparam [I] Parent window handle.
- * message [I] Pointer to a MAPIMessage structure.
- * flags [I] Flags.
- * reserved [I] Reserved, pass 0.
+ * BrowserSendMail
*
- * RETURNS
- * Success: SUCCESS_SUCCESS
- * Failure: MAPI_E_FAILURE
+ * Send an email by forming a mailto uri and invoking a browser.
*
*/
-ULONG WINAPI MAPISendMail(LHANDLE session, ULONG_PTR uiparam,
+static ULONG BrowserSendMail(LHANDLE session, ULONG_PTR uiparam,
lpMapiMessage message, FLAGS flags, ULONG reserved)
{
ULONG ret = MAPI_E_FAILURE;
@@ -289,6 +280,35 @@ exit:
return ret;
}
+/**************************************************************************
+ * MAPISendMail
+ *
+ * Send a message using a native mail client.
+ *
+ * PARAMS
+ * session [I] Handle to a MAPI session.
+ * uiparam [I] Parent window handle.
+ * message [I] Pointer to a MAPIMessage structure.
+ * flags [I] Flags.
+ * reserved [I] Reserved, pass 0.
+ *
+ * RETURNS
+ * Success: SUCCESS_SUCCESS
+ * Failure: MAPI_E_FAILURE
+ *
+ */
+ULONG WINAPI MAPISendMail(LHANDLE session, ULONG_PTR uiparam,
+ lpMapiMessage message, FLAGS flags, ULONG reserved)
+{
+ TRACE("(0x%I64x 0x%I64x %p 0x%08lx 0x%08lx)\n", session, uiparam,
+ message, flags, reserved);
+
+ if (XDGMailAvailable())
+ return XDGSendMail(session, uiparam, message, flags, reserved);
+
+ return BrowserSendMail(session, uiparam, message, flags, reserved);
+}
+
ULONG WINAPI MAPISendDocuments(ULONG_PTR uiparam, LPSTR delim, LPSTR paths,
LPSTR filenames, ULONG reserved)
{
diff --git a/dlls/winemapi/winemapi_private.h b/dlls/winemapi/winemapi_private.h
new file mode 100644
index 00000000000..a8bb8c5e075
--- /dev/null
+++ b/dlls/winemapi/winemapi_private.h
@@ -0,0 +1,27 @@
+/*
+ *
+ * Copyright 2016 Jeremy White
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINEMAPI_PRIVATE_INCLUDED__
+#define __WINEMAPI_PRIVATE_INCLUDED__
+
+ULONG XDGSendMail(LHANDLE session, ULONG_PTR uiparam,
+ lpMapiMessage message, FLAGS flags, ULONG reserved);
+BOOLEAN XDGMailAvailable(void);
+
+#endif /* __WINEMAPI_PRIVATE_INCLUDED__ */
diff --git a/dlls/winemapi/xdg-email.c b/dlls/winemapi/xdg-email.c
new file mode 100644
index 00000000000..a92f8ca079a
--- /dev/null
+++ b/dlls/winemapi/xdg-email.c
@@ -0,0 +1,241 @@
+/*
+ * MAPISendMail implementation for xdg-email
+ *
+ * Copyright 2016 Jeremy White for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winnls.h"
+#include "mapi.h"
+#include "process.h"
+#include "wine/heap.h"
+#include "wine/debug.h"
+
+#include "winemapi_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winemapi);
+
+static inline WCHAR *heap_strdupAtoW(const char *str)
+{
+ LPWSTR ret = NULL;
+
+ if(str) {
+ DWORD len;
+
+ len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+ ret = heap_alloc(len*sizeof(WCHAR));
+ if(ret)
+ MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
+ }
+
+ return ret;
+}
+
+static void add_argument(char **argv, int *argc, const char *arg, const char *param)
+{
+ argv[(*argc)] = heap_alloc(strlen(arg) + 1);
+ strcpy(argv[(*argc)++], arg);
+ if (param)
+ {
+ argv[(*argc)] = heap_alloc(strlen(param) + 1);
+ strcpy(argv[(*argc)++], param);
+ }
+}
+
+static void add_target(char **argv, int *argc, ULONG class, const char *address)
+{
+ static const char smtp[] = "smtp:";
+
+ if (!strncasecmp(address, smtp, sizeof(smtp) - 1))
+ address += sizeof(smtp) - 1;
+
+ switch (class)
+ {
+ case MAPI_ORIG:
+ TRACE("From: %s\n (unused)", debugstr_a(address));
+ break;
+
+ case MAPI_TO:
+ TRACE("To: %s\n", debugstr_a(address));
+ add_argument(argv, argc, address, NULL);
+ break;
+
+ case MAPI_CC:
+ TRACE("CC: %s\n", debugstr_a(address));
+ add_argument(argv, argc, "--cc", address);
+ break;
+
+ case MAPI_BCC:
+ TRACE("BCC: %s\n", debugstr_a(address));
+ add_argument(argv, argc, "--bcc", address);
+ break;
+
+ default:
+ TRACE("Unknown recipient class: %ld\n", class);
+ }
+}
+
+static void add_file(char **argv, int *argc, const char *path, const char *file)
+{
+ char fullname[MAX_PATH] = {0};
+ WCHAR *fullnameW;
+ char *unixpath;
+
+ if (path)
+ {
+ strcpy(fullname, path);
+ strcat(fullname, "\\");
+ }
+ if (file)
+ strcat(fullname, file);
+
+ fullnameW = heap_strdupAtoW(fullname);
+ if(!fullnameW)
+ {
+ ERR("Out of memory\n");
+ return;
+ }
+
+ unixpath = wine_get_unix_file_name(fullnameW);
+ if (unixpath)
+ {
+ add_argument(argv, argc, "--attach", unixpath);
+ heap_free(unixpath);
+ }
+ else
+ ERR("Cannot find unix path of '%s'; not attaching.\n", debugstr_w(fullnameW));
+
+ heap_free(fullnameW);
+}
+
+/**************************************************************************
+ * XDGIsAvailable
+ *
+ */
+BOOLEAN XDGMailAvailable(void)
+{
+#ifdef HAVE_UNISTD_H
+ char *p, *q, *test;
+ int len;
+ int rc;
+
+ for (p = getenv("PATH"); p; p = q)
+ {
+ while (*p == ':')
+ p++;
+
+ if (!*p)
+ break;
+
+ q = strchr(p, ':');
+ len = q ? q - p : strlen(p);
+
+ test = heap_alloc(len + strlen("xdg-email") + 2); /* '/' + NULL */
+ if(!test)
+ break;
+ memcpy(test, p, len);
+ strcpy(test + len, "/");
+ strcat(test, "xdg-email");
+
+ rc = access(test, X_OK);
+ heap_free(test);
+
+ if (rc == 0)
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
+/**************************************************************************
+ * XDGSendMail
+ *
+ * Send a message using xdg-email mail client.
+ *
+ */
+ULONG XDGSendMail(LHANDLE session, ULONG_PTR uiparam,
+ lpMapiMessage message, FLAGS flags, ULONG reserved)
+{
+ int i;
+ int argc = 0;
+ int max_args;
+ char **argv = NULL;
+ ULONG ret = MAPI_E_FAILURE;
+
+ TRACE("(0x%08lx 0x%08lx %p 0x%08x 0x%08x)\n", session, uiparam, message, flags, reserved);
+
+ if (!message)
+ return MAPI_E_FAILURE;
+
+ max_args = 1 + (2 + message->nRecipCount + message->nFileCount) * 2;
+ argv = heap_alloc_zero( (max_args + 1) * sizeof(*argv));
+
+ add_argument(argv, &argc, "xdg-email", NULL);
+
+ if (message->lpOriginator)
+ TRACE("From: %s (unused)\n", debugstr_a(message->lpOriginator->lpszAddress));
+
+ for (i = 0; i < message->nRecipCount; i++)
+ {
+ if (!message->lpRecips)
+ {
+ WARN("Recipient %d missing\n", i);
+ goto exit;
+ }
+
+ if (message->lpRecips[i].lpszAddress)
+ add_target(argv, &argc, message->lpRecips[i].ulRecipClass,
+ message->lpRecips[i].lpszAddress);
+ else
+ FIXME("Name resolution and entry identifiers not supported\n");
+ }
+
+ for (i = 0; i < message->nFileCount; i++)
+ {
+ TRACE("File Path: %s, name %s\n", debugstr_a(message->lpFiles[i].lpszPathName),
+ debugstr_a(message->lpFiles[i].lpszFileName));
+ add_file(argv, &argc, message->lpFiles[i].lpszPathName, message->lpFiles[i].lpszFileName);
+ }
+
+ if (message->lpszSubject)
+ {
+ TRACE("Subject: %s\n", debugstr_a(message->lpszSubject));
+ add_argument(argv, &argc, "--subject", message->lpszSubject);
+ }
+
+ if (message->lpszNoteText)
+ {
+ TRACE("Body: %s\n", debugstr_a(message->lpszNoteText));
+ add_argument(argv, &argc, "--body", message->lpszNoteText);
+ }
+
+ TRACE("Executing xdg-email; parameters:\n");
+ for (i = 0; argv[i] && i <= max_args; i++)
+ TRACE(" %d: [%s]\n", i, argv[i]);
+ if (_spawnvp(_P_WAIT, "xdg-email", (const char **) argv) == 0)
+ ret = SUCCESS_SUCCESS;
+
+exit:
+ heap_free(argv);
+ return ret;
+}
--
2.42.0

View File

@ -1 +0,0 @@
Fixes: [11770] - use xdg-email if it's available.

View File

@ -1 +1 @@
e3d2620bdf6f8e91a5ccf5904f256a55a5af137e
055bddab4f14a1f73e887b88b86408d654382c2b