könnte mir jemand diese 2 Dateien zu einer DLL zusammenfügen?
Meine Testversion von Visual Sutdio 2008 & 2010 Express ist abgelaufen.
Die zwei Dateien sind nicht von mir!
CTitlemain.cpp:
PHP Code:
#include "StdAfx.h"
#include "CTitleMain.h"
CTitleMain::MultiByteToWideChar_Detour_Type CTitleMain::MultiByteToWideChar_Orig;
CTitleMain::myXAttFType CTitleMain::myXAttForig;
char CTitleMain::CurrPlayerName[50];
char CTitleMain::CurrPlayerName1[50];
list<CTitleMain::PlayerTitle>* CTitleMain::TitleList;
PHP Code:
#include "StdAfx.h"
#pragma once
#define GuildFlag_Unknown -1
#define GuildFlag_1 1
#define GuildFlag_0 0
using namespace std;
class CTitleMain
{
private:
typedef void (__fastcall * myXAttFType)(int thisp, int a2, char vid, const char *lvltext, int a5);
typedef int (__stdcall * MultiByteToWideChar_Detour_Type)(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
static MultiByteToWideChar_Detour_Type MultiByteToWideChar_Orig;
static myXAttFType myXAttForig;
static char CurrPlayerName[50];
static char CurrPlayerName1[50];
typedef struct PlayerTitle
{
string PlayerName;
string TitleName;
unsigned char GuildValue;
unsigned char ShowTitle;
};
static list<PlayerTitle>* TitleList;
static int __stdcall MultiByteToWideChar_Detoured (UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar)
{
if (strlen(lpMultiByteStr) < 50)
{
strncpy(CurrPlayerName1,CurrPlayerName,49);
strncpy(CurrPlayerName,lpMultiByteStr,49);
CurrPlayerName1[50] = 0;
CurrPlayerName[50] = 0;
}
//if (strcmp (lpMultiByteStr,"xSomnusx1000") == 0)
// return MultiByteToWideChar_Orig(CodePage,dwFlags,"xSumnusX1000",cbMultiByte,lpWideCharStr,cchWideChar);
return MultiByteToWideChar_Orig(CodePage,dwFlags,lpMultiByteStr,cbMultiByte,lpWideCharStr,cchWideChar);
}
static void __fastcall myXAttF(int thisp, int a2, char vid, const char *lvltext, int a5)
{
#if MPATCH_DEBUG
//printf("call: %s ; %s \n",CurrPlayerName,CurrPlayerName1);
#endif
list<PlayerTitle>::iterator it;
for (it = TitleList->begin(); it != TitleList->end();it++)
{
if (it->GuildValue != 0)
if (it->PlayerName.compare(CurrPlayerName) == 0)
return MyMethod(it, lvltext, thisp, a2, vid, a5);
if (it->GuildValue != 1)
if (it->PlayerName.compare(CurrPlayerName1) == 0)
return MyMethod(it, lvltext, thisp, a2, vid, a5);
}
////0B9C07B9
myXAttForig(thisp,a2,vid,lvltext,a5); return;
}
static void __fastcall MyMethod( list<PlayerTitle>::iterator it, const char * lvltext, int thisp, int a2, char vid, int a5 )
{
char buf[50];
sprintf(buf, "%s (%s)",it->TitleName.c_str(),lvltext);
myXAttForig(thisp,a2,vid,(const char*)&buf,a5); return;
}
public:
static void SetTitle(string pPlayerName, string pTitleName)
{
list<PlayerTitle>::iterator it;
for (it = TitleList->begin(); it != TitleList->end(); it++)
{
if (it->PlayerName.compare(pPlayerName) == 0)
{
it->TitleName = pTitleName;
it->GuildValue = GuildFlag_Unknown;
return;
}
}
PlayerTitle title;
title.PlayerName = pPlayerName;
title.TitleName = pTitleName;
TitleList->push_back(title);
}
static void Init()
{
if (myXAttForig == NULL)
myXAttForig = reinterpret_cast<myXAttFType>(DetourFunction((PBYTE) 0x0048C810,(PBYTE)&myXAttF));
if (MultiByteToWideChar_Orig == NULL)
MultiByteToWideChar_Orig = reinterpret_cast<MultiByteToWideChar_Detour_Type>(DetourFunction((PBYTE)&MultiByteToWideChar,(PBYTE)&MultiByteToWideChar_Detoured));
if (TitleList == NULL)
TitleList = new list<PlayerTitle>;
}
};






