https://git.reactos.org/?p=reactos.git;a=commitdiff;h=33595a42c9b9bd4bf5c257b158446b16ef14f0b1

commit 33595a42c9b9bd4bf5c257b158446b16ef14f0b1
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 23:54:32 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:59 2022 +0100

    [WINESYNC] msiexec: Don't keep the custom action GUID in the main thread's 
stack.
    
    Since it could potentially change on us during an asynchronous custom 
action.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 2592690540a87498db09753a32c416cfe7f26e81 by Zebediah Figura 
<[email protected]>
---
 base/system/msiexec/msiexec.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/base/system/msiexec/msiexec.c b/base/system/msiexec/msiexec.c
index ead3bfb9dea..efbcb5c7f4d 100644
--- a/base/system/msiexec/msiexec.c
+++ b/base/system/msiexec/msiexec.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 
 #include "wine/debug.h"
+#include "wine/heap.h"
 #include "wine/unicode.h"
 
 #include "initguid.h"
@@ -400,20 +401,21 @@ extern UINT CDECL __wine_msi_call_dll_function(GUID 
*guid);
 
 static DWORD CALLBACK custom_action_thread(void *arg)
 {
-    GUID *guid = arg;
-    return __wine_msi_call_dll_function(guid);
+    GUID guid = *(GUID *)arg;
+    heap_free(arg);
+    return __wine_msi_call_dll_function(&guid);
 }
 
 static int custom_action_server(const WCHAR *arg)
 {
     static const WCHAR pipe_name[] = 
{'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0};
     DWORD client_pid = atoiW(arg);
+    GUID guid, *thread_guid;
     DWORD64 thread64;
     WCHAR buffer[24];
     HANDLE thread;
     HANDLE pipe;
     DWORD size;
-    GUID guid;
 
     TRACE("%s\n", debugstr_w(arg));
 
@@ -443,7 +445,9 @@ static int custom_action_server(const WCHAR *arg)
             return 0;
         }
 
-        thread = CreateThread(NULL, 0, custom_action_thread, &guid, 0, NULL);
+        thread_guid = heap_alloc(sizeof(GUID));
+        memcpy(thread_guid, &guid, sizeof(GUID));
+        thread = CreateThread(NULL, 0, custom_action_thread, thread_guid, 0, 
NULL);
 
         /* give the thread handle to the client to wait on, since we might have
          * to run a nested action and can't block during this one */

Reply via email to