https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b1b2cc1e8d83431bb5acc…
commit b1b2cc1e8d83431bb5acce3f341b6748acb1da34
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 23:54:31 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:59 2022 +0100
[WINESYNC] msi: Protect communication with the custom action server with a critical
section.
Avoids a potential race whereby an asynchronous custom action receives the
wrong thread handle.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 583edf7f59866cf0a58c978e692f3077e74b4938 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/custom.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c
index 3d426190f00..9cf3ba1081c 100644
--- a/dll/win32/msi/custom.c
+++ b/dll/win32/msi/custom.c
@@ -698,6 +698,8 @@ static DWORD WINAPI custom_client_thread(void *arg)
pipe = info->package->custom_server_64_pipe;
}
+ EnterCriticalSection(&msi_custom_action_cs);
+
if (!WriteFile(pipe, &info->guid, sizeof(info->guid), &size, NULL) ||
size != sizeof(info->guid))
{
@@ -710,6 +712,8 @@ static DWORD WINAPI custom_client_thread(void *arg)
return GetLastError();
}
+ LeaveCriticalSection(&msi_custom_action_cs);
+
if (DuplicateHandle(process, (HANDLE)(DWORD_PTR)thread64, GetCurrentProcess(),
&thread, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
{