![]() |
Delphi-Version: 2010
Is volume compressed?
How to receive from GetVolumeInformation.lpFileSystemFlags if volume is compressed or not?
I have
Delphi-Quellcode:
but not working. F1, please.
FileSysFlags and FILE_VOLUME_IS_COMPRESSED <> 0
|
AW: Is volume compressed?
Do you really mean a compressed volume or a volume which supports compression of indivual files?
![]() Zitat:
|
AW: Is volume compressed?
|
Re: Is volume compressed?
So, I still don't know hot to get information if volome is compressed or not :(
|
Re: AW: Is volume compressed?
Zitat:
|
Re: Is volume compressed?
None of above flags (flags and flag <> 0) are working, some always returns false, another always true. Any help? :(
|
AW: Is volume compressed?
I might be wrong, but I believe there is no clear indication if a volume is either compressed or not compressed at all. We're talking about NTFS, right? I think the
Delphi-Quellcode:
flag still hails from the time of the FAT file system. Back then, a volume was either entirely compressed ("double space volume") or no compression at all was taking place.
FILE_VOLUME_IS_COMPRESSED
Take a look: Set a volume of yours to "compressed". Create some folders, they're all blue (compressed). Now set a folder to "uncompressed". Your volume will still state "compressed". I believe "volume compression" only means "Default setting for compressing content or not". Keeping this in mind, this is what I baked together:
Delphi-Quellcode:
procedure TForm18.checkCompression();
const // According to http://www.swissdelphicenter.ch/en/showcode.php?id=1053 COMPRESSION_FORMAT_NONE = 0; COMPRESSION_FORMAT_LZNT1 = 2; COMPRESSION_FORMAT_DEFAULT = 1; var fileHandle: THandle; outBuffer: ^USHORT; bufferLength: DWORD; begin // Fetch Handle fileHandle := CreateFile( 'F:\.', GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL or FILE_FLAG_BACKUP_SEMANTICS, 0 ); if (fileHandle = INVALID_HANDLE_VALUE) then raise Exception.Create('CreateFile Failed'); // Init Buffer New(outBuffer); if not DeviceIoControl( fileHandle, FSCTL_GET_COMPRESSION, nil, 0, outBuffer, SizeOf(outBuffer), bufferLength, nil ) then raise Exception.Create('DeviceIoControl failed'); if (outBuffer^ and COMPRESSION_FORMAT_LZNT1) <> 0 then ShowMessage('it is compressed'); end; |
AW: Is volume compressed?
Zitat:
Entweder ist alles immer komprimiert, oder das Volume unterstützt eine eine Komprimierung. Und wenn das Volume nun manuell komprimiert wurde, dann ist das andere Flag dennoch nicht aktiv, da nicht das Volume, sondern nur das Root-Verzeichnis komprimiert wurde. |
AW: Is volume compressed?
Ja, aber er hat ja schon gesagt, dass das Flag trotzdem nicht gesetzt wird, auch wenn man im Explorer für das gesamte Laufwerk das "komprimiert"-Häkchen gesetzt hat. Und das kann ich auch bestätigen. Das war vielleicht unter FAT noch so, aber unter NTFS zwingt kein übergeordnetes Verzeichnis/Laufwerk einen, jetzt gefälligst komprimiert zu sein.
Wie das unter exFat, ReFS und was weiß ich aussieht- Keine Ahnung. |
Re: Is volume compressed?
Thanks, your explanation is helpful and now I understand more 8-)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:08 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz