The following HELIOS structure to maintain the desktop is in the first 512 bytes of every file in the HELIOS “.rsrc” directory. To create a new file, you will need to zero the first 512 bytes and then fill in the desired parameters. Mandatory parameters are the magic and version numbers, if these are not set, the “.rsrc” file will not be accepted by the file server. The finderInfo field contains type and creator and is described in “Inside Macintosh”, in the chapter about the file manager.
The createTime and backupTime fields are standard UNIX time values in seconds since Jan 1, 1970 midnight. The attr field contains the file flags (locked, protected), which are also described in “Inside Macintosh”. The openMax field can be used to limit the number of concurrent opens of a file, if zero, there is no limit. If this is used with an application, you can limit the number of concurrent users of an application. But to enforce the limit, you should also set the “copy protect” bit in the attr field to avoid local copies.
Old EtherShare versions wrote the complete structure including the comment. The new EtherShare file server only writes the FileInfo structure – only if the user sets the comment field using the Mac OS 9 Finder information window, the XFileInfo structure is written. This might cause slight incompatibilities if the file has only a data fork but no resource fork. Old programs might expect to read sizeof(XFileInfo) bytes from the “.rsrc” area while HELIOS only wrote sizeof(FileInfo) bytes. This is no problem if the file has data in its resource fork, as the application will then read zeros for the comment field.
The id field contains the file ID if the appropriate entry is a file, or a directory ID if the entry is a directory. Setting the id to zero causes the file server to allocate a file / directory ID upon first seeing this file / directory.
#define VERSION 0x0102
#define MAGIC 0x3681093
#define INFOLEN 32
typedef struct FileInfo {
uint32 magic;
uint32 serno; /* written only, never read */
uint16 version;
uint16 attr; /* invisible... */
uint16 openMax; /* max number of opens */
uint16 filler0;
uint32 backupCleared; /* time backup bit cleared */
uint32 id; /* dir/file id */
uint32 createTime; /* unix format */
uint32 backupTime; /* unix format */
uint8 finderInfo[INFOLEN];
} FileInfo;
typedef struct XFileInfo {
FileInfo fi;
uint8 shortFileName[12 + 1 + 3]; /* not used anymore */
uint8 longFileName[32 + 1 + 3]; /* not used anymore */
uint8 comment[199 + 1];
} XFileInfo;