If someone have mumsg dll sources please post here or send on pm.
Thanks!
Printable View
If someone have mumsg dll sources please post here or send on pm.
Thanks!
MuMsg.cpp
MuMsg.hCode:#include "stdafx.h"
#include "MuMsg.h"
MUMSG_API int nMsg=0;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" MUMSG_API int fnMsg(void)
{
return 42;
}
CMsg::CMsg() // Correct
{
memset(&this->szDefaultMsg , 0, sizeof(this->szDefaultMsg ) );
this->Msghead = NULL;
strcpy(this->szDefaultMsg , "Msg error");
}
CMsg::~CMsg() // Correct
{
this->lMsgFree();
}
void CMsg::XorBuffer(char* buff, int len) // Correct
{
if (len <=0)
{
return;
}
for(int iCounter=0;iCounter<len;iCounter++)
{
buff[iCounter] = buff[iCounter]^0xCA; // Buffer
}
}
void CMsg::DataFileLoadVer01(FILE* filename) // SubIndex;Index;Len(WORD);LPSTR
{
unsigned char szTemp[256];
int Index;
unsigned int Len;
int Max=this->LoadHeader.count;
if (Max <= 0)
{
MessageBox(NULL, "bla bla" , "Error", MB_OK|MB_APPLMODAL); // Modification error data while reading
return;
}
else
{
while ( Max != 0 )
{
memset(&szTemp, 0, sizeof(szTemp) );
fread(&Index , 2, 1, filename);
fread(&Len , 2, 1, filename);
fread(&szTemp[0] , Len , 1, filename);
szTemp[Len]=0;
this->XorBuffer((char*)szTemp , Len );
this->lMsgListAdd( Index, (unsigned char*) szTemp);
Max--;
}
}
}
void CMsg::LoadWTF(LPSTR filename)
{
FILE* WTFFile;
char szBufferError[128];
WTFFile =fopen(filename, "rb");
if (WTFFile == 0 )
{
wsprintf(szBufferError, "Could not open %s.", filename); // %s file does not exist
MessageBox(NULL, szBufferError, "Error", MB_OK|MB_APPLMODAL);
return;
}
else
{
if (this->lMsgListInit() != 0)
{
fread(&this->LoadHeader, 28, 1, WTFFile);
if (this->LoadHeader.headcode != 0xCC)
{
MessageBox(NULL, "TextCode Type Wrong.", "Error", MB_OK|MB_APPLMODAL);
}
else if ( (this->LoadHeader.version -1) != 0)
{
MessageBox(NULL, "bla bla", "Error", MB_OK|MB_APPLMODAL);
}
else
{
DataFileLoadVer01(WTFFile);
}
fclose(WTFFile);
}
}
}
int CMsg::lMsgListInit()
{
LPMSG_STRUCT msg;
if ( (msg =new MSG_STRUCT) == 0 )
{
MessageBox(NULL, "Memory Allocation Error (MuMsg)", "Error", MB_OK);
return 0;
}
else
{
msg->next =NULL;
msg->number =0;
msg->msg = NULL;
memset(this->MsgIndex, 0, sizeof(this->MsgIndex));
return 1;
}
return 1;
}
void CMsg::lMsgFree()
{
for ( int n = 0; n < 32768; n++ )
{
if ( this->MsgIndex[n] != 0 )
{
delete this->MsgIndex[n]->msg ;
delete this->MsgIndex[n];
}
}
}
LPMSG_STRUCT CMsg::lMsgListNew()
{
return new MSG_STRUCT;
}
int CMsg::lMsgListAdd(int index, UCHAR* smsg)
{
int MsgLen=strlen((char*)smsg);
char* pPointer;
if ( MsgLen > 0 )
{
this->MsgIndex[index]=this->lMsgListNew();
if (this->MsgIndex[index] == 0)
{
MessageBox(NULL, "Memory Allocation Error #2(MuMsg)", "Error", MB_OK); // Memory Allocation Error
return 0;
}
pPointer = new char[MsgLen+1];
if ( pPointer != 0 )
{
this->MsgIndex[index]->number=index;
if ( index >= 0 || index < 32767 )
{
this->MsgIndex[index]->msg = (unsigned char*)pPointer;
strcpy((char*)this->MsgIndex[index]->msg , (char*)smsg);
return 1;
}
else
{
MessageBox(NULL, "Message Index Table Make Error", "Error", MB_OK);
return 0;
}
}
}
return 1;
}
void CMsg::lMsgListPrint()
{
for ( int n = 0; n<32768 ; n++)
{
if ( this->MsgIndex[n] != 0 )
{
MessageBox(NULL, (char*)this->MsgIndex[n]->msg, "Message", MB_OK);
}
}
}
LPSTR CMsg::Get(int index)
{
if ( index >= 0 && index < 32768 )
{
if ( this->MsgIndex[index] == 0 )
{
return this->szDefaultMsg;
}
if ( this->MsgIndex[index]->msg == 0 )
{
return this->szDefaultMsg;
}
if ( *this->MsgIndex[index]->msg == 0 )
{
return this->szDefaultMsg;
}
return (char*)this->MsgIndex[index]->msg;
}
return (char*)this->szDefaultMsg;
}
Code:#ifdef MUMSG_EXPORTS
#define MUMSG_API __declspec(dllexport)
#else
#define MUMSG_API __declspec(dllimport)
#endif
typedef struct MSG_STRUCT
{
MSG_STRUCT* next; // 0
int number; // 4
LPBYTE msg; // 8
} MSG_STRUCT, * LPMSG_STRUCT;
#define MSGGET(x, y) ( (x) * 256 + (y) )
struct TCHeader
{
BYTE headcode; // 0
BYTE version; // 1
char caption[21]; // 2
int count; // 18
};
extern "C" MUMSG_API int fnMsg(void);
class MUMSG_API CMsg
{
public:
CMsg();
~CMsg();
void LoadWTF(LPSTR filename);
LPSTR Get(int);
private:
int lMsgListInit();
int lMsgListAdd(int, LPBYTE);
MSG_STRUCT* lMsgListNew();
void XorBuffer(LPSTR, int);
void DataFileLoadVer01(struct _iobuf*);
void lMsgFree();
void lMsgListPrint();
protected:
MSG_STRUCT* Msghead; // 0
MSG_STRUCT* Msgcur; // 4
MSG_STRUCT* MsgIndex[32768]; // 8
TCHeader LoadHeader; // 20008
char szDefaultMsg[50]; // 20024
};
extern MUMSG_API int nMsg;
MUMSG_API int fnMuMsg(void);
gs close silently when CMsg::LoadWTF is called in gs or it is working for you?
Thanks anyway,waiting your reply.