Commit 02f6ea92 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added Chr implementation.

parent f3d15811
......@@ -1070,8 +1070,29 @@ static HRESULT Global_Asc(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
int c;
HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
hres = to_int(arg, &c);
if(FAILED(hres))
return hres;
if(c <= 0 || c >= 0x100) {
FIXME("invalid arg\n");
return E_FAIL;
}
if(res) {
WCHAR ch = c;
V_VT(res) = VT_BSTR;
V_BSTR(res) = SysAllocStringLen(&ch, 1);
if(!V_BSTR(res))
return E_OUTOFMEMORY;
}
return S_OK;
}
static HRESULT Global_AscW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
......@@ -50,6 +50,10 @@ TestCStr 3, "3"
if isEnglishLang then TestCStr 3.5, "3.5"
if isEnglishLang then TestCStr true, "True"
Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120)))
Call ok(getVT(Chr(255)) = "VT_BSTR", "getVT(Chr(255)) = " & getVT(Chr(255)))
Call ok(Chr(120) = "x", "Chr(120) = " & Chr(120))
Call ok(isObject(new EmptyClass), "isObject(new EmptyClass) is not true?")
Set x = new EmptyClass
Call ok(isObject(x), "isObject(x) is not true?")
......
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