Il a encore grossi, je suppose ?
Qu'est-ce que ça fait si vous compilez et exécutez le programme suivant, que certains d'entre vous ont déjà, sur la 3.01 et la 3.10:
#define MIN_AMS 204
#include <tigcclib.h> // Include All Header Files
// The prototype of LOC_formatDate is still wrong in TIGCC due to a bug in
// UpdateInclude.exe !
#undef LOC_formatDate
// DecodeCertTimestamp and ROM_CALL_504 were previously unknown.
#define DecodeCertTimestamp _rom_call(void,(CERT_FIELD*,__pushort,__pushort,__pushort,__pushort,__pushort,__pushort),58E)
#define ROM_CALL_504 _rom_call(short,(CERT_FIELD*,unsigned short,unsigned short,CERT_FIELD*),504)
#define LOC_formatDate _rom_call(void,(const char *,short,short,short,char[]),590)
typedef HANDLE AppID;
#define OO_APP_NAME 2UL
#define MAX_APPLET_NAME_SIZE (8)
typedef struct
{
unsigned long magic;
unsigned char name[MAX_APPLET_NAME_SIZE];
unsigned char zeros[24];
unsigned short flags;
unsigned long dataLen;
unsigned long codeOffset;
unsigned long initDataOffset;
unsigned long initDataLen;
unsigned long optlen;
} AppHdr;
typedef enum
{
ACB_BUILTIN = 0x0001,
ACB_INSTALLED = 0x0002,
ACB_LOCALIZER = 0x0004,
ACB_LOCK = 0x0008,
ACB_JT_VERSION = 0x0010,
ACB_SELECTED = 0x0020,
ACB_COLLAPSE = 0x0800,
ACB_BG = 0x1000,
ACB_COMPRESS = 0x4000,
ACB_DELETE = 0x8000
} ACB_Flags;
typedef struct SACB
{
ACB_Flags flags;
AppID myID;
AppID next;
AppID prev;
unsigned long publicstorage;
const AppHdr *appHeader;
const unsigned char *certhdr;
pFrame appData;
} ACB;
typedef enum {OO_RW=0, OO_RO=1,
OO_SEQ=0, OO_KEYED=2} OO_Flags;
typedef struct
{
unsigned long key;
void *value;
} OO_Attr;
typedef struct SFrameHdr
{
pFrame parent;
pFrame prototype;
OO_Flags flags;
unsigned long first;
unsigned long count;
} OO_Hdr;
typedef struct SFrame
{
OO_Hdr head;
union
{
void * value[65000];
OO_Attr pair[65000];
} attr;
} Frame;
// Main Function
void _main(void)
{
unsigned short s1, s2, s3, s4, s5, s6;
unsigned char string[80];
unsigned char string2[20];
CERT_FIELD field,field2;
CFILE context;
HANDLE h;
void *ptr, *name;
h = OO_firstACB;
push_END_TAG();
while (h) {
ptr = (void*)HeapDeref(h);
// We want only installed FlashApps.
if ((((ACB*)ptr)->flags & (ACB_INSTALLED|ACB_BUILTIN)) == ACB_INSTALLED) {
// Open the certificate fields of that FlashApp.
ptr = (void*)(((ACB*)ptr)->certhdr);
if (ptr) {
copen(&context,ptr,(unsigned long)FlashMemoryEnd-(unsigned long)ptr);
// Fill field.
cread(&context,&field);
// Use field to search for fields 0x320 (timestamp) and its subfield 0x900.
if (ROM_CALL_504(&field,0x320,0x900,&field2)) {
// Never seen otherwise, but...
if (field2.Len == 4) {
// Get the name of that FlashApp.
if (OO_CondGetAttr((pFrame)(((ACB*)HeapDeref(h))->appData),OO_APP_NAME,&name)) {
push_END_TAG();
// The name I gave this function says everything...
DecodeCertTimestamp(&field2,&s1,&s2,&s3,&s4,&s5,&s6);
// Use LOC_getLocalDateFormat so as to output
// the date in the format the user usually uses.
LOC_formatDate(LOC_getLocalDateFormat(),s1,s2,s3,string2);
// Print decoded timestamp completely.
sprintf(string,"%s, %02huh %02hum %02hus",
string2,s4,s5,s6);
push_zstr(string);
// Certificate fields are not necessarily
// aligned...
push_ulong_to_integer(cgetfnl(&field2));
push_zstr(name);
push_LIST_TAG();
}
}
}
}
}
h = OO_NextACB(h);
}
// Now, push the AMS timestamp.
ptr = CertificateMemory+0x2000; // TIGCC lacks constant CERT_SIZE == (8*1024).
copen(&context,ptr,(unsigned long)FlashMemoryEnd-(unsigned long)ptr);
// Fill field.
cread(&context,&field);
// Use field to search for fields 0x320 (timestamp) and its subfield 0x900.
if (ROM_CALL_504(&field,0x320,0x900,&field2)) {
if (field2.Len == 4) {
push_END_TAG();
// The name I gave this function says everything...
DecodeCertTimestamp(&field2,&s1,&s2,&s3,&s4,&s5,&s6);
// Use LOC_getLocalDateFormat so as to output
// the date in the format the user usually uses.
LOC_formatDate(LOC_getLocalDateFormat(),s1,s2,s3,string2);
// Print decoded timestamp completely.
sprintf(string,"%s, %02huh %02hum %02hus",
string2,s4,s5,s6);
push_zstr(string);
// Certificate fields are not necessarily aligned...
push_ulong_to_integer(cgetfnl(&field2));
push_zstr("AMS");
push_LIST_TAG();
}
}
push_LIST_TAG();
}
