wscript: Added WScript.CreateObject implementation.

oldstable
Jacek Caban 2014-04-15 09:34:53 +02:00 committed by Alexandre Julliard
parent 554871ea81
commit 6617f27004
2 changed files with 31 additions and 2 deletions

View File

@ -236,8 +236,29 @@ static HRESULT WINAPI Host_put_Timeout(IHost *iface, LONG v)
static HRESULT WINAPI Host_CreateObject(IHost *iface, BSTR ProgID, BSTR Prefix,
IDispatch **out_Dispatch)
{
WINE_FIXME("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
return E_NOTIMPL;
IUnknown *unk;
GUID guid;
HRESULT hres;
TRACE("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
if(Prefix && *Prefix) {
FIXME("Prefix %s not supported\n", debugstr_w(Prefix));
return E_NOTIMPL;
}
hres = CLSIDFromProgID(ProgID, &guid);
if(FAILED(hres))
return hres;
hres = CoCreateInstance(&guid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER,
&IID_IUnknown, (void**)&unk);
if(FAILED(hres))
return hres;
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)out_Dispatch);
IUnknown_Release(unk);
return hres;
}
static HRESULT WINAPI Host_Echo(IHost *iface, SAFEARRAY *args)

View File

@ -49,4 +49,12 @@ WScript.Interactive = true;
ok(WScript.Interactive === true, "WScript.Interactive = " + WScript.Interactive);
ok(WScript.Application === WScript, "WScript.Application = " + WScript.Application);
var obj = WScript.CreateObject("Wine.Test");
obj.ok(true, "Broken WScript.CreateObject object?");
try {
obj = WScript.CreateObject("nonexistent");
ok(false, "Expected exception for CreateObject('nonexistent')");
}catch(e) {}
winetest.reportSuccess();