Edit report at http://bugs.php.net/bug.php?id=25235&edit=1

 ID:                 25235
 Updated by:         [email protected]
 Reported by:        fgarcia at uef dot es
 Summary:            win32api problem in arguments
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   win32
 PHP Version:        4.3.3
 Block user comment: N
 Private report:     N

 New Comment:

w32api is in PECL nowadays.


Previous Comments:
------------------------------------------------------------------------
[2003-09-03 02:17:36] foxkill at gmx dot de

The problem is within the WIN32API_CLASS_FUNCTION(win32,
invokefunction). It declares the variable func_argument as zval**
func_arguments = NULL and later on it calls
zend_get_parameters_array_ex(argc, &func_arguments). If there are more
than 2 arguments this call overwrites the stack and thereby the variable
w32api_return_buffer

(and some others). w32api_return_buffer is now not null in the following
call to php_w32api_do_dynamic_call and the stack calculation in this
function goes wrong.

In my opinion the variable func_arguments should be allocated
dynamically according to number of actual parameters.

------------------------------------------------------------------------
[2003-08-25 08:24:04] fgarcia at uef dot es

Description:
------------
I need to use a dll external function.

My code in php 4.2.3 was:

------------------

   w32api_register_function("MYLIB.DLL", 

                                                 "MYFUNC",

                                                 "long");



   $attr1="string1";

   $attr2="string2";

   $attr3="string3";

   $attr4="string4";

   $attr5="string5";

   $attr6=long2Str(2);// long



   $iError=MYFUNC($attr1,$attr2,$attr3,$attr4,$attr5,$attr6);

   $iRtn=str2Long($siRtn);

--------------

The code works.



Now (php 4.3.2) my  code is:

--------------

$api = new win32();

$api->RegisterFunction("int MYFUNC(string attr1, string attr2, string
attr3, string attr4, string attr5, int &attr6) From MYLIB.DLL");



   $attr1="string1";

   $attr2="string2";

   $attr3="string3";

   $attr4="string4";

   $attr5="string5";

   $attr6=2;// long



   $iError=$api->MYFUNC($attr1,$attr2,$attr3,$attr4,$attr5,$attr6);

-------------------



and php crashes.



I've traced the dll call and I've seen that arguments aren't pass well
to the dll.



In PHP 4.2.3 version, first argument (attr1) offsets 0x04 bytes (in the
call stack) but in 4.3.3 version the same first argument offsets 0x08
bytes.



It seems that PHP 4.3.3 version puts an extra (???) attribute in the
call stack.







------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=25235&edit=1

Reply via email to