cvs: php-src /ext/com_dotnet com_dotnet.c
| From: | Stanislav Malyshev | Date: | Wed, 21 Feb 2007 01:21:24 +0000 |
| Subject: | cvs: php-src /ext/com_dotnet com_dotnet.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-43165@lists.php.net to get a copy of this message | ||
stas Wed Feb 21 01:21:24 2007 UTC
Modified files:
/php-src/ext/com_dotnet com_dotnet.c
Log:
MF5.2: CreateInstance requires BSTR (should fix #33188)
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_dotnet.c?r1=1.17&r2=1.18&diff_format=u
Index: php-src/ext/com_dotnet/com_dotnet.c
diff -u php-src/ext/com_dotnet/com_dotnet.c:1.17 php-src/ext/com_dotnet/com_dotnet.c:1.18
--- php-src/ext/com_dotnet/com_dotnet.c:1.17 Mon Jan 1 09:29:21 2007
+++ php-src/ext/com_dotnet/com_dotnet.c Wed Feb 21 01:21:24 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_dotnet.c,v 1.17 2007/01/01 09:29:21 sebastian Exp $ */
+/* $Id: com_dotnet.c,v 1.18 2007/02/21 01:21:24 stas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -188,6 +188,7 @@
int assembly_name_len, datatype_name_len;
struct dotnet_runtime_stuff *stuff;
OLECHAR *oleassembly, *oletype;
+ BSTR oleassembly_sys, oletype_sys;
HRESULT hr;
int ret = FAILURE;
char *where = "";
@@ -223,10 +224,14 @@
oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page
TSRMLS_CC);
oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page
TSRMLS_CC);
+ oletype_sys = SysAllocString(oletype);
+ oleassembly_sys = SysAllocString(oleassembly);
where = "CreateInstance";
- hr = stuff->dotnet_domain->lpVtbl->CreateInstance(stuff->dotnet_domain, oleassembly,
oletype, &unk);
+ hr = stuff->dotnet_domain->lpVtbl->CreateInstance(stuff->dotnet_domain,
oleassembly_sys, oletype_sys, &unk);
efree(oletype);
efree(oleassembly);
+ SysFreeString(oletype_sys);
+ SysFreeString(oleassembly_sys);
if (SUCCEEDED(hr)) {
VARIANT unwrapped;
@@ -275,8 +280,9 @@
char buf[1024];
char *err = php_win_err(hr);
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where,
hr, err);
- if (err)
+ if (err && err[0]) {
LocalFree(err);
+ }
php_com_throw_exception(hr, buf TSRMLS_CC);
ZVAL_NULL(object);
return;