vbscript: Don't use ITypeInfo for builtin function dispids.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-10-17 22:46:52 +02:00 committed by Alexandre Julliard
parent d061ba0e35
commit 4a30e699e8
1 changed files with 220 additions and 219 deletions

View File

@ -48,7 +48,7 @@ typedef struct {
} string_constant_t;
struct _builtin_prop_t {
DISPID id;
const WCHAR *name;
HRESULT (*proc)(BuiltinDisp*,VARIANT*,unsigned,VARIANT*);
DWORD flags;
unsigned min_args;
@ -122,7 +122,24 @@ static HRESULT WINAPI Builtin_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lc
HRESULT get_builtin_id(BuiltinDisp *disp, const WCHAR *name, DISPID *id)
{
return ITypeInfo_GetIDsOfNames(disp->typeinfo, (WCHAR**)&name, 1, id);
size_t min = 1, max = disp->member_cnt - 1, i;
int r;
while(min <= max) {
i = (min + max) / 2;
r = wcsicmp(disp->members[i].name, name);
if(!r) {
*id = i;
return S_OK;
}
if(r < 0)
min = i+1;
else
max = i-1;
}
return DISP_E_MEMBERNOTFOUND;
}
static HRESULT WINAPI Builtin_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names, UINT name_cnt,
@ -163,24 +180,6 @@ static HRESULT WINAPI Builtin_Invoke(IDispatch *iface, DISPID id, REFIID riid, L
return E_UNEXPECTED;
}
if(This->member_cnt) {
unsigned min = 0, max = This->member_cnt-1, i;
while(min <= max) {
i = (min+max)/2;
if(This->members[i].id == id) {
id = i;
break;
}
if(This->members[i].id < id)
min = i+1;
else
max = i-1;
}
if(min > max)
return DISP_E_MEMBERNOTFOUND;
}
if(id >= This->member_cnt || (!This->members[id].proc && !This->members[id].flags))
return DISP_E_MEMBERNOTFOUND;
prop = This->members + id;
@ -2500,198 +2499,199 @@ static const string_constant_t vbTab = {1, {'\t'}};
static const string_constant_t vbVerticalTab = {1, {0xb}};
static const builtin_prop_t global_props[] = {
{DISPID_GLOBAL_VBUSESYSTEM, NULL, BP_GET, VT_I2, 0},
{DISPID_GLOBAL_USESYSTEMDAYOFWEEK, NULL, BP_GET, VT_I2, 0},
{DISPID_GLOBAL_VBSUNDAY, NULL, BP_GET, VT_I2, 1},
{DISPID_GLOBAL_VBMONDAY, NULL, BP_GET, VT_I2, 2},
{DISPID_GLOBAL_VBTUESDAY, NULL, BP_GET, VT_I2, 3},
{DISPID_GLOBAL_VBWEDNESDAY, NULL, BP_GET, VT_I2, 4},
{DISPID_GLOBAL_VBTHURSDAY, NULL, BP_GET, VT_I2, 5},
{DISPID_GLOBAL_VBFRIDAY, NULL, BP_GET, VT_I2, 6},
{DISPID_GLOBAL_VBSATURDAY, NULL, BP_GET, VT_I2, 7},
{DISPID_GLOBAL_VBFIRSTJAN1, NULL, BP_GET, VT_I2, 1},
{DISPID_GLOBAL_VBFIRSTFOURDAYS, NULL, BP_GET, VT_I2, 2},
{DISPID_GLOBAL_VBFIRSTFULLWEEK, NULL, BP_GET, VT_I2, 3},
{DISPID_GLOBAL_VBOKONLY, NULL, BP_GET, VT_I2, MB_OK},
{DISPID_GLOBAL_VBOKCANCEL, NULL, BP_GET, VT_I2, MB_OKCANCEL},
{DISPID_GLOBAL_VBABORTRETRYIGNORE, NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE},
{DISPID_GLOBAL_VBYESNOCANCEL, NULL, BP_GET, VT_I2, MB_YESNOCANCEL},
{DISPID_GLOBAL_VBYESNO, NULL, BP_GET, VT_I2, MB_YESNO},
{DISPID_GLOBAL_VBRETRYCANCEL, NULL, BP_GET, VT_I2, MB_RETRYCANCEL},
{DISPID_GLOBAL_VBCRITICAL, NULL, BP_GET, VT_I2, MB_ICONHAND},
{DISPID_GLOBAL_VBQUESTION, NULL, BP_GET, VT_I2, MB_ICONQUESTION},
{DISPID_GLOBAL_VBEXCLAMATION, NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION},
{DISPID_GLOBAL_VBINFORMATION, NULL, BP_GET, VT_I2, MB_ICONASTERISK},
{DISPID_GLOBAL_VBDEFAULTBUTTON1, NULL, BP_GET, VT_I2, MB_DEFBUTTON1},
{DISPID_GLOBAL_VBDEFAULTBUTTON2, NULL, BP_GET, VT_I2, MB_DEFBUTTON2},
{DISPID_GLOBAL_VBDEFAULTBUTTON3, NULL, BP_GET, VT_I2, MB_DEFBUTTON3},
{DISPID_GLOBAL_VBDEFAULTBUTTON4, NULL, BP_GET, VT_I2, MB_DEFBUTTON4},
{DISPID_GLOBAL_VBAPPLICATIONMODAL, NULL, BP_GET, VT_I2, MB_APPLMODAL},
{DISPID_GLOBAL_VBSYSTEMMODAL, NULL, BP_GET, VT_I2, MB_SYSTEMMODAL},
{DISPID_GLOBAL_VBOK, NULL, BP_GET, VT_I2, IDOK},
{DISPID_GLOBAL_VBCANCEL, NULL, BP_GET, VT_I2, IDCANCEL},
{DISPID_GLOBAL_VBABORT, NULL, BP_GET, VT_I2, IDABORT},
{DISPID_GLOBAL_VBRETRY, NULL, BP_GET, VT_I2, IDRETRY},
{DISPID_GLOBAL_VBIGNORE, NULL, BP_GET, VT_I2, IDIGNORE},
{DISPID_GLOBAL_VBYES, NULL, BP_GET, VT_I2, IDYES},
{DISPID_GLOBAL_VBNO, NULL, BP_GET, VT_I2, IDNO},
{DISPID_GLOBAL_VBEMPTY, NULL, BP_GET, VT_I2, VT_EMPTY},
{DISPID_GLOBAL_VBNULL, NULL, BP_GET, VT_I2, VT_NULL},
{DISPID_GLOBAL_VBINTEGER, NULL, BP_GET, VT_I2, VT_I2},
{DISPID_GLOBAL_VBLONG, NULL, BP_GET, VT_I2, VT_I4},
{DISPID_GLOBAL_VBSINGLE, NULL, BP_GET, VT_I2, VT_R4},
{DISPID_GLOBAL_VBDOUBLE, NULL, BP_GET, VT_I2, VT_R8},
{DISPID_GLOBAL_VBCURRENCY, NULL, BP_GET, VT_I2, VT_CY},
{DISPID_GLOBAL_VBDATE, NULL, BP_GET, VT_I2, VT_DATE},
{DISPID_GLOBAL_VBSTRING, NULL, BP_GET, VT_I2, VT_BSTR},
{DISPID_GLOBAL_VBOBJECT, NULL, BP_GET, VT_I2, VT_DISPATCH},
{DISPID_GLOBAL_VBERROR, NULL, BP_GET, VT_I2, VT_ERROR},
{DISPID_GLOBAL_VBBOOLEAN, NULL, BP_GET, VT_I2, VT_BOOL},
{DISPID_GLOBAL_VBVARIANT, NULL, BP_GET, VT_I2, VT_VARIANT},
{DISPID_GLOBAL_VBDATAOBJECT, NULL, BP_GET, VT_I2, VT_UNKNOWN},
{DISPID_GLOBAL_VBDECIMAL, NULL, BP_GET, VT_I2, VT_DECIMAL},
{DISPID_GLOBAL_VBBYTE, NULL, BP_GET, VT_I2, VT_UI1},
{DISPID_GLOBAL_VBARRAY, NULL, BP_GET, VT_I2, VT_ARRAY},
{DISPID_GLOBAL_VBTRUE, NULL, BP_GET, VT_I2, VARIANT_TRUE},
{DISPID_GLOBAL_VBFALSE, NULL, BP_GET, VT_I2, VARIANT_FALSE},
{DISPID_GLOBAL_VBUSEDEFAULT, NULL, BP_GET, VT_I2, -2},
{DISPID_GLOBAL_VBBINARYCOMPARE, NULL, BP_GET, VT_I2, 0},
{DISPID_GLOBAL_VBTEXTCOMPARE, NULL, BP_GET, VT_I2, 1},
{DISPID_GLOBAL_VBDATABASECOMPARE, NULL, BP_GET, VT_I2, 2},
{DISPID_GLOBAL_VBGENERALDATE, NULL, BP_GET, VT_I2, 0},
{DISPID_GLOBAL_VBLONGDATE, NULL, BP_GET, VT_I2, 1},
{DISPID_GLOBAL_VBSHORTDATE, NULL, BP_GET, VT_I2, 2},
{DISPID_GLOBAL_VBLONGTIME, NULL, BP_GET, VT_I2, 3},
{DISPID_GLOBAL_VBSHORTTIME, NULL, BP_GET, VT_I2, 4},
{DISPID_GLOBAL_VBOBJECTERROR, NULL, BP_GET, VT_I4, 0x80040000},
{DISPID_GLOBAL_VBBLACK, NULL, BP_GET, VT_I4, 0x000000},
{DISPID_GLOBAL_VBBLUE, NULL, BP_GET, VT_I4, 0xff0000},
{DISPID_GLOBAL_VBCYAN, NULL, BP_GET, VT_I4, 0xffff00},
{DISPID_GLOBAL_VBGREEN, NULL, BP_GET, VT_I4, 0x00ff00},
{DISPID_GLOBAL_VBMAGENTA, NULL, BP_GET, VT_I4, 0xff00ff},
{DISPID_GLOBAL_VBRED, NULL, BP_GET, VT_I4, 0x0000ff},
{DISPID_GLOBAL_VBWHITE, NULL, BP_GET, VT_I4, 0xffffff},
{DISPID_GLOBAL_VBYELLOW, NULL, BP_GET, VT_I4, 0x00ffff},
{DISPID_GLOBAL_VBCR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr},
{DISPID_GLOBAL_VBCRLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf},
{DISPID_GLOBAL_VBNEWLINE, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine},
{DISPID_GLOBAL_VBFORMFEED, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed},
{DISPID_GLOBAL_VBLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf},
{DISPID_GLOBAL_VBNULLCHAR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar},
{DISPID_GLOBAL_VBNULLSTRING, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString},
{DISPID_GLOBAL_VBTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab},
{DISPID_GLOBAL_VBVERTICALTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab},
{DISPID_GLOBAL_CCUR, Global_CCur, 0, 1},
{DISPID_GLOBAL_CINT, Global_CInt, 0, 1},
{DISPID_GLOBAL_CLNG, Global_CLng, 0, 1},
{DISPID_GLOBAL_CBOOL, Global_CBool, 0, 1},
{DISPID_GLOBAL_CBYTE, Global_CByte, 0, 1},
{DISPID_GLOBAL_CDATE, Global_CDate, 0, 1},
{DISPID_GLOBAL_CDBL, Global_CDbl, 0, 1},
{DISPID_GLOBAL_CSNG, Global_CSng, 0, 1},
{DISPID_GLOBAL_CSTR, Global_CStr, 0, 1},
{DISPID_GLOBAL_HEX, Global_Hex, 0, 1},
{DISPID_GLOBAL_OCT, Global_Oct, 0, 1},
{DISPID_GLOBAL_VARTYPE, Global_VarType, 0, 1},
{DISPID_GLOBAL_ISDATE, Global_IsDate, 0, 1},
{DISPID_GLOBAL_ISEMPTY, Global_IsEmpty, 0, 1},
{DISPID_GLOBAL_ISNULL, Global_IsNull, 0, 1},
{DISPID_GLOBAL_ISNUMERIC, Global_IsNumeric, 0, 1},
{DISPID_GLOBAL_ISARRAY, Global_IsArray, 0, 1},
{DISPID_GLOBAL_ISOBJECT, Global_IsObject, 0, 1},
{DISPID_GLOBAL_ATN, Global_Atn, 0, 1},
{DISPID_GLOBAL_COS, Global_Cos, 0, 1},
{DISPID_GLOBAL_SIN, Global_Sin, 0, 1},
{DISPID_GLOBAL_TAN, Global_Tan, 0, 1},
{DISPID_GLOBAL_EXP, Global_Exp, 0, 1},
{DISPID_GLOBAL_LOG, Global_Log, 0, 1},
{DISPID_GLOBAL_SQR, Global_Sqr, 0, 1},
{DISPID_GLOBAL_RANDOMIZE, Global_Randomize, 0, 1},
{DISPID_GLOBAL_RND, Global_Rnd, 0, 1},
{DISPID_GLOBAL_TIMER, Global_Timer, 0, 0},
{DISPID_GLOBAL_LBOUND, Global_LBound, 0, 1},
{DISPID_GLOBAL_UBOUND, Global_UBound, 0, 1, 2},
{DISPID_GLOBAL_RGB, Global_RGB, 0, 3},
{DISPID_GLOBAL_LEN, Global_Len, 0, 1},
{DISPID_GLOBAL_LENB, Global_LenB, 0, 1},
{DISPID_GLOBAL_LEFT, Global_Left, 0, 2},
{DISPID_GLOBAL_LEFTB, Global_LeftB, 0, 2},
{DISPID_GLOBAL_RIGHT, Global_Right, 0, 2},
{DISPID_GLOBAL_RIGHTB, Global_RightB, 0, 2},
{DISPID_GLOBAL_MID, Global_Mid, 0, 2, 3},
{DISPID_GLOBAL_MIDB, Global_MidB, 0, 2, 3},
{DISPID_GLOBAL_STRCOMP, Global_StrComp, 0, 2, 3},
{DISPID_GLOBAL_LCASE, Global_LCase, 0, 1},
{DISPID_GLOBAL_UCASE, Global_UCase, 0, 1},
{DISPID_GLOBAL_LTRIM, Global_LTrim, 0, 1},
{DISPID_GLOBAL_RTRIM, Global_RTrim, 0, 1},
{DISPID_GLOBAL_TRIM, Global_Trim, 0, 1},
{DISPID_GLOBAL_SPACE, Global_Space, 0, 1},
{DISPID_GLOBAL_STRING, Global_String, 0, 0, 2},
{DISPID_GLOBAL_INSTR, Global_InStr, 0, 2, 4},
{DISPID_GLOBAL_INSTRB, Global_InStrB, 0, 3, 4},
{DISPID_GLOBAL_ASCB, Global_AscB, 0, 1},
{DISPID_GLOBAL_CHRB, Global_ChrB, 0, 1},
{DISPID_GLOBAL_ASC, Global_Asc, 0, 1},
{DISPID_GLOBAL_CHR, Global_Chr, 0, 1},
{DISPID_GLOBAL_ASCW, Global_AscW, 0, 1},
{DISPID_GLOBAL_CHRW, Global_ChrW, 0, 1},
{DISPID_GLOBAL_ABS, Global_Abs, 0, 1},
{DISPID_GLOBAL_FIX, Global_Fix, 0, 1},
{DISPID_GLOBAL_INT, Global_Int, 0, 1},
{DISPID_GLOBAL_SGN, Global_Sgn, 0, 1},
{DISPID_GLOBAL_NOW, Global_Now, 0, 0},
{DISPID_GLOBAL_DATE, Global_Date, 0, 0},
{DISPID_GLOBAL_TIME, Global_Time, 0, 0},
{DISPID_GLOBAL_DAY, Global_Day, 0, 1},
{DISPID_GLOBAL_MONTH, Global_Month, 0, 1},
{DISPID_GLOBAL_WEEKDAY, Global_Weekday, 0, 1, 2},
{DISPID_GLOBAL_YEAR, Global_Year, 0, 1},
{DISPID_GLOBAL_HOUR, Global_Hour, 0, 1},
{DISPID_GLOBAL_MINUTE, Global_Minute, 0, 1},
{DISPID_GLOBAL_SECOND, Global_Second, 0, 1},
{DISPID_GLOBAL_DATEVALUE, Global_DateValue, 0, 1},
{DISPID_GLOBAL_TIMEVALUE, Global_TimeValue, 0, 1},
{DISPID_GLOBAL_DATESERIAL, Global_DateSerial, 0, 3},
{DISPID_GLOBAL_TIMESERIAL, Global_TimeSerial, 0, 3},
{DISPID_GLOBAL_INPUTBOX, Global_InputBox, 0, 1, 7},
{DISPID_GLOBAL_MSGBOX, Global_MsgBox, 0, 1, 5},
{DISPID_GLOBAL_CREATEOBJECT, Global_CreateObject, 0, 1},
{DISPID_GLOBAL_GETOBJECT, Global_GetObject, 0, 0, 2},
{DISPID_GLOBAL_DATEADD, Global_DateAdd, 0, 3},
{DISPID_GLOBAL_DATEDIFF, Global_DateDiff, 0, 3, 5},
{DISPID_GLOBAL_DATEPART, Global_DatePart, 0, 2, 4},
{DISPID_GLOBAL_TYPENAME, Global_TypeName, 0, 1},
{DISPID_GLOBAL_ARRAY, Global_Array, 0, 0, MAXDWORD},
{DISPID_GLOBAL_ERASE, Global_Erase, 0, 1},
{DISPID_GLOBAL_FILTER, Global_Filter, 0, 2, 4},
{DISPID_GLOBAL_JOIN, Global_Join, 0, 1, 2},
{DISPID_GLOBAL_SPLIT, Global_Split, 0, 1, 4},
{DISPID_GLOBAL_REPLACE, Global_Replace, 0, 3, 6},
{DISPID_GLOBAL_STRREVERSE, Global_StrReverse, 0, 1},
{DISPID_GLOBAL_INSTRREV, Global_InStrRev, 0, 2, 4},
{DISPID_GLOBAL_LOADPICTURE, Global_LoadPicture, 0, 1},
{DISPID_GLOBAL_SCRIPTENGINE, Global_ScriptEngine, 0, 0},
{DISPID_GLOBAL_SCRIPTENGINEMAJORVERSION, Global_ScriptEngineMajorVersion, 0, 0},
{DISPID_GLOBAL_SCRIPTENGINEMINORVERSION, Global_ScriptEngineMinorVersion, 0, 0},
{DISPID_GLOBAL_SCRIPTENGINEBUILDVERSION, Global_ScriptEngineBuildVersion, 0, 0},
{DISPID_GLOBAL_FORMATNUMBER, Global_FormatNumber, 0, 1, 5},
{DISPID_GLOBAL_FORMATCURRENCY, Global_FormatCurrency, 0, 1, 5},
{DISPID_GLOBAL_FORMATPERCENT, Global_FormatPercent, 0, 1, 5},
{DISPID_GLOBAL_FORMATDATETIME, Global_FormatDateTime, 0, 1, 2},
{DISPID_GLOBAL_WEEKDAYNAME, Global_WeekdayName, 0, 1, 3},
{DISPID_GLOBAL_MONTHNAME, Global_MonthName, 0, 1, 2},
{DISPID_GLOBAL_ROUND, Global_Round, 0, 1, 2},
{DISPID_GLOBAL_ESCAPE, Global_Escape, 0, 1},
{DISPID_GLOBAL_UNESCAPE, Global_Unescape, 0, 1},
{DISPID_GLOBAL_EVAL, Global_Eval, 0, 1},
{DISPID_GLOBAL_EXECUTE, Global_Execute, 0, 1},
{DISPID_GLOBAL_EXECUTEGLOBAL, Global_ExecuteGlobal, 0, 1},
{DISPID_GLOBAL_GETREF, Global_GetRef, 0, 1},
{DISPID_GLOBAL_VBMSGBOXHELPBUTTON, NULL, BP_GET, VT_I4, MB_HELP},
{DISPID_GLOBAL_VBMSGBOXSETFOREGROUND, NULL, BP_GET, VT_I4, MB_SETFOREGROUND},
{DISPID_GLOBAL_VBMSGBOXRIGHT, NULL, BP_GET, VT_I4, MB_RIGHT},
{DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, VT_I4, MB_RTLREADING}
{NULL}, /* no default value */
{L"Abs", Global_Abs, 0, 1},
{L"Array", Global_Array, 0, 0, MAXDWORD},
{L"Asc", Global_Asc, 0, 1},
{L"AscB", Global_AscB, 0, 1},
{L"AscW", Global_AscW, 0, 1},
{L"Atn", Global_Atn, 0, 1},
{L"CBool", Global_CBool, 0, 1},
{L"CByte", Global_CByte, 0, 1},
{L"CCur", Global_CCur, 0, 1},
{L"CDate", Global_CDate, 0, 1},
{L"CDbl", Global_CDbl, 0, 1},
{L"Chr", Global_Chr, 0, 1},
{L"ChrB", Global_ChrB, 0, 1},
{L"ChrW", Global_ChrW, 0, 1},
{L"CInt", Global_CInt, 0, 1},
{L"CLng", Global_CLng, 0, 1},
{L"Cos", Global_Cos, 0, 1},
{L"CreateObject", Global_CreateObject, 0, 1},
{L"CSng", Global_CSng, 0, 1},
{L"CStr", Global_CStr, 0, 1},
{L"Date", Global_Date, 0, 0},
{L"DateAdd", Global_DateAdd, 0, 3},
{L"DateDiff", Global_DateDiff, 0, 3, 5},
{L"DatePart", Global_DatePart, 0, 2, 4},
{L"DateSerial", Global_DateSerial, 0, 3},
{L"DateValue", Global_DateValue, 0, 1},
{L"Day", Global_Day, 0, 1},
{L"Erase", Global_Erase, 0, 1},
{L"Escape", Global_Escape, 0, 1},
{L"Eval", Global_Eval, 0, 1},
{L"Execute", Global_Execute, 0, 1},
{L"ExecuteGlobal", Global_ExecuteGlobal, 0, 1},
{L"Exp", Global_Exp, 0, 1},
{L"Filter", Global_Filter, 0, 2, 4},
{L"Fix", Global_Fix, 0, 1},
{L"FormatCurrency", Global_FormatCurrency, 0, 1, 5},
{L"FormatDateTime", Global_FormatDateTime, 0, 1, 2},
{L"FormatNumber", Global_FormatNumber, 0, 1, 5},
{L"FormatPercent", Global_FormatPercent, 0, 1, 5},
{L"GetObject", Global_GetObject, 0, 0, 2},
{L"GetRef", Global_GetRef, 0, 1},
{L"Hex", Global_Hex, 0, 1},
{L"Hour", Global_Hour, 0, 1},
{L"InputBox", Global_InputBox, 0, 1, 7},
{L"InStr", Global_InStr, 0, 2, 4},
{L"InStrB", Global_InStrB, 0, 3, 4},
{L"InStrRev", Global_InStrRev, 0, 2, 4},
{L"Int", Global_Int, 0, 1},
{L"IsArray", Global_IsArray, 0, 1},
{L"IsDate", Global_IsDate, 0, 1},
{L"IsEmpty", Global_IsEmpty, 0, 1},
{L"IsNull", Global_IsNull, 0, 1},
{L"IsNumeric", Global_IsNumeric, 0, 1},
{L"IsObject", Global_IsObject, 0, 1},
{L"Join", Global_Join, 0, 1, 2},
{L"LBound", Global_LBound, 0, 1},
{L"LCase", Global_LCase, 0, 1},
{L"Left", Global_Left, 0, 2},
{L"LeftB", Global_LeftB, 0, 2},
{L"Len", Global_Len, 0, 1},
{L"LenB", Global_LenB, 0, 1},
{L"LoadPicture", Global_LoadPicture, 0, 1},
{L"Log", Global_Log, 0, 1},
{L"LTrim", Global_LTrim, 0, 1},
{L"Mid", Global_Mid, 0, 2, 3},
{L"MidB", Global_MidB, 0, 2, 3},
{L"Minute", Global_Minute, 0, 1},
{L"Month", Global_Month, 0, 1},
{L"MonthName", Global_MonthName, 0, 1, 2},
{L"MsgBox", Global_MsgBox, 0, 1, 5},
{L"Now", Global_Now, 0, 0},
{L"Oct", Global_Oct, 0, 1},
{L"Randomize", Global_Randomize, 0, 1},
{L"Replace", Global_Replace, 0, 3, 6},
{L"RGB", Global_RGB, 0, 3},
{L"Right", Global_Right, 0, 2},
{L"RightB", Global_RightB, 0, 2},
{L"Rnd", Global_Rnd, 0, 1},
{L"Round", Global_Round, 0, 1, 2},
{L"RTrim", Global_RTrim, 0, 1},
{L"ScriptEngine", Global_ScriptEngine, 0, 0},
{L"ScriptEngineBuildVersion", Global_ScriptEngineBuildVersion, 0, 0},
{L"ScriptEngineMajorVersion", Global_ScriptEngineMajorVersion, 0, 0},
{L"ScriptEngineMinorVersion", Global_ScriptEngineMinorVersion, 0, 0},
{L"Second", Global_Second, 0, 1},
{L"Sgn", Global_Sgn, 0, 1},
{L"Sin", Global_Sin, 0, 1},
{L"Space", Global_Space, 0, 1},
{L"Split", Global_Split, 0, 1, 4},
{L"Sqr", Global_Sqr, 0, 1},
{L"StrComp", Global_StrComp, 0, 2, 3},
{L"String", Global_String, 0, 0, 2},
{L"StrReverse", Global_StrReverse, 0, 1},
{L"Tan", Global_Tan, 0, 1},
{L"Time", Global_Time, 0, 0},
{L"Timer", Global_Timer, 0, 0},
{L"TimeSerial", Global_TimeSerial, 0, 3},
{L"TimeValue", Global_TimeValue, 0, 1},
{L"Trim", Global_Trim, 0, 1},
{L"TypeName", Global_TypeName, 0, 1},
{L"UBound", Global_UBound, 0, 1, 2},
{L"UCase", Global_UCase, 0, 1},
{L"Unescape", Global_Unescape, 0, 1},
{L"VarType", Global_VarType, 0, 1},
{L"vbAbort", NULL, BP_GET, VT_I2, IDABORT},
{L"vbAbortRetryIgnore", NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE},
{L"vbApplicationModal", NULL, BP_GET, VT_I2, MB_APPLMODAL},
{L"vbArray", NULL, BP_GET, VT_I2, VT_ARRAY},
{L"vbBinaryCompare", NULL, BP_GET, VT_I2, 0},
{L"vbBlack", NULL, BP_GET, VT_I4, 0x000000},
{L"vbBlue", NULL, BP_GET, VT_I4, 0xff0000},
{L"vbBoolean", NULL, BP_GET, VT_I2, VT_BOOL},
{L"vbByte", NULL, BP_GET, VT_I2, VT_UI1},
{L"vbCancel", NULL, BP_GET, VT_I2, IDCANCEL},
{L"vbCr", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr},
{L"vbCritical", NULL, BP_GET, VT_I2, MB_ICONHAND},
{L"vbCrLf", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf},
{L"vbCurrency", NULL, BP_GET, VT_I2, VT_CY},
{L"vbCyan", NULL, BP_GET, VT_I4, 0xffff00},
{L"vbDatabaseCompare", NULL, BP_GET, VT_I2, 2},
{L"vbDataObject", NULL, BP_GET, VT_I2, VT_UNKNOWN},
{L"vbDate", NULL, BP_GET, VT_I2, VT_DATE},
{L"vbDecimal", NULL, BP_GET, VT_I2, VT_DECIMAL},
{L"vbDefaultButton1", NULL, BP_GET, VT_I2, MB_DEFBUTTON1},
{L"vbDefaultButton2", NULL, BP_GET, VT_I2, MB_DEFBUTTON2},
{L"vbDefaultButton3", NULL, BP_GET, VT_I2, MB_DEFBUTTON3},
{L"vbDefaultButton4", NULL, BP_GET, VT_I2, MB_DEFBUTTON4},
{L"vbDouble", NULL, BP_GET, VT_I2, VT_R8},
{L"vbEmpty", NULL, BP_GET, VT_I2, VT_EMPTY},
{L"vbError", NULL, BP_GET, VT_I2, VT_ERROR},
{L"vbExclamation", NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION},
{L"vbFalse", NULL, BP_GET, VT_I2, VARIANT_FALSE},
{L"vbFirstFourDays", NULL, BP_GET, VT_I2, 2},
{L"vbFirstFullWeek", NULL, BP_GET, VT_I2, 3},
{L"vbFirstJan1", NULL, BP_GET, VT_I2, 1},
{L"vbFormFeed", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed},
{L"vbFriday", NULL, BP_GET, VT_I2, 6},
{L"vbGeneralDate", NULL, BP_GET, VT_I2, 0},
{L"vbGreen", NULL, BP_GET, VT_I4, 0x00ff00},
{L"vbIgnore", NULL, BP_GET, VT_I2, IDIGNORE},
{L"vbInformation", NULL, BP_GET, VT_I2, MB_ICONASTERISK},
{L"vbInteger", NULL, BP_GET, VT_I2, VT_I2},
{L"vbLf", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf},
{L"vbLong", NULL, BP_GET, VT_I2, VT_I4},
{L"vbLongDate", NULL, BP_GET, VT_I2, 1},
{L"vbLongTime", NULL, BP_GET, VT_I2, 3},
{L"vbMagenta", NULL, BP_GET, VT_I4, 0xff00ff},
{L"vbMonday", NULL, BP_GET, VT_I2, 2},
{L"vbMsgBoxHelpButton", NULL, BP_GET, VT_I4, MB_HELP},
{L"vbMsgBoxRight", NULL, BP_GET, VT_I4, MB_RIGHT},
{L"vbMsgBoxRtlReading", NULL, BP_GET, VT_I4, MB_RTLREADING},
{L"vbMsgBoxSetForeground", NULL, BP_GET, VT_I4, MB_SETFOREGROUND},
{L"vbNewLine", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine},
{L"vbNo", NULL, BP_GET, VT_I2, IDNO},
{L"vbNull", NULL, BP_GET, VT_I2, VT_NULL},
{L"vbNullChar", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar},
{L"vbNullString", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString},
{L"vbObject", NULL, BP_GET, VT_I2, VT_DISPATCH},
{L"vbObjectError", NULL, BP_GET, VT_I4, 0x80040000},
{L"vbOK", NULL, BP_GET, VT_I2, IDOK},
{L"vbOKCancel", NULL, BP_GET, VT_I2, MB_OKCANCEL},
{L"vbOKOnly", NULL, BP_GET, VT_I2, MB_OK},
{L"vbQuestion", NULL, BP_GET, VT_I2, MB_ICONQUESTION},
{L"vbRed", NULL, BP_GET, VT_I4, 0x0000ff},
{L"vbRetry", NULL, BP_GET, VT_I2, IDRETRY},
{L"vbRetryCancel", NULL, BP_GET, VT_I2, MB_RETRYCANCEL},
{L"vbSaturday", NULL, BP_GET, VT_I2, 7},
{L"vbShortDate", NULL, BP_GET, VT_I2, 2},
{L"vbShortTime", NULL, BP_GET, VT_I2, 4},
{L"vbSingle", NULL, BP_GET, VT_I2, VT_R4},
{L"vbString", NULL, BP_GET, VT_I2, VT_BSTR},
{L"vbSunday", NULL, BP_GET, VT_I2, 1},
{L"vbSystemModal", NULL, BP_GET, VT_I2, MB_SYSTEMMODAL},
{L"vbTab", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab},
{L"vbTextCompare", NULL, BP_GET, VT_I2, 1},
{L"vbThursday", NULL, BP_GET, VT_I2, 5},
{L"vbTrue", NULL, BP_GET, VT_I2, VARIANT_TRUE},
{L"vbTuesday", NULL, BP_GET, VT_I2, 3},
{L"vbUseDefault", NULL, BP_GET, VT_I2, -2},
{L"vbUseSystem", NULL, BP_GET, VT_I2, 0},
{L"vbUseSystemDayOfWeek", NULL, BP_GET, VT_I2, 0},
{L"vbVariant", NULL, BP_GET, VT_I2, VT_VARIANT},
{L"vbVerticalTab", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab},
{L"vbWednesday", NULL, BP_GET, VT_I2, 4},
{L"vbWhite", NULL, BP_GET, VT_I4, 0xffffff},
{L"vbYellow", NULL, BP_GET, VT_I4, 0x00ffff},
{L"vbYes", NULL, BP_GET, VT_I2, IDYES},
{L"vbYesNo", NULL, BP_GET, VT_I2, MB_YESNO},
{L"vbYesNoCancel", NULL, BP_GET, VT_I2, MB_YESNOCANCEL},
{L"Weekday", Global_Weekday, 0, 1, 2},
{L"WeekdayName", Global_WeekdayName, 0, 1, 3},
{L"Year", Global_Year, 0, 1}
};
static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res)
@ -2823,13 +2823,14 @@ static HRESULT Err_Raise(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VA
}
static const builtin_prop_t err_props[] = {
{DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT},
{DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT},
{DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT},
{DISPID_ERR_NUMBER, Err_Number, BP_GETPUT},
{DISPID_ERR_SOURCE, Err_Source, BP_GETPUT},
{DISPID_ERR_CLEAR, Err_Clear},
{DISPID_ERR_RAISE, Err_Raise, 0, 1, 5},
{NULL, Err_Number, BP_GETPUT},
{L"Clear", Err_Clear},
{L"Description", Err_Description, BP_GETPUT},
{L"HelpContext", Err_HelpContext, BP_GETPUT},
{L"HelpFile", Err_HelpFile, BP_GETPUT},
{L"Number", Err_Number, BP_GETPUT},
{L"Raise", Err_Raise, 0, 1, 5},
{L"Source", Err_Source, BP_GETPUT}
};
void detach_global_objects(script_ctx_t *ctx)