Nikolay Sivov : wshom: Implement IWshShell3::Run().
Alexandre Julliard
julliard at winehq.org
Tue Feb 26 13:48:15 CST 2013
Module: wine
Branch: master
Commit: 5db4741d0b074ca0080adf36c3fdb440bf92f8d8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5db4741d0b074ca0080adf36c3fdb440bf92f8d8
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Feb 26 10:48:00 2013 +0400
wshom: Implement IWshShell3::Run().
---
dlls/wshom.ocx/shell.c | 59 +++++++++++++++++++++++++++++++++++++++++++++--
include/shellapi.h | 1 +
2 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c
index 1973e2d..bc6a839 100644
--- a/dlls/wshom.ocx/shell.c
+++ b/dlls/wshom.ocx/shell.c
@@ -19,6 +19,7 @@
#include "wshom_private.h"
#include "wshom.h"
+#include "shellapi.h"
#include "shlobj.h"
#include "wine/debug.h"
@@ -665,10 +666,62 @@ static HRESULT WINAPI WshShell3_get_Environment(IWshShell3 *iface, VARIANT *Type
return E_NOTIMPL;
}
-static HRESULT WINAPI WshShell3_Run(IWshShell3 *iface, BSTR Command, VARIANT *WindowStyle, VARIANT *WaitOnReturn, int *out_ExitCode)
+static HRESULT WINAPI WshShell3_Run(IWshShell3 *iface, BSTR cmd, VARIANT *style, VARIANT *WaitOnReturn, int *exit_code)
{
- FIXME("(%s %s %p): stub\n", debugstr_variant(WindowStyle), debugstr_variant(WaitOnReturn), out_ExitCode);
- return E_NOTIMPL;
+ SHELLEXECUTEINFOW info;
+ int waitforprocess;
+ VARIANT s, w;
+ HRESULT hr;
+
+ TRACE("(%s %s %s %p)\n", debugstr_w(cmd), debugstr_variant(style), debugstr_variant(WaitOnReturn), exit_code);
+
+ VariantInit(&s);
+ hr = VariantChangeType(&s, style, 0, VT_I4);
+ if (FAILED(hr))
+ {
+ ERR("failed to convert style argument, 0x%08x\n", hr);
+ return hr;
+ }
+
+ VariantInit(&w);
+ hr = VariantChangeType(&w, WaitOnReturn, 0, VT_I4);
+ if (FAILED(hr))
+ {
+ ERR("failed to convert wait argument, 0x%08x\n", hr);
+ return hr;
+ }
+
+ memset(&info, 0, sizeof(info));
+ info.cbSize = sizeof(info);
+
+ waitforprocess = V_I4(&w);
+
+ info.fMask = waitforprocess ? SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS : SEE_MASK_DEFAULT;
+ info.lpFile = cmd;
+ info.nShow = V_I4(&s);
+
+ if (!ShellExecuteExW(&info))
+ {
+ TRACE("ShellExecute failed, %d\n", GetLastError());
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+ else
+ {
+ if (waitforprocess)
+ {
+ if (exit_code)
+ {
+ DWORD code;
+ GetExitCodeProcess(info.hProcess, &code);
+ *exit_code = code;
+ }
+ CloseHandle(info.hProcess);
+ }
+ else
+ if (exit_code) *exit_code = 0;
+
+ return S_OK;
+ }
}
static HRESULT WINAPI WshShell3_Popup(IWshShell3 *iface, BSTR Text, VARIANT* SecondsToWait, VARIANT *Title, VARIANT *Type, int *button)
diff --git a/include/shellapi.h b/include/shellapi.h
index d2b4081..acc345d 100644
--- a/include/shellapi.h
+++ b/include/shellapi.h
@@ -273,6 +273,7 @@ HINSTANCE WINAPI ShellExecuteW(HWND,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,INT);
#define SE_ERR_DDEBUSY 30
#define SE_ERR_NOASSOC 31
+#define SEE_MASK_DEFAULT 0x00000000
#define SEE_MASK_CLASSNAME 0x00000001
#define SEE_MASK_CLASSKEY 0x00000003
#define SEE_MASK_IDLIST 0x00000004
More information about the wine-cvs
mailing list