For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > June 2006 > #21504 [Com]: W32api extension documentation is obsolete









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #21504 [Com]: W32api extension documentation is obsolete
nightwulfe at gmail dot com

2006-06-24, 8:03 am

ID: 21504
Comment by: nightwulfe at gmail dot com
Reported By: thingol at mail dot ru
Status: Open
Bug Type: Documentation problem
Operating System: win32
PHP Version: Irrelevant
New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2003-07-17 11:55:46] 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");

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

[2003-05-12 14:00:14] 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-05-12 13:44:26] 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 13:29:00] 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-01-07 21:53:57] 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?

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


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







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com