Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Zeichen für Datei-Attribute (https://www.delphipraxis.net/215601-zeichen-fuer-datei-attribute.html)

Amateurprofi 4. Aug 2024 02:59

Zeichen für Datei-Attribute
 
Gibt es eine Funktion, die für ein Datei-Attribut den/die Buchstaben/Zeichen liefert, die Windows für dieses Attribut verwendet.
Für die gängigen Attribute sind die mir bekannt, aber für einige bin ich nicht fündig geworden.
Ich weiß, dass für einige (viele) Werte keine Konstanten definiert sind.
Die Frage ist, was zum Beispiel im Explorer angezeigt wird, wenn eine Datei solche Attribute hat.
Könnte ich vielleicht herausfinden, indem ich für eine Datei diese Attribute setze.
Allein: Wollen hätte ich gern gewollt, aber dürfen hab ich mich nicht getraut.

In der nachstehenden Tabelle sind die mir nicht bekannten Zeichen = '?' gesetzt - um die geht es mir.

Code:
   FileAttributes:Array[0..31] of TFileAttribute=
      ((Bit:0; Attribute:1;         Text:'R'; LongText:'ReadOnly')
      ,(Bit:1; Attribute:2;         Text:'H'; LongText:'Hidden')
      ,(Bit:2; Attribute:4;         Text:'S'; LongText:'System')
      ,(Bit:3; Attribute:8;         Text:'?'; LongText:'Unknown')
      ,(Bit:4; Attribute:16;        Text:'D'; LongText:'Directory')
      ,(Bit:5; Attribute:32;        Text:'A'; LongText:'Archive')
      ,(Bit:6; Attribute:64;        Text:'?'; LongText:'FutureUse')
      ,(Bit:7; Attribute:128;       Text:'N'; LongText:'Normal')
      ,(Bit:8; Attribute:256;       Text:'T'; LongText:'Temporary')
      ,(Bit:9; Attribute:512;       Text:'P'; LongText:'SparseFile')
      ,(Bit:10; Attribute:1024;      Text:'?'; LongText:'ReparsePoint')
      ,(Bit:11; Attribute:2048;      Text:'C'; LongText:'Compressed')
      ,(Bit:12; Attribute:4096;      Text:'?'; LongText:'OffLine')
      ,(Bit:13; Attribute:8192;      Text:'?'; LongText:'NotContentIndexed')
      ,(Bit:14; Attribute:16384;     Text:'E'; LongText:'Encrypted')
      ,(Bit:15; Attribute:32768;     Text:'?'; LongText:'IntegrityStream')
      ,(Bit:16; Attribute:65536;     Text:'?'; LongText:'Virtual')
      ,(Bit:17; Attribute:131072;    Text:'?'; LongText:'NoScrubData')
      ,(Bit:18; Attribute:262144;    Text:'?'; LongText:'RecallOnOpen')  //EA
      ,(Bit:19; Attribute:524288;    Text:'?'; LongText:'Pinned')
      ,(Bit:20; Attribute:1048576;   Text:'?'; LongText:'Unpinned')
      ,(Bit:21; Attribute:2097152;   Text:'?'; LongText:'Unknown')
      ,(Bit:22; Attribute:4194304;   Text:'?'; LongText:'RecallOnDataAccess')
      ,(Bit:23; Attribute:8388608;   Text:'?'; LongText:'Unknown')
      ,(Bit:24; Attribute:16777216;  Text:'?'; LongText:'Unknown')
      ,(Bit:25; Attribute:33554432;  Text:'?'; LongText:'Unknown')
      ,(Bit:26; Attribute:67108864;  Text:'?'; LongText:'Unknown')
      ,(Bit:27; Attribute:134217728; Text:'?'; LongText:'Unknown')
      ,(Bit:28; Attribute:268435456; Text:'?'; LongText:'Unknown')
      ,(Bit:29; Attribute:536870912; Text:'?'; LongText:'Unknown')
      ,(Bit:30; Attribute:1073741824; Text:'?'; LongText:'Unknown')
      ,(Bit:31; Attribute:2147483648; Text:'?'; LongText:'Unknown'));

Kas Ob. 4. Aug 2024 08:28

AW: Zeichen für Datei-Attribute
 
Hi,

Zitat:

Is there a function that returns the letter/characters that Windows uses for a file attribute?
I don't recall seeing such thing.

One thing though, where did you get these letters from ?
I mean this part might be wrong, ( i think !! )
Code:
     
      ,(Bit:9; Attribute:512;      Text:'P'; LongText:'SparseFile')  // ??
..........
      ,(Bit:19; Attribute:524288;   Text:'?'; LongText:'Pinned')     // should be P
      ,(Bit:20; Attribute:1048576;  Text:'?'; LongText:'Unpinned')   // should be U
from here https://learn.microsoft.com/en-us/wi...ommands/attrib


on side note : files can be pinned and unpinned at the same time.
also found this (by searching) https://ss64.com/nt/attrib.html

The one that is really i don't understand what it does is this one
Zitat:

{+\|-}b Sets (+) or clears (-) the SMR Blob file attribute.
As i can't find any helpful resource about it, and why if possible a local file can have it !? yet, on my PC it only report "Invalid switch - +b", like i am not allowed to change this attribute or even access it.

Amateurprofi 5. Aug 2024 00:27

AW: Zeichen für Datei-Attribute
 
Liste der Anhänge anzeigen (Anzahl: 2)
Thank You, Kas Ob.

Zitat:

One thing though, where did you get these letters from ?
I mean this part might be wrong, ( i think !! )
Code:
      ,(Bit:9; Attribute:512;     Text:'P'; LongText:'SparseFile') // ??
I got the "P" for SparseFile from the Windows-Explorer.

Pic1.jpg (Own Application) shows for a file that Bit 9 (SparseFile) is set.
Pic2.jpg (Windows Explorer) shows for that attribute for that file a "P"

Kas Ob. 5. Aug 2024 07:40

AW: Zeichen für Datei-Attribute
 
Liste der Anhänge anzeigen (Anzahl: 1)
Thank you, Amateurprofi !

Now the question is :
How your Explorer will report the Pinned and Unpinned bits ? and how it will change when the file is sparse one ?

Here what i see here
Anhang 57041

Also i tried the steps from here https://superuser.com/questions/5088...file-attribute yet my Explorer didn't show any letter for the sparse file, even though the file is marked with sparse attribute, my Windows 10 didn't show any special letter for it.

Kas Ob. 5. Aug 2024 07:56

AW: Zeichen für Datei-Attribute
 
And found two more letters :-D
https://en.wikipedia.org/wiki/File_attribute

Zitat:

Not Content-Indexed (I): When set, Indexing Service or Windows Search do not include the hosting file in their indexing operation.
Reparse Point (L): The file or directory has an associated re-parse point, or is a symbolic link.
Offline (O): The file data is physically moved to offline storage (Remote Storage).

///// ??? again this ???
Sparse (P): The file is a sparse file, i.e., its contents are partially empty and non-contiguous.
I and L can be seen with link files like the directory "Cookies" in your user directory.

Amateurprofi 5. Aug 2024 14:41

AW: Zeichen für Datei-Attribute
 
Liste der Anhänge anzeigen (Anzahl: 2)
Yes.
Pic3 and Pic4 show Users/Defaults/Cookies in my Application and in the Windos-Explorer.

ringli 5. Aug 2024 18:29

AW: Zeichen für Datei-Attribute
 
Die Eingabeaufforderung / Terminal gibt unter Windows 11 folgendes für den Befehl attrib /? aus:
Code:
  R  Attribut für "Schreibgeschützte Datei".
  A  Attribut für "Archivdatei".
  S  Attribut für "Systemdatei".
  H  Attribut für "Versteckte Datei".
  O  Attribut für "Offline".
  I  Attribut für "Datei ohne indizierten Inhalt".
  X  Attribut für "Keine Scrubbingdatei".
  V  Attribut für "Integrität".
  P  Attribut für "Angeheftet".
  U  Attribut für "Losgelöst".
  B  Attribut für "SMR-BLOB".
[EDIT]
Grade erst den Link zu ss64.com gesehen...:oops:

Amateurprofi 5. Aug 2024 23:30

AW: Zeichen für Datei-Attribute
 
Danke, ringli.

'O' für Offline hab ich intuitiv auch eingesetzt
'X' Für NoScrubData war mir bisher nicht bekannt
'V' für IntegrityStream war mir bisher nicht bekannt
'P' Für Pinned wird bei mir (Windows 7) für SparseFile verwendet.
'U' für Unpinned war mir bisher nicht bekannt

Last not least
B Attribut für "SMR-BLOB".
Weißt Du für welches Bit das steht?

Für mich unverständlich warum es in Windows keine Funktion gibt (zu geben scheint=, die für ein Bit den Buchstaben liefert.

ringli 6. Aug 2024 05:29

AW: Zeichen für Datei-Attribute
 
Das hier habe ich gefunden:

http://justsolve.archiveteam.org/wik...ile_attributes

Demnach soll das FILE_ATTRIBUTE_STRICTLY_SEQUENTIAL bzw. 0x20000000 sein. :?

himitsu 6. Aug 2024 08:32

AW: Zeichen für Datei-Attribute
 
Es wird noch besser:
* viele dieser Attribute sind keine (binären) Attribute (im Dateisystem)
* manches gehört eigentlich zum FileHandle und steuert wie Windows den FileCache behandelt
* und einige Bits haben je, nach drunterliegendem Dateisystem/Treiber/Protokol, ganz andere oder garkeine Bedeutung :stupid:


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:03 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-2025 by Thomas Breitkreuz