-
Notifications
You must be signed in to change notification settings - Fork 0
/
applebackup.ksy
288 lines (288 loc) · 8.46 KB
/
applebackup.ksy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
meta:
id: apple_backup
title: Apple Backup segmented data file format
application: Apple Backup 1.00 - 1.04
license: MIT
endian: be
doc: |
In the early- to mid- 1990s, Apple produced their Macintosh Performa line of computers.
These computers did not come with install disks, but instead with software pre-installed
on the hard disk, with an Apple Backup program that could be used to back the hard disk's
contents up to 1440KB floppy disks in 1414KB files named "Backup Disk #" where # was 1
through the last disk needed for a full drive backup.
These files had the Type/Creator codes of OBDa and OBBa.
Later versions of the Performa line came with Restore CDs that contained "Restore All Software"
and "Restore System Software" folders containing 1414KB files named "Data File #" -- where all
the required files resided in the same folder on the CD.
These files had the Type/Creatorcodes of OBDc and OBBa.
Both file types are flat data files as indicated in the struct below.
doc-ref: https://www.downtowndougbrown.com/2013/06/legacy-apple-backup-file-format-on-floppy-disks/
seq:
- id: backup_disk_header
type: backup_disk_header_type
size: 0x200
- id: boot_blocks
type: boot_blocks_type
size: 0x400
- id: file_data
type: file_data_seq
size: (backup_disk_header.total_size_used - 0x600)
types:
file_data_seq:
seq:
- id: file_data_contents
type: file_data_type
repeat: eos
backup_disk_header_type:
seq:
- id: version
doc: valid up to and including version 0x0104
type: u2
- id: magic
doc: identifies this file as an Apple Backup file
contents: 'CMWL'
- id: disk_number
doc: value is between 1 and total_disks
type: u2
- id: total_disks
doc: total number of disks used for the backup
type: u2
- id: backup_start_time
doc: Seconds since January 1, 1904 00:00:00 local time
type: u4
- id: backup_start_time2
doc: duplicate of backup_start_time
type: u4
- id: hard_drive_name_len
doc: Length of the name of the hard drive that was backed up
type: u1
- id: hard_drive_name
doc: Name of the hard drive that was backed up
type: str
size: hard_drive_name_len
encoding: ascii
- id: hard_drive_name_padding
doc: Remainder of Pascal Str31 address space
size: 31 - hard_drive_name_len
- id: total_file_size
doc: Total size of this restore file; typically 0x161800
type: u4
- id: total_size_used
doc: Number of bytes actually used in this restore file; usually 0x161800 except for last file
type: u4
- id: bdh_padding
doc: 0x00 padding to end of header
size: 0x1c6
boot_blocks_type:
doc: |
Standard SCSI boot blocks, begins with LK, shortly followed by
System, Finder, MacsBug, Dissasembler, StartUpScreen, Finder and Clipboard.
Theyare written to the hard drive by the restore program when the
System Folder is blessed as it's restored.
doc-ref: http://mcosre.sourceforge.net/docs/boot_blocks.html
seq:
- id: sig_bytes
contents: LK
- id: branch_code
type: u4
- id: boot_block_flags
type: u1
- id: boot_block_version_number
type: u1
- id: secondary_sound_and_video_pages
type: u2
- id: len_system_name
type: u1
- id: system_name
type: str
encoding: ascii
size: len_system_name
- id: system_name_padding
size: (0xf - len_system_name)
- id: len_finder_name
type: u1
- id: finder_name
type: str
encoding: ascii
size: len_finder_name
- id: finder_name_padding
size: (0xf - len_finder_name)
- id: len_debugger_name
type: u1
- id: debugger_name
type: str
encoding: ascii
size: len_debugger_name
- id: debugger_name_padding
size: (0x0f - len_debugger_name)
- id: len_dissassembler_name
type: u1
- id: dissassembler_name
type: str
encoding: ascii
size: len_dissassembler_name
- id: dissassembler_name_padding
size: (0x0f - len_dissassembler_name)
- id: len_start_up_screen_name
type: u1
- id: start_up_screen_name
type: str
encoding: ascii
size: len_start_up_screen_name
- id: start_up_screen_name_padding
size: (0x0f - len_start_up_screen_name)
- id: len_boot_up_name
type: u1
- id: boot_up_name
type: str
encoding: ascii
size: len_boot_up_name
- id: boot_up_name_padding
size: (0x0f - len_boot_up_name)
- id: len_clipboard_name
type: u1
- id: clipboard_name
type: str
encoding: ascii
size: len_clipboard_name
- id: clipboard_name_padding
size: (0x0f - len_clipboard_name)
- id: max_files
type: u2
- id: event_queue_size
type: u2
- id: heap_on_128k_mac
type: u4
- id: heap_on_256k_mac
type: u4
- id: heap_on_512k_mac # on all machines
type: u4
- id: boot_code
size: 0x376
file_data_type:
seq:
- id: file_version
#contents: [0x01, 0x00] or [0x01, 0x03]
type: u2
- id: file_magic
contents: 'RLDW'
#type: u4
- id: file_starts_on_disk
type: u2
- id: backup_start_time
doc: Seconds since January 1, 1904 00:00:00 local time
type: u4
- id: header_offset
type: u4
- id: file_name_len
type: u1
- id: file_name
type: str
size: file_name_len
encoding: ascii
- id: file_name_padding
size: 31 - file_name_len
- id: file_part
type: u2
- id: folder_flags
type: u1
- id: validity_flag
type: u1
- id: finfo_data
type: finfo_data_struct
if: folder_flags == 0
size: 16
- id: fxinfo_data
type: fxinfo_data_struct
if: folder_flags == 0
size: 16
- id: dinfo_data
type: dinfo_data_struct
if: folder_flags != 0
size: 16
- id: dxinfo_data
type: dxinfo_data_struct
if: folder_flags != 0
size: 16
- id: file_attributes
doc: HFileInfo.ioFlAttrib or DirInfo.ioFlAttrib from Mac Toolbox
type: u1
- id: file_reserved
type: u1
- id: creation_date
doc: Seconds since January 1, 1904 00:00:00 local time
type: u4
- id: modification_date
doc: Seconds since January 1, 1904 00:00:00 local time
type: u4
- id: data_fork_length
type: u4
- id: resource_fork_length
type: u4
- id: data_fork_in_file_length
type: u4
- id: resource_fork_in_file_length
type: u4
- id: full_file_path_length
type: u2
- id: full_file_path
type: str
encoding: ascii
size: full_file_path_length
- id: data_fork
size: data_fork_in_file_length
- id: resource_fork
size: resource_fork_in_file_length
- id: file_padding
size: (0x200 - ((0x70 + data_fork_in_file_length + resource_fork_in_file_length + full_file_path_length) % 0x200))
if: ((0x200 - ((0x70 + data_fork_in_file_length + resource_fork_in_file_length + full_file_path_length) % 0x200)) != 0x200) or (_parent._parent.backup_disk_header.disk_number - _parent._parent.backup_disk_header.total_disks == 0)
finfo_data_struct:
seq:
- id: fd_type
type: str
encoding: ascii
size: 4
- id: fd_creator
type: str
encoding: ascii
size: 4
- id: fd_flags_0_7
type: u1
- id: fd_flags_8_f
type: u1
- id: fd_location
type: u4
- id: fd_fldr
type: u2
fxinfo_data_struct:
seq:
- id: fd_icon_id
type: u2
- id: fd_unused
size: 8
- id: fd_comment
type: u2
- id: fd_put_away
type: u4
dinfo_data_struct:
seq:
- id: fr_rect
size: 8
- id: fr_flags
type: u2
- id: fr_location
type: u4
- id: fr_view
type: u2
dxinfo_data_struct:
seq:
- id: fr_scroll
type: u4
- id: fr_open_chain
type: u4
- id: fr_unused
size: 2
- id: fr_comment
type: u2
- id: fr_put_away
type: u4