|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #21504 W32api extension documentation is obsolete
Submitted: 2003-01-07 21:53 UTC Modified: 2006-09-08 17:07 UTC
Avg. Score:4.3 ± 0.8
Reproduced:14 of 15 (93.3%)
Same Version:7 (50.0%)
Same OS:10 (71.4%)
From: thingol at mail dot ru Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS: win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: thingol at mail dot ru
New email:
PHP Version: OS:


 [2003-01-07 21:53 UTC] thingol at mail dot ru
New (rewritten) W32api extension is totally undocumented and have no examples.

Is it working? If yes, is it possible to give us a little example of using rewritten extension?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-12 13:29 UTC] psychosos at gmx dot at
Jan Kleinsorge has made some documentation available at . (I got the link to it from his comment on the w32api documentation page at
 [2003-05-12 13:44 UTC] thingol at mail dot ru
This documentation gives no sample.

I try this code and it don't work:

Win32::RegisterFunction("long MessageBox (long hWnd, string lpText, string lpCaption, long uType) From User32.dll", 0);
$str = "Test, oh my god";
echo Win32::MessageBox(NULL, $str, "Information", 0);

PHP 4.3.2RC1
 [2003-05-12 14:00 UTC] thingol at mail dot ru
I notice that I use wrong syntax.

$api = new win32();

$api->RegisterFunction("long MessageBoxA (long hWnd, string &lpText, string &lpCaption, long uType) From User32.dll", 0);
$str = "Test, oh my god";
$api->MessageBoxA(NULL, $str, $str, 0);
with new ext shows no errors and no messagebox.


w32api_register_function("User32.dll", "MessageBoxA", "long");
$str = "Test, oh my god";
MessageBoxA(NULL, $str, $str, 0);
with old ext shows messagebox.
 [2003-07-17 11:55 UTC] iron at ironiq dot hu
The rewritten w32api extension works wrong on WinXP with PHP 4.3.2 (as isapi dll) and IIS 5.

If I use the php as isapi dll, the unregisterfunction doesn't work. I get an "Access Violation" if I run second time.
After restarting the IIS, the php script works first and doesn't on the second time.

The sample:

$api  = new win32;
$api->registerfunction("long GetTickCount () From Kernel32.dll");
 [2006-06-20 16:20 UTC] nightwulfe at gmail dot com
I receive the following error:

Call to undefined function:  registerfunction() in D:\web_4\wwwroot\shm.php on line 25

In CGI mode, this happens if I have a third call to registerfunction in the script.

In ISAPI mode, this happens if the page attempts a third call (between all page accesses) to registerfunction.

The PHP code is as follows:


function Output($text)
	echo str_pad($text, 4096), "\n";

header('Content-Type: text/plain');

while(ob_get_level() > 0)


Output("Register Functions");
$api = new win32();
$api->registerFunction("int Log (string sfile, string sText, string sData, string sStack) From Support.dll");
$api->registerFunction("int Test (int nValue) From TestSupport.dll");

Output("Execute Log Statement");
Output("Result " . $api->Log("Tset", "Test", "test", "Value"));

Output("Wait 5 Seconds");
Output("Call Test");
Output("Wait 5 Seconds");


Additionally, the statement Output("Result " . $api->Log("Tset", "Test", "test", "Value")); will echo 0 to the browser.  I know the correct function is being called as  I have logging code that is being executed.

The Output($api->Test(432)) line, however returns the correct value (432) and displays it.  This C function just returns what is passed to it.
 [2006-06-20 16:21 UTC] nightwulfe at gmail dot com
That's PHP 4.4.1, sorry.
 [2006-09-08 17:07 UTC]
This pecl extension is dead. If anything the documentation 
will be removed.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 09:01:41 2024 UTC