I receive an error:

"Warning: dl(): Not supported in multithreaded Web servers - use extension
statements in your php.ini "




"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Friday, July 23, 2004, 8:26:56 AM, you wrote:
> R> Hi,
> R> Is there a way to get with PHP script ( maybe with some module) serial
> R> number of the hard disk?
>
> R> Thanks in advance!
>
> On windows you can use the win32api like this:
>
> <?php
> dl("php_w32api.dll");
> $api =& new win32;
> $api->registerfunction("long GetLastError
>   Alias GetError ()
>   From kernel32.dll");
> $api->registerfunction("long GetVolumeInformationA
>   Alias GetVolumeInformation
>   (string a, string &b, int c, int &d, int &e, int &f, string &g, int h)
>   From kernel32.dll");
>
> $drive = "C:\\";
> $serialNo = 0;
> $MaximumComponentLength = 0;
> $FileSystemFlags = 0;
> $VolumeNameSize = 260;
> $VolumeNameBuffer = str_repeat("\0", $VolumeNameSize);
> $FileSystemNameSize = 260;
> $FileSystemNameBuffer = str_repeat("\0", $FileSystemNameSize);
> if(!$result = $api->GetVolumeInformation(
>     $drive,
>     $VolumeNameBuffer,
>     $VolumeNameSize,
>     $serialNo,
>     $MaximumComponentLength,
>     $FileSystemFlags,
>     $FileSystemNameBuffer,
>     $FileSystemNameSize)){
>   $error = $api->getError();
>   echo $drive.' Oops error: '.$error."\n";
> }
> echo "Drive $drive (".trim($VolumeNameBuffer).") Serial number
$serialNo\n";
> ?>
>
> (The stock win32api dll will probably crash with that many variables so
> let me know if you want a working version.)
>
> -- 
> regards,
> Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to