Author: akhaldi
Date: Wed Jul 22 00:47:35 2015
New Revision: 68545
URL:
http://svn.reactos.org/svn/reactos?rev=68545&view=rev
Log:
[WSHOM.OCX] Sync with Wine Staging 1.7.47. CORE-9924
Modified:
trunk/reactos/dll/win32/wshom.ocx/CMakeLists.txt
trunk/reactos/dll/win32/wshom.ocx/shell.c
trunk/reactos/dll/win32/wshom.ocx/wshom.idl
trunk/reactos/dll/win32/wshom.ocx/wshom_main.c
trunk/reactos/dll/win32/wshom.ocx/wshom_private.h
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/wshom.ocx/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/CMakeL…
==============================================================================
--- trunk/reactos/dll/win32/wshom.ocx/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wshom.ocx/CMakeLists.txt [iso-8859-1] Wed Jul 22 00:47:35
2015
@@ -28,7 +28,7 @@
set_source_files_properties(wshom.rc PROPERTIES OBJECT_DEPENDS
"${wshom_rc_deps}")
set_module_type(wshom win32ocx)
target_link_libraries(wshom uuid wine)
-add_importlibs(wshom oleaut32 ole32 shell32 advapi32 msvcrt kernel32 ntdll)
+add_importlibs(wshom oleaut32 ole32 shell32 advapi32 user32 msvcrt kernel32 ntdll)
add_dependencies(wshom stdole2 wshom_idlheader)
add_pch(wshom wshom_private.h SOURCE)
add_cd_file(TARGET wshom DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/wshom.ocx/shell.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/shell.…
==============================================================================
--- trunk/reactos/dll/win32/wshom.ocx/shell.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wshom.ocx/shell.c [iso-8859-1] Wed Jul 22 00:47:35 2015
@@ -67,6 +67,13 @@
LONG ref;
} WshEnvironment;
+typedef struct
+{
+ IWshExec IWshExec_iface;
+ LONG ref;
+ PROCESS_INFORMATION info;
+} WshExec;
+
static inline WshCollection *impl_from_IWshCollection( IWshCollection *iface )
{
return CONTAINING_RECORD(iface, WshCollection, IWshCollection_iface);
@@ -80,6 +87,260 @@
static inline WshEnvironment *impl_from_IWshEnvironment( IWshEnvironment *iface )
{
return CONTAINING_RECORD(iface, WshEnvironment, IWshEnvironment_iface);
+}
+
+static inline WshExec *impl_from_IWshExec( IWshExec *iface )
+{
+ return CONTAINING_RECORD(iface, WshExec, IWshExec_iface);
+}
+
+static HRESULT WINAPI WshExec_QueryInterface(IWshExec *iface, REFIID riid, void **obj)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+
+ TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
+
+ if (IsEqualGUID(riid, &IID_IDispatch) ||
+ IsEqualGUID(riid, &IID_IWshExec) ||
+ IsEqualGUID(riid, &IID_IUnknown))
+ {
+ *obj = iface;
+ }else {
+ FIXME("Unknown iface %s\n", debugstr_guid(riid));
+ *obj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IWshExec_AddRef(iface);
+ return S_OK;
+}
+
+static ULONG WINAPI WshExec_AddRef(IWshExec *iface)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+ TRACE("(%p) ref = %d\n", This, ref);
+ return ref;
+}
+
+static ULONG WINAPI WshExec_Release(IWshExec *iface)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+ TRACE("(%p) ref = %d\n", This, ref);
+
+ if (!ref) {
+ CloseHandle(This->info.hThread);
+ CloseHandle(This->info.hProcess);
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+
+ return ref;
+}
+
+static HRESULT WINAPI WshExec_GetTypeInfoCount(IWshExec *iface, UINT *pctinfo)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ TRACE("(%p)->(%p)\n", This, pctinfo);
+ *pctinfo = 1;
+ return S_OK;
+}
+
+static HRESULT WINAPI WshExec_GetTypeInfo(IWshExec *iface, UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
+ return get_typeinfo(IWshExec_tid, ppTInfo);
+}
+
+static HRESULT WINAPI WshExec_GetIDsOfNames(IWshExec *iface, REFIID riid, LPOLESTR
*rgszNames,
+ UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames,
cNames, lcid, rgDispId);
+
+ hr = get_typeinfo(IWshExec_tid, &typeinfo);
+ if(SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
+ ITypeInfo_Release(typeinfo);
+ }
+
+ return hr;
+}
+
+static HRESULT WINAPI WshExec_Invoke(IWshExec *iface, DISPID dispIdMember, REFIID riid,
LCID lcid,
+ WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
UINT *puArgErr)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember,
debugstr_guid(riid),
+ lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+
+ hr = get_typeinfo(IWshExec_tid, &typeinfo);
+ if(SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_Invoke(typeinfo, &This->IWshExec_iface, dispIdMember,
wFlags,
+ pDispParams, pVarResult, pExcepInfo, puArgErr);
+ ITypeInfo_Release(typeinfo);
+ }
+
+ return hr;
+}
+
+static HRESULT WINAPI WshExec_get_Status(IWshExec *iface, WshExecStatus *status)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ DWORD code;
+
+ TRACE("(%p)->(%p)\n", This, status);
+
+ if (!status)
+ return E_INVALIDARG;
+
+ if (!GetExitCodeProcess(This->info.hProcess, &code))
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ switch (code)
+ {
+ case 0:
+ *status = WshFinished;
+ break;
+ case STILL_ACTIVE:
+ *status = WshRunning;
+ break;
+ default:
+ *status = WshFailed;
+ }
+
+ return S_OK;
+}
+
+static HRESULT WINAPI WshExec_get_StdIn(IWshExec *iface, ITextStream **stream)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, stream);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WshExec_get_StdOut(IWshExec *iface, ITextStream **stream)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, stream);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WshExec_get_StdErr(IWshExec *iface, ITextStream **stream)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, stream);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WshExec_get_ProcessID(IWshExec *iface, DWORD *pid)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+
+ TRACE("(%p)->(%p)\n", This, pid);
+
+ if (!pid)
+ return E_INVALIDARG;
+
+ *pid = This->info.dwProcessId;
+ return S_OK;
+}
+
+static HRESULT WINAPI WshExec_get_ExitCode(IWshExec *iface, DWORD *code)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, code);
+
+ return E_NOTIMPL;
+}
+
+static BOOL CALLBACK enum_thread_wnd_proc(HWND hwnd, LPARAM lParam)
+{
+ INT *count = (INT*)lParam;
+
+ (*count)++;
+ PostMessageW(hwnd, WM_CLOSE, 0, 0);
+ /* try to send it to all windows, even if failed for some */
+ return TRUE;
+}
+
+static HRESULT WINAPI WshExec_Terminate(IWshExec *iface)
+{
+ WshExec *This = impl_from_IWshExec(iface);
+ BOOL ret, kill = FALSE;
+ INT count = 0;
+
+ TRACE("(%p)\n", This);
+
+ ret = EnumThreadWindows(This->info.dwThreadId, enum_thread_wnd_proc,
(LPARAM)&count);
+ if (ret && count) {
+ /* manual testing shows that it waits 2 seconds before forcing termination */
+ if (WaitForSingleObject(This->info.hProcess, 2000) != WAIT_OBJECT_0)
+ kill = TRUE;
+ }
+ else
+ kill = TRUE;
+
+ if (kill)
+ TerminateProcess(This->info.hProcess, 0);
+
+ return S_OK;
+}
+
+static const IWshExecVtbl WshExecVtbl = {
+ WshExec_QueryInterface,
+ WshExec_AddRef,
+ WshExec_Release,
+ WshExec_GetTypeInfoCount,
+ WshExec_GetTypeInfo,
+ WshExec_GetIDsOfNames,
+ WshExec_Invoke,
+ WshExec_get_Status,
+ WshExec_get_StdIn,
+ WshExec_get_StdOut,
+ WshExec_get_StdErr,
+ WshExec_get_ProcessID,
+ WshExec_get_ExitCode,
+ WshExec_Terminate
+};
+
+static HRESULT WshExec_create(BSTR command, IWshExec **ret)
+{
+ STARTUPINFOW si = {0};
+ WshExec *This;
+
+ *ret = NULL;
+
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ if (!This)
+ return E_OUTOFMEMORY;
+
+ This->IWshExec_iface.lpVtbl = &WshExecVtbl;
+ This->ref = 1;
+
+ if (!CreateProcessW(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si,
&This->info)) {
+ HeapFree(GetProcessHeap(), 0, This);
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ *ret = &This->IWshExec_iface;
+ return S_OK;
}
static HRESULT WINAPI WshEnvironment_QueryInterface(IWshEnvironment *iface, REFIID riid,
void **obj)
@@ -1131,7 +1392,7 @@
case REG_SZ:
case REG_EXPAND_SZ:
V_VT(value) = VT_BSTR;
- V_BSTR(value) = SysAllocStringLen((WCHAR*)data, datalen - sizeof(WCHAR));
+ V_BSTR(value) = SysAllocString((WCHAR*)data);
if (!V_BSTR(value))
hr = E_OUTOFMEMORY;
break;
@@ -1335,6 +1596,56 @@
{
FIXME("(%s %p): stub\n", debugstr_w(Keys), Wait);
return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WshShell3_Exec(IWshShell3 *iface, BSTR command, IWshExec **ret)
+{
+ TRACE("(%s %p)\n", debugstr_w(command), ret);
+
+ if (!ret)
+ return E_POINTER;
+
+ if (!command)
+ return DISP_E_EXCEPTION;
+
+ return WshExec_create(command, ret);
+}
+
+static HRESULT WINAPI WshShell3_get_CurrentDirectory(IWshShell3 *iface, BSTR *dir)
+{
+ DWORD ret;
+
+ TRACE("(%p)\n", dir);
+
+ ret = GetCurrentDirectoryW(0, NULL);
+ if (!ret)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ *dir = SysAllocStringLen(NULL, ret-1);
+ if (!*dir)
+ return E_OUTOFMEMORY;
+
+ ret = GetCurrentDirectoryW(ret, *dir);
+ if (!ret) {
+ SysFreeString(*dir);
+ *dir = NULL;
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ return S_OK;
+}
+
+static HRESULT WINAPI WshShell3_put_CurrentDirectory(IWshShell3 *iface, BSTR dir)
+{
+ TRACE("(%s)\n", debugstr_w(dir));
+
+ if (!dir)
+ return E_INVALIDARG;
+
+ if (!SetCurrentDirectoryW(dir))
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ return S_OK;
}
static const IWshShell3Vtbl WshShell3Vtbl = {
@@ -1356,7 +1667,10 @@
WshShell3_RegDelete,
WshShell3_LogEvent,
WshShell3_AppActivate,
- WshShell3_SendKeys
+ WshShell3_SendKeys,
+ WshShell3_Exec,
+ WshShell3_get_CurrentDirectory,
+ WshShell3_put_CurrentDirectory
};
static IWshShell3 WshShell3 = { &WshShell3Vtbl };
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom.…
==============================================================================
--- trunk/reactos/dll/win32/wshom.ocx/wshom.idl [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wshom.ocx/wshom.idl [iso-8859-1] Wed Jul 22 00:47:35 2015
@@ -436,10 +436,10 @@
HRESULT StdErr([out, retval] ITextStream** stream);
[id(0x0006), propget]
- HRESULT ProcessID([out, retval] long* pid);
+ HRESULT ProcessID([out, retval] DWORD *pid);
[id(0x0007), propget]
- HRESULT ExitCode([out, retval] long* ExitCode);
+ HRESULT ExitCode([out, retval] DWORD *code);
[id(0x0008)]
HRESULT Terminate();
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom_…
==============================================================================
--- trunk/reactos/dll/win32/wshom.ocx/wshom_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wshom.ocx/wshom_main.c [iso-8859-1] Wed Jul 22 00:47:35 2015
@@ -29,6 +29,7 @@
&IID_NULL,
&IID_IWshCollection,
&IID_IWshEnvironment,
+ &IID_IWshExec,
&IID_IWshShell3,
&IID_IWshShortcut
};
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom_…
==============================================================================
--- trunk/reactos/dll/win32/wshom.ocx/wshom_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wshom.ocx/wshom_private.h [iso-8859-1] Wed Jul 22 00:47:35
2015
@@ -35,6 +35,7 @@
NULL_tid,
IWshCollection_tid,
IWshEnvironment_tid,
+ IWshExec_tid,
IWshShell3_tid,
IWshShortcut_tid,
LAST_tid
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Wed Jul 22 00:47:35 2015
@@ -216,7 +216,7 @@
reactos/dll/win32/wldap32 # Synced to WineStaging-1.7.37
reactos/dll/win32/wmi # Synced to WineStaging-1.7.37
reactos/dll/win32/wmiutils # Synced to WineStaging-1.7.37
-reactos/dll/win32/wshom.ocx # Synced to WineStaging-1.7.37
+reactos/dll/win32/wshom.ocx # Synced to WineStaging-1.7.47
reactos/dll/win32/wtsapi32 # Synced to WineStaging-1.7.47
reactos/dll/win32/wuapi # Synced to WineStaging-1.7.37
reactos/dll/win32/xinput1_1 # Synced to WineStaging-1.7.37