Add AppDefaults app selection to control panel
[wine/gsoc-2012-control.git] / dlls / vbscript / global.c
blob55c1acc7b907f5bda183372323533dc252df6037
1 /*
2 * Copyright 2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <assert.h>
21 #include "vbscript.h"
22 #include "vbscript_defs.h"
24 #include "mshtmhst.h"
25 #include "objsafe.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
31 #define VB_E_CANNOT_CREATE_OBJ 0x800a01ad
33 /* Defined as extern in urlmon.idl, but not exported by uuid.lib */
34 const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
35 {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
37 static IInternetHostSecurityManager *get_sec_mgr(script_ctx_t *ctx)
39 IInternetHostSecurityManager *secmgr;
40 IServiceProvider *sp;
41 HRESULT hres;
43 if(!ctx->site)
44 return NULL;
46 if(ctx->secmgr)
47 return ctx->secmgr;
49 hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
50 if(FAILED(hres))
51 return NULL;
53 hres = IServiceProvider_QueryService(sp, &SID_SInternetHostSecurityManager, &IID_IInternetHostSecurityManager,
54 (void**)&secmgr);
55 IServiceProvider_Release(sp);
56 if(FAILED(hres))
57 return NULL;
59 return ctx->secmgr = secmgr;
62 static HRESULT return_bstr(VARIANT *res, const WCHAR *str)
64 BSTR ret;
66 if(!res)
67 return S_OK;
69 ret = SysAllocString(str);
70 if(!ret)
71 return E_OUTOFMEMORY;
73 V_VT(res) = VT_BSTR;
74 V_BSTR(res) = ret;
75 return S_OK;
78 static HRESULT return_short(VARIANT *res, short val)
80 if(res) {
81 V_VT(res) = VT_I2;
82 V_I2(res) = val;
85 return S_OK;
88 static HRESULT return_int(VARIANT *res, int val)
90 if((short)val == val)
91 return return_short(res, val);
93 if(res) {
94 V_VT(res) = VT_I4;
95 V_I4(res) = val;
98 return S_OK;
101 static inline HRESULT return_null(VARIANT *res)
103 if(res)
104 V_VT(res) = VT_NULL;
105 return S_OK;
108 static HRESULT to_int(VARIANT *v, int *ret)
110 switch(V_VT(v)) {
111 case VT_I2:
112 *ret = V_I2(v);
113 break;
114 case VT_I4:
115 *ret = V_I4(v);
116 break;
117 default:
118 FIXME("not supported %s\n", debugstr_variant(v));
119 return E_NOTIMPL;
122 return S_OK;
125 static HRESULT to_string(VARIANT *v, BSTR *ret)
127 VARIANT dst;
128 HRESULT hres;
130 V_VT(&dst) = VT_EMPTY;
131 hres = VariantChangeType(&dst, v, VARIANT_LOCALBOOL, VT_BSTR);
132 if(FAILED(hres))
133 return hres;
135 *ret = V_BSTR(&dst);
136 return S_OK;
139 static IUnknown *create_object(script_ctx_t *ctx, const WCHAR *progid)
141 IInternetHostSecurityManager *secmgr = NULL;
142 IObjectWithSite *obj_site;
143 struct CONFIRMSAFETY cs;
144 IClassFactoryEx *cfex;
145 IClassFactory *cf;
146 DWORD policy_size;
147 BYTE *bpolicy;
148 IUnknown *obj;
149 DWORD policy;
150 GUID guid;
151 HRESULT hres;
153 hres = CLSIDFromProgID(progid, &guid);
154 if(FAILED(hres))
155 return NULL;
157 TRACE("GUID %s\n", debugstr_guid(&guid));
159 if(ctx->safeopt & INTERFACE_USES_SECURITY_MANAGER) {
160 secmgr = get_sec_mgr(ctx);
161 if(!secmgr)
162 return NULL;
164 policy = 0;
165 hres = IInternetHostSecurityManager_ProcessUrlAction(secmgr, URLACTION_ACTIVEX_RUN,
166 (BYTE*)&policy, sizeof(policy), (BYTE*)&guid, sizeof(GUID), 0, 0);
167 if(FAILED(hres) || policy != URLPOLICY_ALLOW)
168 return NULL;
171 hres = CoGetClassObject(&guid, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, NULL, &IID_IClassFactory, (void**)&cf);
172 if(FAILED(hres))
173 return NULL;
175 hres = IClassFactory_QueryInterface(cf, &IID_IClassFactoryEx, (void**)&cfex);
176 if(SUCCEEDED(hres)) {
177 FIXME("Use IClassFactoryEx\n");
178 IClassFactoryEx_Release(cfex);
181 hres = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)&obj);
182 if(FAILED(hres))
183 return NULL;
185 if(secmgr) {
186 cs.clsid = guid;
187 cs.pUnk = obj;
188 cs.dwFlags = 0;
189 hres = IInternetHostSecurityManager_QueryCustomPolicy(secmgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
190 &bpolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
191 if(SUCCEEDED(hres)) {
192 policy = policy_size >= sizeof(DWORD) ? *(DWORD*)bpolicy : URLPOLICY_DISALLOW;
193 CoTaskMemFree(bpolicy);
196 if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
197 IUnknown_Release(obj);
198 return NULL;
202 hres = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (void**)&obj_site);
203 if(SUCCEEDED(hres)) {
204 IUnknown *ax_site;
206 ax_site = create_ax_site(ctx);
207 if(ax_site) {
208 hres = IObjectWithSite_SetSite(obj_site, ax_site);
209 IUnknown_Release(ax_site);
211 IObjectWithSite_Release(obj_site);
212 if(!ax_site || FAILED(hres)) {
213 IUnknown_Release(obj);
214 return NULL;
218 return obj;
221 static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
223 FIXME("\n");
224 return E_NOTIMPL;
227 static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
229 FIXME("\n");
230 return E_NOTIMPL;
233 static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
235 FIXME("\n");
236 return E_NOTIMPL;
239 static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
241 FIXME("\n");
242 return E_NOTIMPL;
245 static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
247 FIXME("\n");
248 return E_NOTIMPL;
251 static HRESULT Global_CDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
253 FIXME("\n");
254 return E_NOTIMPL;
257 static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
259 FIXME("\n");
260 return E_NOTIMPL;
263 static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
265 FIXME("\n");
266 return E_NOTIMPL;
269 static HRESULT Global_CStr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
271 FIXME("\n");
272 return E_NOTIMPL;
275 static inline WCHAR hex_char(unsigned n)
277 return n < 10 ? '0'+n : 'A'+n-10;
280 static HRESULT Global_Hex(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
282 WCHAR buf[17], *ptr;
283 DWORD n;
285 TRACE("%s\n", debugstr_variant(arg));
287 switch(V_VT(arg)) {
288 case VT_I2:
289 n = (WORD)V_I2(arg);
290 break;
291 case VT_I4:
292 n = V_I4(arg);
293 break;
294 case VT_EMPTY:
295 n = 0;
296 break;
297 case VT_NULL:
298 if(res)
299 V_VT(res) = VT_NULL;
300 return S_OK;
301 default:
302 FIXME("unsupported type %s\n", debugstr_variant(arg));
303 return E_NOTIMPL;
306 buf[16] = 0;
307 ptr = buf+15;
309 if(n) {
310 do {
311 *ptr-- = hex_char(n & 0xf);
312 n >>= 4;
313 }while(n);
314 ptr++;
315 }else {
316 *ptr = '0';
319 return return_bstr(res, ptr);
322 static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
324 FIXME("\n");
325 return E_NOTIMPL;
328 static HRESULT Global_VarType(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
330 FIXME("\n");
331 return E_NOTIMPL;
334 static HRESULT Global_IsDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
336 FIXME("\n");
337 return E_NOTIMPL;
340 static HRESULT Global_IsEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
342 TRACE("(%s)\n", debugstr_variant(arg));
344 assert(args_cnt == 1);
346 if(res) {
347 V_VT(res) = VT_BOOL;
348 V_BOOL(res) = V_VT(arg) == VT_EMPTY ? VARIANT_TRUE : VARIANT_FALSE;
350 return S_OK;
353 static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
355 TRACE("(%s)\n", debugstr_variant(arg));
357 assert(args_cnt == 1);
359 if(res) {
360 V_VT(res) = VT_BOOL;
361 V_BOOL(res) = V_VT(arg) == VT_NULL ? VARIANT_TRUE : VARIANT_FALSE;
363 return S_OK;
366 static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
368 FIXME("\n");
369 return E_NOTIMPL;
372 static HRESULT Global_IsArray(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
374 FIXME("\n");
375 return E_NOTIMPL;
378 static HRESULT Global_IsObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
380 TRACE("(%s)\n", debugstr_variant(arg));
382 assert(args_cnt == 1);
384 if(res) {
385 V_VT(res) = VT_BOOL;
386 V_BOOL(res) = V_VT(arg) == VT_DISPATCH ? VARIANT_TRUE : VARIANT_FALSE;
388 return S_OK;
391 static HRESULT Global_Ant(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
393 FIXME("\n");
394 return E_NOTIMPL;
397 static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
399 FIXME("\n");
400 return E_NOTIMPL;
403 static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
405 FIXME("\n");
406 return E_NOTIMPL;
409 static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
411 FIXME("\n");
412 return E_NOTIMPL;
415 static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
417 FIXME("\n");
418 return E_NOTIMPL;
421 static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
423 FIXME("\n");
424 return E_NOTIMPL;
427 static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
429 FIXME("\n");
430 return E_NOTIMPL;
433 static HRESULT Global_Randomize(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
435 FIXME("\n");
436 return E_NOTIMPL;
439 static HRESULT Global_Rnd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
441 FIXME("\n");
442 return E_NOTIMPL;
445 static HRESULT Global_Timer(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
447 FIXME("\n");
448 return E_NOTIMPL;
451 static HRESULT Global_LBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
453 FIXME("\n");
454 return E_NOTIMPL;
457 static HRESULT Global_UBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
459 FIXME("\n");
460 return E_NOTIMPL;
463 static HRESULT Global_RGB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
465 FIXME("\n");
466 return E_NOTIMPL;
469 static HRESULT Global_Len(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
471 FIXME("\n");
472 return E_NOTIMPL;
475 static HRESULT Global_LenB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
477 FIXME("\n");
478 return E_NOTIMPL;
481 static HRESULT Global_Left(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
483 FIXME("\n");
484 return E_NOTIMPL;
487 static HRESULT Global_LeftB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
489 FIXME("\n");
490 return E_NOTIMPL;
493 static HRESULT Global_Right(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
495 FIXME("\n");
496 return E_NOTIMPL;
499 static HRESULT Global_RightB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
501 FIXME("\n");
502 return E_NOTIMPL;
505 static HRESULT Global_Mid(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
507 int len = -1, start, str_len;
508 BSTR str;
509 HRESULT hres;
511 TRACE("\n");
513 switch(args_cnt) {
514 case 3:
515 hres = to_int(args, &len);
516 if(FAILED(hres))
517 return hres;
519 if(len < 0) {
520 FIXME("len = %d\n", len);
521 return E_FAIL;
523 /* fallthrough */
524 case 2:
525 hres = to_int(args+args_cnt-2, &start);
526 if(FAILED(hres))
527 return hres;
529 if(V_VT(args+args_cnt-1) != VT_BSTR) {
530 FIXME("args[0] = %s\n", debugstr_variant(args+args_cnt-1));
531 return E_NOTIMPL;
534 str = V_BSTR(args+args_cnt-1);
535 break;
536 default:
537 assert(0);
541 str_len = SysStringLen(str);
542 start--;
543 if(start > str_len)
544 start = str_len;
546 if(len == -1)
547 len = str_len-start;
548 else if(len > str_len-start)
549 len = str_len-start;
551 if(res) {
552 V_VT(res) = VT_BSTR;
553 V_BSTR(res) = SysAllocStringLen(str+start, len);
554 if(!V_BSTR(res))
555 return E_OUTOFMEMORY;
558 return S_OK;
561 static HRESULT Global_MidB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
563 FIXME("\n");
564 return E_NOTIMPL;
567 static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
569 FIXME("\n");
570 return E_NOTIMPL;
573 static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
575 BSTR str;
576 HRESULT hres;
578 TRACE("%s\n", debugstr_variant(arg));
580 if(V_VT(arg) == VT_NULL) {
581 if(res)
582 V_VT(res) = VT_NULL;
583 return S_OK;
586 hres = to_string(arg, &str);
587 if(FAILED(hres))
588 return hres;
590 if(res) {
591 WCHAR *ptr;
593 for(ptr = str; *ptr; ptr++)
594 *ptr = tolowerW(*ptr);
596 V_VT(res) = VT_BSTR;
597 V_BSTR(res) = str;
598 }else {
599 SysFreeString(str);
601 return S_OK;
604 static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
606 BSTR str;
607 HRESULT hres;
609 TRACE("%s\n", debugstr_variant(arg));
611 if(V_VT(arg) == VT_NULL) {
612 if(res)
613 V_VT(res) = VT_NULL;
614 return S_OK;
617 hres = to_string(arg, &str);
618 if(FAILED(hres))
619 return hres;
621 if(res) {
622 WCHAR *ptr;
624 for(ptr = str; *ptr; ptr++)
625 *ptr = toupperW(*ptr);
627 V_VT(res) = VT_BSTR;
628 V_BSTR(res) = str;
629 }else {
630 SysFreeString(str);
632 return S_OK;
635 static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
637 FIXME("\n");
638 return E_NOTIMPL;
641 static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
643 FIXME("\n");
644 return E_NOTIMPL;
647 static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
649 FIXME("\n");
650 return E_NOTIMPL;
653 static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
655 FIXME("\n");
656 return E_NOTIMPL;
659 static HRESULT Global_String(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
661 FIXME("\n");
662 return E_NOTIMPL;
665 static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
667 VARIANT *startv, *str1v, *str2v;
668 BSTR str1, str2;
669 int start, ret;
670 HRESULT hres;
672 TRACE("\n");
674 switch(args_cnt) {
675 case 2:
676 startv = NULL;
677 str1v = args+1;
678 str2v = args;
679 break;
680 case 3:
681 startv = args+2;
682 str1v = args+1;
683 str2v = args;
684 break;
685 case 4:
686 FIXME("unsupported compare argument %s\n", debugstr_variant(args));
687 return E_NOTIMPL;
688 default:
689 assert(0);
692 if(startv) {
693 hres = to_int(startv, &start);
694 if(FAILED(hres))
695 return hres;
696 if(--start < 0) {
697 FIXME("start %d\n", start);
698 return E_FAIL;
700 }else {
701 start = 0;
704 if(V_VT(str1v) == VT_NULL || V_VT(str2v) == VT_NULL)
705 return return_null(res);
707 if(V_VT(str1v) != VT_BSTR) {
708 FIXME("Unsupported str1 type %s\n", debugstr_variant(str1v));
709 return E_NOTIMPL;
711 str1 = V_BSTR(str1v);
713 if(V_VT(str2v) != VT_BSTR) {
714 FIXME("Unsupported str2 type %s\n", debugstr_variant(str2v));
715 return E_NOTIMPL;
717 str2 = V_BSTR(str2v);
719 if(start < SysStringLen(str1)) {
720 WCHAR *ptr;
722 ptr = strstrW(str1+start, str2);
723 ret = ptr ? ptr-str1+1 : 0;
724 }else {
725 ret = 0;
728 return return_int(res, ret);
731 static HRESULT Global_InStrB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
733 FIXME("\n");
734 return E_NOTIMPL;
737 static HRESULT Global_AscB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
739 FIXME("\n");
740 return E_NOTIMPL;
743 static HRESULT Global_ChrB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
745 FIXME("\n");
746 return E_NOTIMPL;
749 static HRESULT Global_Asc(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
751 FIXME("\n");
752 return E_NOTIMPL;
755 static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
757 FIXME("\n");
758 return E_NOTIMPL;
761 static HRESULT Global_AscW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
763 FIXME("\n");
764 return E_NOTIMPL;
767 static HRESULT Global_ChrW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
769 FIXME("\n");
770 return E_NOTIMPL;
773 static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
775 FIXME("\n");
776 return E_NOTIMPL;
779 static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
781 FIXME("\n");
782 return E_NOTIMPL;
785 static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
787 FIXME("\n");
788 return E_NOTIMPL;
791 static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
793 FIXME("\n");
794 return E_NOTIMPL;
797 static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
799 FIXME("\n");
800 return E_NOTIMPL;
803 static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
805 FIXME("\n");
806 return E_NOTIMPL;
809 static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
811 FIXME("\n");
812 return E_NOTIMPL;
815 static HRESULT Global_Day(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
817 FIXME("\n");
818 return E_NOTIMPL;
821 static HRESULT Global_Month(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
823 FIXME("\n");
824 return E_NOTIMPL;
827 static HRESULT Global_Weekday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
829 FIXME("\n");
830 return E_NOTIMPL;
833 static HRESULT Global_Year(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
835 FIXME("\n");
836 return E_NOTIMPL;
839 static HRESULT Global_Hour(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
841 FIXME("\n");
842 return E_NOTIMPL;
845 static HRESULT Global_Minute(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
847 FIXME("\n");
848 return E_NOTIMPL;
851 static HRESULT Global_Second(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
853 FIXME("\n");
854 return E_NOTIMPL;
857 static HRESULT Global_DateValue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
859 FIXME("\n");
860 return E_NOTIMPL;
863 static HRESULT Global_TimeValue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
865 FIXME("\n");
866 return E_NOTIMPL;
869 static HRESULT Global_DateSerial(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
871 FIXME("\n");
872 return E_NOTIMPL;
875 static HRESULT Global_TimeSerial(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
877 FIXME("\n");
878 return E_NOTIMPL;
881 static HRESULT Global_InputBox(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
883 FIXME("\n");
884 return E_NOTIMPL;
887 static HRESULT Global_MsgBox(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
889 FIXME("\n");
890 return E_NOTIMPL;
893 static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
895 IUnknown *obj;
896 HRESULT hres;
898 TRACE("(%s)\n", debugstr_variant(arg));
900 if(V_VT(arg) != VT_BSTR) {
901 FIXME("non-bstr arg\n");
902 return E_INVALIDARG;
905 obj = create_object(This->desc->ctx, V_BSTR(arg));
906 if(!obj)
907 return VB_E_CANNOT_CREATE_OBJ;
909 if(res) {
910 hres = IUnknown_QueryInterface(obj, &IID_IDispatch, (void**)&V_DISPATCH(res));
911 if(FAILED(hres))
912 return hres;
914 V_VT(res) = VT_DISPATCH;
917 IUnknown_Release(obj);
918 return S_OK;
921 static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
923 FIXME("\n");
924 return E_NOTIMPL;
927 static HRESULT Global_DateAdd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
929 FIXME("\n");
930 return E_NOTIMPL;
933 static HRESULT Global_DateDiff(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
935 FIXME("\n");
936 return E_NOTIMPL;
939 static HRESULT Global_DatePart(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
941 FIXME("\n");
942 return E_NOTIMPL;
945 static HRESULT Global_TypeName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
947 FIXME("\n");
948 return E_NOTIMPL;
951 static HRESULT Global_Array(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
953 FIXME("\n");
954 return E_NOTIMPL;
957 static HRESULT Global_Erase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
959 FIXME("\n");
960 return E_NOTIMPL;
963 static HRESULT Global_Filter(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
965 FIXME("\n");
966 return E_NOTIMPL;
969 static HRESULT Global_Join(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
971 FIXME("\n");
972 return E_NOTIMPL;
975 static HRESULT Global_Split(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
977 FIXME("\n");
978 return E_NOTIMPL;
981 static HRESULT Global_Replace(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
983 FIXME("\n");
984 return E_NOTIMPL;
987 static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
989 FIXME("\n");
990 return E_NOTIMPL;
993 static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
995 FIXME("\n");
996 return E_NOTIMPL;
999 static HRESULT Global_LoadPicture(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1001 FIXME("\n");
1002 return E_NOTIMPL;
1005 static HRESULT Global_ScriptEngine(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1007 FIXME("\n");
1008 return E_NOTIMPL;
1011 static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1013 FIXME("\n");
1014 return E_NOTIMPL;
1017 static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1019 FIXME("\n");
1020 return E_NOTIMPL;
1023 static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1025 FIXME("\n");
1026 return E_NOTIMPL;
1029 static HRESULT Global_FormatNumber(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1031 FIXME("\n");
1032 return E_NOTIMPL;
1035 static HRESULT Global_FormatCurrency(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1037 FIXME("\n");
1038 return E_NOTIMPL;
1041 static HRESULT Global_FormatPercent(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1043 FIXME("\n");
1044 return E_NOTIMPL;
1047 static HRESULT Global_FormatDateTime(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1049 FIXME("\n");
1050 return E_NOTIMPL;
1053 static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1055 FIXME("\n");
1056 return E_NOTIMPL;
1059 static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1061 FIXME("\n");
1062 return E_NOTIMPL;
1065 static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1067 FIXME("\n");
1068 return E_NOTIMPL;
1071 static HRESULT Global_Escape(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1073 FIXME("\n");
1074 return E_NOTIMPL;
1077 static HRESULT Global_Unescape(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1079 FIXME("\n");
1080 return E_NOTIMPL;
1083 static HRESULT Global_Eval(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1085 FIXME("\n");
1086 return E_NOTIMPL;
1089 static HRESULT Global_Execute(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1091 FIXME("\n");
1092 return E_NOTIMPL;
1095 static HRESULT Global_ExecuteGlobal(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1097 FIXME("\n");
1098 return E_NOTIMPL;
1101 static HRESULT Global_GetRef(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1103 FIXME("\n");
1104 return E_NOTIMPL;
1107 static HRESULT Global_vbUseSystem(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1109 FIXME("\n");
1110 return E_NOTIMPL;
1113 static HRESULT Global_vbUseSystemDayOfWeek(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1115 FIXME("\n");
1116 return E_NOTIMPL;
1119 static HRESULT Global_vbSunday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1121 TRACE("\n");
1122 return return_short(res, 1);
1125 static HRESULT Global_vbMonday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1127 TRACE("\n");
1128 return return_short(res, 2);
1131 static HRESULT Global_vbTuesday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1133 TRACE("\n");
1134 return return_short(res, 3);
1137 static HRESULT Global_vbWednesday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1139 TRACE("\n");
1140 return return_short(res, 4);
1143 static HRESULT Global_vbThursday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1145 TRACE("\n");
1146 return return_short(res, 5);
1149 static HRESULT Global_vbFriday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1151 TRACE("\n");
1152 return return_short(res, 6);
1155 static HRESULT Global_vbSaturday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1157 TRACE("\n");
1158 return return_short(res, 7);
1161 static HRESULT Global_vbFirstJan1(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1163 FIXME("\n");
1164 return E_NOTIMPL;
1167 static HRESULT Global_vbFirstFourDays(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1169 FIXME("\n");
1170 return E_NOTIMPL;
1173 static HRESULT Global_vbFirstFullWeek(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1175 FIXME("\n");
1176 return E_NOTIMPL;
1179 static HRESULT Global_vbOKOnly(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1181 FIXME("\n");
1182 return E_NOTIMPL;
1185 static HRESULT Global_vbOKCancel(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1187 FIXME("\n");
1188 return E_NOTIMPL;
1191 static HRESULT Global_vbAbortRetryIgnore(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1193 FIXME("\n");
1194 return E_NOTIMPL;
1197 static HRESULT Global_vbYesNoCancel(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1199 FIXME("\n");
1200 return E_NOTIMPL;
1203 static HRESULT Global_vbYesNo(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1205 FIXME("\n");
1206 return E_NOTIMPL;
1209 static HRESULT Global_vbRetryCancel(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1211 FIXME("\n");
1212 return E_NOTIMPL;
1215 static HRESULT Global_vbCritical(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1217 FIXME("\n");
1218 return E_NOTIMPL;
1221 static HRESULT Global_vbQuestion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1223 FIXME("\n");
1224 return E_NOTIMPL;
1227 static HRESULT Global_vbExclamation(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1229 FIXME("\n");
1230 return E_NOTIMPL;
1233 static HRESULT Global_vbInformation(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1235 FIXME("\n");
1236 return E_NOTIMPL;
1239 static HRESULT Global_vbDefaultButton1(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1241 FIXME("\n");
1242 return E_NOTIMPL;
1245 static HRESULT Global_vbDefaultButton2(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1247 FIXME("\n");
1248 return E_NOTIMPL;
1251 static HRESULT Global_vbDefaultButton3(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1253 FIXME("\n");
1254 return E_NOTIMPL;
1257 static HRESULT Global_vbDefaultButton4(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1259 FIXME("\n");
1260 return E_NOTIMPL;
1263 static HRESULT Global_vbApplicationModal(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1265 FIXME("\n");
1266 return E_NOTIMPL;
1269 static HRESULT Global_vbSystemModal(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1271 FIXME("\n");
1272 return E_NOTIMPL;
1275 static HRESULT Global_vbOK(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1277 FIXME("\n");
1278 return E_NOTIMPL;
1281 static HRESULT Global_vbCancel(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1283 FIXME("\n");
1284 return E_NOTIMPL;
1287 static HRESULT Global_vbAbort(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1289 FIXME("\n");
1290 return E_NOTIMPL;
1293 static HRESULT Global_vbRetry(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1295 FIXME("\n");
1296 return E_NOTIMPL;
1299 static HRESULT Global_vbIgnore(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1301 FIXME("\n");
1302 return E_NOTIMPL;
1305 static HRESULT Global_vbYes(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1307 FIXME("\n");
1308 return E_NOTIMPL;
1311 static HRESULT Global_vbNo(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1313 FIXME("\n");
1314 return E_NOTIMPL;
1317 static HRESULT Global_vbEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1319 FIXME("\n");
1320 return E_NOTIMPL;
1323 static HRESULT Global_vbNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1325 FIXME("\n");
1326 return E_NOTIMPL;
1329 static HRESULT Global_vbInteger(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1331 FIXME("\n");
1332 return E_NOTIMPL;
1335 static HRESULT Global_vbLong(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1337 FIXME("\n");
1338 return E_NOTIMPL;
1341 static HRESULT Global_vbSingle(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1343 FIXME("\n");
1344 return E_NOTIMPL;
1347 static HRESULT Global_vbDouble(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1349 FIXME("\n");
1350 return E_NOTIMPL;
1353 static HRESULT Global_vbCurrency(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1355 FIXME("\n");
1356 return E_NOTIMPL;
1359 static HRESULT Global_vbDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1361 FIXME("\n");
1362 return E_NOTIMPL;
1365 static HRESULT Global_vbString(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1367 FIXME("\n");
1368 return E_NOTIMPL;
1371 static HRESULT Global_vbObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1373 FIXME("\n");
1374 return E_NOTIMPL;
1377 static HRESULT Global_vbError(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1379 FIXME("\n");
1380 return E_NOTIMPL;
1383 static HRESULT Global_vbBoolean(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1385 FIXME("\n");
1386 return E_NOTIMPL;
1389 static HRESULT Global_vbVariant(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1391 FIXME("\n");
1392 return E_NOTIMPL;
1395 static HRESULT Global_vbDataObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1397 FIXME("\n");
1398 return E_NOTIMPL;
1401 static HRESULT Global_vbDecimal(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1403 FIXME("\n");
1404 return E_NOTIMPL;
1407 static HRESULT Global_vbByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1409 FIXME("\n");
1410 return E_NOTIMPL;
1413 static HRESULT Global_vbArray(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1415 FIXME("\n");
1416 return E_NOTIMPL;
1419 static HRESULT Global_vbTrue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1421 FIXME("\n");
1422 return E_NOTIMPL;
1425 static HRESULT Global_vbFalse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1427 FIXME("\n");
1428 return E_NOTIMPL;
1431 static HRESULT Global_vbUseDefault(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1433 FIXME("\n");
1434 return E_NOTIMPL;
1437 static HRESULT Global_vbBinaryCompare(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1439 FIXME("\n");
1440 return E_NOTIMPL;
1443 static HRESULT Global_vbTextCompare(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1445 FIXME("\n");
1446 return E_NOTIMPL;
1449 static HRESULT Global_vbDatabaseCompare(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1451 FIXME("\n");
1452 return E_NOTIMPL;
1455 static HRESULT Global_vbGeneralDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1457 FIXME("\n");
1458 return E_NOTIMPL;
1461 static HRESULT Global_vbLongDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1463 FIXME("\n");
1464 return E_NOTIMPL;
1467 static HRESULT Global_vbShortDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1469 FIXME("\n");
1470 return E_NOTIMPL;
1473 static HRESULT Global_vbLongTime(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1475 FIXME("\n");
1476 return E_NOTIMPL;
1479 static HRESULT Global_vbShortTime(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1481 FIXME("\n");
1482 return E_NOTIMPL;
1485 static HRESULT Global_vbObjectError(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1487 FIXME("\n");
1488 return E_NOTIMPL;
1491 static HRESULT Global_vbBlack(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1493 FIXME("\n");
1494 return E_NOTIMPL;
1497 static HRESULT Global_vbBlue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1499 FIXME("\n");
1500 return E_NOTIMPL;
1503 static HRESULT Global_vbCyan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1505 FIXME("\n");
1506 return E_NOTIMPL;
1509 static HRESULT Global_vbGreen(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1511 FIXME("\n");
1512 return E_NOTIMPL;
1515 static HRESULT Global_vbMagenta(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1517 FIXME("\n");
1518 return E_NOTIMPL;
1521 static HRESULT Global_vbRed(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1523 FIXME("\n");
1524 return E_NOTIMPL;
1527 static HRESULT Global_vbWhite(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1529 FIXME("\n");
1530 return E_NOTIMPL;
1533 static HRESULT Global_vbYellow(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1535 FIXME("\n");
1536 return E_NOTIMPL;
1539 static HRESULT Global_vbCr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1541 FIXME("\n");
1542 return E_NOTIMPL;
1545 static HRESULT Global_vbCrLf(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1547 FIXME("\n");
1548 return E_NOTIMPL;
1551 static HRESULT Global_vbNewLine(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1553 FIXME("\n");
1554 return E_NOTIMPL;
1557 static HRESULT Global_vbFormFeed(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1559 FIXME("\n");
1560 return E_NOTIMPL;
1563 static HRESULT Global_vbLf(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1565 FIXME("\n");
1566 return E_NOTIMPL;
1569 static HRESULT Global_vbNullChar(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1571 FIXME("\n");
1572 return E_NOTIMPL;
1575 static HRESULT Global_vbNullString(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1577 FIXME("\n");
1578 return E_NOTIMPL;
1581 static HRESULT Global_vbTab(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1583 FIXME("\n");
1584 return E_NOTIMPL;
1587 static HRESULT Global_vbVerticalTab(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1589 FIXME("\n");
1590 return E_NOTIMPL;
1593 static HRESULT Global_vbMsgBoxHelpButton(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1595 FIXME("\n");
1596 return E_NOTIMPL;
1599 static HRESULT Global_vbMsgBoxSetForeground(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1601 FIXME("\n");
1602 return E_NOTIMPL;
1605 static HRESULT Global_vbMsgBoxRight(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1607 FIXME("\n");
1608 return E_NOTIMPL;
1611 static HRESULT Global_vbMsgBoxRtlReading(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
1613 FIXME("\n");
1614 return E_NOTIMPL;
1617 static const builtin_prop_t global_props[] = {
1618 {DISPID_GLOBAL_VBUSESYSTEM, Global_vbUseSystem, BP_GET},
1619 {DISPID_GLOBAL_USESYSTEMDAYOFWEEK, Global_vbUseSystemDayOfWeek, BP_GET},
1620 {DISPID_GLOBAL_VBSUNDAY, Global_vbSunday, BP_GET},
1621 {DISPID_GLOBAL_VBMONDAY, Global_vbMonday, BP_GET},
1622 {DISPID_GLOBAL_VBTUESDAY, Global_vbTuesday, BP_GET},
1623 {DISPID_GLOBAL_VBWEDNESDAY, Global_vbWednesday, BP_GET},
1624 {DISPID_GLOBAL_VBTHURSDAY, Global_vbThursday, BP_GET},
1625 {DISPID_GLOBAL_VBFRIDAY, Global_vbFriday, BP_GET},
1626 {DISPID_GLOBAL_VBSATURDAY, Global_vbSaturday, BP_GET},
1627 {DISPID_GLOBAL_VBFIRSTJAN1, Global_vbFirstJan1, BP_GET},
1628 {DISPID_GLOBAL_VBFIRSTFOURDAYS, Global_vbFirstFourDays, BP_GET},
1629 {DISPID_GLOBAL_VBFIRSTFULLWEEK, Global_vbFirstFullWeek, BP_GET},
1630 {DISPID_GLOBAL_VBOKONLY, Global_vbOKOnly, BP_GET},
1631 {DISPID_GLOBAL_VBOKCANCEL, Global_vbOKCancel, BP_GET},
1632 {DISPID_GLOBAL_VBABORTRETRYIGNORE, Global_vbAbortRetryIgnore, BP_GET},
1633 {DISPID_GLOBAL_VBYESNOCANCEL, Global_vbYesNoCancel, BP_GET},
1634 {DISPID_GLOBAL_VBYESNO, Global_vbYesNo, BP_GET},
1635 {DISPID_GLOBAL_VBRETRYCANCEL, Global_vbRetryCancel, BP_GET},
1636 {DISPID_GLOBAL_VBCRITICAL, Global_vbCritical, BP_GET},
1637 {DISPID_GLOBAL_VBQUESTION, Global_vbQuestion, BP_GET},
1638 {DISPID_GLOBAL_VBEXCLAMATION, Global_vbExclamation, BP_GET},
1639 {DISPID_GLOBAL_VBINFORMATION, Global_vbInformation, BP_GET},
1640 {DISPID_GLOBAL_VBDEFAULTBUTTON1, Global_vbDefaultButton1, BP_GET},
1641 {DISPID_GLOBAL_VBDEFAULTBUTTON2, Global_vbDefaultButton2, BP_GET},
1642 {DISPID_GLOBAL_VBDEFAULTBUTTON3, Global_vbDefaultButton3, BP_GET},
1643 {DISPID_GLOBAL_VBDEFAULTBUTTON4, Global_vbDefaultButton4, BP_GET},
1644 {DISPID_GLOBAL_VBAPPLICATIONMODAL, Global_vbApplicationModal, BP_GET},
1645 {DISPID_GLOBAL_VBSYSTEMMODAL, Global_vbSystemModal, BP_GET},
1646 {DISPID_GLOBAL_VBOK, Global_vbOK, BP_GET},
1647 {DISPID_GLOBAL_VBCANCEL, Global_vbCancel, BP_GET},
1648 {DISPID_GLOBAL_VBABORT, Global_vbAbort, BP_GET},
1649 {DISPID_GLOBAL_VBRETRY, Global_vbRetry, BP_GET},
1650 {DISPID_GLOBAL_VBIGNORE, Global_vbIgnore, BP_GET},
1651 {DISPID_GLOBAL_VBYES, Global_vbYes, BP_GET},
1652 {DISPID_GLOBAL_VBNO, Global_vbNo, BP_GET},
1653 {DISPID_GLOBAL_VBEMPTY, Global_vbEmpty, BP_GET},
1654 {DISPID_GLOBAL_VBNULL, Global_vbNull, BP_GET},
1655 {DISPID_GLOBAL_VBINTEGER, Global_vbInteger, BP_GET},
1656 {DISPID_GLOBAL_VBLONG, Global_vbLong, BP_GET},
1657 {DISPID_GLOBAL_VBSINGLE, Global_vbSingle, BP_GET},
1658 {DISPID_GLOBAL_VBDOUBLE, Global_vbDouble, BP_GET},
1659 {DISPID_GLOBAL_VBCURRENCY, Global_vbCurrency, BP_GET},
1660 {DISPID_GLOBAL_VBDATE, Global_vbDate, BP_GET},
1661 {DISPID_GLOBAL_VBSTRING, Global_vbString, BP_GET},
1662 {DISPID_GLOBAL_VBOBJECT, Global_vbObject, BP_GET},
1663 {DISPID_GLOBAL_VBERROR, Global_vbError, BP_GET},
1664 {DISPID_GLOBAL_VBBOOLEAN, Global_vbBoolean, BP_GET},
1665 {DISPID_GLOBAL_VBVARIANT, Global_vbVariant, BP_GET},
1666 {DISPID_GLOBAL_VBDATAOBJECT, Global_vbDataObject, BP_GET},
1667 {DISPID_GLOBAL_VBDECIMAL, Global_vbDecimal, BP_GET},
1668 {DISPID_GLOBAL_VBBYTE, Global_vbByte, BP_GET},
1669 {DISPID_GLOBAL_VBARRAY, Global_vbArray, BP_GET},
1670 {DISPID_GLOBAL_VBTRUE, Global_vbTrue, BP_GET},
1671 {DISPID_GLOBAL_VBFALSE, Global_vbFalse, BP_GET},
1672 {DISPID_GLOBAL_VBUSEDEFAULT, Global_vbUseDefault, BP_GET},
1673 {DISPID_GLOBAL_VBBINARYCOMPARE, Global_vbBinaryCompare, BP_GET},
1674 {DISPID_GLOBAL_VBTEXTCOMPARE, Global_vbTextCompare, BP_GET},
1675 {DISPID_GLOBAL_VBDATABASECOMPARE, Global_vbDatabaseCompare, BP_GET},
1676 {DISPID_GLOBAL_VBGENERALDATE, Global_vbGeneralDate, BP_GET},
1677 {DISPID_GLOBAL_VBLONGDATE, Global_vbLongDate, BP_GET},
1678 {DISPID_GLOBAL_VBSHORTDATE, Global_vbShortDate, BP_GET},
1679 {DISPID_GLOBAL_VBLONGTIME, Global_vbLongTime, BP_GET},
1680 {DISPID_GLOBAL_VBSHORTTIME, Global_vbShortTime, BP_GET},
1681 {DISPID_GLOBAL_VBOBJECTERROR, Global_vbObjectError, BP_GET},
1682 {DISPID_GLOBAL_VBBLACK, Global_vbBlack, BP_GET},
1683 {DISPID_GLOBAL_VBBLUE, Global_vbBlue, BP_GET},
1684 {DISPID_GLOBAL_VBCYAN, Global_vbCyan, BP_GET},
1685 {DISPID_GLOBAL_VBGREEN, Global_vbGreen, BP_GET},
1686 {DISPID_GLOBAL_VBMAGENTA, Global_vbMagenta, BP_GET},
1687 {DISPID_GLOBAL_VBRED, Global_vbRed, BP_GET},
1688 {DISPID_GLOBAL_VBWHITE, Global_vbWhite, BP_GET},
1689 {DISPID_GLOBAL_VBYELLOW, Global_vbYellow, BP_GET},
1690 {DISPID_GLOBAL_VBCR, Global_vbCr, BP_GET},
1691 {DISPID_GLOBAL_VBCRLF, Global_vbCrLf, BP_GET},
1692 {DISPID_GLOBAL_VBNEWLINE, Global_vbNewLine, BP_GET},
1693 {DISPID_GLOBAL_VBFORMFEED, Global_vbFormFeed, BP_GET},
1694 {DISPID_GLOBAL_VBLF, Global_vbLf, BP_GET},
1695 {DISPID_GLOBAL_VBNULLCHAR, Global_vbNullChar, BP_GET},
1696 {DISPID_GLOBAL_VBNULLSTRING, Global_vbNullString, BP_GET},
1697 {DISPID_GLOBAL_VBTAB, Global_vbTab, BP_GET},
1698 {DISPID_GLOBAL_VBVERTICALTAB, Global_vbVerticalTab, BP_GET},
1699 {DISPID_GLOBAL_CCUR, Global_CCur, 0, 1},
1700 {DISPID_GLOBAL_CINT, Global_CInt, 0, 1},
1701 {DISPID_GLOBAL_CLNG, Global_CLng, 0, 1},
1702 {DISPID_GLOBAL_CBOOL, Global_CBool, 0, 1},
1703 {DISPID_GLOBAL_CBYTE, Global_CByte, 0, 1},
1704 {DISPID_GLOBAL_CDATE, Global_CDate, 0, 1},
1705 {DISPID_GLOBAL_CDBL, Global_CDbl, 0, 1},
1706 {DISPID_GLOBAL_CSNG, Global_CSng, 0, 1},
1707 {DISPID_GLOBAL_CSTR, Global_CStr, 0, 1},
1708 {DISPID_GLOBAL_HEX, Global_Hex, 0, 1},
1709 {DISPID_GLOBAL_OCT, Global_Oct, 0, 1},
1710 {DISPID_GLOBAL_VARTYPE, Global_VarType, 0, 1},
1711 {DISPID_GLOBAL_ISDATE, Global_IsDate, 0, 1},
1712 {DISPID_GLOBAL_ISEMPTY, Global_IsEmpty, 0, 1},
1713 {DISPID_GLOBAL_ISNULL, Global_IsNull, 0, 1},
1714 {DISPID_GLOBAL_ISNUMERIC, Global_IsNumeric, 0, 1},
1715 {DISPID_GLOBAL_ISARRAY, Global_IsArray, 0, 1},
1716 {DISPID_GLOBAL_ISOBJECT, Global_IsObject, 0, 1},
1717 {DISPID_GLOBAL_ATN, Global_Ant, 0, 1},
1718 {DISPID_GLOBAL_COS, Global_Cos, 0, 1},
1719 {DISPID_GLOBAL_SIN, Global_Sin, 0, 1},
1720 {DISPID_GLOBAL_TAN, Global_Tan, 0, 1},
1721 {DISPID_GLOBAL_EXP, Global_Exp, 0, 1},
1722 {DISPID_GLOBAL_LOG, Global_Log, 0, 1},
1723 {DISPID_GLOBAL_SQR, Global_Sqr, 0, 1},
1724 {DISPID_GLOBAL_RANDOMIZE, Global_Randomize, 0, 1},
1725 {DISPID_GLOBAL_RND, Global_Rnd, 0, 1},
1726 {DISPID_GLOBAL_TIMER, Global_Timer, 0, 0},
1727 {DISPID_GLOBAL_LBOUND, Global_LBound, 0, 1},
1728 {DISPID_GLOBAL_UBOUND, Global_UBound, 0, 1},
1729 {DISPID_GLOBAL_RGB, Global_RGB, 0, 3},
1730 {DISPID_GLOBAL_LEN, Global_Len, 0, 1},
1731 {DISPID_GLOBAL_LENB, Global_LenB, 0, 1},
1732 {DISPID_GLOBAL_LEFT, Global_Left, 0, 2},
1733 {DISPID_GLOBAL_LEFTB, Global_LeftB, 0, 2},
1734 {DISPID_GLOBAL_RIGHT, Global_Right, 0, 2},
1735 {DISPID_GLOBAL_RIGHTB, Global_RightB, 0, 2},
1736 {DISPID_GLOBAL_MID, Global_Mid, 0, 2, 3},
1737 {DISPID_GLOBAL_MIDB, Global_MidB, 0, 2, 3},
1738 {DISPID_GLOBAL_STRCOMP, Global_StrComp, 0, 2, 3},
1739 {DISPID_GLOBAL_LCASE, Global_LCase, 0, 1},
1740 {DISPID_GLOBAL_UCASE, Global_UCase, 0, 1},
1741 {DISPID_GLOBAL_LTRIM, Global_LTrim, 0, 1},
1742 {DISPID_GLOBAL_RTRIM, Global_RTrim, 0, 1},
1743 {DISPID_GLOBAL_TRIM, Global_Trim, 0, 1},
1744 {DISPID_GLOBAL_SPACE, Global_Space, 0, 1},
1745 {DISPID_GLOBAL_STRING, Global_String, 0, 0, 2},
1746 {DISPID_GLOBAL_INSTR, Global_InStr, 0, 2, 4},
1747 {DISPID_GLOBAL_INSTRB, Global_InStrB, 0, 3, 4},
1748 {DISPID_GLOBAL_ASCB, Global_AscB, 0, 1},
1749 {DISPID_GLOBAL_CHRB, Global_ChrB, 0, 1},
1750 {DISPID_GLOBAL_ASC, Global_Asc, 0, 1},
1751 {DISPID_GLOBAL_CHR, Global_Chr, 0, 1},
1752 {DISPID_GLOBAL_ASCW, Global_AscW, 0, 1},
1753 {DISPID_GLOBAL_CHRW, Global_ChrW, 0, 1},
1754 {DISPID_GLOBAL_ABS, Global_Abs, 0, 1},
1755 {DISPID_GLOBAL_FIX, Global_Fix, 0, 1},
1756 {DISPID_GLOBAL_INT, Global_Int, 0, 1},
1757 {DISPID_GLOBAL_SGN, Global_Sgn, 0, 1},
1758 {DISPID_GLOBAL_NOW, Global_Now, 0, 0},
1759 {DISPID_GLOBAL_DATE, Global_Date, 0, 0},
1760 {DISPID_GLOBAL_TIME, Global_Time, 0, 0},
1761 {DISPID_GLOBAL_DAY, Global_Day, 0, 1},
1762 {DISPID_GLOBAL_MONTH, Global_Month, 0, 1},
1763 {DISPID_GLOBAL_WEEKDAY, Global_Weekday, 0, 1, 2},
1764 {DISPID_GLOBAL_YEAR, Global_Year, 0, 1},
1765 {DISPID_GLOBAL_HOUR, Global_Hour, 0, 1},
1766 {DISPID_GLOBAL_MINUTE, Global_Minute, 0, 1},
1767 {DISPID_GLOBAL_SECOND, Global_Second, 0, 1},
1768 {DISPID_GLOBAL_DATEVALUE, Global_DateValue, 0, 1},
1769 {DISPID_GLOBAL_TIMEVALUE, Global_TimeValue, 0, 1},
1770 {DISPID_GLOBAL_DATESERIAL, Global_DateSerial, 0, 3},
1771 {DISPID_GLOBAL_TIMESERIAL, Global_TimeSerial, 0, 3},
1772 {DISPID_GLOBAL_INPUTBOX, Global_InputBox, 0, 1, 7},
1773 {DISPID_GLOBAL_MSGBOX, Global_MsgBox, 0, 1, 5},
1774 {DISPID_GLOBAL_CREATEOBJECT, Global_CreateObject, 0, 1},
1775 {DISPID_GLOBAL_GETOBJECT, Global_GetObject, 0, 0, 2},
1776 {DISPID_GLOBAL_DATEADD, Global_DateAdd, 0, 3},
1777 {DISPID_GLOBAL_DATEDIFF, Global_DateDiff, 0, 3, 5},
1778 {DISPID_GLOBAL_DATEPART, Global_DatePart, 0, 2, 4},
1779 {DISPID_GLOBAL_TYPENAME, Global_TypeName, 0, 1},
1780 {DISPID_GLOBAL_ARRAY, Global_Array, 0, 1},
1781 {DISPID_GLOBAL_ERASE, Global_Erase, 0, 1},
1782 {DISPID_GLOBAL_FILTER, Global_Filter, 0, 2, 4},
1783 {DISPID_GLOBAL_JOIN, Global_Join, 0, 1, 2},
1784 {DISPID_GLOBAL_SPLIT, Global_Split, 0, 1, 4},
1785 {DISPID_GLOBAL_REPLACE, Global_Replace, 0, 3, 6},
1786 {DISPID_GLOBAL_STRREVERSE, Global_StrReverse, 0, 1},
1787 {DISPID_GLOBAL_INSTRREV, Global_InStrRev, 0, 2, 4},
1788 {DISPID_GLOBAL_LOADPICTURE, Global_LoadPicture, 0, 1},
1789 {DISPID_GLOBAL_SCRIPTENGINE, Global_ScriptEngine, 0, 0},
1790 {DISPID_GLOBAL_SCRIPTENGINEMAJORVERSION, Global_ScriptEngineMajorVersion, 0, 0},
1791 {DISPID_GLOBAL_SCRIPTENGINEMINORVERSION, Global_ScriptEngineMinorVersion, 0, 0},
1792 {DISPID_GLOBAL_SCRIPTENGINEBUILDVERSION, Global_ScriptEngineBuildVersion, 0, 0},
1793 {DISPID_GLOBAL_FORMATNUMBER, Global_FormatNumber, 0, 1, 5},
1794 {DISPID_GLOBAL_FORMATCURRENCY, Global_FormatCurrency, 0, 1, 5},
1795 {DISPID_GLOBAL_FORMATPERCENT, Global_FormatPercent, 0, 1, 5},
1796 {DISPID_GLOBAL_FORMATDATETIME, Global_FormatDateTime, 0, 1, 2},
1797 {DISPID_GLOBAL_WEEKDAYNAME, Global_WeekdayName, 0, 3},
1798 {DISPID_GLOBAL_MONTHNAME, Global_MonthName, 0, 1, 2},
1799 {DISPID_GLOBAL_ROUND, Global_Round, 0, 1, 2},
1800 {DISPID_GLOBAL_ESCAPE, Global_Escape, 0, 1},
1801 {DISPID_GLOBAL_UNESCAPE, Global_Unescape, 0, 1},
1802 {DISPID_GLOBAL_EVAL, Global_Eval, 0, 1},
1803 {DISPID_GLOBAL_EXECUTE, Global_Execute, 0, 1},
1804 {DISPID_GLOBAL_EXECUTEGLOBAL, Global_ExecuteGlobal, 0, 1},
1805 {DISPID_GLOBAL_GETREF, Global_GetRef, 0, 1},
1806 {DISPID_GLOBAL_VBMSGBOXHELPBUTTON, Global_vbMsgBoxHelpButton, BP_GET},
1807 {DISPID_GLOBAL_VBMSGBOXSETFOREGROUND, Global_vbMsgBoxSetForeground, BP_GET},
1808 {DISPID_GLOBAL_VBMSGBOXRIGHT, Global_vbMsgBoxRight, BP_GET},
1809 {DISPID_GLOBAL_VBMSGBOXRTLREADING, Global_vbMsgBoxRtlReading, BP_GET}
1812 HRESULT init_global(script_ctx_t *ctx)
1814 HRESULT hres;
1816 ctx->global_desc.ctx = ctx;
1817 ctx->global_desc.builtin_prop_cnt = sizeof(global_props)/sizeof(*global_props);
1818 ctx->global_desc.builtin_props = global_props;
1820 hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo);
1821 if(FAILED(hres))
1822 return hres;
1824 hres = create_vbdisp(&ctx->global_desc, &ctx->global_obj);
1825 if(FAILED(hres))
1826 return hres;
1828 ctx->script_desc.ctx = ctx;
1829 hres = create_vbdisp(&ctx->script_desc, &ctx->script_obj);
1830 if(FAILED(hres))
1831 return hres;
1833 return init_err(ctx);