xref: /PHP-7.2/ext/com_dotnet/com_extension.c (revision 115ee49b)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 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$ */
20 
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include <intsafe.h>
26 
27 #include "php.h"
28 #include "php_ini.h"
29 #include "ext/standard/info.h"
30 #include "php_com_dotnet.h"
31 #include "php_com_dotnet_internal.h"
32 #include "Zend/zend_exceptions.h"
33 #include "Zend/zend_interfaces.h"
34 
35 ZEND_DECLARE_MODULE_GLOBALS(com_dotnet)
36 static PHP_GINIT_FUNCTION(com_dotnet);
37 
38 TsHashTable php_com_typelibraries;
39 
40 zend_class_entry
41 	*php_com_variant_class_entry,
42    	*php_com_exception_class_entry,
43 	*php_com_saproxy_class_entry;
44 
45 /* {{{ arginfo */
46 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_set, 0, 0, 2)
47 	ZEND_ARG_INFO(0, variant)
48 	ZEND_ARG_INFO(0, value)
49 ZEND_END_ARG_INFO()
50 
51 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_add, 0, 0, 2)
52 	ZEND_ARG_INFO(0, left)
53 	ZEND_ARG_INFO(0, right)
54 ZEND_END_ARG_INFO()
55 
56 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cat, 0, 0, 2)
57 	ZEND_ARG_INFO(0, left)
58 	ZEND_ARG_INFO(0, right)
59 ZEND_END_ARG_INFO()
60 
61 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_sub, 0, 0, 2)
62 	ZEND_ARG_INFO(0, left)
63 	ZEND_ARG_INFO(0, right)
64 ZEND_END_ARG_INFO()
65 
66 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_mul, 0, 0, 2)
67 	ZEND_ARG_INFO(0, left)
68 	ZEND_ARG_INFO(0, right)
69 ZEND_END_ARG_INFO()
70 
71 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_and, 0, 0, 2)
72 	ZEND_ARG_INFO(0, left)
73 	ZEND_ARG_INFO(0, right)
74 ZEND_END_ARG_INFO()
75 
76 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_div, 0, 0, 2)
77 	ZEND_ARG_INFO(0, left)
78 	ZEND_ARG_INFO(0, right)
79 ZEND_END_ARG_INFO()
80 
81 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_eqv, 0, 0, 2)
82 	ZEND_ARG_INFO(0, left)
83 	ZEND_ARG_INFO(0, right)
84 ZEND_END_ARG_INFO()
85 
86 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_idiv, 0, 0, 2)
87 	ZEND_ARG_INFO(0, left)
88 	ZEND_ARG_INFO(0, right)
89 ZEND_END_ARG_INFO()
90 
91 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_imp, 0, 0, 2)
92 	ZEND_ARG_INFO(0, left)
93 	ZEND_ARG_INFO(0, right)
94 ZEND_END_ARG_INFO()
95 
96 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_mod, 0, 0, 2)
97 	ZEND_ARG_INFO(0, left)
98 	ZEND_ARG_INFO(0, right)
99 ZEND_END_ARG_INFO()
100 
101 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_or, 0, 0, 2)
102 	ZEND_ARG_INFO(0, left)
103 	ZEND_ARG_INFO(0, right)
104 ZEND_END_ARG_INFO()
105 
106 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_pow, 0, 0, 2)
107 	ZEND_ARG_INFO(0, left)
108 	ZEND_ARG_INFO(0, right)
109 ZEND_END_ARG_INFO()
110 
111 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_xor, 0, 0, 2)
112 	ZEND_ARG_INFO(0, left)
113 	ZEND_ARG_INFO(0, right)
114 ZEND_END_ARG_INFO()
115 
116 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_abs, 0, 0, 1)
117 	ZEND_ARG_INFO(0, left)
118 ZEND_END_ARG_INFO()
119 
120 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_fix, 0, 0, 1)
121 	ZEND_ARG_INFO(0, left)
122 ZEND_END_ARG_INFO()
123 
124 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_int, 0, 0, 1)
125 	ZEND_ARG_INFO(0, left)
126 ZEND_END_ARG_INFO()
127 
128 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_neg, 0, 0, 1)
129 	ZEND_ARG_INFO(0, left)
130 ZEND_END_ARG_INFO()
131 
132 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_not, 0, 0, 1)
133 	ZEND_ARG_INFO(0, left)
134 ZEND_END_ARG_INFO()
135 
136 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_round, 0, 0, 2)
137 	ZEND_ARG_INFO(0, left)
138 	ZEND_ARG_INFO(0, decimals)
139 ZEND_END_ARG_INFO()
140 
141 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cmp, 0, 0, 2)
142 	ZEND_ARG_INFO(0, left)
143 	ZEND_ARG_INFO(0, right)
144 	ZEND_ARG_INFO(0, lcid)
145 	ZEND_ARG_INFO(0, flags)
146 ZEND_END_ARG_INFO()
147 
148 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_to_timestamp, 0, 0, 1)
149 	ZEND_ARG_INFO(0, variant)
150 ZEND_END_ARG_INFO()
151 
152 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_from_timestamp, 0, 0, 1)
153 	ZEND_ARG_INFO(0, timestamp)
154 ZEND_END_ARG_INFO()
155 
156 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_get_type, 0, 0, 1)
157 	ZEND_ARG_INFO(0, variant)
158 ZEND_END_ARG_INFO()
159 
160 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_set_type, 0, 0, 2)
161 	ZEND_ARG_INFO(0, variant)
162 	ZEND_ARG_INFO(0, type)
163 ZEND_END_ARG_INFO()
164 
165 ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cast, 0, 0, 2)
166 	ZEND_ARG_INFO(0, variant)
167 	ZEND_ARG_INFO(0, type)
168 ZEND_END_ARG_INFO()
169 
170 ZEND_BEGIN_ARG_INFO_EX(arginfo_com_get_active_object, 0, 0, 1)
171 	ZEND_ARG_INFO(0, progid)
172 	ZEND_ARG_INFO(0, code_page)
173 ZEND_END_ARG_INFO()
174 
175 ZEND_BEGIN_ARG_INFO(arginfo_com_create_guid, 0)
176 ZEND_END_ARG_INFO()
177 
178 ZEND_BEGIN_ARG_INFO_EX(arginfo_com_event_sink, 0, 0, 2)
179 	ZEND_ARG_INFO(0, comobject)
180 	ZEND_ARG_INFO(0, sinkobject)
181 	ZEND_ARG_INFO(0, sinkinterface)
182 ZEND_END_ARG_INFO()
183 
184 ZEND_BEGIN_ARG_INFO_EX(arginfo_com_print_typeinfo, 0, 0, 1)
185 	ZEND_ARG_INFO(0, comobject)
186 	ZEND_ARG_INFO(0, dispinterface)
187 	ZEND_ARG_INFO(0, wantsink)
188 ZEND_END_ARG_INFO()
189 
190 ZEND_BEGIN_ARG_INFO_EX(arginfo_com_message_pump, 0, 0, 0)
191 	ZEND_ARG_INFO(0, timeoutms)
192 ZEND_END_ARG_INFO()
193 
194 ZEND_BEGIN_ARG_INFO_EX(arginfo_com_load_typelib, 0, 0, 1)
195 	ZEND_ARG_INFO(0, typelib_name)
196 	ZEND_ARG_INFO(0, case_insensitive)
197 ZEND_END_ARG_INFO()
198 /* }}} */
199 
200 const zend_function_entry com_dotnet_functions[] = {
201 	PHP_FE(variant_set, arginfo_variant_set)
202 	PHP_FE(variant_add, arginfo_variant_add)
203 	PHP_FE(variant_cat, arginfo_variant_cat)
204 	PHP_FE(variant_sub, arginfo_variant_sub)
205 	PHP_FE(variant_mul, arginfo_variant_mul)
206 	PHP_FE(variant_and, arginfo_variant_and)
207 	PHP_FE(variant_div, arginfo_variant_div)
208 	PHP_FE(variant_eqv, arginfo_variant_eqv)
209 	PHP_FE(variant_idiv, arginfo_variant_idiv)
210 	PHP_FE(variant_imp, arginfo_variant_imp)
211 	PHP_FE(variant_mod, arginfo_variant_mod)
212 	PHP_FE(variant_or, arginfo_variant_or)
213 	PHP_FE(variant_pow, arginfo_variant_pow)
214 	PHP_FE(variant_xor, arginfo_variant_xor)
215 	PHP_FE(variant_abs, arginfo_variant_abs)
216 	PHP_FE(variant_fix, arginfo_variant_fix)
217 	PHP_FE(variant_int, arginfo_variant_int)
218 	PHP_FE(variant_neg, arginfo_variant_neg)
219 	PHP_FE(variant_not, arginfo_variant_not)
220 	PHP_FE(variant_round, arginfo_variant_round)
221 	PHP_FE(variant_cmp, arginfo_variant_cmp)
222 	PHP_FE(variant_date_to_timestamp, arginfo_variant_date_to_timestamp)
223 	PHP_FE(variant_date_from_timestamp, arginfo_variant_date_from_timestamp)
224 	PHP_FE(variant_get_type, arginfo_variant_get_type)
225 	PHP_FE(variant_set_type, arginfo_variant_set_type)
226 	PHP_FE(variant_cast, arginfo_variant_cast)
227 	/* com_com.c */
228 	PHP_FE(com_create_guid, arginfo_com_create_guid)
229 	PHP_FE(com_event_sink, arginfo_com_event_sink)
230 	PHP_FE(com_print_typeinfo, arginfo_com_print_typeinfo)
231 	PHP_FE(com_message_pump, arginfo_com_message_pump)
232 	PHP_FE(com_load_typelib, arginfo_com_load_typelib)
233 	PHP_FE(com_get_active_object, arginfo_com_get_active_object)
234 	PHP_FE_END
235 };
236 
237 /* {{{ com_dotnet_module_entry
238  */
239 zend_module_entry com_dotnet_module_entry = {
240 	STANDARD_MODULE_HEADER,
241 	"com_dotnet",
242 	com_dotnet_functions,
243 	PHP_MINIT(com_dotnet),
244 	PHP_MSHUTDOWN(com_dotnet),
245 	PHP_RINIT(com_dotnet),
246 	PHP_RSHUTDOWN(com_dotnet),
247 	PHP_MINFO(com_dotnet),
248 	PHP_COM_DOTNET_VERSION,
249 	PHP_MODULE_GLOBALS(com_dotnet),
250 	PHP_GINIT(com_dotnet),
251 	NULL,
252 	NULL,
253 	STANDARD_MODULE_PROPERTIES_EX
254 };
255 /* }}} */
256 
257 #ifdef COMPILE_DL_COM_DOTNET
258 #ifdef ZTS
259 ZEND_TSRMLS_CACHE_DEFINE()
260 #endif
ZEND_GET_MODULE(com_dotnet)261 ZEND_GET_MODULE(com_dotnet)
262 #endif
263 
264 /* {{{ PHP_INI
265  */
266 
267 /* com.typelib_file is the path to a file containing a
268  * list of typelibraries to register *persistently*.
269  * lines starting with ; are comments
270  * append #cis to end of typelib name to cause its constants
271  * to be loaded case insensitively */
272 static PHP_INI_MH(OnTypeLibFileUpdate)
273 {
274 	FILE *typelib_file;
275 	char *typelib_name_buffer;
276 	char *strtok_buf = NULL;
277 	int cached;
278 
279 	if (NULL == new_value || !new_value->val[0] || (typelib_file = VCWD_FOPEN(new_value->val, "r"))==NULL) {
280 		return FAILURE;
281 	}
282 
283 	typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
284 
285 	while (fgets(typelib_name_buffer, 1024, typelib_file)) {
286 		ITypeLib *pTL;
287 		char *typelib_name;
288 		char *modifier, *ptr;
289 		int mode = CONST_CS | CONST_PERSISTENT;	/* CONST_PERSISTENT is ok here */
290 
291 		if (typelib_name_buffer[0]==';') {
292 			continue;
293 		}
294 		typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
295 		if (typelib_name == NULL) {
296 			continue;
297 		}
298 		typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
299 		modifier = php_strtok_r(NULL, "#", &strtok_buf);
300 		if (modifier != NULL) {
301 			if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
302 				mode &= ~CONST_CS;
303 			}
304 		}
305 
306 		/* Remove leading/training white spaces on search_string */
307 		while (isspace(*typelib_name)) {/* Ends on '\0' in worst case */
308 			typelib_name ++;
309 		}
310 		ptr = typelib_name + strlen(typelib_name) - 1;
311 		while ((ptr != typelib_name) && isspace(*ptr)) {
312 			*ptr = '\0';
313 			ptr--;
314 		}
315 
316 		if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page), &cached)) != NULL) {
317 			if (!cached) {
318 				php_com_import_typelib(pTL, mode, COMG(code_page));
319 			}
320 			ITypeLib_Release(pTL);
321 		}
322 	}
323 
324 	efree(typelib_name_buffer);
325 	fclose(typelib_file);
326 
327 	return SUCCESS;
328 }
329 
330 PHP_INI_BEGIN()
331     STD_PHP_INI_ENTRY("com.allow_dcom",				"0", PHP_INI_SYSTEM, OnUpdateBool, allow_dcom, zend_com_dotnet_globals, com_dotnet_globals)
332     STD_PHP_INI_ENTRY("com.autoregister_verbose",	"0", PHP_INI_ALL, OnUpdateBool, autoreg_verbose, zend_com_dotnet_globals, com_dotnet_globals)
333     STD_PHP_INI_ENTRY("com.autoregister_typelib",	"0", PHP_INI_ALL, OnUpdateBool, autoreg_on, zend_com_dotnet_globals, com_dotnet_globals)
334     STD_PHP_INI_ENTRY("com.autoregister_casesensitive",	"1", PHP_INI_ALL, OnUpdateBool, autoreg_case_sensitive, zend_com_dotnet_globals, com_dotnet_globals)
335 	STD_PHP_INI_ENTRY("com.code_page", "", PHP_INI_ALL, OnUpdateLong, code_page, zend_com_dotnet_globals, com_dotnet_globals)
336 	PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypeLibFileUpdate)
PHP_INI_END()337 PHP_INI_END()
338 /* }}} */
339 
340 /* {{{ PHP_GINIT_FUNCTION
341  */
342 static PHP_GINIT_FUNCTION(com_dotnet)
343 {
344 #if defined(COMPILE_DL_COM_DOTNET) && defined(ZTS)
345 	ZEND_TSRMLS_CACHE_UPDATE();
346 #endif
347 	memset(com_dotnet_globals, 0, sizeof(*com_dotnet_globals));
348 	com_dotnet_globals->code_page = CP_ACP;
349 }
350 /* }}} */
351 
352 /* {{{ PHP_MINIT_FUNCTION
353  */
PHP_MINIT_FUNCTION(com_dotnet)354 PHP_MINIT_FUNCTION(com_dotnet)
355 {
356 	zend_class_entry ce, *tmp;
357 
358 	zend_hash_init(&com_dotnet_object_properties, 0, NULL, NULL, 0);
359 
360 	php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU);
361 	php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);
362 
363 	INIT_CLASS_ENTRY(ce, "com_exception", NULL);
364 	php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception);
365 	php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
366 /*	php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
367 
368 	INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
369 	php_com_saproxy_class_entry = zend_register_internal_class(&ce);
370 	php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
371 /*	php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
372 	php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;
373 
374 	INIT_CLASS_ENTRY(ce, "variant", NULL);
375 	ce.create_object = php_com_object_new;
376 	php_com_variant_class_entry = zend_register_internal_class(&ce);
377 	php_com_variant_class_entry->get_iterator = php_com_iter_get;
378 	php_com_variant_class_entry->serialize = zend_class_serialize_deny;
379 	php_com_variant_class_entry->unserialize = zend_class_unserialize_deny;
380 
381 	INIT_CLASS_ENTRY(ce, "com", NULL);
382 	ce.create_object = php_com_object_new;
383 	tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
384 	tmp->get_iterator = php_com_iter_get;
385 	tmp->serialize = zend_class_serialize_deny;
386 	tmp->unserialize = zend_class_unserialize_deny;
387 
388 	zend_ts_hash_init(&php_com_typelibraries, 0, NULL, php_com_typelibrary_dtor, 1);
389 
390 #if HAVE_MSCOREE_H
391 	INIT_CLASS_ENTRY(ce, "dotnet", NULL);
392 	ce.create_object = php_com_object_new;
393 	tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
394 	tmp->get_iterator = php_com_iter_get;
395 	tmp->serialize = zend_class_serialize_deny;
396 	tmp->unserialize = zend_class_unserialize_deny;
397 #endif
398 
399 	REGISTER_INI_ENTRIES();
400 
401 #define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
402 
403 #define COM_ERR_CONST(x) { \
404 	zend_long __tmp; \
405 	ULongToIntPtr(x, &__tmp); \
406 	REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
407 }
408 
409 	COM_CONST(CLSCTX_INPROC_SERVER);
410 	COM_CONST(CLSCTX_INPROC_HANDLER);
411 	COM_CONST(CLSCTX_LOCAL_SERVER);
412 	COM_CONST(CLSCTX_REMOTE_SERVER);
413 	COM_CONST(CLSCTX_SERVER);
414 	COM_CONST(CLSCTX_ALL);
415 
416 #if 0
417 	COM_CONST(DISPATCH_METHOD);
418 	COM_CONST(DISPATCH_PROPERTYGET);
419 	COM_CONST(DISPATCH_PROPERTYPUT);
420 #endif
421 
422 	COM_CONST(VT_NULL);
423 	COM_CONST(VT_EMPTY);
424 	COM_CONST(VT_UI1);
425 	COM_CONST(VT_I1);
426 	COM_CONST(VT_UI2);
427 	COM_CONST(VT_I2);
428 	COM_CONST(VT_UI4);
429 	COM_CONST(VT_I4);
430 	COM_CONST(VT_R4);
431 	COM_CONST(VT_R8);
432 	COM_CONST(VT_BOOL);
433 	COM_CONST(VT_ERROR);
434 	COM_CONST(VT_CY);
435 	COM_CONST(VT_DATE);
436 	COM_CONST(VT_BSTR);
437 	COM_CONST(VT_DECIMAL);
438 	COM_CONST(VT_UNKNOWN);
439 	COM_CONST(VT_DISPATCH);
440 	COM_CONST(VT_VARIANT);
441 	COM_CONST(VT_INT);
442 	COM_CONST(VT_UINT);
443 	COM_CONST(VT_ARRAY);
444 	COM_CONST(VT_BYREF);
445 
446 	COM_CONST(CP_ACP);
447 	COM_CONST(CP_MACCP);
448 	COM_CONST(CP_OEMCP);
449 	COM_CONST(CP_UTF7);
450 	COM_CONST(CP_UTF8);
451 	COM_CONST(CP_SYMBOL);
452 	COM_CONST(CP_THREAD_ACP);
453 
454 	COM_CONST(VARCMP_LT);
455 	COM_CONST(VARCMP_EQ);
456 	COM_CONST(VARCMP_GT);
457 	COM_CONST(VARCMP_NULL);
458 
459 	COM_CONST(NORM_IGNORECASE);
460 	COM_CONST(NORM_IGNORENONSPACE);
461 	COM_CONST(NORM_IGNORESYMBOLS);
462 	COM_CONST(NORM_IGNOREWIDTH);
463 	COM_CONST(NORM_IGNOREKANATYPE);
464 #ifdef NORM_IGNOREKASHIDA
465 	COM_CONST(NORM_IGNOREKASHIDA);
466 #endif
467 	COM_ERR_CONST(DISP_E_DIVBYZERO);
468 	COM_ERR_CONST(DISP_E_OVERFLOW);
469 	COM_ERR_CONST(DISP_E_BADINDEX);
470 	COM_ERR_CONST(MK_E_UNAVAILABLE);
471 
472 #if SIZEOF_ZEND_LONG == 8
473 	COM_CONST(VT_UI8);
474 	COM_CONST(VT_I8);
475 #endif
476 	return SUCCESS;
477 }
478 /* }}} */
479 
480 /* {{{ PHP_MSHUTDOWN_FUNCTION
481  */
PHP_MSHUTDOWN_FUNCTION(com_dotnet)482 PHP_MSHUTDOWN_FUNCTION(com_dotnet)
483 {
484 	UNREGISTER_INI_ENTRIES();
485 #if HAVE_MSCOREE_H
486 	if (COMG(dotnet_runtime_stuff)) {
487 		php_com_dotnet_mshutdown();
488 	}
489 #endif
490 
491 	zend_ts_hash_destroy(&php_com_typelibraries);
492 	return SUCCESS;
493 }
494 /* }}} */
495 
496 /* {{{ PHP_RINIT_FUNCTION
497  */
PHP_RINIT_FUNCTION(com_dotnet)498 PHP_RINIT_FUNCTION(com_dotnet)
499 {
500 	COMG(rshutdown_started) = 0;
501 	return SUCCESS;
502 }
503 /* }}} */
504 
505 /* {{{ PHP_RSHUTDOWN_FUNCTION
506  */
PHP_RSHUTDOWN_FUNCTION(com_dotnet)507 PHP_RSHUTDOWN_FUNCTION(com_dotnet)
508 {
509 #if HAVE_MSCOREE_H
510 	if (COMG(dotnet_runtime_stuff)) {
511 		php_com_dotnet_rshutdown();
512 	}
513 #endif
514 	COMG(rshutdown_started) = 1;
515 	return SUCCESS;
516 }
517 /* }}} */
518 
519 /* {{{ PHP_MINFO_FUNCTION
520  */
PHP_MINFO_FUNCTION(com_dotnet)521 PHP_MINFO_FUNCTION(com_dotnet)
522 {
523 	php_info_print_table_start();
524 
525 	php_info_print_table_header(2, "COM support", "enabled");
526 	php_info_print_table_header(2, "DCOM support", COMG(allow_dcom) ? "enabled" : "disabled");
527 
528 #if HAVE_MSCOREE_H
529 	php_info_print_table_header(2, ".Net support", "enabled");
530 #else
531 	php_info_print_table_header(2, ".Net support", "not present in this build");
532 #endif
533 
534 	php_info_print_table_end();
535 
536 	DISPLAY_INI_ENTRIES();
537 }
538 /* }}} */
539 
540 /*
541  * Local variables:
542  * tab-width: 4
543  * c-basic-offset: 4
544  * End:
545  * vim600: noet sw=4 ts=4 fdm=marker
546  * vim<600: noet sw=4 ts=4
547  */
548