[VBSCRIPT] Sync with Wine Staging 4.18. CORE-16441

This commit is contained in:
Amine Khaldi 2019-12-01 19:42:07 +01:00
parent 573d40fbaa
commit 9a0ddc1388
17 changed files with 3194 additions and 2132 deletions

View file

@ -19,6 +19,7 @@
#pragma once
#include <stdarg.h>
#include <stdint.h>
#define COBJMACROS
@ -33,10 +34,10 @@
#include <initguid.h>
#endif
#include "vbscript_classes.h"
#include "vbscript_defs.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/unicode.h"
typedef struct {
void **blocks;
@ -92,17 +93,6 @@ typedef struct {
function_t *entries[VBDISP_ANY];
} vbdisp_funcprop_desc_t;
#define BP_GET 1
#define BP_GETPUT 2
typedef struct {
DISPID id;
HRESULT (*proc)(vbdisp_t*,VARIANT*,unsigned,VARIANT*);
DWORD flags;
unsigned min_args;
UINT_PTR max_args;
} builtin_prop_t;
typedef struct _class_desc_t {
const WCHAR *name;
script_ctx_t *ctx;
@ -118,9 +108,6 @@ typedef struct _class_desc_t {
unsigned array_cnt;
array_desc_t *array_descs;
unsigned builtin_prop_cnt;
const builtin_prop_t *builtin_props;
ITypeInfo *typeinfo;
function_t *value_func;
struct _class_desc_t *next;
@ -151,6 +138,16 @@ typedef struct {
script_ctx_t *ctx;
} ScriptDisp;
typedef struct _builtin_prop_t builtin_prop_t;
typedef struct {
IDispatch IDispatch_iface;
LONG ref;
size_t member_cnt;
const builtin_prop_t *members;
script_ctx_t *ctx;
} BuiltinDisp;
HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**) DECLSPEC_HIDDEN;
HRESULT disp_get_id(IDispatch*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN;
HRESULT vbdisp_get_id(vbdisp_t*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN;
@ -158,7 +155,6 @@ HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*) DECLSPEC
HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,WORD,DISPPARAMS*) DECLSPEC_HIDDEN;
HRESULT get_disp_value(script_ctx_t*,IDispatch*,VARIANT*) DECLSPEC_HIDDEN;
void collect_objects(script_ctx_t*) DECLSPEC_HIDDEN;
HRESULT create_procedure_disp(script_ctx_t*,vbscode_t*,IDispatch**) DECLSPEC_HIDDEN;
HRESULT create_script_disp(script_ctx_t*,ScriptDisp**) DECLSPEC_HIDDEN;
HRESULT to_int(VARIANT*,int*) DECLSPEC_HIDDEN;
@ -191,13 +187,10 @@ struct _script_ctx_t {
ScriptDisp *script_obj;
class_desc_t global_desc;
vbdisp_t *global_obj;
BuiltinDisp *global_obj;
BuiltinDisp *err_obj;
class_desc_t err_desc;
vbdisp_t *err_obj;
HRESULT err_number;
EXCEPINFO ei;
dynamic_var_t *global_vars;
function_t *global_funcs;
@ -253,11 +246,11 @@ typedef enum {
X(idiv, 1, 0, 0) \
X(imp, 1, 0, 0) \
X(incc, 1, ARG_BSTR, 0) \
X(int, 1, ARG_INT, 0) \
X(is, 1, 0, 0) \
X(jmp, 0, ARG_ADDR, 0) \
X(jmp_false, 0, ARG_ADDR, 0) \
X(jmp_true, 0, ARG_ADDR, 0) \
X(long, 1, ARG_INT, 0) \
X(lt, 1, 0, 0) \
X(lteq, 1, 0, 0) \
X(mcall, 1, ARG_BSTR, ARG_UINT) \
@ -275,9 +268,9 @@ typedef enum {
X(or, 1, 0, 0) \
X(pop, 1, ARG_UINT, 0) \
X(ret, 0, 0, 0) \
X(retval, 1, 0, 0) \
X(set_ident, 1, ARG_BSTR, ARG_UINT) \
X(set_member, 1, ARG_BSTR, ARG_UINT) \
X(short, 1, ARG_INT, 0) \
X(step, 0, ARG_ADDR, ARG_BSTR) \
X(stop, 1, 0, 0) \
X(string, 1, ARG_STR, 0) \
@ -359,38 +352,18 @@ struct _vbscode_t {
};
void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN;
HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**) DECLSPEC_HIDDEN;
HRESULT compile_procedure(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,class_desc_t**) DECLSPEC_HIDDEN;
HRESULT exec_script(script_ctx_t*,BOOL,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN;
HRESULT report_script_error(script_ctx_t*) DECLSPEC_HIDDEN;
void detach_global_objects(script_ctx_t*) DECLSPEC_HIDDEN;
HRESULT get_builtin_id(BuiltinDisp*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
typedef struct {
UINT16 len;
WCHAR buf[7];
} string_constant_t;
#define TID_LIST \
XDIID(ErrObj) \
XDIID(GlobalObj)
typedef enum {
#define XDIID(iface) iface ## _tid,
TID_LIST
#undef XDIID
LAST_tid
} tid_t;
HRESULT get_typeinfo(tid_t,ITypeInfo**) DECLSPEC_HIDDEN;
void release_regexp_typelib(void) DECLSPEC_HIDDEN;
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
static inline BOOL is_int32(double d)
{
return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d;
@ -405,40 +378,12 @@ HRESULT create_safearray_iter(SAFEARRAY *sa, IEnumVARIANT **ev) 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_ILLEGAL_NULL_USE 94
#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;
BSTR get_vbscript_string(int) DECLSPEC_HIDDEN;
BSTR get_vbscript_error_string(HRESULT) DECLSPEC_HIDDEN;
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
LPWSTR ret = NULL;
@ -446,7 +391,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
if(str) {
DWORD size;
size = (strlenW(str)+1)*sizeof(WCHAR);
size = (lstrlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);