From 59823eca66ff76a66baf4f0a903e01d6ef7c48e3 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 6 Dec 2003 17:31:40 +0000 Subject: com_create_guid() returns... --- ext/com_dotnet/com_com.c | 20 ++++++++++++++++++++ ext/com_dotnet/com_extension.c | 1 + ext/com_dotnet/php_com_dotnet.h | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 5484161712..9183a013a0 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -441,3 +441,23 @@ int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen, return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args TSRMLS_CC); } + +PHP_FUNCTION(com_create_guid) +{ + GUID retval; + OLECHAR *guid_string; + + if (ZEND_NUM_ARGS() != 0) { + ZEND_WRONG_PARAM_COUNT(); + } + + if (CoCreateGuid(&retval) == S_OK && StringFromCLSID(&retval, &guid_string) == S_OK) { + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = php_com_olestring_to_string(guid_string, &Z_STRLEN_P(return_value), CP_ACP, 0); + + CoTaskMemFree(guid_string); + } else { + RETURN_FALSE; + } +} + diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index ec155ead19..7ff7dbb0c4 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -60,6 +60,7 @@ function_entry com_dotnet_functions[] = { PHP_FE(variant_get_type, NULL) PHP_FE(variant_set_type, NULL) PHP_FE(variant_cast, NULL) + PHP_FE(com_create_guid, NULL) { NULL, NULL, NULL } }; diff --git a/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h index 5d29c52594..831c7ad3c0 100644 --- a/ext/com_dotnet/php_com_dotnet.h +++ b/ext/com_dotnet/php_com_dotnet.h @@ -40,7 +40,7 @@ PHP_RINIT_FUNCTION(com_dotnet); PHP_RSHUTDOWN_FUNCTION(com_dotnet); PHP_MINFO_FUNCTION(com_dotnet); -PHP_FUNCTION(confirm_com_dotnet_compiled); +PHP_FUNCTION(com_create_guid); ZEND_BEGIN_MODULE_GLOBALS(com_dotnet) zend_bool allow_dcom; -- cgit v1.2.1