COM PropPut() patch - support for write-only properties

From: Date: Wed, 27 Sep 2000 13:45:20 +0000
Subject: COM PropPut() patch - support for write-only properties
Groups: php.dev 
Request: Send a blank email to php-dev+get-33755@lists.php.net to get a copy of this message
Hello developers, In on of our projects we use some COM component with a property that is available only for writing, i.e. has only propput method. With the PHP's PropPut() function we received an COM error. I looked into that and found that implementation puts a property and gets it to form a return value for PropPut(), which is unacceptable with write-only properties. So, the proposed patch fixes this problem. PropPut() now should return a value passed to it. I am not on the list, so if somebody will followup, please write to me directly, too. And here is the patch (I based it on 4.0.2 release, there may be updated version in CVS but http://cvs.php.net/ doesnt seem to be responding): diff -u COM.c COM.c.new --- COM.c Wed Sep 27 13:06:00 2000 +++ COM.c.new Wed Sep 27 12:24:57 2000 @@ -667,7 +667,6 @@ HRESULT hr; OLECHAR *propname; char *error_message; - VARIANTARG var_result; DISPPARAMS dispparams; VARIANTARG new_value; DISPID mydispid = DISPID_PROPERTYPUT; @@ -698,13 +697,6 @@ LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, 0); - dispparams.cArgs = 0; - dispparams.cNamedArgs = 0; - - hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL, - LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, - &dispparams, &var_result, NULL, 0); - if (FAILED(hr)) { error_message = php_COM_error_message(hr); php_error(E_WARNING,"PropPut() failed: %s\n", error_message); @@ -713,7 +705,7 @@ RETURN_FALSE; } - php_variant_to_pval(&var_result, return_value, 0); + php_variant_to_pval(&new_value, return_value, 0); efree(propname); }

« previous php.dev (#33755) next »