#include "stdafx.h"
#include <atlpath.h>
#include "../../include/DumpCommon.h"
#include "../../include/MiniDumper.h"
#include "../../include/NTService.h"
#include "../../include/ProudNetServer.h"
#include "conio.h"
using namespace std;
using namespace Proud;
const int _MAX_PATH2 = 8192;
#define _COUNTOF(array) (sizeof(array)/sizeof(array[0]))
void GetDumpFilePath(LPWSTR output)
{
WCHAR path[_MAX_PATH2];
WCHAR drive[_MAX_PATH2];
WCHAR dir[_MAX_PATH2];
WCHAR fname[_MAX_PATH2];
WCHAR ext[_MAX_PATH2];
WCHAR module_file_name[_MAX_PATH2];
GetModuleFileNameW(NULL, module_file_name, _COUNTOF(module_file_name));
_tsplitpath_s(module_file_name, drive, _MAX_PATH2, dir, _MAX_PATH2, fname, _MAX_PATH2, ext, _MAX_PATH2);
_tmakepath_s(path, _MAX_PATH2, drive, dir, L"", L"");
wsprintf(output, L"%s%s.DMP", path, fname);
};
int g_ServerPort = 33334;
void AccessViolation()
{
int* a = 0;
*a = 1;
}
{
public:
virtual void Log(int type, LPCWSTR text)
{
_tprintf(L"%s\n", text);
}
virtual void Run()
{
bool result = srv->
Start(p1, err);
if (result == false)
{
printf(
"Server Start Error: %s\n",
StringW2A(ErrorInfo::TypeToString_Kor(err->m_errorType)));
return;
}
puts("Game Server started.\n");
while (1)
{
Sleep(100);
if (_kbhit())
{
int ch = _getch();
switch (ch)
{
case 27:
return;
}
}
MSG msg;
MsgWaitForMultipleObjects(0, 0, TRUE, 100, QS_ALLEVENTS);
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage(&msg, NULL, NULL, NULL))
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
virtual void Pause()
{
AccessViolation();
printf("pause");
}
virtual void Stop()
{
printf("stop");
}
virtual void Continue()
{
printf("continue");
}
};
CMySvrEvent g_svrEvent;
int wmain(int argc, WCHAR* argv[], WCHAR* envp[])
{
int nRetCode = 0;
WCHAR dumpFileName[_MAX_PATH2] = { 0, };
GetDumpFilePath(dumpFileName);
switch (CMiniDumper::Instance().Startup(parameter))
{
...
return nRetCode;
...
return nRetCode;
default:
...
break;
}
CNTService::WinMain(argc, argv, envp, param);
return nRetCode;
}