vfs: check userland buffers before reading them.
[haiku.git] / headers / private / storage / ResourcesDefs.h
blob68886ddbf2f1f057608cc2f9258b836230940759
1 // ResourcesDefs.h
3 #ifndef _DEF_RESOURCES_H
4 #define _DEF_RESOURCES_H
6 #include <SupportDefs.h>
8 // x86 resource file constants
9 const char kX86ResourceFileMagic[4] = { 'R', 'S', 0, 0 };
10 const uint32 kX86ResourcesOffset = 0x00000004;
12 // PPC resource file constants
13 const char kPPCResourceFileMagic[4] = { 'r', 'e', 's', 'f' };
14 const uint32 kPPCResourcesOffset = 0x00000028;
16 // ELF file related constants
17 const uint32 kELFMinResourceAlignment = 32;
19 // the unused data pattern
20 const uint32 kUnusedResourceDataPattern[3] = {
21 0xffffffff, 0x000003e9, 0x00000000
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];
34 const uint32 kResourcesHeaderMagic = 0x444f1000;
35 const uint32 kResourceIndexSectionOffset = 0x00000044;
36 const uint32 kResourceIndexSectionAlignment = 0x00000600;
37 const uint32 kResourcesHeaderSize = 68;
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;
53 const uint32 kUnknownResourceSectionSize = 0x00000168;
54 const uint32 kResourceIndexSectionHeaderSize = 132;
57 // an entry of the index table
58 struct resource_index_entry {
59 uint32 rie_offset;
60 uint32 rie_size;
61 uint32 rie_pad;
64 const uint32 kResourceIndexEntrySize = 12;
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];
75 const uint32 kMinResourceInfoSize = 10;
78 // a resource info block
79 struct resource_info_block {
80 type_code rib_type;
81 resource_info rib_info[1];
84 const uint32 kMinResourceInfoBlockSize = 4 + kMinResourceInfoSize;
87 // the structure separating resource info blocks
88 struct resource_info_separator {
89 uint32 ris_value1;
90 uint32 ris_value2;
93 const uint32 kResourceInfoSeparatorSize = 8;
96 // the end of the info table
97 struct resource_info_table_end {
98 uint32 rite_check_sum;
99 uint32 rite_terminator;
102 const uint32 kResourceInfoTableEndSize = 8;
105 #endif // _DEF_RESOURCES_H