shell32: Wait for process to finish when using flag SEE_MASK_NOASYNC

Carlos Palminha CARLOS.PALMINHA at synopsys.com
Tue Aug 8 10:50:13 CDT 2017


Support for SEE_MASK_NOASYNC (same value as SEE_MASK_FLAG_DDEWAIT).
Waits for process execution to finish before returning.

Signed-off-by: Carlos Palminha <palminha at synopsys.com>
---
 dlls/shell32/shlexec.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index c0ef53ab8e7..fe3eeeb5743 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -344,6 +344,11 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
     dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
     if (!(psei->fMask & SEE_MASK_NO_CONSOLE))
         dwCreationFlags |= CREATE_NEW_CONSOLE;
+
+    if(psei->fMask & SEE_MASK_NOASYNC) {
+        dwCreationFlags |= SEE_MASK_NOASYNC;
+    }
+
     if (CreateProcessW(NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE, dwCreationFlags, env,
                        lpDirectory, &startup, &info))
     {
@@ -352,6 +357,16 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
         if (shWait)
             if (WaitForInputIdle( info.hProcess, 30000 ) == WAIT_FAILED)
                 WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
+        /* wait for execute operation to finish if
+           SEE_MASK_NOASYNC/SEE_MASK_FLAG_DDEWAIT is used */
+        if (dwCreationFlags & SEE_MASK_NOASYNC) {
+            DWORD event;
+            event = WaitForSingleObject(info.hProcess, INFINITE);
+            if(event == WAIT_FAILED) {
+                WARN("WaitForSingleObject failed: Error %d\n", GetLastError() );
+            }
+        }
+
         retval = 33;
         if (psei->fMask & SEE_MASK_NOCLOSEPROCESS)
             psei_out->hProcess = info.hProcess;
@@ -1566,7 +1581,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
     static const WCHAR wHttp[] = {'h','t','t','p',':','/','/',0};
     static const DWORD unsupportedFlags =
         SEE_MASK_INVOKEIDLIST  | SEE_MASK_ICON         | SEE_MASK_HOTKEY |
-        SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
+        SEE_MASK_CONNECTNETDRV |
         SEE_MASK_UNICODE       | SEE_MASK_ASYNCOK      | SEE_MASK_HMONITOR;
 
     WCHAR parametersBuffer[1024], dirBuffer[MAX_PATH], wcmdBuffer[1024];
-- 
2.11.0




More information about the wine-patches mailing list