![]() |
|
31 פיט - יפלד | |
![]() |
|
ישאר דומע | םיפיטה דומע | רנק ודיע תאמ |
![]() |
? בשחמב יל שי םיננוכ וליאfunction Drives : TstringLists; var ld : Dword; I : integer; begin ld:=GetLocalDrives; for I:= 0 to 25 do begin if ((ld and (1 shl I)) <>0 then result.add((ord('A')+I)+':\'); end; end; ...ולש דיקפתה המ רמולכ ... ןנוכ לכ המ הלגנ אוב ,וישכעו Type TDriveType = (dtNotDetermined, dtNonExistent, dtRemoveable, dtFixed, dtRemote, dtCDROM, dtRamDrive); TFileFlag = (fsCaseIsPreserved, fsCaseSensitive, fsUnicodeStoredOnDisk, fsPersistentAcls, fsFileCompression, fsVolumeIsCompressed); function GetTypeOfDrive(drive : string) : DriveType; begin drive:=lowercase(drive); case length(drive) of 1 : begin if not (drive[1] in ['A'..'Z']) then begin result:=dtNotDetermined; exit; end; drive:=drive+':\'; end; 2 : begin if drive[2]<>':' then begin begin result:=dtNotDetermined; exit; end; end else drive:=drive+'\'; end; else if (drive[2]<>':')or(drive[3]<>'\') then begin result:=dtNotDetermined; exit; end; end; case GetDriveType(PChar(drive)) of 0 : result := dtNotDetermined; 1 : result := dtNonExistent; DRIVE_REMOVABLE : result := dtRemoveable; DRIVE_FIXED : result := dtFixed; DRIVE_REMOTE : result := dtRemote; DRIVE_CDROM : result := dtCDROM; DRIVE_RAMDISK : result := dtRamDrive; end; end; function GetDriveVolume(const drive : string) : string; var pFSBuf, Vol : PChar; FSSysFlags, maxCmpLen : DWord; begin getmem(vol,max_path); GetMem(pFSBuf, MAX_PATH); GetVolumeInformation(PChar(drive), Vol, max_path, nil, maxCmpLen, FSSysFlags, pFSBuf,max_path); result:=trim(StrPas(Vol)); freemem(Vol); freemem(PfsBuf); end; function GetSerialNumber(const drive : string) : longint; var pFSBuf, Vol : PChar; FSSysFlags, maxCmpLen : DWord; Serial : PDWord; begin getmem(vol,max_path); GetMem(pFSBuf, MAX_PATH); GetMem(Serial, MAX_PATH); GetVolumeInformation(PChar(drive), Vol, max_path, Serial, maxCmpLen, FSSysFlags, pFSBuf,max_path); result:=Serial^; freemem(Vol); freemem(PfsBuf); freemem(Serial); end; function GetDriveInfo(const drive : string) : TFileFlag; var pFSBuf, Vol : PChar; FSSysFlags, maxCmpLen : DWord; begin getmem(vol,max_path); GetMem(pFSBuf, MAX_PATH); GetVolumeInformation(PChar(drive), Vol, max_path, nil, maxCmpLen, FSSysFlags, pFSBuf,max_path); case FSSysFlags of FS_CASE_IS_PRESERVED : result := fsCaseIsPreserved; FS_CASE_SENSITIVE : result := fsCaseSensitive; FS_UNICODE_STORED_ON_DISK : result := fsUnicodeStoredOnDisk; FS_PERSISTENT_ACLS : result := fsPersistentAcls; FS_FILE_COMPRESSION : result := fsFileCompression; FS_VOL_IS_COMPRESSED : result := fsVolumeIsCompressed; end; freemem(Vol); freemem(PfsBuf); end; .ךירצ המ קוידב ,בשחמב ןנוכו ןנוכ לכ לע עדימ תונתונ ןה .ידי לע ובתכנ ולא תויצקנופ 4 .יפלד תויצקנופבו API תויצקנופ תושמתשמ ןה |