FireBirdLib - Topfield TMS PVR TAP Programming Library
ELFReadShstrtabSection.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include "
ELF.h
"
3
#include "
FBLib_elf.h
"
4
5
bool
ELFReadShstrtabSection
(
void
)
6
{
7
TRACEENTER
();
8
9
Elf32_Shdr
*pshstrtabSH = NULL;
//Shortcut to speed up access to the .shstrtab section header
10
11
//Read the .shstrtab section. It contains a "string database" with the names of all sections
12
if
(
ELFHeader
->
e_shstrndx
>=
ELFHeader
->
e_shnum
)
13
{
14
TRACEEXIT
();
15
return
FALSE;
16
}
17
18
pshstrtabSH = &
SectionHeaders
[
ELFHeader
->
e_shstrndx
];
19
if
(pshstrtabSH->
sh_type
!=
SHT_STRTAB
)
20
{
21
TRACEEXIT
();
22
return
FALSE;
23
}
24
25
if
(!(
shstrtab
= TAP_MemAlloc(pshstrtabSH->
sh_size
)))
26
{
27
TRACEEXIT
();
28
return
FALSE;
29
}
30
31
lseek(
fTAP
, pshstrtabSH->
sh_offset
,
SEEK_SET
);
32
if
(read(
fTAP
,
shstrtab
, pshstrtabSH->
sh_size
) != (
int
)pshstrtabSH->
sh_size
)
33
{
34
TRACEEXIT
();
35
return
FALSE;
36
}
37
38
39
TRACEEXIT
();
40
return
TRUE;
41
}
SectionHeaders
Elf32_Shdr * SectionHeaders
Definition:
ELFOpenFile.c:7
shstrtab
char * shstrtab
Definition:
ELFOpenFile.c:8
ELFHeader
Elf32_Ehdr * ELFHeader
Definition:
ELFOpenFile.c:6
fTAP
int fTAP
Definition:
ELFOpenFile.c:5
ELFReadShstrtabSection
bool ELFReadShstrtabSection(void)
Definition:
ELFReadShstrtabSection.c:5
ELF.h
SHT_STRTAB
#define SHT_STRTAB
Definition:
ELF.h:13
FBLib_elf.h
SEEK_SET
#define SEEK_SET
Definition:
libFireBird.h:1875
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
Elf32_Ehdr::e_shnum
Elf32_Half e_shnum
Definition:
ELF.h:44
Elf32_Ehdr::e_shstrndx
Elf32_Half e_shstrndx
Definition:
ELF.h:45
Elf32_Shdr
Definition:
ELF.h:49
Elf32_Shdr::sh_offset
Elf32_Off sh_offset
Definition:
ELF.h:54
Elf32_Shdr::sh_size
Elf32_Word sh_size
Definition:
ELF.h:55
Elf32_Shdr::sh_type
Elf32_Word sh_type
Definition:
ELF.h:51
elf
ELFReadShstrtabSection.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3