1/* -*- c -*- */
2/*****************************************************************************/
3/*  LibreDWG - free implementation of the DWG file format                    */
4/*                                                                           */
5/*  Copyright (C) 2018-2019 Free Software Foundation, Inc.                   */
6/*                                                                           */
7/*  This library is free software, licensed under the terms of the GNU       */
8/*  General Public License as published by the Free Software Foundation,     */
9/*  either version 3 of the License, or (at your option) any later version.  */
10/*  You should have received a copy of the GNU General Public License        */
11/*  along with this program.  If not, see <http://www.gnu.org/licenses/>.    */
12/*****************************************************************************/
13
14/*
15 * r2004_file_header.spec: DWG file header specification
16 * the encrypted part.
17 * written by Reini Urban
18 */
19
20#include "spec.h"
21
22  // to be done after encryption, resp. before when encoding
23  SINCE (R_2004) {
24    IF_ENCODE_FROM_EARLIER {
25      FIELD_VALUE (header_size) = 108;
26      FIELD_VALUE (x04) = 4;
27      FIELD_VALUE (x20) = 0x20;
28      FIELD_VALUE (x80) = 0x80;
29      FIELD_VALUE (x40) = 0x40;
30      //??
31      FIELD_VALUE (last_section_id) = 19;
32      FIELD_VALUE (numsections) = 17;
33      FIELD_VALUE (section_map_id) = 19;
34      FIELD_VALUE (section_array_size) = 19;
35    }
36  }
37  FIELD_TFF (file_ID_string, 12, 0) //pre-allocated: "AcFssFcAJMB"
38  FIELD_RLx (header_address, 0);
39  FIELD_RL (header_size, 0);
40  FIELD_RL (x04, 0);
41
42  FIELD_RLd (root_tree_node_gap, 0);   // @0x18 - compr_len?
43  FIELD_RLd (lowermost_left_tree_node_gap, 0);   // @0x1c
44  FIELD_RLd (lowermost_right_tree_node_gap, 0);  // @0x20 - start of 2007_file_header
45  FIELD_RL (unknown_long, 0);         // =1
46  FIELD_RL (last_section_id, 0);      // @0x28 =0x13
47  FIELD_RLL (last_section_address, 0);// @0x2c =0x9c80
48  FIELD_RLL (second_header_address, 0);// @0x34 =0x984b
49  FIELD_RL (numgaps, 0);              // @0x3c =0
50  FIELD_RL (numsections, 0);          // @0x40 =0x11
51  FIELD_RL (x20, 0);        	      // @0x44 =0x20
52  FIELD_RL (x80, 0);                  // @0x48 =0x80
53  FIELD_RL (x40, 0);                  // @0x4c =0x40
54  FIELD_RL (section_map_id, 0);       // @0x50 =0x13
55  FIELD_RLL (section_map_address, 0); // @0x54 (+ 0x100) =0x97a0
56  FIELD_RLd (section_info_id, 0);     // @0x5c
57  FIELD_RL (section_array_size, 0);   // @0x60 =0x13
58  FIELD_RL (gap_array_size, 0);       // @0x64 =0
59  FIELD_RLx (crc32, 0);               // @0x68
60  //end of encrypted header // @108 0x6c
61
62  // well, the padding is also encrypted, but ODA didn't grok that.
63  // 12 byte encrypted via 0
64  FIELD_TFFx (padding, (int)sizeof(FIELD_VALUE (padding)), 0) // @120
65
66