From: fgarcia at uef dot es
Operating system: Windows 2000
PHP version: 4.3.2
PHP Bug Type: Unknown/Other Function
Bug description: win32api problem in arguments
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 bug report at http://bugs.php.net/?id=25235&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25235&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25235&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25235&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25235&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25235&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25235&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25235&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25235&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25235&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25235&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25235&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25235&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25235&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25235&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25235&r=gnused