ReactOS 0.4.16-dev-297-gc569aee
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}
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
static BuiltinDisp * impl_from_IDispatch(IDispatch *iface)
Definition: global.c:63

◆ 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;
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++) {
166 if(FAILED(hres))
167 return hres;
168 }
169
170 return S_OK;
171}
#define FIXME(fmt,...)
Definition: precomp.h:53
GLuint * ids
Definition: glext.h:5907
GLuint GLuint * names
Definition: glext.h:11545
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
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hres
Definition: protocol.c:465
HRESULT get_builtin_id(BuiltinDisp *disp, const WCHAR *name, DISPID *id)
Definition: global.c:128
#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}
#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}

◆ 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))
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 ARRAY_SIZE(A)
Definition: main.h:20
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
OLECHAR * BSTR
Definition: compat.h:2293
@ VT_BSTR
Definition: compat.h:2303
@ VT_BYREF
Definition: compat.h:2342
@ VT_VARIANT
Definition: compat.h:2307
@ VT_I4
Definition: compat.h:2298
@ VT_I2
Definition: compat.h:2297
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:91
#define VBSE_FUNC_ARITY_MISMATCH
#define assert(x)
Definition: debug.h:53
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
GLuint GLfloat * val
Definition: glext.h:7180
GLuint id
Definition: glext.h:5910
#define DEFAULT_UNREACHABLE
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_VARIANTREF(A)
Definition: oleauto.h:283
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_I4(A)
Definition: oleauto.h:247
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
#define V_I2(A)
Definition: oleauto.h:245
#define err(...)
const WCHAR * str
Definition: match.c:390
DWORD flags
Definition: jscript.h:213
#define BP_GETPUT
Definition: global.c:48
#define BP_GET
Definition: global.c:47
static unsigned arg_cnt(const DISPPARAMS *dp)
Definition: vbscript.h:162
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379
int ret
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512

◆ 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}
const GUID IID_IUnknown
#define NULL
Definition: types.h:112
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IDispatch
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ 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);
108 }
109
110 return ref;
111}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52

◆ 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}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
size_t member_cnt
Definition: vbscript.h:146
LONG ref
Definition: vbscript.h:145
const builtin_prop_t * members
Definition: vbscript.h:147
IDispatch IDispatch_iface
Definition: vbscript.h:144
script_ctx_t * ctx
Definition: vbscript.h:148
static const IDispatchVtbl BuiltinDispVtbl
Definition: global.c:266

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;
492 DWORD policy_size;
493 BYTE *bpolicy;
494 IUnknown *obj;
496 GUID guid;
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
549 if(FAILED(hres)) {
550 IUnknown_Release(obj);
551 return NULL;
552 }
553
554 return obj;
555}
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:47
const GUID IID_IClassFactory
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3103
#define progid(str)
Definition: exdisp.idl:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define cs
Definition: i386-dis.c:442
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define SUCCEEDED(hr)
Definition: intsafe.h:50
const GUID * guid
#define DWORD
Definition: nt_native.h:44
static HRESULT set_object_site(script_ctx_t *ctx, IUnknown *obj)
Definition: global.c:465
static IInternetHostSecurityManager * get_sec_mgr(script_ctx_t *ctx)
Definition: global.c:293
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: global.c:41
unsigned char BYTE
Definition: xxhash.c:193

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}
CONTEXT ctx

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

◆ 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}
static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2716

◆ 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}
static HRESULT return_int(VARIANT *res, int val)
Definition: global.c:364

◆ 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}

◆ 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 FACILITY_VBS
Definition: vbscript.h:378
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define HRESULT_CODE(hr)
Definition: winerror.h:76

◆ 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;
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}
static const TCHAR helpfile[]
Definition: dialog.c:19
#define E_INVALIDARG
Definition: ddrawi.h:101
#define VBS_RUNTIME_ERROR
#define error(str)
Definition: mkdosfs.c:1605
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
HRESULT map_hres
Definition: sec_mgr.c:1753
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
Definition: inflate.c:139
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:410
static HRESULT to_string(VARIANT *v, BSTR *ret)
Definition: global.c:438
BSTR get_vbscript_error_string(HRESULT) DECLSPEC_HIDDEN
Definition: vbscript_main.c:45
BSTR get_vbscript_string(int) DECLSPEC_HIDDEN
Definition: vbscript_main.c:38
const char * description
Definition: directx.c:2497

◆ 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}

◆ 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}
#define L(x)
Definition: ntvdm.h:50
static HRESULT return_string(VARIANT *res, const WCHAR *str)
Definition: global.c:318

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
147
148}
#define wcsicmp
Definition: compat.h:15
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define min(a, b)
Definition: monoChain.cc:55
const WCHAR * name
Definition: global.c:56
Definition: name.c:39
#define max(a, b)
Definition: svc.c:63

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{
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}
static const WCHAR sp[]
Definition: suminfo.c:287

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}
GLenum GLenum dst
Definition: glext.h:6340
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
HRESULT WINAPI VarAbs(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4263

◆ 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++) {
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}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
@ VT_ARRAY
Definition: compat.h:2341
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define V_ARRAY(A)
Definition: oleauto.h:222
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847

◆ 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}
@ VT_NULL
Definition: compat.h:2296
@ VT_EMPTY
Definition: compat.h:2295
#define VBSE_ILLEGAL_FUNC_CALL
#define VBSE_ILLEGAL_NULL_USE
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
static HRESULT return_short(VARIANT *res, short val)
Definition: global.c:354

◆ 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}

◆ 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}

◆ 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{
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}
valarray< _Tp > atan(const valarray< _Tp > &__x)
Definition: _valarray.h:919
#define d
Definition: ke_i.h:81
static HRESULT to_double(VARIANT *v, double *ret)
Definition: global.c:424
static HRESULT return_double(VARIANT *res, double val)
Definition: global.c:374

◆ 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;
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}
@ VT_BOOL
Definition: compat.h:2306
const GLdouble * v
Definition: gl.h:2040
#define VARIANT_LOCALBOOL
Definition: oleauto.h:314
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962

◆ 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;
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}
@ VT_UI1
Definition: compat.h:2311
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517

◆ 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;
636
637 TRACE("%s\n", debugstr_variant(arg));
638
639 assert(args_cnt == 1);
640
641 V_VT(&v) = VT_EMPTY;
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}
@ VT_CY
Definition: compat.h:2301

◆ 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}

◆ 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;
749
750 TRACE("%s\n", debugstr_variant(arg));
751
752 assert(args_cnt == 1);
753
754 V_VT(&v) = VT_EMPTY;
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}
@ VT_R8
Definition: compat.h:2300

◆ 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}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
UINT WINAPI GetACP(void)
Definition: locale.c:2021
BOOL WINAPI GetCPInfo(UINT codepage, LPCPINFO cpinfo)
Definition: locale.c:2144
BOOL WINAPI IsDBCSLeadByteEx(UINT codepage, BYTE testchar)
Definition: locale.c:2104
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define c
Definition: ke_i.h:80
POINT cp
Definition: magnifier.c:59
UINT MaxCharSize
Definition: winnls.h:583
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ 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}

◆ 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}

◆ 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;
659
660 TRACE("%s\n", debugstr_variant(arg));
661
662 assert(args_cnt == 1);
663
664 V_VT(&v) = VT_EMPTY;
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}

◆ 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;
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}

◆ 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{
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 > &)

◆ 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)
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}
@ VT_DISPATCH
Definition: compat.h:2304
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define VB_E_CANNOT_CREATE_OBJ
Definition: global.c:37
static IUnknown * create_object(script_ctx_t *ctx, const WCHAR *progid)
Definition: global.c:486

◆ 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;
771
772 TRACE("%s\n", debugstr_variant(arg));
773
774 assert(args_cnt == 1);
775
776 V_VT(&v) = VT_EMPTY;
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}
@ VT_R4
Definition: compat.h:2299

◆ 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;
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}
static HRESULT return_bstr(VARIANT *res, BSTR str)
Definition: global.c:334

◆ 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}
double DATE
Definition: compat.h:2253
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
__u16 date
Definition: mkdosfs.c:8
#define VAR_DATEVALUEONLY
Definition: oleauto.h:327
Definition: oleauto.h:720
SYSTEMTIME st
Definition: oleauto.h:721
USHORT wDayOfYear
Definition: oleauto.h:722
HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DATE *pDateOut)
Definition: variant.c:1345
static HRESULT return_date(VARIANT *res, double date)
Definition: global.c:401

◆ 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}

◆ 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}

◆ 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}

◆ 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}

◆ 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}

◆ 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}
WORD wDay
Definition: winbase.h:933
static HRESULT to_system_time(VARIANT *v, SYSTEMTIME *st)
Definition: global.c:452

◆ 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}

◆ 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}

◆ 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}

◆ 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}

◆ 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}

◆ 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}

◆ 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}
DWORD exp
Definition: msg.c:16058

◆ 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}

◆ 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}
HRESULT WINAPI VarFix(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4367

◆ 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}

◆ 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}

◆ 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}

◆ 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}

◆ 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");
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}
HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:1129
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
uint32_t ULONG
Definition: typedefs.h:59
#define MK_E_SYNTAX
Definition: winerror.h:2785

◆ 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}

◆ 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;
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}
unsigned short WORD
Definition: ntddk_ex.h:93
GLdouble n
Definition: glext.h:7729
static PVOID ptr
Definition: dispmode.c:27
static WCHAR hex_char(unsigned n)
Definition: global.c:805

◆ 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}
WORD wHour
Definition: winbase.h:934

◆ 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}

◆ 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}
GLuint start
Definition: gl.h:1545
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define args
Definition: format.c:66
static HRESULT return_null(VARIANT *res)
Definition: global.c:394

◆ 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}

◆ 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

◆ 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}
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}

◆ 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}

◆ 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 V_BOOL(A)
Definition: oleauto.h:224

◆ 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}

◆ 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{
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}
static HRESULT return_bool(VARIANT *res, BOOL val)
Definition: global.c:345

◆ 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}

◆ 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}

◆ 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}

◆ 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 {
1402 }
1403 return S_OK;
1404}
#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}
#define str_len
Definition: treelist.c:89

◆ 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}

◆ 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);
1172 }else {
1174 }
1175
1176 return return_int(res, len);
1177}

◆ 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}

◆ 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}

◆ 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 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
1457 SysFreeString(conv_str);
1458 if(!str)
1459 return E_OUTOFMEMORY;
1460
1461 return return_bstr(res, str);
1462}
#define iswspace(_c)
Definition: ctype.h:669
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

◆ 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}

◆ Global_MidB()

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

Definition at line 1326 of file global.c.

1327{
1328 FIXME("\n");
1329 return E_NOTIMPL;
1330}

◆ Global_Minute()

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

Definition at line 1911 of file global.c.

1912{
1913 SYSTEMTIME st;
1914 HRESULT hres;
1915
1916 TRACE("(%s)\n", debugstr_variant(arg));
1917
1918 hres = to_system_time(arg, &st);
1919 return FAILED(hres) ? hres : return_short(res, st.wMinute);
1920}
WORD wMinute
Definition: winbase.h:935

◆ Global_Month()

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

Definition at line 1872 of file global.c.

1873{
1874 SYSTEMTIME st;
1875 HRESULT hres;
1876
1877 TRACE("(%s)\n", debugstr_variant(arg));
1878
1879 hres = to_system_time(arg, &st);
1880 return FAILED(hres) ? hres : return_short(res, st.wMonth);
1881}
WORD wMonth
Definition: winbase.h:931

◆ Global_MonthName()

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

Definition at line 2403 of file global.c.

2404{
2405 int month, abbrev = 0;
2406 BSTR ret;
2407 HRESULT hres;
2408
2409 TRACE("\n");
2410
2411 assert(args_cnt == 1 || args_cnt == 2);
2412
2413 hres = to_int(args, &month);
2414 if(FAILED(hres))
2415 return hres;
2416
2417 if(args_cnt == 2) {
2418 hres = to_int(args+1, &abbrev);
2419 if(FAILED(hres))
2420 return hres;
2421 }
2422
2423 hres = VarMonthName(month, abbrev, 0, &ret);
2424 if(FAILED(hres))
2425 return hres;
2426
2427 return return_bstr(res, ret);
2428}
HRESULT WINAPI VarMonthName(INT iMonth, INT fAbbrev, ULONG dwFlags, BSTR *pbstrOut)
Definition: varformat.c:2517
static const WCHAR month[12][4]
Definition: session.c:2150

◆ Global_MsgBox()

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

Definition at line 1963 of file global.c.

1964{
1965 BSTR prompt, title = NULL;
1966 int type = MB_OK;
1967 HRESULT hres;
1968
1969 TRACE("\n");
1970
1971 assert(1 <= args_cnt && args_cnt <= 5);
1972
1973 hres = to_string(args, &prompt);
1974 if(FAILED(hres))
1975 return hres;
1976
1977 if(args_cnt > 1)
1978 hres = to_int(args+1, &type);
1979
1980 if(SUCCEEDED(hres) && args_cnt > 2)
1981 hres = to_string(args+2, &title);
1982
1983 if(SUCCEEDED(hres) && args_cnt > 3) {
1984 FIXME("unsupported arg_cnt %d\n", args_cnt);
1985 hres = E_NOTIMPL;
1986 }
1987
1988 if(SUCCEEDED(hres))
1989 hres = show_msgbox(This->ctx, prompt, type, title, res);
1990
1991 SysFreeString(prompt);
1993 return hres;
1994}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static char title[]
Definition: ps.c:92
static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR orig_title, VARIANT *res)
Definition: global.c:557
#define MB_OK
Definition: winuser.h:793

◆ Global_Now()

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

Definition at line 1813 of file global.c.

1814{
1815 SYSTEMTIME lt;
1816 double date;
1817
1818 TRACE("\n");
1819
1820 GetLocalTime(&lt);
1822 return return_date(res, date);
1823}
INT WINAPI SystemTimeToVariantTime(LPSYSTEMTIME lpSt, double *pDateOut)
Definition: variant.c:1286

◆ Global_Oct()

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

Definition at line 851 of file global.c.

852{
854 WCHAR buf[23], *ptr;
855 DWORD n;
856 int ret;
857
858 TRACE("%s\n", debugstr_variant(arg));
859
860 switch(V_VT(arg)) {
861 case VT_I2:
862 n = (WORD)V_I2(arg);
863 break;
864 case VT_NULL:
865 if(res)
866 V_VT(res) = VT_NULL;
867 return S_OK;
868 default:
869 hres = to_int(arg, &ret);
870 if(FAILED(hres))
871 return hres;
872 else
873 n = ret;
874 }
875
876 buf[22] = 0;
877 ptr = buf + 21;
878
879 if(n) {
880 do {
881 *ptr-- = '0' + (n & 0x7);
882 n >>= 3;
883 }while(n);
884 ptr++;
885 }else {
886 *ptr = '0';
887 }
888
889 return return_string(res, ptr);
890}

◆ Global_Randomize()

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

Definition at line 1064 of file global.c.

1065{
1066 FIXME("\n");
1067 return E_NOTIMPL;
1068}

◆ Global_Replace()

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

Definition at line 2215 of file global.c.

2216{
2217 FIXME("\n");
2218 return E_NOTIMPL;
2219}

◆ Global_RGB()

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

Definition at line 1131 of file global.c.

1132{
1133 HRESULT hres;
1134 int i, color[3];
1135
1137
1138 assert(args_cnt == 3);
1139
1140 for(i = 0; i < 3; i++) {
1141 hres = to_int(arg + i, color + i);
1142 if(FAILED(hres))
1143 return hres;
1144 if(color[i] > 255)
1145 color[i] = 255;
1146 if(color[i] < 0)
1148 }
1149
1150 return return_int(res, RGB(color[0], color[1], color[2]));
1151}
#define RGB(r, g, b)
Definition: precomp.h:71
GLuint color
Definition: glext.h:6243

◆ Global_Right()

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

Definition at line 1229 of file global.c.

1230{
1231 BSTR str, ret, conv_str = NULL;
1232 int len, str_len;
1233 HRESULT hres;
1234
1235 TRACE("(%s %s)\n", debugstr_variant(args), debugstr_variant(args+1));
1236
1237 if(V_VT(args+1) == VT_BSTR) {
1238 str = V_BSTR(args);
1239 }else {
1240 hres = to_string(args, &conv_str);
1241 if(FAILED(hres))
1242 return hres;
1243 str = conv_str;
1244 }
1245
1246 hres = to_int(args+1, &len);
1247 if(FAILED(hres))
1248 return hres;
1249
1250 if(len < 0) {
1251 FIXME("len = %d\n", len);
1252 return E_FAIL;
1253 }
1254
1256 if(len > str_len)
1257 len = str_len;
1258
1260 SysFreeString(conv_str);
1261 if(!ret)
1262 return E_OUTOFMEMORY;
1263
1264 return return_bstr(res, ret);
1265}

◆ Global_RightB()

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

Definition at line 1267 of file global.c.

1268{
1269 FIXME("\n");
1270 return E_NOTIMPL;
1271}

◆ Global_Rnd()

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

Definition at line 1070 of file global.c.

1071{
1072 FIXME("\n");
1073 return E_NOTIMPL;
1074}

◆ Global_Round()

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

Definition at line 2430 of file global.c.

2431{
2432 double n;
2433 HRESULT hres;
2434
2435 TRACE("%s\n", debugstr_variant(arg));
2436
2437 if(!res)
2438 return S_OK;
2439
2440 switch(V_VT(arg)) {
2441 case VT_I2:
2442 case VT_I4:
2443 case VT_BOOL:
2444 *res = *arg;
2445 return S_OK;
2446 case VT_R8:
2447 n = V_R8(arg);
2448 break;
2449 default:
2450 hres = to_double(arg, &n);
2451 if(FAILED(hres))
2452 return hres;
2453 }
2454
2455 return return_double(res, round(n));
2456}
#define V_R8(A)
Definition: oleauto.h:262
#define round(x)
Definition: opentype.c:47
void * arg
Definition: msvc.h:10

◆ Global_RTrim()

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

Definition at line 1464 of file global.c.

1465{
1466 BSTR str, conv_str = NULL;
1467 WCHAR *ptr;
1468 HRESULT hres;
1469
1470 TRACE("%s\n", debugstr_variant(arg));
1471
1472 if(V_VT(arg) == VT_BSTR) {
1473 str = V_BSTR(arg);
1474 }else {
1475 hres = to_string(arg, &conv_str);
1476 if(FAILED(hres))
1477 return hres;
1478 str = conv_str;
1479 }
1480
1481 for(ptr = str+SysStringLen(str); ptr-1 > str && iswspace(*(ptr-1)); ptr--);
1482
1484 SysFreeString(conv_str);
1485 if(!str)
1486 return E_OUTOFMEMORY;
1487
1488 return return_bstr(res, str);
1489}

◆ Global_ScriptEngine()

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

Definition at line 2310 of file global.c.

2311{
2312 TRACE("%s\n", debugstr_variant(arg));
2313
2314 assert(args_cnt == 0);
2315
2316 return return_string(res, vbscriptW);
2317}
static const WCHAR vbscriptW[]
Definition: global.c:45

◆ Global_ScriptEngineBuildVersion()

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

Definition at line 2337 of file global.c.

2338{
2339 TRACE("%s\n", debugstr_variant(arg));
2340
2341 assert(args_cnt == 0);
2342
2344}
#define VBSCRIPT_BUILD_VERSION
Definition: vbscript.h:403

◆ Global_ScriptEngineMajorVersion()

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

Definition at line 2319 of file global.c.

2320{
2321 TRACE("%s\n", debugstr_variant(arg));
2322
2323 assert(args_cnt == 0);
2324
2326}
#define VBSCRIPT_MAJOR_VERSION
Definition: vbscript.h:404

◆ Global_ScriptEngineMinorVersion()

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

Definition at line 2328 of file global.c.

2329{
2330 TRACE("%s\n", debugstr_variant(arg));
2331
2332 assert(args_cnt == 0);
2333
2335}
#define VBSCRIPT_MINOR_VERSION
Definition: vbscript.h:405

◆ Global_Second()

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

Definition at line 1922 of file global.c.

1923{
1924 SYSTEMTIME st;
1925 HRESULT hres;
1926
1927 TRACE("(%s)\n", debugstr_variant(arg));
1928
1929 hres = to_system_time(arg, &st);
1930 return FAILED(hres) ? hres : return_short(res, st.wSecond);
1931}
WORD wSecond
Definition: winbase.h:936

◆ Global_Sgn()

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

Definition at line 1792 of file global.c.

1793{
1794 double v;
1795 short val;
1796 HRESULT hres;
1797
1798 TRACE("(%s)\n", debugstr_variant(arg));
1799
1800 assert(args_cnt == 1);
1801
1802 if(V_VT(arg) == VT_NULL)
1804
1805 hres = to_double(arg, &v);
1806 if (FAILED(hres))
1807 return hres;
1808
1809 val = v == 0 ? 0 : (v > 0 ? 1 : -1);
1810 return return_short(res, val);
1811}

◆ Global_Sin()

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

Definition at line 998 of file global.c.

999{
1000 HRESULT hres;
1001 double d;
1002
1003 hres = to_double(arg, &d);
1004 if(FAILED(hres))
1005 return hres;
1006
1007 return return_double(res, sin(d));
1008}
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)

◆ Global_Space()

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

Definition at line 1519 of file global.c.

1520{
1521 BSTR str;
1522 int n, i;
1523 HRESULT hres;
1524
1525 TRACE("%s\n", debugstr_variant(arg));
1526
1527 hres = to_int(arg, &n);
1528 if(FAILED(hres))
1529 return hres;
1530
1531 if(n < 0) {
1532 FIXME("n = %d\n", n);
1533 return E_NOTIMPL;
1534 }
1535
1536 if(!res)
1537 return S_OK;
1538
1540 if(!str)
1541 return E_OUTOFMEMORY;
1542
1543 for(i=0; i<n; i++)
1544 str[i] = ' ';
1545
1546 V_VT(res) = VT_BSTR;
1547 V_BSTR(res) = str;
1548 return S_OK;
1549}

◆ Global_Split()

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

Definition at line 2209 of file global.c.

2210{
2211 FIXME("\n");
2212 return E_NOTIMPL;
2213}

◆ Global_Sqr()

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

Definition at line 1049 of file global.c.

1050{
1051 HRESULT hres;
1052 double d;
1053
1054 hres = to_double(arg, &d);
1055 if(FAILED(hres))
1056 return hres;
1057
1058 if(d < 0)
1060 else
1061 return return_double(res, sqrt(d));
1062}
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188

◆ Global_StrComp()

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

Definition at line 1332 of file global.c.

1333{
1334 BSTR left, right;
1335 int mode, ret;
1336 HRESULT hres;
1337 short val;
1338
1339 TRACE("(%s %s ...)\n", debugstr_variant(args), debugstr_variant(args+1));
1340
1341 assert(args_cnt == 2 || args_cnt == 3);
1342
1343 if (args_cnt == 3) {
1344 hres = to_int(args+2, &mode);
1345 if(FAILED(hres))
1346 return hres;
1347
1348 if (mode != 0 && mode != 1) {
1349 FIXME("unknown compare mode = %d\n", mode);
1350 return E_FAIL;
1351 }
1352 }
1353 else
1354 mode = 0;
1355
1356 hres = to_string(args, &left);
1357 if(FAILED(hres))
1358 return hres;
1359
1360 hres = to_string(args+1, &right);
1361 if(FAILED(hres))
1362 {
1364 return hres;
1365 }
1366
1368 val = ret < 0 ? -1 : (ret > 0 ? 1 : 0);
1369
1372 return return_short(res, val);
1373}
GLdouble GLdouble right
Definition: glext.h:10859
GLenum mode
Definition: glext.h:6217
GLint left
Definition: glext.h:7726
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ Global_String()

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

Definition at line 1551 of file global.c.

1552{
1553 FIXME("\n");
1554 return E_NOTIMPL;
1555}

◆ Global_StrReverse()

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

Definition at line 2221 of file global.c.

2222{
2223 WCHAR *ptr1, *ptr2, ch;
2224 BSTR ret;
2225 HRESULT hres;
2226
2227 TRACE("%s\n", debugstr_variant(arg));
2228
2229 hres = to_string(arg, &ret);
2230 if(FAILED(hres))
2231 return hres;
2232
2233 ptr1 = ret;
2234 ptr2 = ret + SysStringLen(ret)-1;
2235 while(ptr1 < ptr2) {
2236 ch = *ptr1;
2237 *ptr1++ = *ptr2;
2238 *ptr2-- = ch;
2239 }
2240
2241 return return_bstr(res, ret);
2242}

◆ Global_Tan()

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

Definition at line 1010 of file global.c.

1011{
1012 HRESULT hres;
1013 double d;
1014
1015 hres = to_double(arg, &d);
1016 if(FAILED(hres))
1017 return hres;
1018
1019 return return_double(res, tan(d));
1020}
_STLP_DECLSPEC complex< float > _STLP_CALL tan(const complex< float > &)

◆ Global_Time()

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

Definition at line 1843 of file global.c.

1844{
1845 SYSTEMTIME lt;
1846 UDATE ud;
1847 DATE time;
1848 HRESULT hres;
1849
1850 TRACE("\n");
1851
1852 GetLocalTime(&lt);
1853 ud.st = lt;
1854 ud.wDayOfYear = 0;
1856 if(FAILED(hres))
1857 return hres;
1858 return return_date(res, time);
1859}
__u16 time
Definition: mkdosfs.c:8
#define VAR_TIMEVALUEONLY
Definition: oleauto.h:326

◆ Global_Timer()

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

Definition at line 1076 of file global.c.

1077{
1078 SYSTEMTIME lt;
1079 double sec;
1080
1081 GetLocalTime(&lt);
1082 sec = lt.wHour * 3600 + lt.wMinute * 60 + lt.wSecond + lt.wMilliseconds / 1000.0;
1083 return return_float(res, sec);
1084
1085}
WORD wMilliseconds
Definition: winbase.h:937
static HRESULT return_float(VARIANT *res, float val)
Definition: global.c:384

◆ Global_TimeSerial()

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

Definition at line 1951 of file global.c.

1952{
1953 FIXME("\n");
1954 return E_NOTIMPL;
1955}

◆ Global_TimeValue()

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

Definition at line 1939 of file global.c.

1940{
1941 FIXME("\n");
1942 return E_NOTIMPL;
1943}

◆ Global_Trim()

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

Definition at line 1491 of file global.c.

1492{
1493 BSTR str, conv_str = NULL;
1494 WCHAR *begin_ptr, *end_ptr;
1495 HRESULT hres;
1496
1497 TRACE("%s\n", debugstr_variant(arg));
1498
1499 if(V_VT(arg) == VT_BSTR) {
1500 str = V_BSTR(arg);
1501 }else {
1502 hres = to_string(arg, &conv_str);
1503 if(FAILED(hres))
1504 return hres;
1505 str = conv_str;
1506 }
1507
1508 for(begin_ptr = str; *begin_ptr && iswspace(*begin_ptr); begin_ptr++);
1509 for(end_ptr = str+SysStringLen(str); end_ptr-1 > begin_ptr && iswspace(*(end_ptr-1)); end_ptr--);
1510
1511 str = SysAllocStringLen(begin_ptr, end_ptr-begin_ptr);
1512 SysFreeString(conv_str);
1513 if(!str)
1514 return E_OUTOFMEMORY;
1515
1516 return return_bstr(res, str);
1517}

◆ Global_TypeName()

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

Definition at line 2099 of file global.c.

2100{
2101 static const WCHAR ByteW[] = {'B', 'y', 't', 'e', 0};
2102 static const WCHAR IntegerW[] = {'I', 'n', 't', 'e', 'g', 'e', 'r', 0};
2103 static const WCHAR LongW[] = {'L', 'o', 'n', 'g', 0};
2104 static const WCHAR SingleW[] = {'S', 'i', 'n', 'g', 'l', 'e', 0};
2105 static const WCHAR DoubleW[] = {'D', 'o', 'u', 'b', 'l', 'e', 0};
2106 static const WCHAR CurrencyW[] = {'C', 'u', 'r', 'r', 'e', 'n', 'c', 'y', 0};
2107 static const WCHAR DecimalW[] = {'D', 'e', 'c', 'i', 'm', 'a', 'l', 0};
2108 static const WCHAR DateW[] = {'D', 'a', 't', 'e', 0};
2109 static const WCHAR StringW[] = {'S', 't', 'r', 'i', 'n', 'g', 0};
2110 static const WCHAR BooleanW[] = {'B', 'o', 'o', 'l', 'e', 'a', 'n', 0};
2111 static const WCHAR EmptyW[] = {'E', 'm', 'p', 't', 'y', 0};
2112 static const WCHAR NullW[] = {'N', 'u', 'l', 'l', 0};
2113
2114 TRACE("(%s)\n", debugstr_variant(arg));
2115
2116 assert(args_cnt == 1);
2117
2118 switch(V_VT(arg)) {
2119 case VT_UI1:
2120 return return_string(res, ByteW);
2121 case VT_I2:
2122 return return_string(res, IntegerW);
2123 case VT_I4:
2124 return return_string(res, LongW);
2125 case VT_R4:
2126 return return_string(res, SingleW);
2127 case VT_R8:
2128 return return_string(res, DoubleW);
2129 case VT_CY:
2130 return return_string(res, CurrencyW);
2131 case VT_DECIMAL:
2132 return return_string(res, DecimalW);
2133 case VT_DATE:
2134 return return_string(res, DateW);
2135 case VT_BSTR:
2136 return return_string(res, StringW);
2137 case VT_BOOL:
2138 return return_string(res, BooleanW);
2139 case VT_EMPTY:
2140 return return_string(res, EmptyW);
2141 case VT_NULL:
2142 return return_string(res, NullW);
2143 default:
2144 FIXME("arg %s not supported\n", debugstr_variant(arg));
2145 return E_NOTIMPL;
2146 }
2147}
@ VT_DECIMAL
Definition: compat.h:2309
@ VT_DATE
Definition: compat.h:2302
static const WCHAR StringW[]
Definition: global.c:49
static const WCHAR BooleanW[]
Definition: global.c:37
static const WCHAR DateW[]
Definition: global.c:38

◆ Global_UBound()

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

Definition at line 1093 of file global.c.

1094{
1095 SAFEARRAY *sa;
1096 HRESULT hres;
1097 LONG ubound;
1098 int dim;
1099
1100 assert(args_cnt == 1 || args_cnt == 2);
1101
1102 TRACE("%s %s\n", debugstr_variant(arg), args_cnt == 2 ? debugstr_variant(arg + 1) : "1");
1103
1104 switch(V_VT(arg)) {
1105 case VT_VARIANT|VT_ARRAY:
1106 sa = V_ARRAY(arg);
1107 break;
1109 sa = *V_ARRAYREF(arg);
1110 break;
1111 default:
1112 FIXME("arg %s not supported\n", debugstr_variant(arg));
1113 return E_NOTIMPL;
1114 }
1115
1116 if(args_cnt == 2) {
1117 hres = to_int(arg + 1, &dim);
1118 if(FAILED(hres))
1119 return hres;
1120 }else {
1121 dim = 1;
1122 }
1123
1124 hres = SafeArrayGetUBound(sa, dim, &ubound);
1125 if(FAILED(hres))
1126 return hres;
1127
1128 return return_int(res, ubound);
1129}
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
#define V_ARRAYREF(A)
Definition: oleauto.h:223

◆ Global_UCase()

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

Definition at line 1406 of file global.c.

1407{
1408 BSTR str;
1409 HRESULT hres;
1410
1411 TRACE("%s\n", debugstr_variant(arg));
1412
1413 if(V_VT(arg) == VT_NULL) {
1414 if(res)
1415 V_VT(res) = VT_NULL;
1416 return S_OK;
1417 }
1418
1419 hres = to_string(arg, &str);
1420 if(FAILED(hres))
1421 return hres;
1422
1423 if(res) {
1424 WCHAR *ptr;
1425
1426 for(ptr = str; *ptr; ptr++)
1427 *ptr = towupper(*ptr);
1428
1429 V_VT(res) = VT_BSTR;
1430 V_BSTR(res) = str;
1431 }else {
1433 }
1434 return S_OK;
1435}
#define towupper(c)
Definition: wctype.h:99

◆ Global_Unescape()

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

Definition at line 2464 of file global.c.

2465{
2466 FIXME("\n");
2467 return E_NOTIMPL;
2468}

◆ Global_VarType()

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

Definition at line 892 of file global.c.

893{
894 VARTYPE vt;
895
896 TRACE("(%s)\n", debugstr_variant(arg));
897
898 assert(args_cnt == 1);
899
900 vt = V_VT(arg) & ~VT_BYREF;
901 if(vt & ~(VT_TYPEMASK | VT_ARRAY)) {
902 FIXME("not supported %s\n", debugstr_variant(arg));
903 return E_NOTIMPL;
904 }
905
906 return return_short(res, vt);
907}
unsigned short VARTYPE
Definition: compat.h:2254
@ VT_TYPEMASK
Definition: compat.h:2346

◆ Global_Weekday()

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

Definition at line 1883 of file global.c.

1884{
1885 FIXME("\n");
1886 return E_NOTIMPL;
1887}

◆ Global_WeekdayName()

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

Definition at line 2370 of file global.c.

2371{
2372 int weekday, first_day = 1, abbrev = 0;
2373 BSTR ret;
2374 HRESULT hres;
2375
2376 TRACE("\n");
2377
2378 assert(1 <= args_cnt && args_cnt <= 3);
2379
2380 hres = to_int(args, &weekday);
2381 if(FAILED(hres))
2382 return hres;
2383
2384 if(args_cnt > 1) {
2385 hres = to_int(args+1, &abbrev);
2386 if(FAILED(hres))
2387 return hres;
2388
2389 if(args_cnt == 3) {
2390 hres = to_int(args+2, &first_day);
2391 if(FAILED(hres))
2392 return hres;
2393 }
2394 }
2395
2396 hres = VarWeekdayName(weekday, abbrev, first_day, 0, &ret);
2397 if(FAILED(hres))
2398 return hres;
2399
2400 return return_bstr(res, ret);
2401}
HRESULT WINAPI VarWeekdayName(INT iWeekday, INT fAbbrev, INT iFirstDay, ULONG dwFlags, BSTR *pbstrOut)
Definition: varformat.c:2568

◆ Global_Year()

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

Definition at line 1889 of file global.c.

1890{
1891 SYSTEMTIME st;
1892 HRESULT hres;
1893
1894 TRACE("(%s)\n", debugstr_variant(arg));
1895
1896 hres = to_system_time(arg, &st);
1897 return FAILED(hres) ? hres : return_short(res, st.wYear);
1898}
WORD wYear
Definition: winbase.h:930

◆ hex_char()

static WCHAR hex_char ( unsigned  n)
inlinestatic

Definition at line 805 of file global.c.

806{
807 return n < 10 ? '0'+n : 'A'+n-10;
808}

Referenced by Global_Hex().

◆ impl_from_IDispatch()

static BuiltinDisp * impl_from_IDispatch ( IDispatch iface)
inlinestatic

Definition at line 63 of file global.c.

64{
65 return CONTAINING_RECORD(iface, BuiltinDisp, IDispatch_iface);
66}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by Builtin_AddRef(), Builtin_GetIDsOfNames(), Builtin_GetTypeInfo(), Builtin_GetTypeInfoCount(), Builtin_Invoke(), Builtin_QueryInterface(), and Builtin_Release().

◆ init_global()

HRESULT init_global ( script_ctx_t ctx)

Definition at line 2870 of file global.c.

2871{
2872 HRESULT hres;
2873
2875 if(FAILED(hres))
2876 return hres;
2877
2879}
static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, BuiltinDisp **ret)
Definition: global.c:276
static const builtin_prop_t global_props[]
Definition: global.c:2519
static const builtin_prop_t err_props[]
Definition: global.c:2844

◆ return_bool()

static HRESULT return_bool ( VARIANT res,
BOOL  val 
)
static

Definition at line 345 of file global.c.

346{
347 if(res) {
348 V_VT(res) = VT_BOOL;
349 V_BOOL(res) = val ? VARIANT_TRUE : VARIANT_FALSE;
350 }
351 return S_OK;
352}

Referenced by Global_IsNumeric().

◆ return_bstr()

static HRESULT return_bstr ( VARIANT res,
BSTR  str 
)
static

Definition at line 334 of file global.c.

335{
336 if(res) {
337 V_VT(res) = VT_BSTR;
338 V_BSTR(res) = str;
339 }else {
341 }
342 return S_OK;
343}

Referenced by Global_CStr(), Global_Left(), Global_LTrim(), Global_MonthName(), Global_Right(), Global_RTrim(), Global_StrReverse(), Global_Trim(), and Global_WeekdayName().

◆ return_date()

static HRESULT return_date ( VARIANT res,
double  date 
)
inlinestatic

Definition at line 401 of file global.c.

402{
403 if(res) {
404 V_VT(res) = VT_DATE;
405 V_DATE(res) = date;
406 }
407 return S_OK;
408}
#define V_DATE(A)
Definition: oleauto.h:231

Referenced by Global_Date(), Global_Now(), and Global_Time().

◆ return_double()

static HRESULT return_double ( VARIANT res,
double  val 
)
inlinestatic

Definition at line 374 of file global.c.

375{
376 if(res) {
377 V_VT(res) = VT_R8;
378 V_R8(res) = val;
379 }
380
381 return S_OK;
382}

Referenced by Global_Atn(), Global_Cos(), Global_Exp(), Global_Log(), Global_Round(), Global_Sin(), Global_Sqr(), and Global_Tan().

◆ return_float()

static HRESULT return_float ( VARIANT res,
float  val 
)
inlinestatic

Definition at line 384 of file global.c.

385{
386 if(res) {
387 V_VT(res) = VT_R4;
388 V_R4(res) = val;
389 }
390
391 return S_OK;
392}
#define V_R4(A)
Definition: oleauto.h:260

Referenced by Global_Timer().

◆ return_int()

static HRESULT return_int ( VARIANT res,
int  val 
)
static

◆ return_null()

static HRESULT return_null ( VARIANT res)
inlinestatic

Definition at line 394 of file global.c.

395{
396 if(res)
397 V_VT(res) = VT_NULL;
398 return S_OK;
399}

Referenced by Global_InStr(), and Global_Len().

◆ return_short()

static HRESULT return_short ( VARIANT res,
short  val 
)
static

Definition at line 354 of file global.c.

355{
356 if(res) {
357 V_VT(res) = VT_I2;
358 V_I2(res) = val;
359 }
360
361 return S_OK;
362}

Referenced by Global_Asc(), Global_Day(), Global_Hour(), Global_Minute(), Global_Month(), Global_Second(), Global_Sgn(), Global_StrComp(), Global_VarType(), Global_Year(), and show_msgbox().

◆ return_string()

static HRESULT return_string ( VARIANT res,
const WCHAR str 
)
static

Definition at line 318 of file global.c.

319{
320 BSTR ret;
321
322 if(!res)
323 return S_OK;
324
326 if(!ret)
327 return E_OUTOFMEMORY;
328
329 V_VT(res) = VT_BSTR;
330 V_BSTR(res) = ret;
331 return S_OK;
332}

Referenced by err_string_prop(), Global_Hex(), Global_Oct(), Global_ScriptEngine(), and Global_TypeName().

◆ set_object_site()

static HRESULT set_object_site ( script_ctx_t ctx,
IUnknown obj 
)
static

Definition at line 465 of file global.c.

466{
467 IObjectWithSite *obj_site;
468 IUnknown *ax_site;
470
471 hres = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (void**)&obj_site);
472 if(FAILED(hres))
473 return S_OK;
474
475 ax_site = create_ax_site(ctx);
476 if(ax_site) {
477 hres = IObjectWithSite_SetSite(obj_site, ax_site);
478 IUnknown_Release(ax_site);
479 }
480 else
482 IObjectWithSite_Release(obj_site);
483 return hres;
484}
IUnknown * create_ax_site(script_ctx_t *ctx)
Definition: jscript.c:324
const IID IID_IObjectWithSite

Referenced by create_object(), and Global_GetObject().

◆ show_msgbox()

static HRESULT show_msgbox ( script_ctx_t ctx,
BSTR  prompt,
unsigned  type,
BSTR  orig_title,
VARIANT res 
)
static

Definition at line 557 of file global.c.

558{
560 IActiveScriptSiteUIControl *ui_control;
561 IActiveScriptSiteWindow *acts_window;
562 WCHAR *title_buf = NULL;
563 const WCHAR *title;
564 HWND hwnd = NULL;
565 int ret = 0;
567
568 hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IActiveScriptSiteUIControl, (void**)&ui_control);
569 if(SUCCEEDED(hres)) {
570 hres = IActiveScriptSiteUIControl_GetUIBehavior(ui_control, SCRIPTUICITEM_MSGBOX, &uic_handling);
571 IActiveScriptSiteUIControl_Release(ui_control);
572 if(FAILED(hres))
574 }
575
576 switch(uic_handling) {
578 break;
580 return return_short(res, 0);
581 default:
582 FIXME("blocked\n");
583 return E_FAIL;
584 }
585
586 hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IActiveScriptSiteWindow, (void**)&acts_window);
587 if(FAILED(hres)) {
588 FIXME("No IActiveScriptSiteWindow\n");
589 return hres;
590 }
591
592 if(ctx->safeopt & INTERFACE_USES_SECURITY_MANAGER) {
593 if(orig_title && *orig_title) {
594 WCHAR *ptr;
595
596 title = title_buf = heap_alloc(sizeof(vbscriptW) + (lstrlenW(orig_title)+2)*sizeof(WCHAR));
597 if(!title)
598 return E_OUTOFMEMORY;
599
600 memcpy(title_buf, vbscriptW, sizeof(vbscriptW));
601 ptr = title_buf + ARRAY_SIZE(vbscriptW)-1;
602
603 *ptr++ = ':';
604 *ptr++ = ' ';
605 lstrcpyW(ptr, orig_title);
606 }else {
608 }
609 }else {
610 title = orig_title ? orig_title : emptyW;
611 }
612
613 hres = IActiveScriptSiteWindow_GetWindow(acts_window, &hwnd);
614 if(SUCCEEDED(hres)) {
615 hres = IActiveScriptSiteWindow_EnableModeless(acts_window, FALSE);
616 if(SUCCEEDED(hres)) {
617 ret = MessageBoxW(hwnd, prompt, title, type);
618 hres = IActiveScriptSiteWindow_EnableModeless(acts_window, TRUE);
619 }
620 }
621
622 heap_free(title_buf);
623 IActiveScriptSiteWindow_Release(acts_window);
624 if(FAILED(hres)) {
625 FIXME("failed: %08x\n", hres);
626 return hres;
627 }
628
629 return return_short(res, ret);
630}
enum tagSCRIPTUICHANDLING SCRIPTUICHANDLING
@ SCRIPTUICITEM_MSGBOX
Definition: activscp.idl:72
@ SCRIPTUICHANDLING_ALLOW
Definition: activscp.idl:76
@ SCRIPTUICHANDLING_NOUIDEFAULT
Definition: activscp.idl:78
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static SCRIPTUICHANDLING uic_handling
Definition: run.c:159
static const WCHAR emptyW[]
Definition: global.c:44
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)

Referenced by Global_MsgBox().

◆ to_double()

static HRESULT to_double ( VARIANT v,
double ret 
)
static

Definition at line 424 of file global.c.

425{
426 VARIANT dst;
428
429 V_VT(&dst) = VT_EMPTY;
431 if(FAILED(hres))
432 return hres;
433
434 *ret = V_R8(&dst);
435 return S_OK;
436}

Referenced by Global_Atn(), Global_Cos(), Global_Exp(), Global_IsNumeric(), Global_Log(), Global_Round(), Global_Sgn(), Global_Sin(), Global_Sqr(), and Global_Tan().

◆ to_int()

◆ to_string()

◆ to_system_time()

static HRESULT to_system_time ( VARIANT v,
SYSTEMTIME st 
)
static

Definition at line 452 of file global.c.

453{
456
457 V_VT(&date) = VT_EMPTY;
459 if(FAILED(hres))
460 return hres;
461
462 return VariantTimeToSystemTime(V_DATE(&date), st);
463}
INT WINAPI VariantTimeToSystemTime(double dateIn, LPSYSTEMTIME lpSt)
Definition: variant.c:1317

Referenced by Global_Day(), Global_Hour(), Global_Minute(), Global_Month(), Global_Second(), and Global_Year().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( vbscript  )

Variable Documentation

◆ BuiltinDispVtbl

const IDispatchVtbl BuiltinDispVtbl
static
Initial value:
= {
}
static HRESULT WINAPI Builtin_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
Definition: global.c:68
static HRESULT WINAPI Builtin_Invoke(IDispatch *iface, DISPID id, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, UINT *err)
Definition: global.c:173
static HRESULT WINAPI Builtin_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
Definition: global.c:113
static ULONG WINAPI Builtin_Release(IDispatch *iface)
Definition: global.c:98
static HRESULT WINAPI Builtin_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: global.c:121
static HRESULT WINAPI Builtin_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names, UINT name_cnt, LCID lcid, DISPID *ids)
Definition: global.c:150
static ULONG WINAPI Builtin_AddRef(IDispatch *iface)
Definition: global.c:88

Definition at line 266 of file global.c.

Referenced by create_builtin_dispatch().

◆ emptyW

const WCHAR emptyW[] = {0}
static

Definition at line 44 of file global.c.

Referenced by show_msgbox().

◆ err_props

const builtin_prop_t err_props[]
static
Initial value:
= {
{L"Clear", Err_Clear},
{L"Description", Err_Description, BP_GETPUT},
{L"HelpContext", Err_HelpContext, BP_GETPUT},
{L"HelpFile", Err_HelpFile, BP_GETPUT},
{L"Number", Err_Number, BP_GETPUT},
{L"Raise", Err_Raise, 0, 1, 5},
{L"Source", Err_Source, BP_GETPUT}
}
static HRESULT Err_Number(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2757
static HRESULT Err_HelpFile(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2751
static HRESULT Err_HelpContext(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2739
static HRESULT Err_Description(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2733
static HRESULT Err_Raise(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2786
static HRESULT Err_Source(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2772
static HRESULT Err_Clear(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
Definition: global.c:2778

Definition at line 2844 of file global.c.

Referenced by init_global().

◆ global_props

const builtin_prop_t global_props[]
static

Definition at line 2519 of file global.c.

Referenced by init_global().

◆ GUID_CUSTOM_CONFIRMOBJECTSAFETY

const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Initial value:
=
{0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}

Definition at line 41 of file global.c.

Referenced by create_object().

◆ vbCr

const string_constant_t vbCr = {1, {'\r'}}
static

Definition at line 2509 of file global.c.

◆ vbCrLf

const string_constant_t vbCrLf = {2, {'\r','\n'}}
static

Definition at line 2510 of file global.c.

◆ vbFormFeed

const string_constant_t vbFormFeed = {1, {0xc}}
static

Definition at line 2512 of file global.c.

◆ vbLf

const string_constant_t vbLf = {1, {'\n'}}
static

Definition at line 2513 of file global.c.

◆ vbNewLine

const string_constant_t vbNewLine = {2, {'\r','\n'}}
static

Definition at line 2511 of file global.c.

◆ vbNullChar

const string_constant_t vbNullChar = {1}
static

Definition at line 2514 of file global.c.

◆ vbNullString

const string_constant_t vbNullString = {0}
static

Definition at line 2515 of file global.c.

◆ vbscriptW

const WCHAR vbscriptW[] = {'V','B','S','c','r','i','p','t',0}
static

Definition at line 45 of file global.c.

Referenced by Global_ScriptEngine(), and show_msgbox().

◆ vbTab

const string_constant_t vbTab = {1, {'\t'}}
static

Definition at line 2516 of file global.c.

◆ vbVerticalTab

const string_constant_t vbVerticalTab = {1, {0xb}}
static

Definition at line 2517 of file global.c.