https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f380a5104034604de6a8ca3d7b90a15a459e894b
commit f380a5104034604de6a8ca3d7b90a15a459e894b Author: Whindmar Saksit <whinds...@proton.me> AuthorDate: Sat Dec 23 21:27:00 2023 +0100 Commit: GitHub <nore...@github.com> CommitDate: Sat Dec 23 21:27:00 2023 +0100 [WSHOM.OCX] WshShell::Run intWindowStyle parameter is optional (#6180) The last two parameters are optional, see https://learn.microsoft.com/en-us/previous-versions/d5fk67ky(v=vs.85) Test case: ``` ' test.vbs Set objShell = Wscript.CreateObject("Wscript.Shell") objShell.Run "calc.exe" ' Should work because the arguments are optional objShell.Run "winver.exe", invalidnumber ' Windows treats this as SW_HIDE because it can convert VT_EMPTY objShell.Run "notepad.exe", "invalidnumber" ' Windows fails with error ``` --- dll/win32/wshom.ocx/shell.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dll/win32/wshom.ocx/shell.c b/dll/win32/wshom.ocx/shell.c index 49f1771ab20..9f545115a84 100644 --- a/dll/win32/wshom.ocx/shell.c +++ b/dll/win32/wshom.ocx/shell.c @@ -1261,6 +1261,15 @@ static HRESULT WINAPI WshShell3_Run(IWshShell3 *iface, BSTR cmd, VARIANT *style, return E_POINTER; VariantInit(&s); +#ifdef __REACTOS__ + if (is_optional_argument(style)) + { + V_VT(&s) = VT_I4; + V_I4(&s) = SW_SHOW; + hr = S_OK; + } + else +#endif hr = VariantChangeType(&s, style, 0, VT_I4); if (FAILED(hr)) {