php.net |  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
Votes:19
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
 [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?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-12 13:29 UTC] psychosos at gmx dot at
Jan Kleinsorge has made some documentation available at http://mynnga.de/tom/loves/wob/w32api.txt . (I got the link to it from his comment on the w32api documentation page at http://www.php.net/manual/en/ref.w32api.php)
 [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:
<?php
dl("php_w32api.dll");

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.
But:
<?php
dl("php_w32api.dll");

$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.

<?php
@dl("php_w32api.dll");

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");
[...]
$api->unregisterfunction("GetTickCount");
 [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:


<?php

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

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

while(ob_get_level() > 0)
{
	ob_end_clean();
}
	
Output("Start");

set_time_limit(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");
Sleep(5);
Output("Call Test");
Output($api->Test(432));
Output("Wait 5 Seconds");
Sleep(5);

Output("Exit");
?>

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] bjori@php.net
This pecl extension is dead. If anything the documentation 
will be removed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC