System
[ class tree: System ] [ index: System ] [ all elements ]

Class: System_WinDrives

Source Location: /System_WinDrives-1.0.0/WinDrives.php

Class Overview


Get drive information on windows systems


Author(s):

Version:

  • 0.1

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 66]
Get drive information on windows systems

This class gives back a list of existing drives (like a:\, c:\ and so) as well as the drive types (hard disk, cdrom, network, removable) and drive names if any

The class requires the php_w32api.dll on php4 and the php_ffi.dll for php5

Note that the php_win32api.dll shipped with normal php packages has a problem with many parameters This means that the script will crash when trying to get the drive name. use "setReadName(false)" to prevent this.

On php5, the drive _names_ are always ''.

You should not use this on non-Windows operating systems

If you use this class in your projects, I ask you to send a real-world postcard to: Christian Weiske Dorfstrasse 42 04683 Threna Germany



[ Top ]


Class Variables

$arTypeTitles = array(
        'A' => '3.5" Floppy',
        SYSTEM_WINDRIVE_ERROR     => 'non-existent',
        SYSTEM_WINDRIVE_REMOVABLE => 'Removable',
        SYSTEM_WINDRIVE_FIXED     => 'Harddisk',
        SYSTEM_WINDRIVE_REMOTE    => 'Network drive',
        SYSTEM_WINDRIVE_CDROM     => 'CD-Rom',
        SYSTEM_WINDRIVE_RAMDISK   => 'RAM-Disk'
    )

[line 99]

List with titles for the drive types
  • Access: public

Type:   array


[ Top ]

$bReadName =  false

[line 75]

If the drive names shall be enumerated

This can cause problems with some versions of win32api.dll, so it's disabled by default

  • Access: protected

Type:   boolean


[ Top ]

$objApi =  null

[line 83]

The win32api object to use

If it's null, it can't be used

  • Access: protected

Type:   object


[ Top ]

$objFFI =  null

[line 92]

The php_ffi object to use

If it's null, it can't be used php_ffi replaces win32api in php5

  • Access: protected

Type:   object


[ Top ]



Method Detail

System_WinDrives (Constructor)   [line 118]

System_WinDrives System_WinDrives( [boolean $bReadName = false])

Constructs the class and checks if the api is available
  • Access: public

Parameters:

boolean   $bReadName   —  If the drive names shall be read

[ Top ]

getDriveList   [line 210]

array getDriveList( )

returns a list with all drive paths like "A:\", "C:\" and so
  • Return: Array with all drive paths
  • Access: public

[ Top ]

getDriveName   [line 340]

string getDriveName( string $strDrive)

returns the name of the drive

The name is the one the user has given the drive like "Windows" or "Data"

The FFI version doesn't seem to work... $strFunc .= "[lib='kernel32.dll'] long GetVolumeInformationA(char lpRootPathName, char *lpVolumeNameBuffer, int nVolumeNameSize, "

  • Return: The name of the drive
  • Access: public

Parameters:

string   $strDrive   —  Drive path like "C:\"

[ Top ]

getDrivesInformation   [line 151]

array getDrivesInformation( )

returns an array containing information about all drives
  • Return: Array with drive infomation
  • Access: public

[ Top ]

getDriveType   [line 293]

int getDriveType( string $strDrive)

returns the drive type
  • Return: Drive type, use "DRIVE_*" constants to enumerate it
  • Access: public

Parameters:

string   $strDrive   —  Drive path like "C:\"

[ Top ]

getReadName   [line 183]

void getReadName( )

return the "bReadName" setting
  • Access: public

[ Top ]

getTypeTitle   [line 316]

string getTypeTitle( int $nType, string $strDrive)

returns the title for a given drive type
  • Return: The type title like "Harddisk"
  • Access: public

Parameters:

int   $nType   —  The drive type
string   $strDrive   —  The drive path (like "A:\")

[ Top ]

guessDriveList   [line 270]

array guessDriveList( )

Tries to guess the drive list The floppy "A:\" will no be in the list
  • Return: Array with all the drive paths like "A:\" and "C:\"
  • Access: public

[ Top ]

isApiAvailable   [line 196]

boolean isApiAvailable( )

checks if the win32 api/ffi is available
  • Return: True if the api can be used, false if the dll is missing
  • Access: public

[ Top ]

setReadName   [line 171]

void setReadName( boolean $bReadName)

Setter for "bReadName"
  • Access: public

Parameters:

boolean   $bReadName   —  If the drive's names shall be read

[ Top ]

splitDriveNumber   [line 248]

array splitDriveNumber( int $nDrives)

splits a number returned by GetLogicalDrives*() into an array with drive strings ("A:\", "C:\")
  • Return: Array with drives
  • Access: protected

Parameters:

int   $nDrives   —  The number the function gave back

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:48:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.