Re: windows disk list in PHP
| From: | Tom Rogers | Date: | Mon, 12 Jul 2004 14:28:12 +0000 |
| Subject: | Re: windows disk list in PHP | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-24142@lists.php.net to get a copy of this message | ||
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