diff options
-rw-r--r-- | ext/com/COM.c | 14 | ||||
-rw-r--r-- | ext/dotnet/dotnet.cpp | 5 | ||||
-rw-r--r-- | ext/rpc/com/com_wrapper.c | 14 | ||||
-rw-r--r-- | ext/rpc/dotnet/dotnet.cpp | 5 |
4 files changed, 16 insertions, 22 deletions
diff --git a/ext/com/COM.c b/ext/com/COM.c index d411026e10..1c046658fd 100644 --- a/ext/com/COM.c +++ b/ext/com/COM.c @@ -380,7 +380,7 @@ static PHP_INI_MH(OnTypelibFileChange) ITypeLib *pTL; char *typelib_name; char *modifier, *ptr; - int mode = CONST_CS | CONST_PERSISTENT; + int mode = CONST_CS | CONST_PERSISTENT; /* CONST_PERSISTENT is ok here */ if (typelib_name_buffer[0]==';') { continue; @@ -448,7 +448,7 @@ PHP_FUNCTION(com_load) comval *obj; char *error_message; char *clsid_str; - int mode = 0; /* CONST_PERSISTENT; */ + int mode = 0; ITypeLib *pTL; @@ -508,7 +508,7 @@ PHP_FUNCTION(com_load) IMoniker *pMoniker; ULONG ulEaten; - /* TODO: if (server_name) */ + /* @todo if (server_name) */ if (!server_name) { if (SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx))) { @@ -577,6 +577,7 @@ PHP_FUNCTION(com_load) if (INI_INT("com.autoregister_typelib")) { unsigned int idx; + /* @todo check if typlib isn't already loaded */ if (C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK) { php_COM_load_typelib(pTL, mode TSRMLS_CC); pTL->lpVtbl->Release(pTL); @@ -667,9 +668,10 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval ** return FAILURE; } } + /* return a single element if next() was called without count */ if ((arg_count == 0) && (count == 1)) { - long index[] = {1}; + long index[] = {0}; SafeArrayGetElement(pSA, index, var_result); SafeArrayDestroy(pSA); @@ -1085,7 +1087,7 @@ PHP_FUNCTION(com_load_typelib) { pval *arg_typelib, *arg_cis; ITypeLib *pTL; - int mode = CONST_CS; /* CONST_PERSISTENT|CONST_CS; */ + int mode = CONST_CS; switch (ZEND_NUM_ARGS()) { case 1: @@ -1651,7 +1653,6 @@ static void php_register_COM_class(TSRMLS_D) PHP_MINIT_FUNCTION(COM) { - CoInitialize(NULL); le_comval = zend_register_list_destructors_ex(php_comval_destructor, NULL, "COM", module_number); php_register_COM_class(TSRMLS_C); REGISTER_INI_ENTRIES(); @@ -1661,7 +1662,6 @@ PHP_MINIT_FUNCTION(COM) PHP_MSHUTDOWN_FUNCTION(COM) { - CoUninitialize(); UNREGISTER_INI_ENTRIES(); return SUCCESS; } diff --git a/ext/dotnet/dotnet.cpp b/ext/dotnet/dotnet.cpp index 7461dd2a17..24a7b26315 100644 --- a/ext/dotnet/dotnet.cpp +++ b/ext/dotnet/dotnet.cpp @@ -209,9 +209,7 @@ PHP_MINIT_FUNCTION(DOTNET) { HRESULT hr; - CoInitialize(0); - hr = dotnet_init(); - if (FAILED(hr)) { + if (FAILED(hr = dotnet_init())) { return hr; } @@ -223,7 +221,6 @@ PHP_MINIT_FUNCTION(DOTNET) PHP_MSHUTDOWN_FUNCTION(DOTNET) { dotnet_term(); - CoUninitialize(); return SUCCESS; } diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c index d411026e10..1c046658fd 100644 --- a/ext/rpc/com/com_wrapper.c +++ b/ext/rpc/com/com_wrapper.c @@ -380,7 +380,7 @@ static PHP_INI_MH(OnTypelibFileChange) ITypeLib *pTL; char *typelib_name; char *modifier, *ptr; - int mode = CONST_CS | CONST_PERSISTENT; + int mode = CONST_CS | CONST_PERSISTENT; /* CONST_PERSISTENT is ok here */ if (typelib_name_buffer[0]==';') { continue; @@ -448,7 +448,7 @@ PHP_FUNCTION(com_load) comval *obj; char *error_message; char *clsid_str; - int mode = 0; /* CONST_PERSISTENT; */ + int mode = 0; ITypeLib *pTL; @@ -508,7 +508,7 @@ PHP_FUNCTION(com_load) IMoniker *pMoniker; ULONG ulEaten; - /* TODO: if (server_name) */ + /* @todo if (server_name) */ if (!server_name) { if (SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx))) { @@ -577,6 +577,7 @@ PHP_FUNCTION(com_load) if (INI_INT("com.autoregister_typelib")) { unsigned int idx; + /* @todo check if typlib isn't already loaded */ if (C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK) { php_COM_load_typelib(pTL, mode TSRMLS_CC); pTL->lpVtbl->Release(pTL); @@ -667,9 +668,10 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval ** return FAILURE; } } + /* return a single element if next() was called without count */ if ((arg_count == 0) && (count == 1)) { - long index[] = {1}; + long index[] = {0}; SafeArrayGetElement(pSA, index, var_result); SafeArrayDestroy(pSA); @@ -1085,7 +1087,7 @@ PHP_FUNCTION(com_load_typelib) { pval *arg_typelib, *arg_cis; ITypeLib *pTL; - int mode = CONST_CS; /* CONST_PERSISTENT|CONST_CS; */ + int mode = CONST_CS; switch (ZEND_NUM_ARGS()) { case 1: @@ -1651,7 +1653,6 @@ static void php_register_COM_class(TSRMLS_D) PHP_MINIT_FUNCTION(COM) { - CoInitialize(NULL); le_comval = zend_register_list_destructors_ex(php_comval_destructor, NULL, "COM", module_number); php_register_COM_class(TSRMLS_C); REGISTER_INI_ENTRIES(); @@ -1661,7 +1662,6 @@ PHP_MINIT_FUNCTION(COM) PHP_MSHUTDOWN_FUNCTION(COM) { - CoUninitialize(); UNREGISTER_INI_ENTRIES(); return SUCCESS; } diff --git a/ext/rpc/dotnet/dotnet.cpp b/ext/rpc/dotnet/dotnet.cpp index 7461dd2a17..24a7b26315 100644 --- a/ext/rpc/dotnet/dotnet.cpp +++ b/ext/rpc/dotnet/dotnet.cpp @@ -209,9 +209,7 @@ PHP_MINIT_FUNCTION(DOTNET) { HRESULT hr; - CoInitialize(0); - hr = dotnet_init(); - if (FAILED(hr)) { + if (FAILED(hr = dotnet_init())) { return hr; } @@ -223,7 +221,6 @@ PHP_MINIT_FUNCTION(DOTNET) PHP_MSHUTDOWN_FUNCTION(DOTNET) { dotnet_term(); - CoUninitialize(); return SUCCESS; } |