Class TVolumeInformation (unit Volinfo)

Inherits from

TComponent

Constructors


constructor Create(AOwner: TComponent);

Public declarations


Functions

procedure ProcessError(Result: Variant);

Protected declarations

*************************************************************************** procedure ProcessError - Handles the GetVolumeInformation errors.


function FCaseIsPreserved: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_CASE_IS_PRESERVED bit status.

function FCaseSensitive: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_CASE_SENSITIVE bit status.

function FPersistentACLs: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_PERSISTENT_ACLS bit status.

function FSupportsFileCompression: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_FILE_COMPRESSION bit status.

function FUnicodeStoredOnDisk: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_UNICODE_STORED_ON_DISK bit status.

function FVolumeIsCompressed: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_VOL_IS_COMPRESSED bit status.

function GetUNCDrive: string;

*************************************************************************** function GetUNCDrive - Gets the Volume label for the specified drive.

function GetVolumeFileSystemFlags: integer;

*************************************************************************** function GetVolumeFileSystemFlags - Gets the Volume file system flags for the specified drive.

function GetVolumeFileSystemName: string;

*************************************************************************** function GetVolumeFileSystemName - Gets the file system name (usually FAT or NTFS) for the specified drive.

function GetVolumeLabel: string;

*************************************************************************** function GetVolumeLabel - Gets the Volume label for the specified drive.

function GetVolumeSerialNumber: string;

*************************************************************************** function GetVolumeSerialNumber - Gets the Volume serial number for the specified drive.

procedure SetDrive(DriveLetter: char);


procedure SetUNCDrive;

*************************************************************************** procedure SetUNCDrive - Sets the FUNCDrive, that is UNC file name of the root directory of the drive specified by FDrive.

Properties

property Drive : char

Published declarations

property UNCDrive : string


property CaseIsPreserved : boolean


property CaseSensitive : boolean


property PersistentACLs : boolean


property SupportsFileCompression : boolean


property UnicodeStoredOnDisk : boolean


property Version : string


property VolumeFileSystemFlags : integer


property VolumeFileSystemName : string


property VolumeIsCompressed : boolean


property VolumeLabel : string


property VolumeSerialNumber : string


Events

event OnError : TErrorEvent


Variables

FDrive : char;

Private declarations

FErrorEvent : TErrorEvent;


FUNCDrive : string;


FVersion : string;



Constructors


constructor Create(AOwner: TComponent);

Public declarations


Functions


procedure ProcessError(Result: Variant);

Protected declarations

*************************************************************************** procedure ProcessError - Handles the GetVolumeInformation errors. If there is an User Event defined for the component, it gets called with the error code passed as parameter. Otherwise a default error box is displayed. In any case, a null value is returned: this means a null string ('') or a null integer(0). Result is of type variant in order to make this routine good both for string and integer return types.


function FCaseIsPreserved: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_CASE_IS_PRESERVED bit status. Input parameters: NONE Output parameters: The function returns True if FS_CASE_IS_PRESERVED is set, False otherwise.


function FCaseSensitive: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_CASE_SENSITIVE bit status. Input parameters: NONE Output parameters: The function returns True if FS_CASE_SENSITIVE is set, False otherwise.


function FPersistentACLs: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_PERSISTENT_ACLS bit status. Input parameters: NONE Output parameters: The function returns True if FS_PERSISTENT_ACLS is set, False otherwise.


function FSupportsFileCompression: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_FILE_COMPRESSION bit status. Input parameters: NONE Output parameters: The function returns True if FS_FILE_COMPRESSION is set, False otherwise.


function FUnicodeStoredOnDisk: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_UNICODE_STORED_ON_DISK bit status. Input parameters: NONE Output parameters: The function returns True if FS_UNICODE_STORED_ON_DISK is set, False otherwise.


function FVolumeIsCompressed: boolean;

*************************************************************************** function CaseIsPreserved - Return the FS_VOL_IS_COMPRESSED bit status. Input parameters: NONE Output parameters: The function returns True if FS_VOL_IS_COMPRESSED is set, False otherwise.


function GetUNCDrive: string;

*************************************************************************** function GetUNCDrive - Gets the Volume label for the specified drive. Input parameters: NONE Output parameters: The function returns a string containing the UNC file name, that could have two possible forms: :\ if FDrive is local, and \\\ if FDrive is remote, i.e. networked. Since FUNCDrive could have an ending backslash to override a NT bug with networked drives, it removes also the last '\'.


function GetVolumeFileSystemFlags: integer;

*************************************************************************** function GetVolumeFileSystemFlags - Gets the Volume file system flags for the specified drive. Input parameters: NONE Output parameters: The function returns an integer containing the volume file system flags, or 0 (zero) if some error occurs.


function GetVolumeFileSystemName: string;

*************************************************************************** function GetVolumeFileSystemName - Gets the file system name (usually FAT or NTFS) for the specified drive. Input parameters: NONE Output parameters: The function returns a string containing the file system name, or an empty string if some error occurs.


function GetVolumeLabel: string;

*************************************************************************** function GetVolumeLabel - Gets the Volume label for the specified drive. Input parameters: NONE Output parameters: The function returns a string containing the volume name, or an empty string if some error occurs.


function GetVolumeSerialNumber: string;

*************************************************************************** function GetVolumeSerialNumber - Gets the Volume serial number for the specified drive. Input parameters: NONE Output parameters: The function returns a string containing the volume serial number, or an empty string if some error occurs.


procedure SetDrive(DriveLetter: char);


procedure SetUNCDrive;

*************************************************************************** procedure SetUNCDrive - Sets the FUNCDrive, that is UNC file name of the root directory of the drive specified by FDrive. If FDrive is local, FUNCDrive is of the form: :\ If FDrive is networked, FDrive has the form: \\\ Input parameters: NONE Output parameters: NONE. Note: Due to a bug in Windows NT, the UNC name passed to GetVolumeInformation must have an extra backslash at its end, e.g. it MUST be of the form: \\\\


Properties


property Drive : char

Published declarations


property UNCDrive : string


property CaseIsPreserved : boolean


property CaseSensitive : boolean


property PersistentACLs : boolean


property SupportsFileCompression : boolean


property UnicodeStoredOnDisk : boolean


property Version : string


property VolumeFileSystemFlags : integer


property VolumeFileSystemName : string


property VolumeIsCompressed : boolean


property VolumeLabel : string


property VolumeSerialNumber : string


Events


event OnError : TErrorEvent


Variables


FDrive : char;

Private declarations


FErrorEvent : TErrorEvent;


FUNCDrive : string;


FVersion : string;