1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1997-2012 The PHP Group |
6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.01 of the PHP license, |
8: | that is bundled with this package in the file LICENSE, and is |
9: | available through the world-wide-web at the following url: |
10: | http://www.php.net/license/3_01.txt |
11: | If you did not receive a copy of the PHP license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@php.net so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Author: Wez Furlong <wez@thebrainroom.com> |
16: +----------------------------------------------------------------------+
17: */
18:
19: /* $Id: php_com_dotnet_internal.h,v 1.1.1.1 2012/02/21 23:47:53 misho Exp $ */
20:
21: #ifndef PHP_COM_DOTNET_INTERNAL_H
22: #define PHP_COM_DOTNET_INTERNAL_H
23:
24: #define _WIN32_DCOM
25: #define COBJMACROS
26: #include <ocidl.h>
27: #include <oleauto.h>
28: #include <unknwn.h>
29: #include <dispex.h>
30: #include "win32/winutil.h"
31:
32: /* brain-death in winutil.h defines the macro to hide the useful function... */
33: #undef php_win_err
34:
35: typedef struct _php_com_dotnet_object {
36: zend_object zo;
37:
38: VARIANT v;
39: int modified;
40:
41: ITypeInfo *typeinfo;
42: long code_page;
43:
44: zend_class_entry *ce;
45:
46: /* associated event sink */
47: IDispatch *sink_dispatch;
48: GUID sink_id;
49: DWORD sink_cookie;
50:
51: /* cache for method signatures */
52: HashTable *method_cache;
53: /* cache for name -> DISPID */
54: HashTable *id_of_name_cache;
55: } php_com_dotnet_object;
56:
57: static inline int php_com_is_valid_object(zval *zv TSRMLS_DC)
58: {
59: zend_class_entry *ce = Z_OBJCE_P(zv);
60: return strcmp("com", ce->name) == 0 ||
61: strcmp("dotnet", ce->name) == 0 ||
62: strcmp("variant", ce->name) == 0;
63: }
64:
65: #define CDNO_FETCH(zv) (php_com_dotnet_object*)zend_object_store_get_object(zv TSRMLS_CC)
66: #define CDNO_FETCH_VERIFY(obj, zv) do { \
67: if (!php_com_is_valid_object(zv TSRMLS_CC)) { \
68: php_com_throw_exception(E_UNEXPECTED, "expected a variant object" TSRMLS_CC); \
69: return; \
70: } \
71: obj = (php_com_dotnet_object*)zend_object_store_get_object(zv TSRMLS_CC); \
72: } while(0)
73:
74: /* com_extension.c */
75: TsHashTable php_com_typelibraries;
76: zend_class_entry *php_com_variant_class_entry, *php_com_exception_class_entry, *php_com_saproxy_class_entry;
77:
78: /* com_handlers.c */
79: zend_object_value php_com_object_new(zend_class_entry *ce TSRMLS_DC);
80: void php_com_object_clone(void *object, void **clone_ptr TSRMLS_DC);
81: void php_com_object_free_storage(void *object TSRMLS_DC);
82: zend_object_handlers php_com_object_handlers;
83: void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable TSRMLS_DC);
84:
85: /* com_saproxy.c */
86: zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
87: int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index TSRMLS_DC);
88:
89: /* com_olechar.c */
90: PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring,
91: uint *string_len, int codepage TSRMLS_DC);
92: PHPAPI OLECHAR *php_com_string_to_olestring(char *string,
93: uint string_len, int codepage TSRMLS_DC);
94:
95:
96: /* com_com.c */
97: PHP_FUNCTION(com_create_instance);
98: PHP_FUNCTION(com_event_sink);
99: PHP_FUNCTION(com_create_guid);
100: PHP_FUNCTION(com_print_typeinfo);
101: PHP_FUNCTION(com_message_pump);
102: PHP_FUNCTION(com_load_typelib);
103: PHP_FUNCTION(com_get_active_object);
104:
105: HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
106: WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent, int allow_noarg TSRMLS_DC);
107: HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
108: int namelen, DISPID *dispid TSRMLS_DC);
109: int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
110: WORD flags, VARIANT *v, int nargs, zval **args, int silent, int allow_noarg TSRMLS_DC);
111: int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
112: WORD flags, VARIANT *v, int nargs, zval **args, int allow_noarg TSRMLS_DC);
113: int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
114: WORD flags, VARIANT *v, int nargs, zval ***args TSRMLS_DC);
115:
116: /* com_wrapper.c */
117: int php_com_wrapper_minit(INIT_FUNC_ARGS);
118: PHPAPI IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC);
119: PHPAPI IDispatch *php_com_wrapper_export(zval *val TSRMLS_DC);
120:
121: /* com_persist.c */
122: int php_com_persist_minit(INIT_FUNC_ARGS);
123:
124: /* com_variant.c */
125: PHP_FUNCTION(com_variant_create_instance);
126: PHP_FUNCTION(variant_set);
127: PHP_FUNCTION(variant_add);
128: PHP_FUNCTION(variant_cat);
129: PHP_FUNCTION(variant_sub);
130: PHP_FUNCTION(variant_mul);
131: PHP_FUNCTION(variant_and);
132: PHP_FUNCTION(variant_div);
133: PHP_FUNCTION(variant_eqv);
134: PHP_FUNCTION(variant_idiv);
135: PHP_FUNCTION(variant_imp);
136: PHP_FUNCTION(variant_mod);
137: PHP_FUNCTION(variant_or);
138: PHP_FUNCTION(variant_pow);
139: PHP_FUNCTION(variant_xor);
140: PHP_FUNCTION(variant_abs);
141: PHP_FUNCTION(variant_fix);
142: PHP_FUNCTION(variant_int);
143: PHP_FUNCTION(variant_neg);
144: PHP_FUNCTION(variant_not);
145: PHP_FUNCTION(variant_round);
146: PHP_FUNCTION(variant_cmp);
147: PHP_FUNCTION(variant_date_to_timestamp);
148: PHP_FUNCTION(variant_date_from_timestamp);
149: PHP_FUNCTION(variant_get_type);
150: PHP_FUNCTION(variant_set_type);
151: PHP_FUNCTION(variant_cast);
152:
153: PHPAPI void php_com_variant_from_zval_with_type(VARIANT *v, zval *z, VARTYPE type, int codepage TSRMLS_DC);
154: PHPAPI void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC);
155: PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC);
156: PHPAPI int php_com_copy_variant(VARIANT *dst, VARIANT *src TSRMLS_DC);
157:
158: /* com_dotnet.c */
159: PHP_FUNCTION(com_dotnet_create_instance);
160: void php_com_dotnet_rshutdown(TSRMLS_D);
161: void php_com_dotnet_mshutdown(TSRMLS_D);
162:
163: /* com_misc.c */
164: void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC);
165: PHPAPI void php_com_wrap_dispatch(zval *z, IDispatch *disp,
166: int codepage TSRMLS_DC);
167: PHPAPI void php_com_wrap_variant(zval *z, VARIANT *v,
168: int codepage TSRMLS_DC);
169: PHPAPI int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1 TSRMLS_DC);
170:
171: /* com_typeinfo.c */
172: PHPAPI ITypeLib *php_com_load_typelib_via_cache(char *search_string,
173: int codepage, int *cached TSRMLS_DC);
174: PHPAPI ITypeLib *php_com_load_typelib(char *search_string, int codepage TSRMLS_DC);
175: PHPAPI int php_com_import_typelib(ITypeLib *TL, int mode,
176: int codepage TSRMLS_DC);
177: void php_com_typelibrary_dtor(void *pDest);
178: ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink TSRMLS_DC);
179: int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage TSRMLS_DC);
180:
181: /* com_iterator.c */
182: zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
183:
184:
185: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>