diff options
author | Wez Furlong <wez@php.net> | 2003-02-18 09:46:19 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-02-18 09:46:19 +0000 |
commit | aad491817c36a3d4e189415d0f764bcc374817c5 (patch) | |
tree | 961b0a95a031f88953ab96bb2dbdc9f0f33b27dd /ext/rpc | |
parent | e52aac940f0c657b4f5d1cddaf7c14f81c1d4b67 (diff) | |
download | php-git-aad491817c36a3d4e189415d0f764bcc374817c5.tar.gz |
Implement com_create_guid().
Add a special case for RETVAL_VARIANT when a variant is of type VT_DISPATCH but has a NULL dispatch pointer.
This kind of variant is returned by the WindowsInstaller automation interface.
Diffstat (limited to 'ext/rpc')
-rw-r--r-- | ext/rpc/com/com.c | 23 | ||||
-rw-r--r-- | ext/rpc/com/variant.h | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/ext/rpc/com/com.c b/ext/rpc/com/com.c index 47efe7231f..9a8e40587b 100644 --- a/ext/rpc/com/com.c +++ b/ext/rpc/com/com.c @@ -34,6 +34,7 @@ static ZEND_FUNCTION(com_indexed_prop_set); +static ZEND_FUNCTION(com_create_guid); /* protos */ static int com_hash(rpc_string, rpc_string *, void *, int, char *, int); @@ -96,6 +97,7 @@ RPC_FUNCTION_ENTRY_BEGIN(com) ZEND_FE(com_load_typelib, NULL) ZEND_FE(com_print_typeinfo, NULL) ZEND_FE(com_indexed_prop_set, NULL) + ZEND_FE(com_create_guid, NULL) RPC_FUNCTION_ENTRY_END() zend_module_entry com_module_entry = { @@ -830,6 +832,27 @@ static int com_get_properties(HashTable **properties, void *data) /* custom functions */ +static ZEND_FUNCTION(com_create_guid) +{ + GUID retval; + OLECHAR *guid_string; + + if (ZEND_NUM_ARGS() != 0) { + ZEND_WRONG_PARAM_COUNT(); + } + + if (CoCreateGuid(&retval) && StringFromCLSID(&retval, &guid_string)) { + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = php_OLECHAR_to_char(guid_string, &Z_STRLEN_P(return_value), CP_ACP, 0); + + CoTaskMemFree(guid_string); + } else { + RETURN_FALSE; + } +} + + + static ZEND_FUNCTION(com_indexed_prop_set) { zval *object; diff --git a/ext/rpc/com/variant.h b/ext/rpc/com/variant.h index 8d7a9bc6d6..e8c3539572 100644 --- a/ext/rpc/com/variant.h +++ b/ext/rpc/com/variant.h @@ -32,6 +32,9 @@ efree((v)); #define ZVAL_VARIANT(z, v, cp) \ + if (V_VT(v) == VT_DISPATCH && V_DISPATCH(v) == NULL) { \ + V_VT(v) = VT_NULL; \ + } \ if (V_VT(v) == VT_DISPATCH) { \ comval *obj; \ ALLOC_COM(obj); \ |