Author: akhaldi Date: Sun Feb 26 20:33:41 2017 New Revision: 73985
URL: http://svn.reactos.org/svn/reactos?rev=73985&view=rev Log: [WSHOM.OCX] Sync with Wine Staging 2.2. CORE-12823
722c28c wshom: Added IProvideClassInfo support for implemented interfaces.
Modified: trunk/reactos/dll/win32/wshom.ocx/shell.c trunk/reactos/dll/win32/wshom.ocx/wshom.idl trunk/reactos/dll/win32/wshom.ocx/wshom.tlb.rgs 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/shell.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/shell.c... ============================================================================== --- trunk/reactos/dll/win32/wshom.ocx/shell.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshom.ocx/shell.c [iso-8859-1] Sun Feb 26 20:33:41 2017 @@ -25,16 +25,23 @@
#include <wine/unicode.h>
-static IWshShell3 WshShell3; - typedef struct { + struct provideclassinfo classinfo; + IWshShell3 IWshShell3_iface; +} WshShellImpl; +static WshShellImpl WshShell3; + +typedef struct +{ + struct provideclassinfo classinfo; IWshCollection IWshCollection_iface; LONG ref; } WshCollection;
typedef struct { + struct provideclassinfo classinfo; IWshShortcut IWshShortcut_iface; LONG ref;
@@ -44,16 +51,18 @@
typedef struct { + struct provideclassinfo classinfo; IWshEnvironment IWshEnvironment_iface; LONG ref; } WshEnvironment;
typedef struct { + struct provideclassinfo classinfo; IWshExec IWshExec_iface; LONG ref; PROCESS_INFORMATION info; -} WshExec; +} WshExecImpl;
static inline WshCollection *impl_from_IWshCollection( IWshCollection *iface ) { @@ -70,14 +79,14 @@ return CONTAINING_RECORD(iface, WshEnvironment, IWshEnvironment_iface); }
-static inline WshExec *impl_from_IWshExec( IWshExec *iface ) -{ - return CONTAINING_RECORD(iface, WshExec, IWshExec_iface); +static inline WshExecImpl *impl_from_IWshExec( IWshExec *iface ) +{ + return CONTAINING_RECORD(iface, WshExecImpl, IWshExec_iface); }
static HRESULT WINAPI WshExec_QueryInterface(IWshExec *iface, REFIID riid, void **obj) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
@@ -86,19 +95,24 @@ IsEqualGUID(riid, &IID_IUnknown)) { *obj = iface; - }else { + } + else if (IsEqualIID(riid, &IID_IProvideClassInfo)) + { + *obj = &This->classinfo.IProvideClassInfo_iface; + } + else { FIXME("Unknown iface %s\n", debugstr_guid(riid)); *obj = NULL; return E_NOINTERFACE; }
- IWshExec_AddRef(iface); + IUnknown_AddRef((IUnknown *)*obj); return S_OK; }
static ULONG WINAPI WshExec_AddRef(IWshExec *iface) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref = %d\n", This, ref); return ref; @@ -106,7 +120,7 @@
static ULONG WINAPI WshExec_Release(IWshExec *iface) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref = %d\n", This, ref);
@@ -121,7 +135,7 @@
static HRESULT WINAPI WshExec_GetTypeInfoCount(IWshExec *iface, UINT *pctinfo) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); TRACE("(%p)->(%p)\n", This, pctinfo); *pctinfo = 1; return S_OK; @@ -129,7 +143,7 @@
static HRESULT WINAPI WshExec_GetTypeInfo(IWshExec *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); return get_typeinfo(IWshExec_tid, ppTInfo); } @@ -137,7 +151,7 @@ static HRESULT WINAPI WshExec_GetIDsOfNames(IWshExec *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); ITypeInfo *typeinfo; HRESULT hr;
@@ -156,7 +170,7 @@ 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); + WshExecImpl *This = impl_from_IWshExec(iface); ITypeInfo *typeinfo; HRESULT hr;
@@ -176,7 +190,7 @@
static HRESULT WINAPI WshExec_get_Status(IWshExec *iface, WshExecStatus *status) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); DWORD code;
TRACE("(%p)->(%p)\n", This, status); @@ -204,7 +218,7 @@
static HRESULT WINAPI WshExec_get_StdIn(IWshExec *iface, ITextStream **stream) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface);
FIXME("(%p)->(%p): stub\n", This, stream);
@@ -213,7 +227,7 @@
static HRESULT WINAPI WshExec_get_StdOut(IWshExec *iface, ITextStream **stream) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface);
FIXME("(%p)->(%p): stub\n", This, stream);
@@ -222,7 +236,7 @@
static HRESULT WINAPI WshExec_get_StdErr(IWshExec *iface, ITextStream **stream) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface);
FIXME("(%p)->(%p): stub\n", This, stream);
@@ -231,7 +245,7 @@
static HRESULT WINAPI WshExec_get_ProcessID(IWshExec *iface, DWORD *pid) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface);
TRACE("(%p)->(%p)\n", This, pid);
@@ -244,7 +258,7 @@
static HRESULT WINAPI WshExec_get_ExitCode(IWshExec *iface, DWORD *code) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface);
FIXME("(%p)->(%p): stub\n", This, code);
@@ -263,7 +277,7 @@
static HRESULT WINAPI WshExec_Terminate(IWshExec *iface) { - WshExec *This = impl_from_IWshExec(iface); + WshExecImpl *This = impl_from_IWshExec(iface); BOOL ret, kill = FALSE; INT count = 0;
@@ -304,7 +318,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret) { STARTUPINFOW si = {0}; - WshExec *This; + WshExecImpl *This;
*ret = NULL;
@@ -320,6 +334,7 @@ return HRESULT_FROM_WIN32(GetLastError()); }
+ init_classinfo(&CLSID_WshExec, (IUnknown *)&This->IWshExec_iface, &This->classinfo); *ret = &This->IWshExec_iface; return S_OK; } @@ -335,7 +350,12 @@ IsEqualGUID(riid, &IID_IWshEnvironment)) { *obj = iface; - }else { + } + else if (IsEqualIID(riid, &IID_IProvideClassInfo)) + { + *obj = &This->classinfo.IProvideClassInfo_iface; + } + else { FIXME("Unknown iface %s\n", debugstr_guid(riid)); *obj = NULL; return E_NOINTERFACE; @@ -502,6 +522,7 @@ This->IWshEnvironment_iface.lpVtbl = &WshEnvironmentVtbl; This->ref = 1;
+ init_classinfo(&IID_IWshEnvironment, (IUnknown *)&This->IWshEnvironment_iface, &This->classinfo); *env = &This->IWshEnvironment_iface;
return S_OK; @@ -518,7 +539,12 @@ IsEqualGUID(riid, &IID_IWshCollection)) { *ppv = iface; - }else { + } + else if (IsEqualIID(riid, &IID_IProvideClassInfo)) + { + *ppv = &This->classinfo.IProvideClassInfo_iface; + } + else { FIXME("Unknown iface %s\n", debugstr_guid(riid)); *ppv = NULL; return E_NOINTERFACE; @@ -698,6 +724,7 @@ This->IWshCollection_iface.lpVtbl = &WshCollectionVtbl; This->ref = 1;
+ init_classinfo(&IID_IWshCollection, (IUnknown *)&This->IWshCollection_iface, &This->classinfo); *collection = &This->IWshCollection_iface;
return S_OK; @@ -715,7 +742,12 @@ IsEqualGUID(riid, &IID_IWshShortcut)) { *ppv = iface; - }else { + } + else if (IsEqualIID(riid, &IID_IProvideClassInfo)) + { + *ppv = &This->classinfo.IProvideClassInfo_iface; + } + else { FIXME("Unknown iface %s\n", debugstr_guid(riid)); *ppv = NULL; return E_NOINTERFACE; @@ -1064,6 +1096,7 @@ return E_OUTOFMEMORY; }
+ init_classinfo(&IID_IWshShortcut, (IUnknown *)&This->IWshShortcut_iface, &This->classinfo); *shortcut = (IDispatch*)&This->IWshShortcut_iface;
return S_OK; @@ -1087,13 +1120,17 @@ { return E_NOINTERFACE; } + else if (IsEqualIID(riid, &IID_IProvideClassInfo)) + { + *ppv = &WshShell3.classinfo.IProvideClassInfo_iface; + } else { WARN("unknown iface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; }
- IWshShell3_AddRef(iface); + IUnknown_AddRef((IUnknown *)*ppv); return S_OK; }
@@ -1654,11 +1691,11 @@ WshShell3_put_CurrentDirectory };
-static IWshShell3 WshShell3 = { &WshShell3Vtbl }; - HRESULT WINAPI WshShellFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv) { TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
- return IWshShell3_QueryInterface(&WshShell3, riid, ppv); -} + WshShell3.IWshShell3_iface.lpVtbl = &WshShell3Vtbl; + init_classinfo(&IID_IWshShell3, (IUnknown *)&WshShell3.IWshShell3_iface, &WshShell3.classinfo); + return IWshShell3_QueryInterface(&WshShell3.IWshShell3_iface, riid, ppv); +}
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom.i... ============================================================================== --- trunk/reactos/dll/win32/wshom.ocx/wshom.idl [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshom.ocx/wshom.idl [iso-8859-1] Sun Feb 26 20:33:41 2017 @@ -663,4 +663,12 @@ coclass WshNetwork { [default] interface IWshNetwork2; } + + [ + uuid(08fed191-be19-11d3-a28b-00104bd35090), + threading(apartment) + ] + coclass WshExec { + [default] interface IWshExec; + } }
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom.tlb.rgs URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom.t... ============================================================================== --- trunk/reactos/dll/win32/wshom.ocx/wshom.tlb.rgs [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshom.ocx/wshom.tlb.rgs [iso-8859-1] Sun Feb 26 20:33:41 2017 @@ -132,6 +132,12 @@ Version = s '1.0' VersionIndependentProgId = s 'WScript.Network' } + '{08FED191-BE19-11D3-A28B-00104BD35090}' = s 'WshExec' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } + TypeLib = s '{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}' + Version = s '1.0' + } } 'WScript.Shell.1' = s 'Windows Script Host Shell Object' {
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom_main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom_m... ============================================================================== --- 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] Sun Feb 26 20:33:41 2017 @@ -22,6 +22,11 @@
static HINSTANCE wshom_instance;
+static inline struct provideclassinfo *impl_from_IProvideClassInfo(IProvideClassInfo *iface) +{ + return CONTAINING_RECORD(iface, struct provideclassinfo, IProvideClassInfo_iface); +} + static ITypeLib *typelib; static ITypeInfo *typeinfos[LAST_tid];
@@ -39,6 +44,9 @@ HRESULT hres; ITypeLib *tl;
+ if(typelib) + return S_OK; + hres = LoadRegTypeLib(&LIBID_IWshRuntimeLibrary, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl); if(FAILED(hres)) { ERR("LoadRegTypeLib failed: %08x\n", hres); @@ -50,13 +58,21 @@ return hres; }
+static HRESULT get_typeinfo_of_guid(const GUID *guid, ITypeInfo **tinfo) +{ + HRESULT hres; + + if(FAILED(hres = load_typelib())) + return hres; + + return ITypeLib_GetTypeInfoOfGuid(typelib, guid, tinfo); +} + HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) { HRESULT hres;
- if (!typelib) - hres = load_typelib(); - if (!typelib) + if (FAILED(hres = load_typelib())) return hres;
if(!typeinfos[tid]) { @@ -90,6 +106,56 @@ ITypeInfo_Release(typeinfos[i]);
ITypeLib_Release(typelib); +} + +static HRESULT WINAPI provideclassinfo_QueryInterface(IProvideClassInfo *iface, REFIID riid, void **obj) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IProvideClassInfo)) { + *obj = iface; + IProvideClassInfo_AddRef(iface); + return S_OK; + } + else + return IUnknown_QueryInterface(This->outer, riid, obj); +} + +static ULONG WINAPI provideclassinfo_AddRef(IProvideClassInfo *iface) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + return IUnknown_AddRef(This->outer); +} + +static ULONG WINAPI provideclassinfo_Release(IProvideClassInfo *iface) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + return IUnknown_Release(This->outer); +} + +static HRESULT WINAPI provideclassinfo_GetClassInfo(IProvideClassInfo *iface, ITypeInfo **ti) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + + TRACE("(%p)->(%p)\n", This, ti); + + return get_typeinfo_of_guid(This->guid, ti); +} + +static const IProvideClassInfoVtbl provideclassinfovtbl = { + provideclassinfo_QueryInterface, + provideclassinfo_AddRef, + provideclassinfo_Release, + provideclassinfo_GetClassInfo +}; + +void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo) +{ + classinfo->IProvideClassInfo_iface.lpVtbl = &provideclassinfovtbl; + classinfo->outer = outer; + classinfo->guid = guid; }
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Modified: trunk/reactos/dll/win32/wshom.ocx/wshom_private.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshom.ocx/wshom_p... ============================================================================== --- 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] Sun Feb 26 20:33:41 2017 @@ -26,6 +26,7 @@ #include <windef.h> #include <winbase.h> #include <wshom.h> +#include <ocidl.h>
#include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(wshom); @@ -43,6 +44,14 @@
HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
+struct provideclassinfo { + IProvideClassInfo IProvideClassInfo_iface; + IUnknown *outer; + const GUID *guid; +}; + +extern void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo) DECLSPEC_HIDDEN; + HRESULT WINAPI WshShellFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
#endif /* _WSHOM_PRIVATE_H_ */
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=7... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Feb 26 20:33:41 2017 @@ -211,7 +211,7 @@ reactos/dll/win32/wmi # Synced to WineStaging-1.9.11 reactos/dll/win32/wmiutils # Synced to WineStaging-1.9.11 reactos/dll/win32/wmvcore # Synced to WineStaging-2.2 -reactos/dll/win32/wshom.ocx # Synced to WineStaging-1.9.11 +reactos/dll/win32/wshom.ocx # Synced to WineStaging-2.2 reactos/dll/win32/wtsapi32 # Synced to WineStaging-1.9.11 reactos/dll/win32/wuapi # Synced to WineStaging-1.9.11 reactos/dll/win32/xinput1_1 # Synced to WineStaging-1.9.11