mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
vbscript: Map some known error codes to vbscript errors.
Special thanks to Eric Lippert for the list of such errors.
This commit is contained in:
parent
b8c42020a9
commit
ccf1567555
@ -2107,7 +2107,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP
|
||||
op = exec.instr->op;
|
||||
hres = op_funcs[op](&exec);
|
||||
if(FAILED(hres)) {
|
||||
ctx->err_number = hres;
|
||||
ctx->err_number = hres = map_hres(hres);
|
||||
|
||||
if(exec.resume_next) {
|
||||
unsigned stack_off;
|
||||
|
@ -968,6 +968,69 @@ HRESULT disp_get_id(IDispatch *disp, BSTR name, vbdisp_invoke_type_t invoke_type
|
||||
return hres;
|
||||
}
|
||||
|
||||
#define RPC_E_SERVER_UNAVAILABLE 0x800706ba
|
||||
|
||||
HRESULT map_hres(HRESULT hres)
|
||||
{
|
||||
if(SUCCEEDED(hres) || HRESULT_FACILITY(hres) == FACILITY_VBS)
|
||||
return hres;
|
||||
|
||||
switch(hres) {
|
||||
case E_NOTIMPL: return MAKE_VBSERROR(VBSE_ACTION_NOT_SUPPORTED);
|
||||
case E_NOINTERFACE: return MAKE_VBSERROR(VBSE_OLE_NOT_SUPPORTED);
|
||||
case DISP_E_UNKNOWNINTERFACE: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD);
|
||||
case DISP_E_MEMBERNOTFOUND: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD);
|
||||
case DISP_E_PARAMNOTFOUND: return MAKE_VBSERROR(VBSE_NAMED_PARAM_NOT_FOUND);
|
||||
case DISP_E_TYPEMISMATCH: return MAKE_VBSERROR(VBSE_TYPE_MISMATCH);
|
||||
case DISP_E_UNKNOWNNAME: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD);
|
||||
case DISP_E_NONAMEDARGS: return MAKE_VBSERROR(VBSE_NAMED_ARGS_NOT_SUPPORTED);
|
||||
case DISP_E_BADVARTYPE: return MAKE_VBSERROR(VBSE_INVALID_TYPELIB_VARIABLE);
|
||||
case DISP_E_OVERFLOW: return MAKE_VBSERROR(VBSE_OVERFLOW);
|
||||
case DISP_E_BADINDEX: return MAKE_VBSERROR(VBSE_OUT_OF_BOUNDS);
|
||||
case DISP_E_UNKNOWNLCID: return MAKE_VBSERROR(VBSE_LOCALE_SETTING_NOT_SUPPORTED);
|
||||
case DISP_E_ARRAYISLOCKED: return MAKE_VBSERROR(VBSE_ARRAY_LOCKED);
|
||||
case DISP_E_BADPARAMCOUNT: return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH);
|
||||
case DISP_E_PARAMNOTOPTIONAL: return MAKE_VBSERROR(VBSE_PARAMETER_NOT_OPTIONAL);
|
||||
case DISP_E_NOTACOLLECTION: return MAKE_VBSERROR(VBSE_NOT_ENUM);
|
||||
case TYPE_E_DLLFUNCTIONNOTFOUND: return MAKE_VBSERROR(VBSE_INVALID_DLL_FUNCTION_NAME);
|
||||
case TYPE_E_TYPEMISMATCH: return MAKE_VBSERROR(VBSE_TYPE_MISMATCH);
|
||||
case TYPE_E_OUTOFBOUNDS: return MAKE_VBSERROR(VBSE_OUT_OF_BOUNDS);
|
||||
case TYPE_E_IOERROR: return MAKE_VBSERROR(VBSE_IO_ERROR);
|
||||
case TYPE_E_CANTCREATETMPFILE: return MAKE_VBSERROR(VBSE_CANT_CREATE_TMP_FILE);
|
||||
case STG_E_FILENOTFOUND: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND);
|
||||
case STG_E_PATHNOTFOUND: return MAKE_VBSERROR(VBSE_PATH_NOT_FOUND);
|
||||
case STG_E_TOOMANYOPENFILES: return MAKE_VBSERROR(VBSE_TOO_MANY_FILES);
|
||||
case STG_E_ACCESSDENIED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED);
|
||||
case STG_E_INSUFFICIENTMEMORY: return MAKE_VBSERROR(VBSE_OUT_OF_MEMORY);
|
||||
case STG_E_NOMOREFILES: return MAKE_VBSERROR(VBSE_TOO_MANY_FILES);
|
||||
case STG_E_DISKISWRITEPROTECTED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED);
|
||||
case STG_E_WRITEFAULT: return MAKE_VBSERROR(VBSE_IO_ERROR);
|
||||
case STG_E_READFAULT: return MAKE_VBSERROR(VBSE_IO_ERROR);
|
||||
case STG_E_SHAREVIOLATION: return MAKE_VBSERROR(VBSE_PATH_FILE_ACCESS);
|
||||
case STG_E_LOCKVIOLATION: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED);
|
||||
case STG_E_FILEALREADYEXISTS: return MAKE_VBSERROR(VBSE_FILE_ALREADY_EXISTS);
|
||||
case STG_E_MEDIUMFULL: return MAKE_VBSERROR(VBSE_DISK_FULL);
|
||||
case STG_E_INVALIDNAME: return MAKE_VBSERROR(VBSE_FILE_NOT_FOUND);
|
||||
case STG_E_INUSE: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED);
|
||||
case STG_E_NOTCURRENT: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED);
|
||||
case STG_E_CANTSAVE: return MAKE_VBSERROR(VBSE_IO_ERROR);
|
||||
case REGDB_E_CLASSNOTREG: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT);
|
||||
case MK_E_UNAVAILABLE: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT);
|
||||
case MK_E_INVALIDEXTENSION: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND);
|
||||
case MK_E_CANTOPENFILE: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND);
|
||||
case CO_E_CLASSSTRING: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT);
|
||||
case CO_E_APPNOTFOUND: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT);
|
||||
case CO_E_APPDIDNTREG: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT);
|
||||
case E_ACCESSDENIED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED);
|
||||
case E_OUTOFMEMORY: return MAKE_VBSERROR(VBSE_OUT_OF_MEMORY);
|
||||
case E_INVALIDARG: return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
|
||||
case RPC_E_SERVER_UNAVAILABLE: return MAKE_VBSERROR(VBSE_SERVER_NOT_FOUND);
|
||||
case CO_E_SERVER_EXEC_FAILURE: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT);
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, VARIANT *retv)
|
||||
{
|
||||
const WORD flags = DISPATCH_METHOD|(retv ? DISPATCH_PROPERTYGET : 0);
|
||||
|
@ -387,6 +387,41 @@ static inline BOOL is_int32(double d)
|
||||
|
||||
HRESULT create_regexp(IDispatch**) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN;
|
||||
|
||||
#define FACILITY_VBS 0xa
|
||||
#define MAKE_VBSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code)
|
||||
|
||||
#define VBSE_ILLEGAL_FUNC_CALL 5
|
||||
#define VBSE_OVERFLOW 6
|
||||
#define VBSE_OUT_OF_MEMORY 7
|
||||
#define VBSE_OUT_OF_BOUNDS 9
|
||||
#define VBSE_ARRAY_LOCKED 10
|
||||
#define VBSE_TYPE_MISMATCH 13
|
||||
#define VBSE_FILE_NOT_FOUND 53
|
||||
#define VBSE_IO_ERROR 57
|
||||
#define VBSE_FILE_ALREADY_EXISTS 58
|
||||
#define VBSE_DISK_FULL 61
|
||||
#define VBSE_TOO_MANY_FILES 67
|
||||
#define VBSE_PERMISSION_DENIED 70
|
||||
#define VBSE_PATH_FILE_ACCESS 75
|
||||
#define VBSE_PATH_NOT_FOUND 76
|
||||
#define VBSE_OLE_NOT_SUPPORTED 430
|
||||
#define VBSE_OLE_NO_PROP_OR_METHOD 438
|
||||
#define VBSE_ACTION_NOT_SUPPORTED 445
|
||||
#define VBSE_NAMED_ARGS_NOT_SUPPORTED 446
|
||||
#define VBSE_LOCALE_SETTING_NOT_SUPPORTED 447
|
||||
#define VBSE_NAMED_PARAM_NOT_FOUND 448
|
||||
#define VBSE_INVALID_TYPELIB_VARIABLE 458
|
||||
#define VBSE_FUNC_ARITY_MISMATCH 450
|
||||
#define VBSE_PARAMETER_NOT_OPTIONAL 449
|
||||
#define VBSE_NOT_ENUM 451
|
||||
#define VBSE_INVALID_DLL_FUNCTION_NAME 453
|
||||
#define VBSE_CANT_CREATE_TMP_FILE 322
|
||||
#define VBSE_OLE_FILE_NOT_FOUND 432
|
||||
#define VBSE_CANT_CREATE_OBJECT 429
|
||||
#define VBSE_SERVER_NOT_FOUND 462
|
||||
|
||||
HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
||||
HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user