Re: windows disk list in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A a wrote:
Hi,
How to obtain a list of all currectly available windows disk?

Thank you.

____________________________________________________________
Obchodní dům.cz - široký sortiment domácích spotřebičů a elektroniky, výrazné slevy. Navštivte http://ad.seznam.cz/clickthru?spotId=73742
This is what I do using the win32api and works on win98 and 2k:

<?php
dl("php_w32api.dll");
$api =& new win32;
$api->registerfunction("long GetLogicalDriveStrings
	Alias GetLogicalDriveStrings
	(long &BufferLength, string &Buffer)
	From kernel32.dll");

$api->registerfunction("long GetLogicalDrives
	Alias GetLogicalDrives ()
	From kernel32.dll");


$drives = array(); $len = 105; // set the buffer length $buffer = str_repeat("\0", $len+1); // prepare an empty string if($api->GetLogicalDriveStrings($len,$buffer)){ $drives = explode("\0",trim($buffer)); }elseif($drive_list = $api->GetLogicalDrives()){ for($i=1,$drv=ord('A');$drv<=ord('Z');$drv++){ if($drive_list & $i){ $drives[] = chr($drv).":\\"; } $i = $i << 1; } }else{ echo "no drives found\n"; } print_r($drives);


(if you need a working version of php_w32api.dll let me know)

Tom

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux