Setting Extra Attributes for Anoraks

A collection of especially useful xplorer² topics and ideas. New users may find it helpful to look here before searching the other forums for information. >>>>>> Please post new material in the relevant forum. (New stuff posted here will be removed.) Thanks. -fg-

Moderators: fgagnon, nikos

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Setting Extra Attributes for Anoraks

Post by Kilmatead »

Seafa - Set Extra Attributes for Anoraks :wink:

Essentially this is a logical extension to this thread wherein a user found an attribute he was unaware had previously existed under NTFS - so, in the interests of discovering things myself, I wrote this utility to change/correct/study (primarily) extra/little-known attributes on such filesystem objects just to see how they play in the wild.

As the title implies this is for Anoraks meaning that it is for weirdos who like to play with filesystem objects in ways that other people wouldn't understand.  Perhaps there is some hint of deviant sexuality involved, but I doubt it - it's just what some people do as a hobby, or as an alternative to what is flippantly referred to (by people who know nothing of human existence) as "having a life". :shrug:

Image

Download Link: Seafa (Updated: 10-Mar-13, Version 0.5.0.5)
(RAR includes 32/64-bit EXE's and Source Code)

User-Command format: > Seafa.exe $A

As you can see, I used the x2 [S]tock attributes display format of "-----------", with a slight change - and for those who don't know what applies to which slot in which order (since most people never see full attributes listed), I'll enumerate them here, just for the fun of it.

Stock Layout: RHSADCEOJIP TNMVGU

R - FILE_ATTRIBUTE_READONLY
H - FILE_ATTRIBUTE_HIDDEN
S - FILE_ATTRIBUTE_SYSTEM
A - FILE_ATTRIBUTE_ARCHIVE
D - FILE_ATTRIBUTE_DIRECTORY
C - FILE_ATTRIBUTE_COMPRESSED
E - FILE_ATTRIBUTE_ENCRYPTED
O - FILE_ATTRIBUTE_OFFLINE
J - FILE_ATTRIBUTE_REPARSE_POINT (Junctions)
I - FILE_ATTRIBUTE_NOT_CONTENT_INDEXED (Disabled Indexing)
P - FILE_ATTRIBUTE_SPARSE_FILE (See this)

T - FILE_ATTRIBUTE_TEMPORARY
N - FILE_ATTRIBUTE_NORMAL
M - FILE_ATTRIBUTE_DEVICE (Reserved)
V - FILE_ATTRIBUTE_VIRTUAL (Reserved)
G - FILE_ATTRIBUTE_INTEGRITY_STREAM (ReFS only)
U - FILE_ATTRIBUTE_NO_SCRUB_DATA (ReFS only)

Now obviously everyone is familiar with the usual boring old attributes, so I included them simply for completeness, not because they have changed in any way.  De facto, this utility only comes into play if you wish to actively set the Offline, Indexing, Temporary, Integrity Stream, No Scrub, or (force-ably) "Normal" attributes.

So, is there any reason you would want to do this?  No, not really.  Anoraks, remember? :D  In fairness though, this is a practical approach to "clearing" those attributes if they have been somehow set by other programmes (such as "Offline" or "Temporary" indicators) and you either wish to control these yourself for your own nefarious purposes, or they have become corrupted and you need to clear them.

The -I- attribute is essentially the status of the "Allow this file to have its contents indexed in addition to file" checkbox that's available when you right-click on an object to check its Properties, and you select "Advanced".  Normally indexing is mass-disabled just by denying the indexing service access to selective areas of your drives (open the Start Menu and type "indexing").  However, should you wish to control/automate this on a more granular level (and in particular on some objects which the service won't allow to become non-indexed), this utility may be applied in that manner.

The -N- attribute is so-called "Normal" simply because it is the absence of all other attributes - and this is taken literally.  For instance, you can't assign -N- to a folder because that object already has the -D- attribute permanently assigned to it, and were you to remove that, the object would no longer be a folder.  (For those interested, this is actually possible to do, at the expense of destroying the folder, but thankfully not with this utility as it only uses the Windows API function Get/SetFileAttributesW which doesn't function on that level.)

The -T- attribute (which is actually quite ingenious as it can utilise disc cache memory instead of actually ever physically writing ephemera for true temporality) is for files only and cannot be applied to folders.  It is beyond the purview of this user/thread to describe exactly how this may be used effectively by a given application, but hey - you never know what I end up doing when I'm bored and it won't stop raining.

To sum up:

* This utility can handle multiple selections/arguments and apply/revert the same attributes to all the objects at once, where possible, depending on the base-attributes of the objects in question.

* It is unicode compliant, and does the usual checking on the veracity of objects (you can't assign attributes to drives or root-folders, etc).

* As it executes assignments it generates a log file ('__Seafa.log') in the %Temp% folder which is overwritten each time; this is only really necessary if assignment errors occur (in case of failures the log will open automatically to show the specific objects in question and what you were attempting to modify) - but the user may track this themselves by ticking the box to always display the log regardless of whether errors occur or not.

* Failures are verified/gauged by comparing the original attributes to an immediate post-assignment re-read of the current state of each object, so it's pretty robust.

And yes, I am aware that there are many other "Mass Attribute Changers" out there, but they never allow for the more obscure (-O-, -I-, -T-, -N-) modifiers, and they don't always verify results - hence the reason I use the term "extra" in the title. :D

In case anyone requests it, I could add other functionality such as subfolder-content recursion, support for the '$>' token to allow true mass-selections, and command-line attribute presets, or timestamp handling - but for now I just decided to keep it simple as it was originally intended "just as something to play with when its raining". :shrug:
Last edited by Kilmatead on 2017 Mar 15, 20:02, edited 4 times in total.
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Out of the usual mind-numbing dolorousness that is the world of Anoraks, we've been updated to 0.5.0.3 (original link above is current).

Basically just fixed a couple of bugs and mapped the remaining attribute bits (whether they're useful or not) - notably INTEGRITY_STREAM and NO_SCRUB_DATA for use under ReFS.  (Attempting to apply ReFS attributes on NTFS will simply fail, so there's not much to be gained there.  The jury is still out as to whether or not they work anyway - hic sunt dracones. :shrug:  But at least the complete bit-set is available to play with now.)

Full changelog is at the top of the source-code, for anyone weird enough to be curious. :D

We also changed the title to "...Extra Attributes...", as it turns out "extended" attributes are something else altogether, so this way there's no confusion.  Well, at least a little less confusion than may be expected from a lifetime of wandering in the desert only to look at the sun one last time before death and see it as an object foreign to all human conception.  Just like what bloody well happens to me every morning when I wake up and crawl out of bed.
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

Image
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

(A couple of years ago I stumbled upon a shell extension which did the same but via the context menu. Can't find it anymore. Damn.)
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

It's easy to add a cascading menu in a static extension, but I would more apply that to "things used on a regular basis". :shrug:  Just how often do you feel in trepidating danger from a rogue -T- attribute which just demands to be removed before breakfast?  Maybe you should offer it milk with its tea and biscuits, and you might see it in a more comely light, no?

Edit: Wait, scratch that - no cascading menu needed.  Just a stock static one.  Surely you know how to do that yourself?
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

I am not a friend of using separate dialogs for basic shell operations.

Edit: I don't have any idea how to develop shell extensions at all. If I had, I would. But I mainly develop applications which don't need them.
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Tuxman wrote:I don't have any idea how to develop shell extensions at all. If I had, I would.
This stuff is pretty basic - if the lowly gardener can do it (like me), you big computer university educated grown up types should consider it child's play.

Besides, static ones are easy - a couple of HKCU registry entries and Bob's your uncle.  Or, for simplicity, doesn't everyone just use FileMenuTools?  You can define rules for what shows up, where, when, and limit to certain object types as desired - which is kinda ticklish if I do say so.  (Or, even more boring just use the built-in utilities - but I disable all of those, and use it entirely bespoke.)
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

Kilmatead wrote:doesn't everyone just use FileMenuTools?
I did, then I noticed I never need it.
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Tuxman wrote:...but via the context menu. Can't find it anymore. Damn.
Tuxman wrote:...then I noticed I never need it.
Makey-uppy your mind-y.  :?
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

FileMenuTools is nice but not the application I meant. That one added a "Extra Properties" menu item, or something, to the bottom of the menu and nothing more..
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Soooo.... like... how is that different from configuring filemenutools to only display a single entry that runs this silly (or any other silly) utility for attributes?  I don't see the problem.  And there's no conceivable way to avoid opening up a separate dialog unless you're depending wholly upon pre-set attribute sets, which would be a little weird - unless they invented an extension to guess what you want to apply?

Besides, the fun of using your own dialog is that you can control everything it does.  Nikos won't add a feature?  Feck that for a game of soldiers - I'll do it meself!  When it doubt, just create the Official Attributes Dialog from Hell (©) and sod everyone else. :shrug:
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

Kilmatead wrote:there's no conceivable way to avoid opening up a separate dialog
I, for one, would even prefer a tool which just adds a new "normal" prefs page, like HashTab does.  :shrug:
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

So you basically want to smear yourself in oil, put bandages over your eyes, and light yourself on fire while jumping off Notre Dame Cathedral?  Just to set attributes?  I don't get it.  I did intone that anoraks may have deviant sexual practices in the original post, but I didn't expect anyone to jump up and shout "Hey, that's me!". :shrug:

I still don't get it - Hashtab just looks like a standard Apple Interface style (ugh) - if you want to adjust attributes, you need to actually select them don't you?  Methinks you're confused.
Tuxman
Platinum Member
Platinum Member
Posts: 1610
Joined: 2009 Aug 19, 07:49

Post by Tuxman »

Of course I have to select them.
And of course (right now) attr is the shortest solution at my fingertips.

Don't call me an anorak, sir!
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Don't call me 'sir' - that's offensive to the Irish, after 800 years of England's holier-than-thou occupation we spit on their titles.

I don't know what attr is - some CLI thing?  If you use the CLI (given your moniker it makes sense), then by definition you are an anorak. :wink:  (So I assume you were being ironic.)
Post Reply