Commit 6617f270 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wscript: Added WScript.CreateObject implementation.

parent 554871ea
......@@ -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)
......
......@@ -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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment