Re: what to do when XP scan disk converted folder to file?



On Sun, 25 Mar 2007 21:29:17 +0400, "serge_moscou"

Exactly !! BUT "HOW TO flip the Directory attribute bit back"
Would you be so kind as to precise what is this "bit" how to put it back.

To be honest, it's not easy unless you know what you are doing and are
very careful, but I'll give you the background.

Traditional directory entries have a very simple, fixed-size set of
information that define and describe the file, directory or volume
label entry that they point to. There's an 11-character field for the
8.3 fiole name, a cluster address field to point to the start of the
file, fields for the date and time, and so on.

One of these fields holds a set of loose bits that flag something
about the file, label, directory or (after Win95) Long File Name.

These bit flags are called "attributes", and they include:
- read-only
- hidden
- system
- volume label
- directory
- archived

You can use the Attrib command to set and clear some, but not all, of
these, e.g. Attrib +r Test.txt would set Test.txt to be read-only, and
Attrib -s -h -r C:\Boot.ini would expose that file for editing.

The trouble is, there aren't any commands to set the Volume or
Directory attribute for an entry, because these are managed by the
machine and arbitrary changes to them can cause disasterous data loss.

So to flip the Directory bit, you have to go beneath the OS, and edit
the raw disk directly. There's absolutely no safety net there, it's
entirely up to you not to (say) overwrite the starting cluster address
or do other damage that can make things considerably worse.

You also need tools to do this stuff, and they don't come with the OS.
I use DiskEdit from DOS mode, but DiskEdit is feeware, being part of
Norton Utilities (I'm using the one from NU95).

I can't recall the offsets offhand, in case you want to do this from a
raw disk editor that doesn't at least show you directory entries as
such (as Diskedit does, for FATxx) but I can find that via Wikipedia
or similar, easily enough...

http://en.wikipedia.org/wiki/File_Allocation_Table#Directories

Scroll down, and you'll see this; offset 0x0B is attribute bitfield...

1 File Attributes
The first byte can have the following special values:

Bit Mask Description
0 0x01 Read Only
1 0x02 Hidden
2 0x04 System
3 0x08 Volume Label
4 0x10 Subdirectory
5 0x20 Archive
6 0x40 Device (internal use only, never found on disk)
7 0x80 Unused

An attribute value of 0x0F is used to designate a long file name
entry.

....so you'd want to flip bit 4 (of 0..7) i.e. er... 1, 2, 4, 8, 16 ...
add 16 (10 in hex) to value if that has that bit cleared, in order to
change that directory entry from "file" to "directory".

The difficulty is going to be finding those entries that you want to
fix. If the 8.3 name is unique, then you could search raw disk for
it, but you must be careful you are really in a dir and not something
else. It's obvious in DiskEdit if the offsets don't make sense;
harder if looking at raw hex.

A tech with general skills may pull this off if he or she has the
material (this thread, that Wikipedia reference) and the tools and the
temprament, even if they aren't file system boffins.

To do the same thing in NTFS, may be tricky - I don't know whether the
directory entry "shape" is the same, and rather suspect it isn't.

If there are easier tools to do this, I'd love to know about them -
but I'd not trust this job to an automated "fixer-upper" like ChkDsk.



--------------- ---- --- -- - - - -
Saws are too hard to use.
Be easier to use!
--------------- ---- --- -- - - - -
.



Relevant Pages

  • Re: what to do when XP scan disk converted folder to file?
    ... I remember vaguely having delt with Disk Edit many many years ago ... Directory attribute for an entry, because these are managed by the ... I use DiskEdit from DOS mode, but DiskEdit is feeware, being part of ... raw disk editor that doesn't at least show you directory entries as ...
    (microsoft.public.windowsxp.hardware)
  • Re: Perform Thru/Go to vs. Perform - Compile Speed
    ... >that is possible is PERFORM x, where x is a paragraph label. ... Yet another advantage is that ENTRY supports recursion. ...
    (comp.lang.cobol)
  • Re: Trouble with updating a label
    ... I have an entry widget which defines a text variable. ... return in that widget a label widget should get updated. ... this variable will be at global scope. ...
    (comp.lang.tcl)
  • Re: Return from function.
    ... float. ... procedures optionally to have additional entry points defined by entry statements. ... If a procedure or entry statement does not have a returns option, then the initial letter of the each label determines the attributes to which a returned value will be converted if the procedure is invoked using that label. ... With the F, Optimizing, and Enterprise compilers, the entry point used is recorded upon procedure invocation and if a value returning return statement is executed, the value of the returned expression is converted to the return attributes of the entry point that was used. ...
    (comp.lang.pl1)
  • Trouble with updating a label
    ... I have an entry widget which defines a text variable. ... return in that widget a label widget should get updated. ... set displayvalue 0.1 ...
    (comp.lang.tcl)

Loading