168 lines
4.5 KiB
C++
168 lines
4.5 KiB
C++
#pragma once
|
|
#include "BaseProcess.h"
|
|
|
|
#include <vector>
|
|
#include <algorithm>
|
|
#include "AuMD5Encrypt.h"
|
|
#include <assert.h>
|
|
#include <direct.h>
|
|
|
|
class CDumpProcess : public CBaseProcess
|
|
{
|
|
public:
|
|
struct sCALLSTACKINFO
|
|
{
|
|
UINT Address_;
|
|
char tag_;
|
|
UINT AddrValue_;
|
|
TCHAR FuntionName_[256];
|
|
|
|
sCALLSTACKINFO() :
|
|
Address_(0),
|
|
tag_(' '),
|
|
AddrValue_(0)
|
|
{
|
|
memset(FuntionName_,0,sizeof(TCHAR)*256);
|
|
}
|
|
};
|
|
|
|
private:
|
|
TCHAR stringExceptionAddr_[256];
|
|
TCHAR stringModuleName_[256];
|
|
TCHAR stringProcessorArchitecture_[256];
|
|
TCHAR stringExceptionCause_[256];
|
|
|
|
ULONG32 ProcessTime_;
|
|
ULONG32 UserTime_;
|
|
ULONG32 KerenlTime_;
|
|
ULONG32 ExceptionCode_;
|
|
ULONG32 ExceptionAddr_;
|
|
|
|
byte* pMapping_;
|
|
|
|
HANDLE handleMap_;
|
|
HANDLE handleFile_;
|
|
|
|
USHORT ProcessorArchitecture_;
|
|
USHORT ProcessorLevel_;
|
|
USHORT ProcessorRevision_;
|
|
|
|
ULONG32 MajorVersion_;
|
|
ULONG32 MinorVersion_;
|
|
ULONG32 BuildNumber_;
|
|
ULONG32 PlatformId_;
|
|
|
|
ULONG32 ThreadId_;
|
|
MINIDUMP_LOCATION_DESCRIPTOR ThreadContext_;
|
|
MINIDUMP_EXCEPTION ExceptionInfo_;
|
|
MINIDUMP_EXCEPTION_STREAM* ExcpetionStreamPointer_;
|
|
|
|
std::vector<MINIDUMP_MEMORY_DESCRIPTOR> DumpMemory_;
|
|
std::vector<MINIDUMP_MODULE> DumpModule_;
|
|
std::vector<sCALLSTACKINFO> CallStackList_;
|
|
|
|
TCHAR version_string[64];
|
|
|
|
public:
|
|
CDumpProcess(void) :
|
|
pMapping_(NULL),
|
|
handleMap_(NULL),
|
|
handleFile_(NULL),
|
|
ProcessTime_(0),
|
|
UserTime_(0),
|
|
KerenlTime_(0),
|
|
ExceptionAddr_(0),
|
|
ExceptionCode_(0),
|
|
MajorVersion_(0),
|
|
MinorVersion_(0),
|
|
BuildNumber_(0),
|
|
PlatformId_(0),
|
|
ProcessorArchitecture_(0),
|
|
ProcessorLevel_(0),
|
|
ProcessorRevision_(0),
|
|
ExcpetionStreamPointer_(NULL)
|
|
{
|
|
memset(stringExceptionAddr_,0,sizeof(TCHAR)*256);
|
|
memset(stringModuleName_,0,sizeof(TCHAR)*256);
|
|
memset(stringProcessorArchitecture_,0,sizeof(TCHAR)*256);
|
|
memset(stringExceptionCause_,0,sizeof(TCHAR)*256);
|
|
memset(version_string,0,sizeof(TCHAR)*64);
|
|
|
|
DumpMemory_.clear();
|
|
DumpModule_.clear();
|
|
CallStackList_.clear();
|
|
}
|
|
|
|
virtual ~CDumpProcess(void)
|
|
{
|
|
ReleaseMap();
|
|
}
|
|
|
|
void ReleaseMap()
|
|
{
|
|
DumpMemory_.clear();
|
|
DumpModule_.clear();
|
|
CallStackList_.clear();
|
|
}
|
|
|
|
private:
|
|
bool ReadDumpFile(const TCHAR* FileName);
|
|
bool OnReadDmpFile();
|
|
|
|
//기본 정보 얻기
|
|
bool OnReadMiscInfo();
|
|
bool OnReadMoudleInfo();
|
|
bool OnReadCrashInfo();
|
|
bool OnReadSystemInfo();
|
|
bool OnReadThreadInfo();
|
|
bool OnReadMemoryInfo();
|
|
|
|
PVOID GetDumpInfo(ULONG Type);
|
|
|
|
void OnExceptionCause(DWORD exceptioncuase,TCHAR* String,size_t Size);
|
|
|
|
int ReadMemory(int addr, int size, byte* buffer);
|
|
|
|
|
|
TCHAR* GetVersion(const _TCHAR* filename);
|
|
|
|
public:
|
|
virtual void OnInitation();
|
|
virtual bool LoadFile(const TCHAR* SymbolName);
|
|
virtual void Clean();
|
|
|
|
//CDumpProcess 에서는 해당 부분은 사용되지 않는다!
|
|
virtual bool OnSearch(DWORD ExceptionAddr , sExceptionInfomation& ExceptionInfo );
|
|
virtual bool OnSearch(const char* ExceptionAddr,sExceptionInfomation& ExceptionInfo );
|
|
|
|
public:
|
|
ULONG32 GetProcessTime() { return ProcessTime_; }
|
|
ULONG32 GetUserTime() { return UserTime_; }
|
|
ULONG32 GetKerenlTime() { return KerenlTime_; }
|
|
ULONG32 GetExceptionCode() { return ExceptionCode_; }
|
|
ULONG32 GetExceptionAddr() { return ExceptionAddr_; }
|
|
|
|
USHORT GetProcessorArchitecture() { return ProcessorArchitecture_; }
|
|
USHORT GetProcessorLevel() { return ProcessorLevel_; }
|
|
USHORT GetProcessorRevision() { return ProcessorRevision_; }
|
|
|
|
ULONG32 GetMajorVersion() { return MajorVersion_; }
|
|
ULONG32 GetMinorVersion() { return MinorVersion_; }
|
|
ULONG32 GetBuildNumber() { return BuildNumber_; }
|
|
ULONG32 GetPlatformId() { return PlatformId_; }
|
|
|
|
const TCHAR* GetModuleInfo() { return stringModuleName_;}
|
|
const TCHAR* GetExceptionCodeStr() { return stringExceptionCause_; }
|
|
|
|
template <typename T>
|
|
bool ReadMemoryValue(UINT addr,T* Vaule)
|
|
{
|
|
return ReadMemory(addr,sizeof(*Vaule),(byte*)Vaule) == sizeof(*Vaule);
|
|
}
|
|
|
|
void FIndExceptionCode(DWORD ExceptionCode);
|
|
|
|
bool decodeDumpfile(const TCHAR* DumpNmae);
|
|
|
|
};
|