forked from metin2/client
1
0
Fork 0
client/UserInterface/NProtectGameGuard.cpp

262 lines
7.4 KiB
C++
Raw Normal View History

#include "StdAfx.h"
#include "NProtectGameGuard.h"
#ifdef USE_NPROTECT_GAMEGUARD
static struct GameGuard
{
bool isInitError;
bool isProcError;
unsigned msg;
unsigned arg;
} gs_gameGuard = {
false, 0, 0,
};
#ifdef LOCALE_SERVICE_HONGKONG
#include "NProtect/NPGameLibHK.h"
#pragma comment(lib, "NPGameLibHK_MT.lib")
CNPGameLib npgl("Metin2HK");
#endif
#ifdef LOCALE_SERVICE_TAIWAN
#include "NProtect/NPGameLibTW.h"
#pragma comment(lib, "NPGameLibTW_MT.lib")
CNPGameLib npgl("Metin2TW");
#endif
#ifdef LOCALE_SERVICE_EUROPE
#include "NProtect/NPGameLibEU.h"
#pragma comment(lib, "NPGameLibEU_MT.lib")
CNPGameLib npgl("Metin2EU");
#endif
BOOL CALLBACK NPGameMonCallback(DWORD msg, DWORD arg)
{
switch (msg)
{
case NPGAMEMON_COMM_ERROR:
case NPGAMEMON_COMM_CLOSE:
case NPGAMEMON_INIT_ERROR:
case NPGAMEMON_SPEEDHACK:
case NPGAMEMON_GAMEHACK_KILLED:
case NPGAMEMON_GAMEHACK_DETECT:
case NPGAMEMON_GAMEHACK_DOUBT:
gs_gameGuard.msg = msg;
gs_gameGuard.arg = arg;
gs_gameGuard.isProcError = true;
return false;
break;
}
return true;
}
bool LocaleService_IsGameGuardError()
{
return gs_gameGuard.isProcError;
}
bool LocaleService_InitGameGuard()
{
unsigned result = npgl.Init();
if (NPGAMEMON_SUCCESS != result)
{
gs_gameGuard.isInitError = true;
gs_gameGuard.msg = result;
return false;
}
return true;
}
bool LocaleService_RunGameGuard(HWND hWnd)
{
npgl.SetHwnd(hWnd);
return true;
}
void LocaleService_NoticeGameGuardInitError_HongKong()
{
char msg[256];
switch (gs_gameGuard.msg)
{
case NPGAMEMON_ERROR_EXIST:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD>?<3F><><EFBFBD>C<EFBFBD>y<EFBFBD><79>??<3F>άO?<3F>s<EFBFBD>Ұʤ<D2B0><CAA4><EFBFBD><EFBFBD>A<EFBFBD><41>?<3F>C ");
break;
case NPGAMEMON_ERROR_GAME_EXIST:
sprintf(msg, "<EFBFBD>C<EFBFBD><EFBFBD>?<3F>ư<EFBFBD>?<3F><>GameGuard<72>w<EFBFBD>b<EFBFBD><62>?<3F><><EFBFBD>C<EFBFBD><43>?<3F>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>s<EFBFBD><73>?<3F>C ");
break;
case NPGAMEMON_ERROR_INIT:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>?<3F>C?<3F>s<EFBFBD>Ұʫ<D2B0><CAAB>A<EFBFBD><41>?<3F>άO<CEAC><4F><EFBFBD><EFBFBD><EFBFBD>i??<3F>o<EFBFBD>ͽĬ<CDBD><C4AC><EFBFBD>?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41>?<3F>C ");
break;
case NPGAMEMON_ERROR_AUTH_GAMEGUARD:
case NPGAMEMON_ERROR_NFOUND_GG:
case NPGAMEMON_ERROR_AUTH_INI:
case NPGAMEMON_ERROR_NFOUND_INI:
sprintf(msg, "<EFBFBD>LGameGuard<EFBFBD><EFBFBD>?<3F>β<EFBFBD><CEB2>Ͳ<EFBFBD><CDB2>ܡC<DCA1>Цw<D0A6><77>GameGuard <20><><EFBFBD>w<EFBFBD><77><EFBFBD>ɡC ");
break;
case NPGAMEMON_ERROR_CRYPTOAPI:
sprintf(msg, "Window<EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F><><EFBFBD>l<EFBFBD>C<EFBFBD><43>?<3F>s<EFBFBD>w<EFBFBD><77>IE<49>C ");
break;
case NPGAMEMON_ERROR_EXECUTE:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD>?<3F><><EFBFBD>ѡC<D1A1><43>?<3F>s<EFBFBD><73>?GameGuard<72>w<EFBFBD><77><EFBFBD>ɡC ");
break;
case NPGAMEMON_ERROR_ILLEGAL_PRG:
sprintf(msg, "<EFBFBD>o?<3F>D<EFBFBD>k?<3F><><EFBFBD>C<EFBFBD>е<EFBFBD>?<3F><><EFBFBD>ݭn<DDAD><6E>?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>s<EFBFBD><73>?<3F>C ");
break;
case NPGMUP_ERROR_ABORT:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD>?<3F><>?<3F>C<EFBFBD>p<EFBFBD>G?<3F><><EFBFBD>L<EFBFBD>k<EFBFBD>s<EFBFBD>u<EFBFBD>A<EFBFBD><41>?<3F>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>w<EFBFBD>C ");
break;
case NPGMUP_ERROR_CONNECT:
case NPGMUP_ERROR_DOWNCFG:
sprintf(msg, "GameGuard<EFBFBD>睊(<28><>?)?<3F>A<EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD>ѡC<D1A1>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A?<3F>s<EFBFBD><73>?<3F>άO<CEAC>p<EFBFBD>G<EFBFBD><47>?<3F>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD>𪺸ܽнվ<D0BD>?<3F>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>w<EFBFBD><77><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>աC ");
break;
case NPGMUP_ERROR_AUTH:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD>S?<3F><><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43>?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F><><EFBFBD>r?<3F><><EFBFBD><EFBFBD><EFBFBD>A?<3F>s<EFBFBD><73>?<3F>άO<CEAC>ϥ<EFBFBD>PC<50>޲z?<3F><><EFBFBD>վ<EFBFBD>?<3F>w<EFBFBD><77><EFBFBD>A<EFBFBD><41>?<3F>C ");
break;
case NPGAMEMON_ERROR_NPSCAN:
sprintf(msg, "<EFBFBD>f<EFBFBD>r<EFBFBD>εn<EFBFBD>J<EFBFBD>b<EFBFBD>ȤJ<EFBFBD>I<EFBFBD>u<EFBFBD><EFBFBD><EFBFBD>ˬd<EFBFBD>Ҳե<EFBFBD><EFBFBD>ѡC<EFBFBD>i?<3F>O<EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><E9A4A3><EFBFBD>άO<CEAC>P<EFBFBD>V<EFBFBD>F<EFBFBD>f<EFBFBD>r<EFBFBD>C ");
break;
default:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD>??<3F>o?<3F><>?<3F>C<EFBFBD>бN<D0B1>C<EFBFBD><43><EFBFBD><EFBFBD>?<3F><><EFBFBD>̪<EFBFBD>GameGuard<72><64>?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*.erl<72><6C>?<3F>H<EFBFBD>q<EFBFBD>l<EFBFBD>l<EFBFBD><6C>??<3F>H<EFBFBD><48>game2@inca.co.kr<6B>H<EFBFBD>c<EFBFBD>C ");
break;
}
MessageBox(NULL, msg, "GameGuard <20><>?", MB_OK);
}
void LocaleService_NoticeGameGuardInitError_International()
{
char msg[256];
switch (gs_gameGuard.msg)
{
case NPGAMEMON_ERROR_EXIST:
sprintf(msg, "GameGuard is already running.\nPlease reboot and restart the game.");
break;
case NPGAMEMON_ERROR_GAME_EXIST:
sprintf(msg, "GameGuard is already running.\nPlease restart the game.");
break;
case NPGAMEMON_ERROR_INIT:
sprintf(msg, "GameGuard has initial error.\nPlease kill other conflict programs and restart game.");
break;
case NPGAMEMON_ERROR_AUTH_GAMEGUARD:
case NPGAMEMON_ERROR_NFOUND_GG:
case NPGAMEMON_ERROR_AUTH_INI:
case NPGAMEMON_ERROR_NFOUND_INI:
sprintf(msg, "GameGuard files are modified or deleted.\nPlease reinstall GameGuard.");
break;
case NPGAMEMON_ERROR_CRYPTOAPI:
sprintf(msg, "GameGuard detects Windows system file error.\nPlease reinstall Internet Explorer(IE)");
break;
case NPGAMEMON_ERROR_EXECUTE:
sprintf(msg, "GameGuard running is failed.\nPlease reinstall GameGuard.");
break;
case NPGAMEMON_ERROR_ILLEGAL_PRG:
sprintf(msg, "GameGuard detects Illegal Program.\nPlease kill other programs not needs and restart game");
break;
case NPGMUP_ERROR_ABORT:
sprintf(msg, "GameGuard update was canceled.\nWhen not connect, change the internal or private firewall settings");
break;
case NPGMUP_ERROR_CONNECT:
sprintf(msg, "GameGuard hooking is failed.\nPlease download newer anti-virus and check all system.");
break;
case NPGAMEMON_ERROR_GAMEGUARD:
sprintf(msg, "GameGuard has initial error or old game guard.\nPlease reinstall GameGuard");
break;
case NPGMUP_ERROR_PARAM:
sprintf(msg, "GameGuard detects .ini file is modified.\nPlease reinstall GameGuard");
break;
case NPGMUP_ERROR_INIT:
sprintf(msg, "GameGuard detects npgmup.des initial error.\nPlease delete GameGuard Folder and reinstall GameGuard");
break;
case NPGMUP_ERROR_DOWNCFG:
sprintf(msg, "GameGuard update server connection is failed.\nPlease restart or check private firewall settings.");
break;
case NPGMUP_ERROR_AUTH:
sprintf(msg, "GameGuard update is not completed.\nPlease pause anti-virus and restart game.");
break;
case NPGAMEMON_ERROR_NPSCAN:
sprintf(msg, "GameGuard virus-hacking checker loading is failed\nPlease check memory lack or virus.");
break;
default:
sprintf(msg, "UnknownErrorCode: %d\nPlease send a letter that has *.erl in game folder to Game1@inca.co.kr", gs_gameGuard.msg);
break;
}
MessageBox(NULL, msg, "GameGuard Initiail Error", MB_OK);
}
void LocaleService_NoticeGameGuardProcError_HongKong()
{
char msg[256];
switch (gs_gameGuard.msg)
{
case NPGAMEMON_COMM_ERROR:
case NPGAMEMON_COMM_CLOSE:
return;
case NPGAMEMON_INIT_ERROR:
sprintf(msg, "GameGuard<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>? : %lu", gs_gameGuard.arg);
break;
case NPGAMEMON_SPEEDHACK:
sprintf(msg, "<EFBFBD>o?speed hack<63>C ");
break;
case NPGAMEMON_GAMEHACK_KILLED:
sprintf(msg, "<EFBFBD>o?<3F>C<EFBFBD><43>hack<63>C ");
break;
case NPGAMEMON_GAMEHACK_DETECT:
sprintf(msg, "<EFBFBD>o?<3F>C<EFBFBD><43>hack<63>C ");
break;
case NPGAMEMON_GAMEHACK_DOUBT:
sprintf(msg, "<EFBFBD>C<EFBFBD><EFBFBD><EFBFBD><EFBFBD>GameGuard<EFBFBD>w<EFBFBD><EFBFBD>?<3F>C ");
break;
}
MessageBox(NULL, msg, "GameGuard Error", MB_OK);
}
void LocaleService_NoticeGameGuardProcError_International()
{
char msg[256];
switch (gs_gameGuard.msg)
{
case NPGAMEMON_COMM_ERROR:
case NPGAMEMON_COMM_CLOSE:
break;
case NPGAMEMON_INIT_ERROR:
wsprintf(msg, "GameGuard has initial error : %lu", gs_gameGuard.arg);
break;
case NPGAMEMON_SPEEDHACK:
wsprintf(msg, "GameGuard detects SpeedHack");
break;
case NPGAMEMON_GAMEHACK_KILLED:
wsprintf(msg, "GameGuard detects GameHack\r\n%s", npgl.GetInfo());
break;
case NPGAMEMON_GAMEHACK_DETECT:
wsprintf(msg, "GameGuard detects GameHack\r\n%s", npgl.GetInfo());
break;
case NPGAMEMON_GAMEHACK_DOUBT:
wsprintf(msg, "Game or Gamguard was modified.");
break;
}
MessageBox(NULL, msg, "GameGuard Error", MB_OK);
}
void LocaleService_NoticeGameGuardMessasge()
{
if (gs_gameGuard.isInitError)
{
if (LocaleService_IsHONGKONG())
LocaleService_NoticeGameGuardInitError_HongKong();
else
LocaleService_NoticeGameGuardInitError_International();
}
else if (gs_gameGuard.isProcError)
{
if (LocaleService_IsHONGKONG())
LocaleService_NoticeGameGuardProcError_HongKong();
else
LocaleService_NoticeGameGuardProcError_International();
}
}
#endif /* USE_NPROTECT_GAMEGUARD */