Get the type of drive

xiaoxiao2021-03-06  38

Function get_diskserialno (driveid: char): String;

VAR

VoluMserialnumber: DWORD;

MaximumComponentlength: DWORD;

FileSystemflags: dword;

PS: PCHAR;

STRING;

DT: DWORD;

Begin

PS: = PCHAR (DRIVEID ': /');

GetVolumeInformation (PS, NIL, 0, @ VoluMserialNumber, MaximumComponentLength, FileSystemflags, NIL, 0);

DT: = GetDriveType (PS);

ST: = '';

Case DT of

0: st: = 'can not determined';

1: st: = 'disk not existsed';

Drive_removable: st: = 'removed';

DRIVE_FIXED: ST: = 'Fixed';

Drive_remote: st: = 'recote';

DRIVE_CDROM: ST: = 'CDROM';

DRIVE_RAMDISK: ST: = 'ramdisk';

END;

Result: = INTTOHEX (HiWord (VoluMserialNumber), 4) '-' INTTOHEX (Loword (VoluMserialNumber), 4) 'Type:' ST;

END;

转载请注明原文地址:https://www.9cbs.com/read-118363.html

New Post(0)