FireBirdLib - Topfield TMS PVR TAP Programming Library
GetApplVer.c
Go to the documentation of this file.
1#include <string.h>
2#include "libFireBird.h"
3
4char *GetApplVer(void)
5{
7
8 void (*Appl_SetApplVer)(char *);
9
10 char *osdOutBuf;
11 static char FWVersion[20];
12 dword roStart, roEnd;
13 byte *p;
14 dword SectionIndex;
15
16 if(FWVersion[0])
17 {
18 TRACEEXIT();
19 return FWVersion;
20 }
21
22 osdOutBuf = (void*)FIS_vOsdOutBuf();
23 Appl_SetApplVer = (void*)FIS_fwAppl_SetApplVer();
24
25 if(!osdOutBuf || !Appl_SetApplVer)
26 {
27 TRACEEXIT();
28 return NULL;
29 }
30
31 //According to the disass listing, the char* parameter is not used.
32 //The output is buffered into the 0x1000 bytes buffer _osdOutBuf.
33 osdOutBuf[0] = '\0';
34 Appl_SetApplVer(NULL);
35 strcpy(FWVersion, osdOutBuf);
36
38 {
39 SectionIndex = ELFGetSectionIndex(".rodata");
40 if(SectionIndex)
41 {
42 ELFGetSectionAddress(SectionIndex, &roStart, &roEnd);
43 roEnd += roStart;
44 p = (byte*)roStart;
45 while(p < (byte*)roEnd)
46 {
47 //a typical date: Dec 19 2013
48 //the first digit of the day is a space instead of a 0
49 if((p[3] == ' ') && (p[6] == ' ') && (p[7] == '2') && (p[8] == '0') && (((p[9] == '0')) || ((p[9] == '1'))))
50 {
51 strcat(FWVersion, " (");
52 strcat(FWVersion, p);
53 strcat(FWVersion, ")");
54 break;
55 }
56 p +=4;
57 }
58 }
59 }
60 ELFCleanup();
61
62 TRACEEXIT();
63 return FWVersion;
64}
void ELFCleanup(void)
Definition: ELFCleanup.c:5
bool ELFGetSectionAddress(dword SectionIndex, dword *SectionAddress, dword *SectionSize)
dword ELFGetSectionIndex(const char *SectionName)
bool ELFOpenFile(const char *FileName)
Definition: ELFOpenFile.c:12
bool ELFReadELFHeader(void)
bool ELFReadSectionHeaders(void)
bool ELFReadShstrtabSection(void)
dword FIS_fwAppl_SetApplVer(void)
dword FIS_vOsdOutBuf(void)
Definition: FIS_vOsdOutBuf.c:3
char * GetApplVer(void)
Definition: GetApplVer.c:4
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243