mrw
Member
Have you ever tried to copy a folder or file only to be stopped by a dialog that looks like one of these on System 6?
(Alert that says: "That contains items that cannot be duplicated or copied.")
(Alert that says: "That cannot be duplicated or copied.")
..or these on System 7?
(Alert that says: "Some selected items cannot be copied, because of copy protection. Do you want to continue copying?")
(Alert that says: '"Macintosh Pascal" cannot be copied, because of copy protection.")
I ran into this trying to use the Macintosh Pascal 1.0 disk image I downloaded from Macintosh Garden. I managed to defeat this restriction so I could code in 1985 style (and upload a usable SIT to the Garden).
Here's what I learned: a copy protection bit causes all of these errors, but it's not the bozo bit!
The Bozo Bit and Finder Flags
Apple included an infamously weak copy protection scheme known as the bozo bit that only early versions of the system software honored. Stephen Chernicoff's first volume of Macintosh Revealed defines it unkindly on page 546:
Finder flags are part of the FInfo structure that tracks important file metadata. Apple documented it as a public API at least as early as 1985's Inside Macintosh Volume II (II-84):
What about the other 14 bits? An enterprising programmer would only have to use GetFInfo and SetFInfo to find out what they did, and it turns out that bit 11 marks a file as uncopyable (Chernicoff' p 360) - the bozo bit. I suppose Apple hoped that Macintosh programmers would be more likely to pay for software than the average user. Oops.
By the time System 7.0 rolled around, the THINK Reference Inside Macintosh commentary for FInfo included a complete explanation of what each bit meant. But System 6's Finder flags meant different things!
I underlined the "BOZO (don't copy)" bit in the System 6 and earlier Finder flags description above. You can see it's 0x0800 (2048), or bit 11.
In System 7.0, however...
Bit 11 marks a file as "stationery"! Inside Macintosh: Files agrees (1-41):
It seems clear from Chernicoff, THINK Reference, and even Inside Macintosh that the "bozo bit" died with System 7. What's the source of those "can't copy" alerts in System 6, which shouldn't care about the bozo bit, and System 7, which didn't know about it?
The copy protection bit and file flags
The FInfo structure documented above is an in-memory representation of file metadata. But files live on disks when the power's off. How is that metadata stored on disk?
As early as MFS, HFS' predecessor, Macintosh stored metadata in a file directory near the start of a volume. Remember that MFS wasn't hierarchical; folders appeared in the Finder, but not in file dialogs, and you couldn't create them - you got one "Empty Folder" that would reappear if you renamed it.
Inside Macintosh Volume II explains graphically on II-120:
I'll save a deeper discussion of MFS for a different post; for this one, it's important to know:
I underlined the first byte of the directory entry definition, flFlags, or the file flags. These describe things like if the entry is used (I suppose in case of a soft delete) and if the file is locked. Once again, what about the other 6 bits?
But first, where are the Finder flags? It turns out they're buried in the 16 bytes of flUsrWds, which consists of:
So much fo Finder flags. Clearly anything in flFlags must be distinct metadata. Maybe there's a copy protection bit in there?
Jörg Langowski determined that there is and wrote about it in a very early issue of MacTech:
If it were 1985 I would have braved Fedit, but I wasn't keen on breaking my PowerBook 100's ZuluSCSI drive image, even if it is an easy laptop to open up.
Instead, wrote a Python script based on the descriptions in that MacTech article and Inside Macintosh Volume II that can rewrite the entries on an MFS formatted disk image, removing copy protection bit 6 from the file flags. It traded clarity for verbosity - hopefull it's comprehensible even if you don't know (or like) Python.
The script prints out interesting information about each entry, and wouldn't you know:
Macintosh Pascal
copy protected? True
UserWords(file_type=b'APPL', file_creator=b'PASC', finder_flags=FinderFlags(locked=False, invisible=False, bundle=True, system=False, bozo=False, busy=False, changed=False, inited=True, private=0, original=8448), word_2=128, word_3=320, word_4=0)
The Macintosh Pascal program itself had bit 6 in its file flags set, but not bit 11 in its Finder flags. The patched disk image allowed me to copy Macintosh Pascal off the disk on Systems 6 and System 7!
There's more to say about this:
(Alert that says: "That contains items that cannot be duplicated or copied.")
(Alert that says: "That cannot be duplicated or copied.")
..or these on System 7?
(Alert that says: "Some selected items cannot be copied, because of copy protection. Do you want to continue copying?")
(Alert that says: '"Macintosh Pascal" cannot be copied, because of copy protection.")
I ran into this trying to use the Macintosh Pascal 1.0 disk image I downloaded from Macintosh Garden. I managed to defeat this restriction so I could code in 1985 style (and upload a usable SIT to the Garden).
Here's what I learned: a copy protection bit causes all of these errors, but it's not the bozo bit!
The Bozo Bit and Finder Flags
Apple included an infamously weak copy protection scheme known as the bozo bit that only early versions of the system software honored. Stephen Chernicoff's first volume of Macintosh Revealed defines it unkindly on page 546:
and goes into greater detail on page 360:bozo bit - A Finder flag that prevents a file from being copied; named for the Apple programmer who invented it.
One reason for its ignominious name might be that Apple gave up on it by 1985 when they released System 2.1 with Finder 5.0. But a more likely reason is its location: the bozo bit is a finder flag.A 1 in this bit prevents the file from being copied: a protection scheme so feeble that only a bozo would think of it. Recent versions of the Finder (version 5.0 or greater) don't even
pay any attention to this bit.
Finder flags are part of the FInfo structure that tracks important file metadata. Apple documented it as a public API at least as early as 1985's Inside Macintosh Volume II (II-84):
and (on II-85):A file directory on a volume lists information about a ll the files on the volume. The information used by the Finder is contained in a data structure of type Flnfo:
TYPE Finfo = RECORD
fdType: OSType; {file type}
fdCreator: OSType; {file's creator}
fdFlags: Integer; {flags}
fdLocation: Point; {file's location}
fdFldr: INTEGER; {file's window}
END;
FdFlags indicates whether the file's icon is invisible, whether the file has a bundle, and other characteristics used internally by the Finder:
Bit Meaning
13 Set if file has a bundle
14 Set if file's icon is invisible
What about the other 14 bits? An enterprising programmer would only have to use GetFInfo and SetFInfo to find out what they did, and it turns out that bit 11 marks a file as uncopyable (Chernicoff' p 360) - the bozo bit. I suppose Apple hoped that Macintosh programmers would be more likely to pay for software than the average user. Oops.
By the time System 7.0 rolled around, the THINK Reference Inside Macintosh commentary for FInfo included a complete explanation of what each bit meant. But System 6's Finder flags meant different things!
The meaning of the flag bits in this structure [FDInfo] have changed significantly in System 7.0. Make sure you look at both diagrams below. The first one shows the old flags, and the second shows the new flags.
I underlined the "BOZO (don't copy)" bit in the System 6 and earlier Finder flags description above. You can see it's 0x0800 (2048), or bit 11.
In System 7.0, however...
Bit 11 marks a file as "stationery"! Inside Macintosh: Files agrees (1-41):
If your application supports stationery, it should check the stationery bit in the Finder flags to determine whether to treat the selected file as stationery.
It seems clear from Chernicoff, THINK Reference, and even Inside Macintosh that the "bozo bit" died with System 7. What's the source of those "can't copy" alerts in System 6, which shouldn't care about the bozo bit, and System 7, which didn't know about it?
The copy protection bit and file flags
The FInfo structure documented above is an in-memory representation of file metadata. But files live on disks when the power's off. How is that metadata stored on disk?
As early as MFS, HFS' predecessor, Macintosh stored metadata in a file directory near the start of a volume. Remember that MFS wasn't hierarchical; folders appeared in the Finder, but not in file dialogs, and you couldn't create them - you got one "Empty Folder" that would reappear if you renamed it.
Inside Macintosh Volume II explains graphically on II-120:
I'll save a deeper discussion of MFS for a different post; for this one, it's important to know:
- The volume information section indicates where to find file directory entries;
- Each file has its own directory entry with its metadata, including Finder flags and where the actual contents exist in the file contents section
I underlined the first byte of the directory entry definition, flFlags, or the file flags. These describe things like if the entry is used (I suppose in case of a soft delete) and if the file is locked. Once again, what about the other 6 bits?
But first, where are the Finder flags? It turns out they're buried in the 16 bytes of flUsrWds, which consists of:
- 4 bytes of file type code;
- 4 bytes of creator code;
- 1 16-bit integer word of Finder flags (2 bytes);
- 3 remaining words (6 bytes)
So much fo Finder flags. Clearly anything in flFlags must be distinct metadata. Maybe there's a copy protection bit in there?
Jörg Langowski determined that there is and wrote about it in a very early issue of MacTech:
Perfect! Now, what can we do about it?The first part of the entry tells the system several parameters it needs to know about the file. ‘Attributes’ [flFlags] contains 8 bits of file attributes. For instance, Bit 7 set means that the file is open, bit 0 set means it is software locked, . Bit 6 is the copy protect bit. If you reset this one to zero, you will be able to copy a ‘protected’ file by dragging the icon.
If it were 1985 I would have braved Fedit, but I wasn't keen on breaking my PowerBook 100's ZuluSCSI drive image, even if it is an easy laptop to open up.
Instead, wrote a Python script based on the descriptions in that MacTech article and Inside Macintosh Volume II that can rewrite the entries on an MFS formatted disk image, removing copy protection bit 6 from the file flags. It traded clarity for verbosity - hopefull it's comprehensible even if you don't know (or like) Python.
The script prints out interesting information about each entry, and wouldn't you know:
Macintosh Pascal
copy protected? True
UserWords(file_type=b'APPL', file_creator=b'PASC', finder_flags=FinderFlags(locked=False, invisible=False, bundle=True, system=False, bozo=False, busy=False, changed=False, inited=True, private=0, original=8448), word_2=128, word_3=320, word_4=0)
The Macintosh Pascal program itself had bit 6 in its file flags set, but not bit 11 in its Finder flags. The patched disk image allowed me to copy Macintosh Pascal off the disk on Systems 6 and System 7!
There's more to say about this:
- What about HFS? HFS appears to honor this flag as well, though I'm not ready to publish my changes to machfs that help demonstrate this;
- Does anybody care about a Python library to manipulate MFS images? If so, I've got a good start that I can turn into something;
- What about the rest of Macintosh Pascal's copy protection? It's interesting! It turns out there are hidden files with resources that Macintosh Pascal must load on start up. If you can copy those along with Macintosh Pascal, then you've got a working program.