ReactOS  0.4.14-dev-1256-g2125fec
global.c File Reference
#include <assert.h>
#include <math.h>
#include "vbscript.h"
#include "vbscript_defs.h"
#include "mshtmhst.h"
#include "objsafe.h"
#include "wine/debug.h"
Include dependency graph for global.c:

Go to the source code of this file.

Classes

struct  string_constant_t
 
struct  _builtin_prop_t
 

Macros

#define VB_E_CANNOT_CREATE_OBJ   0x800a01ad
 
#define VB_E_MK_PARSE_ERROR   0x800a01b0
 
#define BP_GET   1
 
#define BP_GETPUT   2
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (vbscript)
 
static BuiltinDispimpl_from_IDispatch (IDispatch *iface)
 
static HRESULT WINAPI Builtin_QueryInterface (IDispatch *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Builtin_AddRef (IDispatch *iface)
 
static ULONG WINAPI Builtin_Release (IDispatch *iface)
 
static HRESULT WINAPI Builtin_GetTypeInfoCount (IDispatch *iface, UINT *pctinfo)
 
static HRESULT WINAPI Builtin_GetTypeInfo (IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
HRESULT get_builtin_id (BuiltinDisp *disp, const WCHAR *name, DISPID *id)
 
static HRESULT WINAPI Builtin_GetIDsOfNames (IDispatch *iface, REFIID riid, LPOLESTR *names, UINT name_cnt, LCID lcid, DISPID *ids)
 
static HRESULT WINAPI Builtin_Invoke (IDispatch *iface, DISPID id, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, UINT *err)
 
static HRESULT create_builtin_dispatch (script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, BuiltinDisp **ret)
 
static IInternetHostSecurityManagerget_sec_mgr (script_ctx_t *ctx)
 
static HRESULT return_string (VARIANT *res, const WCHAR *str)
 
static HRESULT return_bstr (VARIANT *res, BSTR str)
 
static HRESULT return_bool (VARIANT *res, BOOL val)
 
static HRESULT return_short (VARIANT *res, short val)
 
static HRESULT return_int (VARIANT *res, int val)
 
static HRESULT return_double (VARIANT *res, double val)
 
static HRESULT return_float (VARIANT *res, float val)
 
static HRESULT return_null (VARIANT *res)
 
static HRESULT return_date (VARIANT *res, double date)
 
HRESULT to_int (VARIANT *v, int *ret)
 
static HRESULT to_double (VARIANT *v, double *ret)
 
static HRESULT to_string (VARIANT *v, BSTR *ret)
 
static HRESULT to_system_time (VARIANT *v, SYSTEMTIME *st)
 
static HRESULT set_object_site (script_ctx_t *ctx, IUnknown *obj)
 
static IUnknowncreate_object (script_ctx_t *ctx, const WCHAR *progid)
 
static HRESULT show_msgbox (script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR orig_title, VARIANT *res)
 
static HRESULT Global_CCur (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CInt (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CLng (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CBool (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CByte (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CDate (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CDbl (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CSng (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CStr (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static WCHAR hex_char (unsigned n)
 
static HRESULT Global_Hex (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Oct (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_VarType (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_IsDate (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_IsEmpty (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_IsNull (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_IsNumeric (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_IsArray (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_IsObject (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Atn (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Cos (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Sin (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Tan (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Exp (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Log (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Sqr (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Randomize (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Rnd (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Timer (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_LBound (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_UBound (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_RGB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Len (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_LenB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Left (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_LeftB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Right (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_RightB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Mid (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_MidB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_StrComp (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_LCase (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_UCase (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_LTrim (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_RTrim (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Trim (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Space (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_String (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_InStr (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_InStrB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_AscB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ChrB (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Asc (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Chr (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_AscW (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ChrW (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Abs (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Fix (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Int (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Sgn (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Now (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Date (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Time (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Day (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Month (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Weekday (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Year (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Hour (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Minute (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Second (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_DateValue (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_TimeValue (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_DateSerial (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_TimeSerial (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_InputBox (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_MsgBox (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_CreateObject (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_GetObject (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_DateAdd (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_DateDiff (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_DatePart (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_TypeName (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Array (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Erase (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Filter (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Join (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Split (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Replace (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_StrReverse (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_InStrRev (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_LoadPicture (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ScriptEngine (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ScriptEngineMajorVersion (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ScriptEngineMinorVersion (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ScriptEngineBuildVersion (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_FormatNumber (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_FormatCurrency (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_FormatPercent (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_FormatDateTime (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_WeekdayName (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_MonthName (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Round (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Escape (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Unescape (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Eval (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Execute (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_ExecuteGlobal (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_GetRef (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT Global_Err (BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 
static HRESULT err_string_prop (BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_Description (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_HelpContext (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_HelpFile (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_Number (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_Source (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_Clear (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
static HRESULT Err_Raise (BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
 
void detach_global_objects (script_ctx_t *ctx)
 
HRESULT init_global (script_ctx_t *ctx)
 

Variables

const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
 
static const WCHAR emptyW [] = {0}
 
static const WCHAR vbscriptW [] = {'V','B','S','c','r','i','p','t',0}
 
static const IDispatchVtbl BuiltinDispVtbl
 
static const string_constant_t vbCr = {1, {'\r'}}
 
static const string_constant_t vbCrLf = {2, {'\r','\n'}}
 
static const string_constant_t vbNewLine = {2, {'\r','\n'}}
 
static const string_constant_t vbFormFeed = {1, {0xc}}
 
static const string_constant_t vbLf = {1, {'\n'}}
 
static const string_constant_t vbNullChar = {1}
 
static const string_constant_t vbNullString = {0}
 
static const string_constant_t vbTab = {1, {'\t'}}
 
static const string_constant_t vbVerticalTab = {1, {0xb}}
 
static const builtin_prop_t global_props []
 
static const builtin_prop_t err_props []
 

Macro Definition Documentation

◆ BP_GET

#define BP_GET   1

Definition at line 47 of file global.c.

◆ BP_GETPUT

#define BP_GETPUT   2

Definition at line 48 of file global.c.

◆ VB_E_CANNOT_CREATE_OBJ

#define VB_E_CANNOT_CREATE_OBJ   0x800a01ad

Definition at line 37 of file global.c.

◆ VB_E_MK_PARSE_ERROR

#define VB_E_MK_PARSE_ERROR   0x800a01b0

Definition at line 38 of file global.c.

Function Documentation

◆ Builtin_AddRef()

static ULONG WINAPI Builtin_AddRef ( IDispatch iface)
static

Definition at line 88 of file global.c.

89 {
92 
93  TRACE("(%p) ref=%d\n", This, ref);
94 
95  return ref;
96 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ Builtin_GetIDsOfNames()

static HRESULT WINAPI Builtin_GetIDsOfNames ( IDispatch iface,
REFIID  riid,
LPOLESTR names,
UINT  name_cnt,
LCID  lcid,
DISPID ids 
)
static

Definition at line 150 of file global.c.

152 {
154  unsigned i;
155  HRESULT hres;
156 
157  TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), names, name_cnt, lcid, ids);
158 
159  if(!This->ctx) {
160  FIXME("NULL context\n");
161  return E_UNEXPECTED;
162  }
163 
164  for(i = 0; i < name_cnt; i++) {
165  hres = get_builtin_id(This, names[i], &ids[i]);
166  if(FAILED(hres))
167  return hres;
168  }
169 
170  return S_OK;
171 }
HRESULT get_builtin_id(BuiltinDisp *disp, const WCHAR *name, DISPID *id)
Definition: global.c:128
REFIID riid
Definition: precomp.h:44
GLuint GLuint * names
Definition: glext.h:11545
GLuint * ids
Definition: glext.h:5907
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ Builtin_GetTypeInfo()

static HRESULT WINAPI Builtin_GetTypeInfo ( IDispatch iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 121 of file global.c.

122 {
124  TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
125  return DISP_E_BADINDEX;
126 }
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
#define TRACE(s)
Definition: solgame.cpp:4
#define DISP_E_BADINDEX
Definition: winerror.h:2520

◆ Builtin_GetTypeInfoCount()

static HRESULT WINAPI Builtin_GetTypeInfoCount ( IDispatch iface,
UINT pctinfo 
)
static

Definition at line 113 of file global.c.

114 {
116  TRACE("(%p)->(%p)\n", This, pctinfo);
117  *pctinfo = 0;
118  return S_OK;
119 }
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ Builtin_Invoke()

static HRESULT WINAPI Builtin_Invoke ( IDispatch iface,
DISPID  id,
REFIID  riid,
LCID  lcid,
WORD  flags,
DISPPARAMS *  dp,
VARIANT res,
EXCEPINFO *  ei,
UINT err 
)
static

Definition at line 173 of file global.c.

175 {
177  const builtin_prop_t *prop;
178  VARIANT args[8];
179  unsigned argn, i;
180 
181  TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, id, debugstr_guid(riid), lcid, flags, dp, res, ei, err);
182 
183  if(!This->ctx) {
184  FIXME("NULL context\n");
185  return E_UNEXPECTED;
186  }
187 
188  if(id >= This->member_cnt || (!This->members[id].proc && !This->members[id].flags))
189  return DISP_E_MEMBERNOTFOUND;
190  prop = This->members + id;
191 
192  switch(flags) {
194  if(!(prop->flags & (BP_GET|BP_GETPUT))) {
195  FIXME("property does not support DISPATCH_PROPERTYGET\n");
196  return E_FAIL;
197  }
198  break;
200  if(!prop->proc && prop->flags == BP_GET) {
201  const int vt = prop->min_args, val = prop->max_args;
202  switch(vt) {
203  case VT_I2:
204  V_VT(res) = VT_I2;
205  V_I2(res) = val;
206  break;
207  case VT_I4:
208  V_VT(res) = VT_I4;
209  V_I4(res) = val;
210  break;
211  case VT_BSTR: {
212  const string_constant_t *str = (const string_constant_t*)prop->max_args;
213  BSTR ret;
214 
215  ret = SysAllocStringLen(str->buf, str->len);
216  if(!ret)
217  return E_OUTOFMEMORY;
218 
219  V_VT(res) = VT_BSTR;
220  V_BSTR(res) = ret;
221  break;
222  }
224  }
225  return S_OK;
226  }
227  break;
228  case DISPATCH_METHOD:
229  if(prop->flags & (BP_GET|BP_GETPUT)) {
230  FIXME("Call on property\n");
231  return E_FAIL;
232  }
233  break;
235  if(!(prop->flags & BP_GETPUT)) {
236  FIXME("property does not support DISPATCH_PROPERTYPUT\n");
237  return E_FAIL;
238  }
239 
240  FIXME("call put\n");
241  return E_NOTIMPL;
242  default:
243  FIXME("unsupported flags %x\n", flags);
244  return E_NOTIMPL;
245  }
246 
247  argn = arg_cnt(dp);
248 
249  if(argn < prop->min_args || argn > (prop->max_args ? prop->max_args : prop->min_args)) {
250  WARN("invalid number of arguments\n");
252  }
253 
254  assert(argn < ARRAY_SIZE(args));
255 
256  for(i=0; i < argn; i++) {
257  if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT))
258  args[i] = *V_VARIANTREF(dp->rgvarg+dp->cArgs-i-1);
259  else
260  args[i] = dp->rgvarg[dp->cArgs-i-1];
261  }
262 
263  return prop->proc(This, args, dp->cArgs, res);
264 }
#define DEFAULT_UNREACHABLE
Definition: compat.h:1947
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define V_I2(A)
Definition: oleauto.h:245
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
#define assert(x)
Definition: debug.h:53
OLECHAR * BSTR
Definition: compat.h:1942
#define E_FAIL
Definition: ddrawi.h:102
Definition: match.c:390
#define V_I4(A)
Definition: oleauto.h:247
#define DISPATCH_METHOD
Definition: oleauto.h:1006
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
DWORD flags
Definition: jscript.h:213
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
#define debugstr_guid
Definition: kernel32.h:35
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
#define BP_GET
Definition: global.c:47
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
GLbitfield flags
Definition: glext.h:7161
#define VBSE_FUNC_ARITY_MISMATCH
int ret
#define V_VT(A)
Definition: oleauto.h:211
#define err(...)
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
static unsigned arg_cnt(const DISPPARAMS *dp)
Definition: vbscript.h:162
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
#define ARRAY_SIZE(a)
Definition: main.h:24
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456
#define BP_GETPUT
Definition: global.c:48
GLuint res
Definition: glext.h:9613
GLenum GLuint id
Definition: glext.h:5579
#define V_VARIANTREF(A)
Definition: oleauto.h:283
Definition: compat.h:1946

◆ Builtin_QueryInterface()

static HRESULT WINAPI Builtin_QueryInterface ( IDispatch iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 68 of file global.c.

69 {
71 
73  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
74  *ppv = &This->IDispatch_iface;
75  }else if(IsEqualGUID(&IID_IDispatch, riid)) {
76  TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
77  *ppv = &This->IDispatch_iface;
78  }else {
79  WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
80  *ppv = NULL;
81  return E_NOINTERFACE;
82  }
83 
84  IUnknown_AddRef((IUnknown*)*ppv);
85  return S_OK;
86 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
const GUID IID_IDispatch
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ Builtin_Release()

static ULONG WINAPI Builtin_Release ( IDispatch iface)
static

Definition at line 98 of file global.c.

99 {
102 
103  TRACE("(%p) ref=%d\n", This, ref);
104 
105  if(!ref) {
106  assert(!This->ctx);
107  heap_free(This);
108  }
109 
110  return ref;
111 }
#define assert(x)
Definition: debug.h:53
Definition: send.c:47
long LONG
Definition: pedump.c:60
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ create_builtin_dispatch()

static HRESULT create_builtin_dispatch ( script_ctx_t ctx,
const builtin_prop_t members,
size_t  member_cnt,
BuiltinDisp **  ret 
)
static

Definition at line 276 of file global.c.

277 {
278  BuiltinDisp *disp;
279 
280  if(!(disp = heap_alloc(sizeof(*disp))))
281  return E_OUTOFMEMORY;
282 
283  disp->IDispatch_iface.lpVtbl = &BuiltinDispVtbl;
284  disp->ref = 1;
285  disp->members = members;
286  disp->member_cnt = member_cnt;
287  disp->ctx = ctx;
288 
289  *ret = disp;
290  return S_OK;
291 }
disp
Definition: i386-dis.c:3181
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
int ret
static const IDispatchVtbl BuiltinDispVtbl
Definition: global.c:266
#define S_OK
Definition: intsafe.h:59

Referenced by init_global().

◆ create_object()

static IUnknown* create_object ( script_ctx_t ctx,
const WCHAR progid 
)
static

Definition at line 486 of file global.c.

487 {
489  struct CONFIRMSAFETY cs;
490  IClassFactoryEx *cfex;
491  IClassFactory *cf;
492  DWORD policy_size;
493  BYTE *bpolicy;
494  IUnknown *obj;
495  DWORD policy;
496  GUID guid;
497  HRESULT hres;
498 
500  if(FAILED(hres))
501  return NULL;
502 
503  TRACE("GUID %s\n", debugstr_guid(&guid));
504 
505  if(ctx->safeopt & INTERFACE_USES_SECURITY_MANAGER) {
506  secmgr = get_sec_mgr(ctx);
507  if(!secmgr)
508  return NULL;
509 
510  policy = 0;
511  hres = IInternetHostSecurityManager_ProcessUrlAction(secmgr, URLACTION_ACTIVEX_RUN,
512  (BYTE*)&policy, sizeof(policy), (BYTE*)&guid, sizeof(GUID), 0, 0);
513  if(FAILED(hres) || policy != URLPOLICY_ALLOW)
514  return NULL;
515  }
516 
517  hres = CoGetClassObject(&guid, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, NULL, &IID_IClassFactory, (void**)&cf);
518  if(FAILED(hres))
519  return NULL;
520 
521  hres = IClassFactory_QueryInterface(cf, &IID_IClassFactoryEx, (void**)&cfex);
522  if(SUCCEEDED(hres)) {
523  FIXME("Use IClassFactoryEx\n");
524  IClassFactoryEx_Release(cfex);
525  }
526 
527  hres = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)&obj);
528  if(FAILED(hres))
529  return NULL;
530 
531  if(secmgr) {
532  cs.clsid = guid;
533  cs.pUnk = obj;
534  cs.dwFlags = 0;
535  hres = IInternetHostSecurityManager_QueryCustomPolicy(secmgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
536  &bpolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
537  if(SUCCEEDED(hres)) {
538  policy = policy_size >= sizeof(DWORD) ? *(DWORD*)bpolicy : URLPOLICY_DISALLOW;
539  CoTaskMemFree(bpolicy);
540  }
541 
542  if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
543  IUnknown_Release(obj);
544  return NULL;
545  }
546  }
547 
548  hres = set_object_site(ctx, obj);
549  if(FAILED(hres)) {
550  IUnknown_Release(obj);
551  return NULL;
552  }
553 
554  return obj;
555 }
static IClassFactory * cf
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define DWORD
Definition: nt_native.h:44
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
uint32_t cs
Definition: isohybrid.c:75
const GUID * guid
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3103
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
DWORD safeopt
Definition: jscript.h:419
LONG HRESULT
Definition: typedefs.h:78
const GUID IID_IUnknown
unsigned long DWORD
Definition: ntddk_ex.h:95
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: global.c:41
static IInternetHostSecurityManager * get_sec_mgr(script_ctx_t *ctx)
Definition: global.c:293
unsigned char BYTE
Definition: mem.h:68
#define progid(str)
Definition: exdisp.idl:31
const GUID IID_IClassFactory
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT set_object_site(script_ctx_t *ctx, IUnknown *obj)
Definition: global.c:465

Referenced by Global_CreateObject().

◆ detach_global_objects()

void detach_global_objects ( script_ctx_t ctx)

Definition at line 2855 of file global.c.

2856 {
2857  if(ctx->err_obj) {
2858  ctx->err_obj->ctx = NULL;
2859  IDispatch_Release(&ctx->err_obj->IDispatch_iface);
2860  ctx->err_obj = NULL;
2861  }
2862 
2863  if(ctx->global_obj) {
2864  ctx->global_obj->ctx = NULL;
2865  IDispatch_Release(&ctx->global_obj->IDispatch_iface);
2866  ctx->global_obj = NULL;
2867  }
2868 }
IDispatch IDispatch_iface
Definition: vbscript.h:144
smooth NULL
Definition: ftsmooth.c:416
script_ctx_t * ctx
Definition: vbscript.h:148
BuiltinDisp * err_obj
Definition: vbscript.h:191
BuiltinDisp * global_obj
Definition: vbscript.h:190

Referenced by release_script().

◆ Err_Clear()

static HRESULT Err_Clear ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2778 of file global.c.

2779 {
2780  TRACE("\n");
2781 
2782  clear_ei(&This->ctx->ei);
2783  return S_OK;
2784 }
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ Err_Description()

static HRESULT Err_Description ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2733 of file global.c.

2734 {
2735  TRACE("\n");
2736  return err_string_prop(&This->ctx->ei.bstrDescription, args, args_cnt, res);
2737 }
Definition: match.c:390
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2716
GLuint res
Definition: glext.h:9613

◆ Err_HelpContext()

static HRESULT Err_HelpContext ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2739 of file global.c.

2740 {
2741  TRACE("\n");
2742 
2743  if(args_cnt) {
2744  FIXME("setter not implemented\n");
2745  return E_NOTIMPL;
2746  }
2747 
2748  return return_int(res, This->ctx->ei.dwHelpContext);
2749 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613

◆ Err_HelpFile()

static HRESULT Err_HelpFile ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2751 of file global.c.

2752 {
2753  TRACE("\n");
2754  return err_string_prop(&This->ctx->ei.bstrHelpFile, args, args_cnt, res);
2755 }
Definition: match.c:390
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2716
GLuint res
Definition: glext.h:9613

◆ Err_Number()

static HRESULT Err_Number ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2757 of file global.c.

2758 {
2759  HRESULT hres;
2760 
2761  TRACE("\n");
2762 
2763  if(args_cnt) {
2764  FIXME("setter not implemented\n");
2765  return E_NOTIMPL;
2766  }
2767 
2768  hres = This->ctx->ei.scode;
2770 }
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364
#define E_NOTIMPL
Definition: ddrawi.h:99
#define HRESULT_CODE(hr)
Definition: winerror.h:76
GLuint res
Definition: glext.h:9613
#define FACILITY_VBS
Definition: vbscript.h:378

◆ Err_Raise()

static HRESULT Err_Raise ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2786 of file global.c.

2787 {
2789  int code, helpcontext = 0;
2790  HRESULT hres, error;
2791 
2792  TRACE("%s %u...\n", debugstr_variant(args), args_cnt);
2793 
2794  hres = to_int(args, &code);
2795  if(FAILED(hres))
2796  return hres;
2797  if(code > 0 && code > 0xffff)
2798  return E_INVALIDARG;
2799 
2800  if(args_cnt >= 2)
2801  hres = to_string(args + 1, &source);
2802  if(args_cnt >= 3 && SUCCEEDED(hres))
2803  hres = to_string(args + 2, &description);
2804  if(args_cnt >= 4 && SUCCEEDED(hres))
2805  hres = to_string(args + 3, &helpfile);
2806  if(args_cnt >= 5 && SUCCEEDED(hres))
2807  hres = to_int(args + 4, &helpcontext);
2808 
2809  if(SUCCEEDED(hres)) {
2810  script_ctx_t *ctx = This->ctx;
2811 
2812  error = (code & ~0xffff) ? map_hres(code) : MAKE_VBSERROR(code);
2813 
2814  if(source) {
2815  if(ctx->ei.bstrSource) SysFreeString(ctx->ei.bstrSource);
2816  ctx->ei.bstrSource = source;
2817  }
2818  if(!ctx->ei.bstrSource)
2819  ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR);
2820  if(description) {
2821  if(ctx->ei.bstrDescription) SysFreeString(ctx->ei.bstrDescription);
2822  ctx->ei.bstrDescription = description;
2823  }
2824  if(!ctx->ei.bstrDescription)
2825  ctx->ei.bstrDescription = get_vbscript_error_string(error);
2826  if(helpfile) {
2827  if(ctx->ei.bstrHelpFile) SysFreeString(ctx->ei.bstrHelpFile);
2828  ctx->ei.bstrHelpFile = helpfile;
2829  }
2830  if(args_cnt >= 5)
2831  ctx->ei.dwHelpContext = helpcontext;
2832 
2833  ctx->ei.scode = error;
2834  hres = SCRIPT_E_RECORDED;
2835  }else {
2839  }
2840 
2841  return hres;
2842 }
BSTR get_vbscript_string(int) DECLSPEC_HIDDEN
Definition: vbscript_main.c:38
HRESULT map_hres
Definition: sec_mgr.c:1759
#define error(str)
Definition: mkdosfs.c:1605
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
OLECHAR * BSTR
Definition: compat.h:1942
const char * description
Definition: directx.c:2497
Definition: match.c:390
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BSTR get_vbscript_error_string(HRESULT) DECLSPEC_HIDDEN
Definition: vbscript_main.c:45
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
int code
Definition: i386-dis.c:3591
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
static const TCHAR helpfile[]
Definition: dialog.c:31
#define VBS_RUNTIME_ERROR
jsexcept_t ei
Definition: jscript.h:425
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ Err_Source()

static HRESULT Err_Source ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2772 of file global.c.

2773 {
2774  TRACE("\n");
2775  return err_string_prop(&This->ctx->ei.bstrSource, args, args_cnt, res);
2776 }
Definition: match.c:390
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2716
GLuint res
Definition: glext.h:9613

◆ err_string_prop()

static HRESULT err_string_prop ( BSTR prop,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2716 of file global.c.

2717 {
2718  BSTR str;
2719  HRESULT hres;
2720 
2721  if(!args_cnt)
2722  return return_string(res, *prop ? *prop : L"");
2723 
2724  hres = to_string(args, &str);
2725  if(FAILED(hres))
2726  return hres;
2727 
2728  SysFreeString(*prop);
2729  *prop = str;
2730  return S_OK;
2731 }
OLECHAR * BSTR
Definition: compat.h:1942
Definition: match.c:390
const WCHAR * str
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
static HRESULT return_string(VARIANT *res, const WCHAR *str)
Definition: global.c:318
static const WCHAR L[]
Definition: oid.c:1250
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613

Referenced by Err_Description(), Err_HelpFile(), and Err_Source().

◆ get_builtin_id()

HRESULT get_builtin_id ( BuiltinDisp disp,
const WCHAR name,
DISPID id 
)

Definition at line 128 of file global.c.

129 {
130  size_t min = 1, max = disp->member_cnt - 1, i;
131  int r;
132 
133  while(min <= max) {
134  i = (min + max) / 2;
135  r = wcsicmp(disp->members[i].name, name);
136  if(!r) {
137  *id = i;
138  return S_OK;
139  }
140  if(r < 0)
141  min = i+1;
142  else
143  max = i-1;
144  }
145 
146  return DISP_E_MEMBERNOTFOUND;
147 
148 }
disp
Definition: i386-dis.c:3181
#define max(a, b)
Definition: svc.c:63
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define wcsicmp
Definition: string.h:1152
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55
Definition: name.c:38

Referenced by Builtin_GetIDsOfNames().

◆ get_sec_mgr()

static IInternetHostSecurityManager* get_sec_mgr ( script_ctx_t ctx)
static

Definition at line 293 of file global.c.

294 {
297  HRESULT hres;
298 
299  if(!ctx->site)
300  return NULL;
301 
302  if(ctx->secmgr)
303  return ctx->secmgr;
304 
305  hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
306  if(FAILED(hres))
307  return NULL;
308 
309  hres = IServiceProvider_QueryService(sp, &SID_SInternetHostSecurityManager, &IID_IInternetHostSecurityManager,
310  (void**)&secmgr);
311  IServiceProvider_Release(sp);
312  if(FAILED(hres))
313  return NULL;
314 
315  return ctx->secmgr = secmgr;
316 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
IActiveScriptSite * site
Definition: jscript.h:417
IInternetHostSecurityManager * secmgr
Definition: jscript.h:418
static const WCHAR sp[]
Definition: suminfo.c:288

Referenced by create_object().

◆ Global_Abs()

static HRESULT Global_Abs ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1729 of file global.c.

1730 {
1731  HRESULT hres;
1732  VARIANT dst;
1733 
1734  TRACE("(%s)\n", debugstr_variant(arg));
1735 
1736  assert(args_cnt == 1);
1737 
1738  hres = VarAbs(arg, &dst);
1739  if(FAILED(hres))
1740  return hres;
1741 
1742  if (res)
1743  *res = dst;
1744  else
1745  VariantClear(&dst);
1746 
1747  return S_OK;
1748 }
#define assert(x)
Definition: debug.h:53
HRESULT WINAPI VarAbs(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4263
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
GLuint res
Definition: glext.h:9613

◆ Global_Array()

static HRESULT Global_Array ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2149 of file global.c.

2150 {
2151  SAFEARRAYBOUND bounds;
2152  SAFEARRAY *sa;
2153  VARIANT *data;
2154  HRESULT hres;
2155  unsigned i;
2156 
2157  TRACE("arg_cnt=%u\n", args_cnt);
2158 
2159  bounds.lLbound = 0;
2160  bounds.cElements = args_cnt;
2161  sa = SafeArrayCreate(VT_VARIANT, 1, &bounds);
2162  if(!sa)
2163  return E_OUTOFMEMORY;
2164 
2165  hres = SafeArrayAccessData(sa, (void**)&data);
2166  if(FAILED(hres)) {
2168  return hres;
2169  }
2170 
2171  for(i=0; i<args_cnt; i++) {
2172  hres = VariantCopyInd(data+i, arg+i);
2173  if(FAILED(hres)) {
2176  return hres;
2177  }
2178  }
2180 
2181  if(res) {
2183  V_ARRAY(res) = sa;
2184  }else {
2186  }
2187 
2188  return S_OK;
2189 }
#define V_ARRAY(A)
Definition: oleauto.h:222
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
#define V_VT(A)
Definition: oleauto.h:211
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168

◆ Global_Asc()

static HRESULT Global_Asc ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1642 of file global.c.

1643 {
1644  BSTR conv_str = NULL, str;
1645  HRESULT hres = S_OK;
1646 
1647  TRACE("(%s)\n", debugstr_variant(arg));
1648 
1649  switch(V_VT(arg)) {
1650  case VT_NULL:
1652  case VT_EMPTY:
1654  case VT_BSTR:
1655  str = V_BSTR(arg);
1656  break;
1657  default:
1658  hres = to_string(arg, &conv_str);
1659  if(FAILED(hres))
1660  return hres;
1661  str = conv_str;
1662  }
1663 
1664  if(!SysStringLen(str) || *str >= 0x100)
1666  else if(res)
1667  hres = return_short(res, *str);
1668  SysFreeString(conv_str);
1669  return hres;
1670 }
#define VBSE_ILLEGAL_NULL_USE
OLECHAR * BSTR
Definition: compat.h:1942
#define VBSE_ILLEGAL_FUNC_CALL
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
static HRESULT return_short(VARIANT *res, short val)
Definition: global.c:354
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613

◆ Global_AscB()

static HRESULT Global_AscB ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1630 of file global.c.

1631 {
1632  FIXME("\n");
1633  return E_NOTIMPL;
1634 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_AscW()

static HRESULT Global_AscW ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1717 of file global.c.

1718 {
1719  FIXME("\n");
1720  return E_NOTIMPL;
1721 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Atn()

static HRESULT Global_Atn ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 974 of file global.c.

975 {
976  HRESULT hres;
977  double d;
978 
979  hres = to_double(arg, &d);
980  if(FAILED(hres))
981  return hres;
982 
983  return return_double(res, atan(d));
984 }
HRESULT hres
Definition: protocol.c:465
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:78
valarray< _Tp > atan(const valarray< _Tp > &__x)
Definition: _valarray.h:919
static HRESULT return_double(VARIANT *res, double val)
Definition: global.c:374
GLuint res
Definition: glext.h:9613
static HRESULT to_double(VARIANT *v, double *ret)
Definition: global.c:424

◆ Global_CBool()

static HRESULT Global_CBool ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 695 of file global.c.

696 {
697  VARIANT v;
698  HRESULT hres;
699 
700  TRACE("%s\n", debugstr_variant(arg));
701 
702  assert(args_cnt == 1);
703 
704  V_VT(&v) = VT_EMPTY;
706  if(FAILED(hres))
707  return hres;
708 
709  if(res)
710  *res = v;
711  else
712  VariantClear(&v);
713  return S_OK;
714 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define VARIANT_LOCALBOOL
Definition: oleauto.h:314
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613

◆ Global_CByte()

static HRESULT Global_CByte ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 716 of file global.c.

717 {
718  VARIANT v;
719  HRESULT hres;
720 
721  TRACE("%s\n", debugstr_variant(arg));
722 
723  assert(args_cnt == 1);
724 
725  V_VT(&v) = VT_EMPTY;
727  if(FAILED(hres))
728  return hres;
729 
730  if(!res) {
731  VariantClear(&v);
732  return DISP_E_BADVARTYPE;
733  }
734 
735  *res = v;
736  return S_OK;
737 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define VARIANT_LOCALBOOL
Definition: oleauto.h:314
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613

◆ Global_CCur()

static HRESULT Global_CCur ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 632 of file global.c.

633 {
634  VARIANT v;
635  HRESULT hres;
636 
637  TRACE("%s\n", debugstr_variant(arg));
638 
639  assert(args_cnt == 1);
640 
641  V_VT(&v) = VT_EMPTY;
642  hres = VariantChangeType(&v, arg, 0, VT_CY);
643  if(FAILED(hres))
644  return hres;
645 
646  if(!res) {
647  VariantClear(&v);
648  return DISP_E_BADVARTYPE;
649  }
650 
651  *res = v;
652  return S_OK;
653 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define V_VT(A)
Definition: oleauto.h:211
Definition: compat.h:1950
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613

◆ Global_CDate()

static HRESULT Global_CDate ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 739 of file global.c.

740 {
741  FIXME("\n");
742  return E_NOTIMPL;
743 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_CDbl()

static HRESULT Global_CDbl ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 745 of file global.c.

746 {
747  VARIANT v;
748  HRESULT hres;
749 
750  TRACE("%s\n", debugstr_variant(arg));
751 
752  assert(args_cnt == 1);
753 
754  V_VT(&v) = VT_EMPTY;
755  hres = VariantChangeType(&v, arg, 0, VT_R8);
756  if(FAILED(hres))
757  return hres;
758 
759  if(!res)
760  return DISP_E_BADVARTYPE;
761  else {
762  *res = v;
763  return S_OK;
764  }
765 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613
Definition: compat.h:1949

◆ Global_Chr()

static HRESULT Global_Chr ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1675 of file global.c.

1676 {
1677  int cp, c, len = 0;
1678  CPINFO cpi;
1679  WCHAR ch;
1680  char buf[2];
1681  HRESULT hres;
1682 
1683  TRACE("%s\n", debugstr_variant(arg));
1684 
1685  hres = to_int(arg, &c);
1686  if(FAILED(hres))
1687  return hres;
1688 
1689  cp = GetACP();
1690  if(!GetCPInfo(cp, &cpi))
1691  cpi.MaxCharSize = 1;
1692 
1693  if((c!=(short)c && c!=(unsigned short)c) ||
1694  (unsigned short)c>=(cpi.MaxCharSize>1 ? 0x10000 : 0x100)) {
1695  WARN("invalid arg %d\n", c);
1697  }
1698 
1699  if(c>>8)
1700  buf[len++] = c>>8;
1701  if(!len || IsDBCSLeadByteEx(cp, buf[0]))
1702  buf[len++] = c;
1703  if(!MultiByteToWideChar(CP_ACP, 0, buf, len, &ch, 1)) {
1704  WARN("invalid arg %d, cp %d\n", c, cp);
1705  return E_FAIL;
1706  }
1707 
1708  if(res) {
1709  V_VT(res) = VT_BSTR;
1710  V_BSTR(res) = SysAllocStringLen(&ch, 1);
1711  if(!V_BSTR(res))
1712  return E_OUTOFMEMORY;
1713  }
1714  return S_OK;
1715 }
BOOL WINAPI GetCPInfo(UINT CodePage, LPCPINFO CodePageInfo)
Definition: nls.c:1915
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:111
UINT MaxCharSize
Definition: winnls.h:578
#define E_FAIL
Definition: ddrawi.h:102
#define VBSE_ILLEGAL_FUNC_CALL
BOOL WINAPI IsDBCSLeadByteEx(UINT CodePage, BYTE TestByte)
Definition: nls.c:2210
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
UINT WINAPI GetACP(VOID)
Definition: nls.c:2180
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
const GLubyte * c
Definition: glext.h:8905
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
#define MultiByteToWideChar
Definition: compat.h:100
POINT cp
Definition: magnifier.c:59
GLuint res
Definition: glext.h:9613
#define c
Definition: ke_i.h:80

◆ Global_ChrB()

static HRESULT Global_ChrB ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1636 of file global.c.

1637 {
1638  FIXME("\n");
1639  return E_NOTIMPL;
1640 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_ChrW()

static HRESULT Global_ChrW ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1723 of file global.c.

1724 {
1725  FIXME("\n");
1726  return E_NOTIMPL;
1727 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_CInt()

static HRESULT Global_CInt ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 655 of file global.c.

656 {
657  VARIANT v;
658  HRESULT hres;
659 
660  TRACE("%s\n", debugstr_variant(arg));
661 
662  assert(args_cnt == 1);
663 
664  V_VT(&v) = VT_EMPTY;
665  hres = VariantChangeType(&v, arg, 0, VT_I2);
666  if(FAILED(hres))
667  return hres;
668 
669  if(!res)
670  return DISP_E_BADVARTYPE;
671  else {
672  *res = v;
673  return S_OK;
674  }
675 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613
Definition: compat.h:1946

◆ Global_CLng()

static HRESULT Global_CLng ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 677 of file global.c.

678 {
679  int i;
680  HRESULT hres;
681 
682  TRACE("%s\n", debugstr_variant(arg));
683 
684  assert(args_cnt == 1);
685 
686  hres = to_int(arg, &i);
687  if(FAILED(hres))
688  return hres;
689  if(!res)
690  return DISP_E_BADVARTYPE;
691 
692  return return_int(res, i);
693 }
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
#define assert(x)
Definition: debug.h:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364
GLuint res
Definition: glext.h:9613

◆ Global_Cos()

static HRESULT Global_Cos ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 986 of file global.c.

987 {
988  HRESULT hres;
989  double d;
990 
991  hres = to_double(arg, &d);
992  if(FAILED(hres))
993  return hres;
994 
995  return return_double(res, cos(d));
996 }
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
HRESULT hres
Definition: protocol.c:465
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:78
static HRESULT return_double(VARIANT *res, double val)
Definition: global.c:374
GLuint res
Definition: glext.h:9613
static HRESULT to_double(VARIANT *v, double *ret)
Definition: global.c:424

◆ Global_CreateObject()

static HRESULT Global_CreateObject ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1996 of file global.c.

1997 {
1998  IUnknown *obj;
1999  HRESULT hres;
2000 
2001  TRACE("(%s)\n", debugstr_variant(arg));
2002 
2003  if(V_VT(arg) != VT_BSTR) {
2004  FIXME("non-bstr arg\n");
2005  return E_INVALIDARG;
2006  }
2007 
2008  obj = create_object(This->ctx, V_BSTR(arg));
2009  if(!obj)
2010  return VB_E_CANNOT_CREATE_OBJ;
2011 
2012  if(res) {
2013  hres = IUnknown_QueryInterface(obj, &IID_IDispatch, (void**)&V_DISPATCH(res));
2014  if(FAILED(hres))
2015  return hres;
2016 
2017  V_VT(res) = VT_DISPATCH;
2018  }
2019 
2020  IUnknown_Release(obj);
2021  return S_OK;
2022 }
#define VB_E_CANNOT_CREATE_OBJ
Definition: global.c:37
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
const GUID IID_IDispatch
static IUnknown * create_object(script_ctx_t *ctx, const WCHAR *progid)
Definition: global.c:486
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613

◆ Global_CSng()

static HRESULT Global_CSng ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 767 of file global.c.

768 {
769  VARIANT v;
770  HRESULT hres;
771 
772  TRACE("%s\n", debugstr_variant(arg));
773 
774  assert(args_cnt == 1);
775 
776  V_VT(&v) = VT_EMPTY;
777  hres = VariantChangeType(&v, arg, 0, VT_R4);
778  if(FAILED(hres))
779  return hres;
780 
781  if(!res)
782  return DISP_E_BADVARTYPE;
783 
784  *res = v;
785  return S_OK;
786 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
Definition: compat.h:1948
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613

◆ Global_CStr()

static HRESULT Global_CStr ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 788 of file global.c.

789 {
790  BSTR str;
791  HRESULT hres;
792 
793  TRACE("%s\n", debugstr_variant(arg));
794 
795  if(V_VT(arg) == VT_NULL)
797 
798  hres = to_string(arg, &str);
799  if(FAILED(hres))
800  return hres;
801 
802  return return_bstr(res, str);
803 }
#define VBSE_ILLEGAL_NULL_USE
OLECHAR * BSTR
Definition: compat.h:1942
static HRESULT return_bstr(VARIANT *res, BSTR str)
Definition: global.c:334
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
GLuint res
Definition: glext.h:9613

◆ Global_Date()

static HRESULT Global_Date ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1825 of file global.c.

1826 {
1827  SYSTEMTIME lt;
1828  UDATE ud;
1829  DATE date;
1830  HRESULT hres;
1831 
1832  TRACE("\n");
1833 
1834  GetLocalTime(&lt);
1835  ud.st = lt;
1836  ud.wDayOfYear = 0;
1838  if(FAILED(hres))
1839  return hres;
1840  return return_date(res, date);
1841 }
static HRESULT return_date(VARIANT *res, double date)
Definition: global.c:401
SYSTEMTIME st
Definition: oleauto.h:721
HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DATE *pDateOut)
Definition: variant.c:1345
double DATE
Definition: compat.h:1902
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
#define VAR_DATEVALUEONLY
Definition: oleauto.h:327
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
Definition: oleauto.h:720
__u16 date
Definition: mkdosfs.c:366
GLuint res
Definition: glext.h:9613
USHORT wDayOfYear
Definition: oleauto.h:722

◆ Global_DateAdd()

static HRESULT Global_DateAdd ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2081 of file global.c.

2082 {
2083  FIXME("\n");
2084  return E_NOTIMPL;
2085 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_DateDiff()

static HRESULT Global_DateDiff ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2087 of file global.c.

2088 {
2089  FIXME("\n");
2090  return E_NOTIMPL;
2091 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_DatePart()

static HRESULT Global_DatePart ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2093 of file global.c.

2094 {
2095  FIXME("\n");
2096  return E_NOTIMPL;
2097 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_DateSerial()

static HRESULT Global_DateSerial ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1945 of file global.c.

1946 {
1947  FIXME("\n");
1948  return E_NOTIMPL;
1949 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_DateValue()

static HRESULT Global_DateValue ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1933 of file global.c.

1934 {
1935  FIXME("\n");
1936  return E_NOTIMPL;
1937 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Day()

static HRESULT Global_Day ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1861 of file global.c.

1862 {
1863  SYSTEMTIME st;
1864  HRESULT hres;
1865 
1866  TRACE("(%s)\n", debugstr_variant(arg));
1867 
1868  hres = to_system_time(arg, &st);
1869  return FAILED(hres) ? hres : return_short(res, st.wDay);
1870 }
static HRESULT to_system_time(VARIANT *v, SYSTEMTIME *st)
Definition: global.c:452
static HRESULT return_short(VARIANT *res, short val)
Definition: global.c:354
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
WORD wDay
Definition: winbase.h:886
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
GLuint res
Definition: glext.h:9613

◆ Global_Erase()

static HRESULT Global_Erase ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2191 of file global.c.

2192 {
2193  FIXME("\n");
2194  return E_NOTIMPL;
2195 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Err()

static HRESULT Global_Err ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2494 of file global.c.

2495 {
2496  TRACE("\n");
2497 
2498  if(args_cnt) {
2499  FIXME("Setter not supported\n");
2500  return E_NOTIMPL;
2501  }
2502 
2503  V_VT(res) = VT_DISPATCH;
2504  V_DISPATCH(res) = &This->ctx->err_obj->IDispatch_iface;
2505  IDispatch_AddRef(V_DISPATCH(res));
2506  return S_OK;
2507 }
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613

◆ Global_Escape()

static HRESULT Global_Escape ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2458 of file global.c.

2459 {
2460  FIXME("\n");
2461  return E_NOTIMPL;
2462 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Eval()

static HRESULT Global_Eval ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2470 of file global.c.

2471 {
2472  FIXME("\n");
2473  return E_NOTIMPL;
2474 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Execute()

static HRESULT Global_Execute ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2476 of file global.c.

2477 {
2478  FIXME("\n");
2479  return E_NOTIMPL;
2480 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_ExecuteGlobal()

static HRESULT Global_ExecuteGlobal ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2482 of file global.c.

2483 {
2484  FIXME("\n");
2485  return E_NOTIMPL;
2486 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Exp()

static HRESULT Global_Exp ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1022 of file global.c.

1023 {
1024  HRESULT hres;
1025  double d;
1026 
1027  hres = to_double(arg, &d);
1028  if(FAILED(hres))
1029  return hres;
1030 
1031  return return_double(res, exp(d));
1032 }
HRESULT hres
Definition: protocol.c:465
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:78
static HRESULT return_double(VARIANT *res, double val)
Definition: global.c:374
DWORD exp
Definition: msg.c:16033
GLuint res
Definition: glext.h:9613
static HRESULT to_double(VARIANT *v, double *ret)
Definition: global.c:424

◆ Global_Filter()

static HRESULT Global_Filter ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2197 of file global.c.

2198 {
2199  FIXME("\n");
2200  return E_NOTIMPL;
2201 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Fix()

static HRESULT Global_Fix ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1750 of file global.c.

1751 {
1752  HRESULT hres;
1753  VARIANT dst;
1754 
1755  TRACE("(%s)\n", debugstr_variant(arg));
1756 
1757  assert(args_cnt == 1);
1758 
1759  hres = VarFix(arg, &dst);
1760  if(FAILED(hres))
1761  return hres;
1762 
1763  if (res)
1764  *res = dst;
1765  else
1766  VariantClear(&dst);
1767 
1768  return S_OK;
1769 }
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
HRESULT WINAPI VarFix(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4367
GLuint res
Definition: glext.h:9613

◆ Global_FormatCurrency()

static HRESULT Global_FormatCurrency ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2352 of file global.c.

2353 {
2354  FIXME("\n");
2355  return E_NOTIMPL;
2356 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_FormatDateTime()

static HRESULT Global_FormatDateTime ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2364 of file global.c.

2365 {
2366  FIXME("\n");
2367  return E_NOTIMPL;
2368 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_FormatNumber()

static HRESULT Global_FormatNumber ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2346 of file global.c.

2347 {
2348  FIXME("\n");
2349  return E_NOTIMPL;
2350 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_FormatPercent()

static HRESULT Global_FormatPercent ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2358 of file global.c.

2359 {
2360  FIXME("\n");
2361  return E_NOTIMPL;
2362 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_GetObject()

static HRESULT Global_GetObject ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2024 of file global.c.

2025 {
2026  IBindCtx *bind_ctx;
2027  IUnknown *obj_unk;
2028  IDispatch *disp;
2029  ULONG eaten = 0;
2030  IMoniker *mon;
2031  HRESULT hres;
2032 
2033  TRACE("%s %s\n", args_cnt ? debugstr_variant(args) : "", args_cnt > 1 ? debugstr_variant(args+1) : "");
2034 
2035  if(args_cnt != 1 || V_VT(args) != VT_BSTR) {
2036  FIXME("unsupported args\n");
2037  return E_NOTIMPL;
2038  }
2039 
2040  if(This->ctx->safeopt & (INTERFACE_USES_SECURITY_MANAGER|INTERFACESAFE_FOR_UNTRUSTED_DATA)) {
2041  WARN("blocked in current safety mode\n");
2042  return VB_E_CANNOT_CREATE_OBJ;
2043  }
2044 
2045  hres = CreateBindCtx(0, &bind_ctx);
2046  if(FAILED(hres))
2047  return hres;
2048 
2049  hres = MkParseDisplayName(bind_ctx, V_BSTR(args), &eaten, &mon);
2050  if(SUCCEEDED(hres)) {
2051  hres = IMoniker_BindToObject(mon, bind_ctx, NULL, &IID_IUnknown, (void**)&obj_unk);
2052  IMoniker_Release(mon);
2053  }else {
2054  hres = MK_E_SYNTAX;
2055  }
2056  IBindCtx_Release(bind_ctx);
2057  if(FAILED(hres))
2058  return hres;
2059 
2060  hres = set_object_site(This->ctx, obj_unk);
2061  if(FAILED(hres)) {
2062  IUnknown_Release(obj_unk);
2063  return hres;
2064  }
2065 
2066  hres = IUnknown_QueryInterface(obj_unk, &IID_IDispatch, (void**)&disp);
2067  if(SUCCEEDED(hres)) {
2068  if(res) {
2069  V_VT(res) = VT_DISPATCH;
2070  V_DISPATCH(res) = disp;
2071  }else {
2072  IDispatch_Release(disp);
2073  }
2074  }else {
2075  FIXME("object does not support IDispatch\n");
2076  }
2077 
2078  return hres;
2079 }
disp
Definition: i386-dis.c:3181
#define VB_E_CANNOT_CREATE_OBJ
Definition: global.c:37
#define WARN(fmt,...)
Definition: debug.h:111
Definition: match.c:390
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
LONG HRESULT
Definition: typedefs.h:78
const GUID IID_IUnknown
const GUID IID_IDispatch
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:1129
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define MK_E_SYNTAX
Definition: winerror.h:2785
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT set_object_site(script_ctx_t *ctx, IUnknown *obj)
Definition: global.c:465

◆ Global_GetRef()

static HRESULT Global_GetRef ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2488 of file global.c.

2489 {
2490  FIXME("\n");
2491  return E_NOTIMPL;
2492 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Hex()

static HRESULT Global_Hex ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 810 of file global.c.

811 {
812  WCHAR buf[17], *ptr;
813  DWORD n;
814  HRESULT hres;
815  int ret;
816 
817  TRACE("%s\n", debugstr_variant(arg));
818 
819  switch(V_VT(arg)) {
820  case VT_I2:
821  n = (WORD)V_I2(arg);
822  break;
823  case VT_NULL:
824  if(res)
825  V_VT(res) = VT_NULL;
826  return S_OK;
827  default:
828  hres = to_int(arg, &ret);
829  if(FAILED(hres))
830  return hres;
831  else
832  n = ret;
833  }
834 
835  buf[16] = 0;
836  ptr = buf+15;
837 
838  if(n) {
839  do {
840  *ptr-- = hex_char(n & 0xf);
841  n >>= 4;
842  }while(n);
843  ptr++;
844  }else {
845  *ptr = '0';
846  }
847 
848  return return_string(res, ptr);
849 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
#define V_I2(A)
Definition: oleauto.h:245
GLdouble n
Definition: glext.h:7729
static PVOID ptr
Definition: dispmode.c:27
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
unsigned short WORD
Definition: ntddk_ex.h:93
static HRESULT return_string(VARIANT *res, const WCHAR *str)
Definition: global.c:318
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
static WCHAR hex_char(unsigned n)
Definition: global.c:805
GLuint res
Definition: glext.h:9613
Definition: compat.h:1946

◆ Global_Hour()

static HRESULT Global_Hour ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1900 of file global.c.

1901 {
1902  SYSTEMTIME st;
1903  HRESULT hres;
1904 
1905  TRACE("(%s)\n", debugstr_variant(arg));
1906 
1907  hres = to_system_time(arg, &st);
1908  return FAILED(hres) ? hres : return_short(res, st.wHour);
1909 }
static HRESULT to_system_time(VARIANT *v, SYSTEMTIME *st)
Definition: global.c:452
static HRESULT return_short(VARIANT *res, short val)
Definition: global.c:354
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
WORD wHour
Definition: winbase.h:887
GLuint res
Definition: glext.h:9613

◆ Global_InputBox()

static HRESULT Global_InputBox ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1957 of file global.c.

1958 {
1959  FIXME("\n");
1960  return E_NOTIMPL;
1961 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_InStr()

static HRESULT Global_InStr ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1557 of file global.c.

1558 {
1559  VARIANT *startv, *str1v, *str2v;
1560  BSTR str1, str2;
1561  int start, ret;
1562  HRESULT hres;
1563 
1564  TRACE("\n");
1565 
1566  assert(2 <= args_cnt && args_cnt <= 4);
1567 
1568  switch(args_cnt) {
1569  case 2:
1570  startv = NULL;
1571  str1v = args;
1572  str2v = args+1;
1573  break;
1574  case 3:
1575  startv = args;
1576  str1v = args+1;
1577  str2v = args+2;
1578  break;
1579  case 4:
1580  FIXME("unsupported compare argument %s\n", debugstr_variant(args));
1581  return E_NOTIMPL;
1583  }
1584 
1585  if(startv) {
1586  hres = to_int(startv, &start);
1587  if(FAILED(hres))
1588  return hres;
1589  if(--start < 0) {
1590  FIXME("start %d\n", start);
1591  return E_FAIL;
1592  }
1593  }else {
1594  start = 0;
1595  }
1596 
1597  if(V_VT(str1v) == VT_NULL || V_VT(str2v) == VT_NULL)
1598  return return_null(res);
1599 
1600  if(V_VT(str1v) != VT_BSTR) {
1601  FIXME("Unsupported str1 type %s\n", debugstr_variant(str1v));
1602  return E_NOTIMPL;
1603  }
1604  str1 = V_BSTR(str1v);
1605 
1606  if(V_VT(str2v) != VT_BSTR) {
1607  FIXME("Unsupported str2 type %s\n", debugstr_variant(str2v));
1608  return E_NOTIMPL;
1609  }
1610  str2 = V_BSTR(str2v);
1611 
1612  if(start < SysStringLen(str1)) {
1613  WCHAR *ptr;
1614 
1615  ptr = wcsstr(str1+start, str2);
1616  ret = ptr ? ptr-str1+1 : 0;
1617  }else {
1618  ret = 0;
1619  }
1620 
1621  return return_int(res, ret);
1622 }
#define DEFAULT_UNREACHABLE
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define assert(x)
Definition: debug.h:53
OLECHAR * BSTR
Definition: compat.h:1942
#define E_FAIL
Definition: ddrawi.h:102
Definition: match.c:390
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static HRESULT return_null(VARIANT *res)
Definition: global.c:394
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
int ret
#define V_VT(A)
Definition: oleauto.h:211
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364
GLuint start
Definition: gl.h:1545
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613
#define args
Definition: format.c:66

◆ Global_InStrB()

static HRESULT Global_InStrB ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1624 of file global.c.

1625 {
1626  FIXME("\n");
1627  return E_NOTIMPL;
1628 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_InStrRev()

static HRESULT Global_InStrRev ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2244 of file global.c.

2245 {
2246  int start, ret = 0;
2247  BSTR str1, str2;
2248  HRESULT hres;
2249 
2250  TRACE("%s %s arg_cnt=%u\n", debugstr_variant(args), debugstr_variant(args+1), args_cnt);
2251 
2252  if(args_cnt > 3) {
2253  FIXME("Unsupported args\n");
2254  return E_NOTIMPL;
2255  }
2256 
2257  assert(2 <= args_cnt && args_cnt <= 4);
2258 
2259  if(V_VT(args) == VT_NULL || V_VT(args+1) == VT_NULL || (args_cnt > 2 && V_VT(args+2) == VT_NULL))
2261 
2262  hres = to_string(args, &str1);
2263  if(FAILED(hres))
2264  return hres;
2265 
2266  hres = to_string(args+1, &str2);
2267  if(SUCCEEDED(hres)) {
2268  if(args_cnt > 2) {
2269  hres = to_int(args+2, &start);
2270  if(SUCCEEDED(hres) && start <= 0) {
2271  FIXME("Unsupported start %d\n", start);
2272  hres = E_NOTIMPL;
2273  }
2274  }else {
2275  start = SysStringLen(str1);
2276  }
2277  } else {
2278  str2 = NULL;
2279  }
2280 
2281  if(SUCCEEDED(hres)) {
2282  const WCHAR *ptr;
2283  size_t len;
2284 
2285  len = SysStringLen(str2);
2286  if(start >= len && start <= SysStringLen(str1)) {
2287  for(ptr = str1+start-SysStringLen(str2); ptr >= str1; ptr--) {
2288  if(!memcmp(ptr, str2, len*sizeof(WCHAR))) {
2289  ret = ptr-str1+1;
2290  break;
2291  }
2292  }
2293  }
2294  }
2295 
2296  SysFreeString(str1);
2297  SysFreeString(str2);
2298  if(FAILED(hres))
2299  return hres;
2300 
2301  return return_int(res, ret);
2302 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
#define VBSE_ILLEGAL_NULL_USE
#define assert(x)
Definition: debug.h:53
OLECHAR * BSTR
Definition: compat.h:1942
Definition: match.c:390
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
int ret
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364
GLuint start
Definition: gl.h:1545
#define E_NOTIMPL
Definition: ddrawi.h:99
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ Global_Int()

static HRESULT Global_Int ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1771 of file global.c.

1772 {
1773  HRESULT hres;
1774  VARIANT dst;
1775 
1776  TRACE("(%s)\n", debugstr_variant(arg));
1777 
1778  assert(args_cnt == 1);
1779 
1780  hres = VarInt(arg, &dst);
1781  if(FAILED(hres))
1782  return hres;
1783 
1784  if (res)
1785  *res = dst;
1786  else
1787  VariantClear(&dst);
1788 
1789  return S_OK;
1790 }
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
GLuint res
Definition: glext.h:9613
HRESULT WINAPI VarInt(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4473

◆ Global_IsArray()

static HRESULT Global_IsArray ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 955 of file global.c.

956 {
957  FIXME("\n");
958  return E_NOTIMPL;
959 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_IsDate()

static HRESULT Global_IsDate ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 909 of file global.c.

910 {
911  FIXME("\n");
912  return E_NOTIMPL;
913 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_IsEmpty()

static HRESULT Global_IsEmpty ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 915 of file global.c.

916 {
917  TRACE("(%s)\n", debugstr_variant(arg));
918 
919  assert(args_cnt == 1);
920 
921  if(res) {
922  V_VT(res) = VT_BOOL;
923  V_BOOL(res) = V_VT(arg) == VT_EMPTY ? VARIANT_TRUE : VARIANT_FALSE;
924  }
925  return S_OK;
926 }
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613

◆ Global_IsNull()

static HRESULT Global_IsNull ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 928 of file global.c.

929 {
930  TRACE("(%s)\n", debugstr_variant(arg));
931 
932  assert(args_cnt == 1);
933 
934  if(res) {
935  V_VT(res) = VT_BOOL;
936  V_BOOL(res) = V_VT(arg) == VT_NULL ? VARIANT_TRUE : VARIANT_FALSE;
937  }
938  return S_OK;
939 }
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613

◆ Global_IsNumeric()

static HRESULT Global_IsNumeric ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 941 of file global.c.

942 {
943  HRESULT hres;
944  double d;
945 
946  TRACE("(%s)\n", debugstr_variant(arg));
947 
948  assert(args_cnt == 1);
949 
950  hres = to_double(arg, &d);
951 
952  return return_bool(res, SUCCEEDED(hres));
953 }
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:78
static HRESULT return_bool(VARIANT *res, BOOL val)
Definition: global.c:345
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
GLuint res
Definition: glext.h:9613
static HRESULT to_double(VARIANT *v, double *ret)
Definition: global.c:424
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ Global_IsObject()

static HRESULT Global_IsObject ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 961 of file global.c.

962 {
963  TRACE("(%s)\n", debugstr_variant(arg));
964 
965  assert(args_cnt == 1);
966 
967  if(res) {
968  V_VT(res) = VT_BOOL;
969  V_BOOL(res) = V_VT(arg) == VT_DISPATCH ? VARIANT_TRUE : VARIANT_FALSE;
970  }
971  return S_OK;
972 }
#define assert(x)
Definition: debug.h:53
#define TRACE(s)
Definition: solgame.cpp:4
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613

◆ Global_Join()

static HRESULT Global_Join ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2203 of file global.c.

2204 {
2205  FIXME("\n");
2206  return E_NOTIMPL;
2207 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_LBound()

static HRESULT Global_LBound ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1087 of file global.c.

1088 {
1089  FIXME("\n");
1090  return E_NOTIMPL;
1091 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_LCase()

static HRESULT Global_LCase ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1375 of file global.c.

1376 {
1377  BSTR str;
1378  HRESULT hres;
1379 
1380  TRACE("%s\n", debugstr_variant(arg));
1381 
1382  if(V_VT(arg) == VT_NULL) {
1383  if(res)
1384  V_VT(res) = VT_NULL;
1385  return S_OK;
1386  }
1387 
1388  hres = to_string(arg, &str);
1389  if(FAILED(hres))
1390  return hres;
1391 
1392  if(res) {
1393  WCHAR *ptr;
1394 
1395  for(ptr = str; *ptr; ptr++)
1396  *ptr = towlower(*ptr);
1397 
1398  V_VT(res) = VT_BSTR;
1399  V_BSTR(res) = str;
1400  }else {
1401  SysFreeString(str);
1402  }
1403  return S_OK;
1404 }
OLECHAR * BSTR
Definition: compat.h:1942
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613
#define towlower(c)
Definition: wctype.h:97

◆ Global_Left()

static HRESULT Global_Left ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1185 of file global.c.

1186 {
1187  BSTR str, ret, conv_str = NULL;
1188  int len, str_len;
1189  HRESULT hres;
1190 
1191  TRACE("(%s %s)\n", debugstr_variant(args+1), debugstr_variant(args));
1192 
1193  if(V_VT(args) == VT_BSTR) {
1194  str = V_BSTR(args);
1195  }else {
1196  hres = to_string(args, &conv_str);
1197  if(FAILED(hres))
1198  return hres;
1199  str = conv_str;
1200  }
1201 
1202  hres = to_int(args+1, &len);
1203  if(FAILED(hres))
1204  return hres;
1205 
1206  if(len < 0) {
1207  FIXME("len = %d\n", len);
1208  return E_FAIL;
1209  }
1210 
1212  if(len > str_len)
1213  len = str_len;
1214 
1216  SysFreeString(conv_str);
1217  if(!ret)
1218  return E_OUTOFMEMORY;
1219 
1220  return return_bstr(res, ret);
1221 }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
#define str_len
Definition: treelist.c:89
OLECHAR * BSTR
Definition: compat.h:1942
#define E_FAIL
Definition: ddrawi.h:102
Definition: match.c:390
static HRESULT return_bstr(VARIANT *res, BSTR str)
Definition: global.c:334
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
int ret
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613

◆ Global_LeftB()

static HRESULT Global_LeftB ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1223 of file global.c.

1224 {
1225  FIXME("\n");
1226  return E_NOTIMPL;
1227 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Len()

static HRESULT Global_Len ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1153 of file global.c.

1154 {
1155  DWORD len;
1156  HRESULT hres;
1157 
1158  TRACE("%s\n", debugstr_variant(arg));
1159 
1160  if(V_VT(arg) == VT_NULL)
1161  return return_null(res);
1162 
1163  if(V_VT(arg) != VT_BSTR) {
1164  BSTR str;
1165 
1166  hres = to_string(arg, &str);
1167  if(FAILED(hres))
1168  return hres;
1169 
1170  len = SysStringLen(str);
1171  SysFreeString(str);
1172  }else {
1173  len = SysStringLen(V_BSTR(arg));
1174  }
1175 
1176  return return_int(res, len);
1177 }
OLECHAR * BSTR
Definition: compat.h:1942
const WCHAR * str
static HRESULT return_null(VARIANT *res)
Definition: global.c:394
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613

◆ Global_LenB()

static HRESULT Global_LenB ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1179 of file global.c.

1180 {
1181  FIXME("\n");
1182  return E_NOTIMPL;
1183 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_LoadPicture()

static HRESULT Global_LoadPicture ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 2304 of file global.c.

2305 {
2306  FIXME("\n");
2307  return E_NOTIMPL;
2308 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_Log()

static HRESULT Global_Log ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1034 of file global.c.

1035 {
1036  HRESULT hres;
1037  double d;
1038 
1039  hres = to_double(arg, &d);
1040  if(FAILED(hres))
1041  return hres;
1042 
1043  if(d <= 0)
1045  else
1046  return return_double(res, log(d));
1047 }
#define VBSE_ILLEGAL_FUNC_CALL
HRESULT hres
Definition: protocol.c:465
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:78
static HRESULT return_double(VARIANT *res, double val)
Definition: global.c:374
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
GLuint res
Definition: glext.h:9613
static HRESULT to_double(VARIANT *v, double *ret)
Definition: global.c:424
#define log(outFile, fmt,...)
Definition: util.h:15

◆ Global_LTrim()

static HRESULT Global_LTrim ( BuiltinDisp This,
VARIANT arg,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1437 of file global.c.

1438 {
1439  BSTR str, conv_str = NULL;
1440  WCHAR *ptr;
1441  HRESULT hres;
1442 
1443  TRACE("%s\n", debugstr_variant(arg));
1444 
1445  if(V_VT(arg) == VT_BSTR) {
1446  str = V_BSTR(arg);
1447  }else {
1448  hres = to_string(arg, &conv_str);
1449  if(FAILED(hres))
1450  return hres;
1451  str = conv_str;
1452  }
1453 
1454  for(ptr = str; *ptr && iswspace(*ptr); ptr++);
1455 
1456  str = SysAllocString(ptr);
1457  SysFreeString(conv_str);
1458  if(!str)
1459  return E_OUTOFMEMORY;
1460 
1461  return return_bstr(res, str);
1462 }
OLECHAR * BSTR
Definition: compat.h:1942
static HRESULT return_bstr(VARIANT *res, BSTR str)
Definition: global.c:334
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define iswspace(_c)
Definition: ctype.h:669
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
GLuint res
Definition: glext.h:9613

◆ Global_Mid()

static HRESULT Global_Mid ( BuiltinDisp This,
VARIANT args,
unsigned  args_cnt,
VARIANT res 
)
static

Definition at line 1273 of file global.c.

1274 {
1275  int len = -1, start, str_len;
1276  BSTR str;
1277  HRESULT hres;
1278 
1279  TRACE("(%s %s ...)\n", debugstr_variant(args), debugstr_variant(args+1));
1280 
1281  assert(args_cnt == 2 || args_cnt == 3);
1282 
1283  if(V_VT(args) != VT_BSTR) {
1284  FIXME("args[0] = %s\n", debugstr_variant(args));
1285  return E_NOTIMPL;
1286  }
1287 
1288  str = V_BSTR(args);
1289 
1290  hres = to_int(args+1, &start);
1291  if(FAILED(hres))
1292  return hres;
1293 
1294  if(args_cnt == 3) {
1295  hres = to_int(args+2, &len);
1296  if(FAILED(hres))
1297  return hres;
1298 
1299  if(len < 0) {
1300  FIXME("len = %d\n", len);
1301  return E_FAIL;
1302  }
1303  }
1304 
1305 
1307  start--;
1308  if(start > str_len)
1309  start = str_len;
1310 
1311  if(len == -1)
1312  len = str_len-start;
1313  else if(len > str_len-start)
1314  len = str_len-start;
1315 
1316  if(res) {
1317  V_VT(res) = VT_BSTR;
1319  if(!V_BSTR(res))
1320  return E_OUTOFMEMORY;
1321  }
1322 
1323  return S_OK;
1324 }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
#define str_len
Definition: treelist.c:89
#define assert(x)
Definition: debug.h:53
OLECHAR * BSTR
Definition: compat.h:1942
#define E_FAIL
Definition: ddrawi.h:102
Definition: match.c:390
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613

◆ Global_MidB()

static