| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Headers of ..MSG Files |
Hello Francisco!
Thursday September 05 1996 17:12, Francisco Caselin Nava wrote to All:
FN> Somebody knows the format of the headers and structure of *.MSG
FN> files?
If you mean not FidoNet MSG files but OS/2 ones here is the source of MSG
file decompiler. Hope it will help (I've stripped russian message text
leaving only the program source). And yes, it is compiled with Watcom.
-------------------------------8<------------------------------------
Ä SU.OS2.PROG (2:5020/620) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SU.OS2.PROG Ä
Msg : 801 of 1092 -699
From : Cyril Pertsev 2:5020/144.9 Sat 24 Aug 96 00:48
To : Vadim Yegorov Sat 24 Aug 96 06:30
Subj : MSG format
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Hi, Vadim!
08:06, Saturday August 17 1996, Vadim Yegorov wrote to All:
[...message text skipped...]
=== Cut ===
/*
* OS/2 Message file decompiler
* written by Cyril Pertsev, Jul 1996
*/
#include
#include
#include
#include
#define MSGF_SIG "\xFFMKMSGF"
long
fsize ( FILE *file )
{
long sav = ftell ( file ), size;
fseek ( file, 0, SEEK_END );
size = ftell ( file );
fseek ( file, sav, SEEK_SET );
return size;
}
void
main ( int argc, char *argv[] )
{
FILE *fmsgf, *fout;
char fname[ _MAX_FNAME + _MAX_EXT + 2 ];
char *buf, compname[4];
long filesz;
short nmsgs, *toc;
int i;
if ( argc < 2 )
{
fprintf ( stderr, "Usage %s \n", argv[0] );
exit ( 1 );
}
if ( ( fmsgf = fopen ( argv[1], "rb" ) ) == NULL )
{
fprintf ( stderr, "Error opening input file %s [%s]\n",
argv[1], strerror ( errno ) );
exit ( 1 );
}
if ( ( buf = malloc ( filesz = fsize ( fmsgf ) ) ) == NULL )
{
fprintf ( stderr, "Can't allocate buffer memory\n" );
exit ( 1 );
}
if ( fread ( buf, 1, filesz, fmsgf ) < filesz )
{
fprintf ( stderr, "Error reading input file [%s]\n",
strerror ( errno ) );
exit ( 1 );
}
if ( memcmp ( buf, MSGF_SIG, sizeof ( MSGF_SIG ) ) != 0 )
{
fprintf ( stderr, "This is not an OS/2 Message File\n" );
exit ( 2 );
}
_splitpath ( argv[1], NULL, NULL, fname, NULL );
strcat ( fname, ".cat" );
if ( ( fout = fopen ( fname, "wb" ) ) == NULL )
{
fprintf ( stderr, "Error opening output file %s [%s]\n",
fname, strerror ( errno ) );
exit ( 1 );
}
// Get the component name (3 bytes at offset 8), store it as a 32-bit int
*((long*)compname) = *((long*)&buf[8]);
compname[3] = 0;
// Get number of messages (2 bytes at offset 0B)
nmsgs = *((short*)(buf + 0x0B));
// Get table of contents (array of 16-bit ints at offset 1F)
// each entry in an array is an offset of a corresponding msg within the file
toc = (short*)(buf + 0x1F );
fprintf ( fout, "%s\r\n", compname );
for ( i = 0; i < nmsgs; i++ )
{
int msglen;
char *msg;
/* Get message length. If it is a last message, then length is until file end,
else it is a difference between consecutive TOC entries (quite obvious, eh?).
*/
msglen = ( i == nmsgs - 1 )? filesz - toc[i]: toc[i + 1] - toc[i];
msg = malloc ( msglen );
/* First char in a msg doesn't belong to a msg itself - it's a class of a
message, so we skip it. Thus this toc[i]+1 expr.
*/
memcpy ( msg, buf + toc[i] + 1, msglen );
msg[msglen-1] = 0;
/* print component name, msg number, msg class, and msg itself
according to MKMSGF rules. RTFtoolkitM dox for them.
*/
fprintf ( fout, "%s%4.4d%c: %s\r\n", compname, i + 1, buf[toc[i]],
msg );
free ( msg );
}
fclose ( fmsgf );
fclose ( fout );
free ( buf );
exit ( 0 );
}
=== Cut ===
Kika
--- Best viewed with GoldED 2.50+
* Origin: Kika Software Company, Moscow, Russia (2:5020/144.9)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1 @PATH: 5020/620 509 443 79 5100/8 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.