xref: /haiku/headers/private/storage/ResourcesDefs.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 // ResourcesDefs.h
2 
3 #ifndef _DEF_RESOURCES_H
4 #define _DEF_RESOURCES_H
5 
6 #include <SupportDefs.h>
7 
8 // x86 resource file constants
9 const char		kX86ResourceFileMagic[4]		= { 'R', 'S', 0, 0 };
10 const uint32	kX86ResourcesOffset				= 0x00000004;
11 
12 // PPC resource file constants
13 const char		kPPCResourceFileMagic[4]		= { 'r', 'e', 's', 'f' };
14 const uint32	kPPCResourcesOffset				= 0x00000028;
15 
16 // ELF file related constants
17 const uint32	kELFMinResourceAlignment		= 32;
18 
19 // the unused data pattern
20 const uint32	kUnusedResourceDataPattern[3]	= {
21 	0xffffffff, 0x000003e9, 0x00000000
22 };
23 
24 
25 // the resources header
26 struct resources_header {
27 	uint32	rh_resources_magic;
28 	uint32	rh_resource_count;
29 	uint32	rh_index_section_offset;
30 	uint32	rh_admin_section_size;
31 	uint32	rh_pad[13];
32 };
33 
34 const uint32	kResourcesHeaderMagic			= 0x444f1000;
35 const uint32	kResourceIndexSectionOffset		= 0x00000044;
36 const uint32	kResourceIndexSectionAlignment	= 0x00000600;
37 const uint32	kResourcesHeaderSize			= 68;
38 
39 
40 // the header of the index section
41 struct resource_index_section_header {
42 	uint32	rish_index_section_offset;
43 	uint32	rish_index_section_size;
44 	uint32	rish_unused_data1;
45 	uint32	rish_unknown_section_offset;
46 	uint32	rish_unknown_section_size;
47 	uint32	rish_unused_data2[25];
48 	uint32	rish_info_table_offset;
49 	uint32	rish_info_table_size;
50 	uint32	rish_unused_data3;
51 };
52 
53 const uint32	kUnknownResourceSectionSize		= 0x00000168;
54 const uint32	kResourceIndexSectionHeaderSize	= 132;
55 
56 
57 // an entry of the index table
58 struct resource_index_entry {
59 	uint32	rie_offset;
60 	uint32	rie_size;
61 	uint32	rie_pad;
62 };
63 
64 const uint32	kResourceIndexEntrySize			= 12;
65 
66 
67 // a resource info
68 struct resource_info {
69 	int32	ri_id;
70 	int32	ri_index;
71 	uint16	ri_name_size;
72 	char	ri_name[1];
73 };
74 
75 const uint32	kMinResourceInfoSize			= 10;
76 
77 
78 // a resource info block
79 struct resource_info_block {
80 	type_code		rib_type;
81 	resource_info	rib_info[1];
82 };
83 
84 const uint32	kMinResourceInfoBlockSize		= 4 + kMinResourceInfoSize;
85 
86 
87 // the structure separating resource info blocks
88 struct resource_info_separator {
89 	uint32	ris_value1;
90 	uint32	ris_value2;
91 };
92 
93 const uint32	kResourceInfoSeparatorSize		= 8;
94 
95 
96 // the end of the info table
97 struct resource_info_table_end {
98 	uint32	rite_check_sum;
99 	uint32	rite_terminator;
100 };
101 
102 const uint32	kResourceInfoTableEndSize		= 8;
103 
104 
105 #endif	// _DEF_RESOURCES_H
106 
107 
108