Zebediah Figura : msi: Protect communication with the custom action server with a critical section.
Module: wine Branch: master Commit: 583edf7f59866cf0a58c978e692f3077e74b4938 URL: https://source.winehq.org/git/wine.git/?a=commit;h=583edf7f59866cf0a58c978e6... Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Aug 16 10:34:38 2018 -0500 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> --- dlls/msi/custom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index a9bb81f..9418b42 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -683,6 +683,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)) { @@ -695,6 +697,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)) {
participants (1)
-
Alexandre Julliard