Files
2022-10-26 12:25:11 +08:00

127 lines
3.0 KiB
C++

// 종합솔루션.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
//
#include "stdafx.h"
#include <Application/WiseClientV2.MainFrame.h>
#include <Application/WiseClientV2.CoreFrame.h>
#include <SolarDump.h>
extern "C"
{
int mainCRTStartup();
}
static int SunAllocHook(int nAllocType, void *pvData,
size_t nSize, int nBlockUse, long lRequest,
const unsigned char * szFileName, int nLine)
{
__UNUSED(nAllocType);
__UNUSED(pvData);
__UNUSED(nBlockUse);
__UNUSED(szFileName);
__UNUSED(nLine);
//if (lRequest >= 74558)
if (lRequest == 74568)
{
//__asm int 3;
DWORD dwA = 0;
dwA += 3;
}
return TRUE;
}
INT SunMemReportHook(INT iReportType, CHAR* pszOutMsg, INT* rRET)
{
static OFSTRUCT sof;
static HANDLE hOUTPUT = (HANDLE)(HFILE)OpenFile(".\\memoryLeak.txt", &sof, OF_CREATE);
DWORD dwWritten;
CHAR strmsg[250];
_snprintf(strmsg, sizeof(strmsg), "%s\r\n", pszOutMsg);
WriteFile(hOUTPUT, strmsg, strlen(strmsg), &dwWritten, NULL);
*rRET = 0;
return TRUE;
}
int WiseMainEntry()
{
_CrtSetAllocHook(SunAllocHook);
//_CrtSetReportHook(SunMemReportHook);
SharedMemoryPool::CreateInstance();
int iRET = mainCRTStartup();
SharedMemoryPool::DestroyInstance();
return iRET;
}
ITimeout sTestTimeout;
int _tmain(int argc, _TCHAR* argv[])
{
#ifndef __WAVERIX_AUTH_SERVER_TEST__
SolarDump stkSolarDump(".", MiniDumpWithFullMemory);
#else
SolarDump stkSolarDump;
#endif
if(sTestTimeout.IsExpired())
printf("HELLO\n");
StartMemoryLeakCheck();
//BreakPointOnMemoryLeak(50);
for(INT iSTEP = eWISE_ROUTINES_LOGO; iSTEP<eWISE_ROUTINES_MAX ; ++iSTEP)
{
SolutionRouter::Execute((eWISE_ROUTINES)iSTEP);
}
SolutionRouter::DestroyInstance();
return 0;
}
//////////////////////////////////////////////////////////////////////////
//#include <MemoryPoolFactoryV2.h>
void fnAssertionLogger4Pool(ePOOL_ERROR::ERROR_TYPE errTYPE, ePOOL_ERROR* IN pINFO)
{
TCHAR* pErrTypeMsg = ePOOL_ERROR::INVALID_REFERENCE == errTYPE ? _T("Freeing Address is Invalid")
: ePOOL_ERROR::CANT_ALLOCATABLE == errTYPE ? _T("Can't Allocatable")
: ePOOL_ERROR::CANT_DEALLOCATABLE == errTYPE ? _T("Can't DeAllocatable, Already Freed -or- Invalid Reference")
: ePOOL_ERROR::NOT_MATCHED_ALLOCnDEALLOC == errTYPE ? _T("Free Count is not matched AllocCount")
: NULL;
SUNLOG(eCRITICAL_LOG, _T("[POOL ASSERTION][TYPE:%s] \"%s\""), pINFO->m_pszTYPENAME, pErrTypeMsg);
//printf(_T("[POOL ASSERTION][TYPE:%s] \"%s\""), rINFO.m_pszTYPENAME, pErrTypeMsg);
#ifdef _DEBUG
__asm { int 3 }
#endif //
}
DECLARE_BASE_WISE_STEP_FUNCTION()
{
CHAR strPath[256];
GetCurrentDirectory(sizeof(strPath), strPath);
DISPMSG("WiseClient %s-%s Start\n- %s -\n", WISE_CLIENT_VERSION, WISE_CLIENT_BUILD_VERSION, strPath);
MainFrame::CreateInstance();
CoreFrame::CreateInstance();
};
REGISTER_STEP_HANDLER_BASE(eWISE_ROUTINES_LOGO);
static void BaseFuntionByModuleDisposer()
{
CoreFrame::DestroyInstance();
MainFrame::DestroyInstance();
}
REGISTER_STEP_HANDLER(eWISE_ROUTINES_INIT_DISPOSER, BaseFuntionByModuleDisposer);