formatted the whole project (AStyle)
This commit is contained in:
parent
b3f1607580
commit
cfb78d8beb
|
@ -1,22 +1,22 @@
|
|||
#ifndef _DEVICENAMERESOLVER_H
|
||||
#define _DEVICENAMERESOLVER_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) bool DevicePathToPathW(const wchar_t* szDevicePath, wchar_t* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathToPathA(const char* szDevicePath, char* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathFromFileHandleW(HANDLE hFile, wchar_t* szDevicePath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathFromFileHandleA(HANDLE hFile, char* szDevicePath, size_t nSize);
|
||||
__declspec(dllexport) bool PathFromFileHandleW(HANDLE hFile, wchar_t* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool PathFromFileHandleA(HANDLE hFile, char* szPath, size_t nSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DEVICENAMERESOLVER_H
|
||||
#ifndef _DEVICENAMERESOLVER_H
|
||||
#define _DEVICENAMERESOLVER_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) bool DevicePathToPathW(const wchar_t* szDevicePath, wchar_t* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathToPathA(const char* szDevicePath, char* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathFromFileHandleW(HANDLE hFile, wchar_t* szDevicePath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathFromFileHandleA(HANDLE hFile, char* szDevicePath, size_t nSize);
|
||||
__declspec(dllexport) bool PathFromFileHandleW(HANDLE hFile, wchar_t* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool PathFromFileHandleA(HANDLE hFile, char* szPath, size_t nSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DEVICENAMERESOLVER_H
|
||||
|
|
|
@ -1,83 +1,83 @@
|
|||
#include "disasm_fast.h"
|
||||
|
||||
static MEMORY_SIZE argsize2memsize(int argsize)
|
||||
{
|
||||
switch(argsize)
|
||||
{
|
||||
case 8:
|
||||
return size_byte;
|
||||
case 16:
|
||||
return size_word;
|
||||
case 32:
|
||||
return size_dword;
|
||||
case 64:
|
||||
return size_qword;
|
||||
}
|
||||
return size_byte;
|
||||
}
|
||||
|
||||
void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo)
|
||||
{
|
||||
//zero basicinfo
|
||||
memset(basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO));
|
||||
//find immidiat
|
||||
if(disasm->Instruction.BranchType==0) //no branch
|
||||
{
|
||||
if((disasm->Argument1.ArgType&CONSTANT_TYPE)==CONSTANT_TYPE)
|
||||
{
|
||||
basicinfo->type|=TYPE_VALUE;
|
||||
basicinfo->value.value=(ULONG_PTR)disasm->Instruction.Immediat;
|
||||
basicinfo->value.size=argsize2memsize(disasm->Argument1.ArgSize);
|
||||
}
|
||||
else if((disasm->Argument2.ArgType&CONSTANT_TYPE)==CONSTANT_TYPE)
|
||||
{
|
||||
basicinfo->type|=TYPE_VALUE;
|
||||
basicinfo->value.value=(ULONG_PTR)disasm->Instruction.Immediat;
|
||||
basicinfo->value.size=argsize2memsize(disasm->Argument2.ArgSize);
|
||||
}
|
||||
}
|
||||
else //branch
|
||||
basicinfo->branch=true;
|
||||
//find memory displacement
|
||||
if((disasm->Argument1.ArgType&MEMORY_TYPE)==MEMORY_TYPE || (disasm->Argument2.ArgType&MEMORY_TYPE)==MEMORY_TYPE)
|
||||
{
|
||||
if(disasm->Argument1.Memory.Displacement)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Argument1.Memory.Displacement;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument1.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument1.ArgSize);
|
||||
}
|
||||
else if(disasm->Argument2.Memory.Displacement)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Argument2.Memory.Displacement;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument2.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument2.ArgSize);
|
||||
}
|
||||
}
|
||||
//find address value
|
||||
if(disasm->Instruction.BranchType && disasm->Instruction.AddrValue)
|
||||
{
|
||||
basicinfo->type|=TYPE_ADDR;
|
||||
basicinfo->addr=(ULONG_PTR)disasm->Instruction.AddrValue;
|
||||
}
|
||||
//rip-relative (non-branch)
|
||||
if(disasm->Instruction.BranchType==0)
|
||||
{
|
||||
if((disasm->Argument1.ArgType&RELATIVE_)==RELATIVE_)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Instruction.AddrValue;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument1.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument1.ArgSize);
|
||||
}
|
||||
else if((disasm->Argument2.ArgType&RELATIVE_)==RELATIVE_)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Instruction.AddrValue;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument2.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument2.ArgSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "disasm_fast.h"
|
||||
|
||||
static MEMORY_SIZE argsize2memsize(int argsize)
|
||||
{
|
||||
switch(argsize)
|
||||
{
|
||||
case 8:
|
||||
return size_byte;
|
||||
case 16:
|
||||
return size_word;
|
||||
case 32:
|
||||
return size_dword;
|
||||
case 64:
|
||||
return size_qword;
|
||||
}
|
||||
return size_byte;
|
||||
}
|
||||
|
||||
void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo)
|
||||
{
|
||||
//zero basicinfo
|
||||
memset(basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO));
|
||||
//find immidiat
|
||||
if(disasm->Instruction.BranchType==0) //no branch
|
||||
{
|
||||
if((disasm->Argument1.ArgType&CONSTANT_TYPE)==CONSTANT_TYPE)
|
||||
{
|
||||
basicinfo->type|=TYPE_VALUE;
|
||||
basicinfo->value.value=(ULONG_PTR)disasm->Instruction.Immediat;
|
||||
basicinfo->value.size=argsize2memsize(disasm->Argument1.ArgSize);
|
||||
}
|
||||
else if((disasm->Argument2.ArgType&CONSTANT_TYPE)==CONSTANT_TYPE)
|
||||
{
|
||||
basicinfo->type|=TYPE_VALUE;
|
||||
basicinfo->value.value=(ULONG_PTR)disasm->Instruction.Immediat;
|
||||
basicinfo->value.size=argsize2memsize(disasm->Argument2.ArgSize);
|
||||
}
|
||||
}
|
||||
else //branch
|
||||
basicinfo->branch=true;
|
||||
//find memory displacement
|
||||
if((disasm->Argument1.ArgType&MEMORY_TYPE)==MEMORY_TYPE || (disasm->Argument2.ArgType&MEMORY_TYPE)==MEMORY_TYPE)
|
||||
{
|
||||
if(disasm->Argument1.Memory.Displacement)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Argument1.Memory.Displacement;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument1.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument1.ArgSize);
|
||||
}
|
||||
else if(disasm->Argument2.Memory.Displacement)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Argument2.Memory.Displacement;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument2.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument2.ArgSize);
|
||||
}
|
||||
}
|
||||
//find address value
|
||||
if(disasm->Instruction.BranchType && disasm->Instruction.AddrValue)
|
||||
{
|
||||
basicinfo->type|=TYPE_ADDR;
|
||||
basicinfo->addr=(ULONG_PTR)disasm->Instruction.AddrValue;
|
||||
}
|
||||
//rip-relative (non-branch)
|
||||
if(disasm->Instruction.BranchType==0)
|
||||
{
|
||||
if((disasm->Argument1.ArgType&RELATIVE_)==RELATIVE_)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Instruction.AddrValue;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument1.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument1.ArgSize);
|
||||
}
|
||||
else if((disasm->Argument2.ArgType&RELATIVE_)==RELATIVE_)
|
||||
{
|
||||
basicinfo->type|=TYPE_MEMORY;
|
||||
basicinfo->memory.value=(ULONG_PTR)disasm->Instruction.AddrValue;
|
||||
strcpy(basicinfo->memory.mnemonic, disasm->Argument2.ArgMnemonic);
|
||||
basicinfo->memory.size=argsize2memsize(disasm->Argument2.ArgSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _DISASM_FAST_H
|
||||
#define _DISASM_FAST_H
|
||||
|
||||
#include "_global.h"
|
||||
#include "BeaEngine\BeaEngine.h"
|
||||
|
||||
void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo);
|
||||
|
||||
#endif //_DISASM_FAST_H
|
||||
#ifndef _DISASM_FAST_H
|
||||
#define _DISASM_FAST_H
|
||||
|
||||
#include "_global.h"
|
||||
#include "BeaEngine\BeaEngine.h"
|
||||
|
||||
void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo);
|
||||
|
||||
#endif //_DISASM_FAST_H
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
#include "reference.h"
|
||||
#include "debugger.h"
|
||||
#include "memory.h"
|
||||
#include "console.h"
|
||||
|
||||
int reffind(uint addr, uint size, CBREF cbRef, void* userinfo, bool silent)
|
||||
{
|
||||
uint start_addr;
|
||||
uint start_size;
|
||||
uint base;
|
||||
uint base_size;
|
||||
base=memfindbaseaddr(fdProcessInfo->hProcess, addr, &base_size);
|
||||
if(!base or !base_size)
|
||||
{
|
||||
if(!silent)
|
||||
dputs("invalid memory page");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!size) //assume the whole page
|
||||
{
|
||||
start_addr=base;
|
||||
start_size=base_size;
|
||||
}
|
||||
else //custom boundaries
|
||||
{
|
||||
start_addr=addr;
|
||||
uint maxsize=size-(start_addr-base);
|
||||
if(size<maxsize) //check if the size fits in the page
|
||||
start_size=size;
|
||||
else
|
||||
start_size=maxsize;
|
||||
}
|
||||
unsigned char* data=(unsigned char*)emalloc(start_size, "reffind:data");
|
||||
if(!memread(fdProcessInfo->hProcess, (const void*)start_addr, data, start_size, 0))
|
||||
{
|
||||
if(!silent)
|
||||
dputs("error reading memory");
|
||||
efree(data, "reffind:data");
|
||||
return 0;
|
||||
}
|
||||
DISASM disasm;
|
||||
memset(&disasm, 0, sizeof(disasm));
|
||||
#ifdef _WIN64
|
||||
disasm.Archi=64;
|
||||
#endif // _WIN64
|
||||
disasm.EIP=(UIntPtr)data;
|
||||
disasm.VirtualAddr=(UInt64)start_addr;
|
||||
uint i=0;
|
||||
BASIC_INSTRUCTION_INFO basicinfo;
|
||||
cbRef(&disasm, &basicinfo, 0); //allow initializing
|
||||
REFINFO refinfo;
|
||||
memset(&refinfo, 0, sizeof(REFINFO));
|
||||
refinfo.userinfo=userinfo;
|
||||
while(i<start_size)
|
||||
{
|
||||
if(!(i%0x1000))
|
||||
{
|
||||
double percent=(double)i/(double)start_size;
|
||||
GuiReferenceSetProgress((int)(percent*100));
|
||||
}
|
||||
int len=Disasm(&disasm);
|
||||
if(len!=UNKNOWN_OPCODE)
|
||||
{
|
||||
fillbasicinfo(&disasm, &basicinfo);
|
||||
if(cbRef(&disasm, &basicinfo, &refinfo))
|
||||
refinfo.refcount++;
|
||||
}
|
||||
else
|
||||
len=1;
|
||||
disasm.EIP+=len;
|
||||
disasm.VirtualAddr+=len;
|
||||
i+=len;
|
||||
}
|
||||
GuiReferenceSetProgress(100);
|
||||
GuiReferenceReloadData();
|
||||
efree(data, "reffind:data");
|
||||
return refinfo.refcount;
|
||||
}
|
||||
#include "reference.h"
|
||||
#include "debugger.h"
|
||||
#include "memory.h"
|
||||
#include "console.h"
|
||||
|
||||
int reffind(uint addr, uint size, CBREF cbRef, void* userinfo, bool silent)
|
||||
{
|
||||
uint start_addr;
|
||||
uint start_size;
|
||||
uint base;
|
||||
uint base_size;
|
||||
base=memfindbaseaddr(fdProcessInfo->hProcess, addr, &base_size);
|
||||
if(!base or !base_size)
|
||||
{
|
||||
if(!silent)
|
||||
dputs("invalid memory page");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!size) //assume the whole page
|
||||
{
|
||||
start_addr=base;
|
||||
start_size=base_size;
|
||||
}
|
||||
else //custom boundaries
|
||||
{
|
||||
start_addr=addr;
|
||||
uint maxsize=size-(start_addr-base);
|
||||
if(size<maxsize) //check if the size fits in the page
|
||||
start_size=size;
|
||||
else
|
||||
start_size=maxsize;
|
||||
}
|
||||
unsigned char* data=(unsigned char*)emalloc(start_size, "reffind:data");
|
||||
if(!memread(fdProcessInfo->hProcess, (const void*)start_addr, data, start_size, 0))
|
||||
{
|
||||
if(!silent)
|
||||
dputs("error reading memory");
|
||||
efree(data, "reffind:data");
|
||||
return 0;
|
||||
}
|
||||
DISASM disasm;
|
||||
memset(&disasm, 0, sizeof(disasm));
|
||||
#ifdef _WIN64
|
||||
disasm.Archi=64;
|
||||
#endif // _WIN64
|
||||
disasm.EIP=(UIntPtr)data;
|
||||
disasm.VirtualAddr=(UInt64)start_addr;
|
||||
uint i=0;
|
||||
BASIC_INSTRUCTION_INFO basicinfo;
|
||||
cbRef(&disasm, &basicinfo, 0); //allow initializing
|
||||
REFINFO refinfo;
|
||||
memset(&refinfo, 0, sizeof(REFINFO));
|
||||
refinfo.userinfo=userinfo;
|
||||
while(i<start_size)
|
||||
{
|
||||
if(!(i%0x1000))
|
||||
{
|
||||
double percent=(double)i/(double)start_size;
|
||||
GuiReferenceSetProgress((int)(percent*100));
|
||||
}
|
||||
int len=Disasm(&disasm);
|
||||
if(len!=UNKNOWN_OPCODE)
|
||||
{
|
||||
fillbasicinfo(&disasm, &basicinfo);
|
||||
if(cbRef(&disasm, &basicinfo, &refinfo))
|
||||
refinfo.refcount++;
|
||||
}
|
||||
else
|
||||
len=1;
|
||||
disasm.EIP+=len;
|
||||
disasm.VirtualAddr+=len;
|
||||
i+=len;
|
||||
}
|
||||
GuiReferenceSetProgress(100);
|
||||
GuiReferenceReloadData();
|
||||
efree(data, "reffind:data");
|
||||
return refinfo.refcount;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#ifndef _REFERENCE_H
|
||||
#define _REFERENCE_H
|
||||
|
||||
#include "_global.h"
|
||||
#include "disasm_fast.h"
|
||||
|
||||
//structs
|
||||
struct REFINFO
|
||||
{
|
||||
int refcount;
|
||||
void* userinfo;
|
||||
};
|
||||
|
||||
//typedefs
|
||||
typedef bool (*CBREF)(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo);
|
||||
|
||||
//functions
|
||||
int reffind(uint page, uint size, CBREF cbRef, void* userinfo, bool silent);
|
||||
|
||||
#endif //_REFERENCE_H
|
||||
#ifndef _REFERENCE_H
|
||||
#define _REFERENCE_H
|
||||
|
||||
#include "_global.h"
|
||||
#include "disasm_fast.h"
|
||||
|
||||
//structs
|
||||
struct REFINFO
|
||||
{
|
||||
int refcount;
|
||||
void* userinfo;
|
||||
};
|
||||
|
||||
//typedefs
|
||||
typedef bool (*CBREF)(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo);
|
||||
|
||||
//functions
|
||||
int reffind(uint page, uint size, CBREF cbRef, void* userinfo, bool silent);
|
||||
|
||||
#endif //_REFERENCE_H
|
||||
|
|
|
@ -160,7 +160,7 @@ static bool scriptcreatelinemap(const char* filename)
|
|||
else //no space before comment
|
||||
{
|
||||
strcpy(line_comment, comment);
|
||||
*comment=0;
|
||||
*comment=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ static bool scriptisinternalcommand(const char* text, const char* cmd)
|
|||
else if(cmdlen==len)
|
||||
return scmp(text, cmd);
|
||||
else if(text[cmdlen]==' ')
|
||||
return (!_strnicmp(text, cmd, cmdlen));
|
||||
return (!_strnicmp(text, cmd, cmdlen));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
*/
|
||||
|
||||
#ifdef BUILD_DLL
|
||||
#define DLL_EXPORT __declspec(dllexport)
|
||||
#define DLL_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLL_EXPORT __declspec(dllimport)
|
||||
#define DLL_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,155 +1,155 @@
|
|||
#include <windows.h>
|
||||
|
||||
//Thanks to: https://github.com/zer0fl4g/Nanomite
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
|
||||
typedef struct _UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PWSTR Buffer;
|
||||
} UNICODE_STRING;
|
||||
|
||||
typedef struct _CLIENT_ID
|
||||
{
|
||||
HANDLE UniqueProcess;
|
||||
HANDLE UniqueThread;
|
||||
} CLIENT_ID;
|
||||
|
||||
typedef struct _PEB
|
||||
{
|
||||
BYTE InheritedAddressSpace;
|
||||
BYTE ReadImageFileExecOptions;
|
||||
BYTE BeingDebugged;
|
||||
BYTE SpareBool;
|
||||
DWORD Mutant;
|
||||
DWORD ImageBaseAddress;
|
||||
DWORD LoaderData;
|
||||
DWORD ProcessParameters;
|
||||
DWORD SubSystemData;
|
||||
DWORD ProcessHeap;
|
||||
DWORD FastPebLock;
|
||||
DWORD FastPebLockRoutine;
|
||||
DWORD FastPebUnlockRoutine;
|
||||
DWORD EnviromentUpdateCount;
|
||||
DWORD KernelCallbackTable;
|
||||
DWORD UserSharedInfoPtr;
|
||||
DWORD ThunksOrOptions;
|
||||
DWORD FreeList;
|
||||
DWORD TlsExpansionCounter;
|
||||
DWORD TlsBitmap;
|
||||
DWORD TlsBitmapBits[2];
|
||||
DWORD ReadOnlySharedMemoryBase;
|
||||
DWORD ReadOnlySharedMemoryHeap;
|
||||
DWORD ReadOnlyStaticServerData;
|
||||
DWORD AnsiCodePageData;
|
||||
DWORD OemCodePageData;
|
||||
DWORD UnicodeCaseTableData;
|
||||
DWORD NumberOfProcessors;
|
||||
DWORD NtGlobalFlag;
|
||||
DWORD Reserved;
|
||||
LARGE_INTEGER CriticalSectionTimeout;
|
||||
DWORD HeapSegmentReserve;
|
||||
DWORD HeapSegmentCommit;
|
||||
DWORD HeapDeCommitTotalFreeThreshold;
|
||||
DWORD HeapDeCommitFreeBlockThreshold;
|
||||
DWORD NumberOfHeaps;
|
||||
DWORD MaximumNumberOfHeaps;
|
||||
DWORD ProcessHeaps;
|
||||
DWORD GdiSharedHandleTable;
|
||||
DWORD ProcessStarterHelper;
|
||||
DWORD GdiDCAttributeList;
|
||||
DWORD LoaderLock;
|
||||
DWORD OSMajorVersion;
|
||||
DWORD OSMinorVersion;
|
||||
WORD OSBuildNumber;
|
||||
WORD OSCSDVersion;
|
||||
DWORD OSPlatformId;
|
||||
DWORD ImageSubsystem;
|
||||
DWORD ImageSubsystemMajorVersion;
|
||||
DWORD ImageSubsystemMinorVersion;
|
||||
DWORD ImageProcessAffinityMask;
|
||||
DWORD GdiHandleBuffer[34];
|
||||
DWORD PostProcessInitRoutine;
|
||||
DWORD TlsExpansionBitmap;
|
||||
DWORD TlsExpansionBitmapBits[32];
|
||||
DWORD SessionId;
|
||||
ULARGE_INTEGER AppCompatFlags;
|
||||
ULARGE_INTEGER AppCompatFlagsUser;
|
||||
DWORD pShimData;
|
||||
DWORD AppCompatInfo;
|
||||
UNICODE_STRING CSDVersion;
|
||||
DWORD ActivationContextData;
|
||||
DWORD ProcessAssemblyStorageMap;
|
||||
DWORD SystemDefaultActivationContextData;
|
||||
DWORD SystemAssemblyStorageMap;
|
||||
DWORD MinimumStackCommit;
|
||||
DWORD FlsCallback;
|
||||
DWORD FlsListHead_Flink;
|
||||
DWORD FlsListHead_Blink;
|
||||
DWORD FlsBitmap;
|
||||
DWORD FlsBitmapBits[4];
|
||||
DWORD FlsHighIndex;
|
||||
} PEB, *PPEB;
|
||||
|
||||
typedef struct _TEB
|
||||
{
|
||||
NT_TIB Tib;
|
||||
PVOID EnvironmentPointer;
|
||||
CLIENT_ID Cid;
|
||||
PVOID ActiveRpcInfo;
|
||||
PVOID ThreadLocalStoragePointer;
|
||||
PPEB Peb;
|
||||
ULONG LastErrorValue;
|
||||
ULONG CountOfOwnedCriticalSections;
|
||||
PVOID CsrClientThread;
|
||||
PVOID Win32ThreadInfo;
|
||||
ULONG Win32ClientInfo[0x1F];
|
||||
PVOID WOW32Reserved;
|
||||
ULONG CurrentLocale;
|
||||
ULONG FpSoftwareStatusRegister;
|
||||
PVOID SystemReserved1[0x36];
|
||||
PVOID Spare1;
|
||||
ULONG ExceptionCode;
|
||||
ULONG SpareBytes1[0x28];
|
||||
PVOID SystemReserved2[0xA];
|
||||
ULONG GdiRgn;
|
||||
ULONG GdiPen;
|
||||
ULONG GdiBrush;
|
||||
CLIENT_ID RealClientId;
|
||||
PVOID GdiCachedProcessHandle;
|
||||
ULONG GdiClientPID;
|
||||
ULONG GdiClientTID;
|
||||
PVOID GdiThreadLocaleInfo;
|
||||
PVOID UserReserved[5];
|
||||
PVOID GlDispatchTable[0x118];
|
||||
ULONG GlReserved1[0x1A];
|
||||
PVOID GlReserved2;
|
||||
PVOID GlSectionInfo;
|
||||
PVOID GlSection;
|
||||
PVOID GlTable;
|
||||
PVOID GlCurrentRC;
|
||||
PVOID GlContext;
|
||||
NTSTATUS LastStatusValue;
|
||||
UNICODE_STRING StaticUnicodeString;
|
||||
WCHAR StaticUnicodeBuffer[0x105];
|
||||
PVOID DeallocationStack;
|
||||
PVOID TlsSlots[0x40];
|
||||
LIST_ENTRY TlsLinks;
|
||||
PVOID Vdm;
|
||||
PVOID ReservedForNtRpc;
|
||||
PVOID DbgSsReserved[0x2];
|
||||
ULONG HardErrorDisabled;
|
||||
PVOID Instrumentation[0x10];
|
||||
PVOID WinSockData;
|
||||
ULONG GdiBatchCount;
|
||||
ULONG Spare2;
|
||||
ULONG Spare3;
|
||||
ULONG Spare4;
|
||||
PVOID ReservedForOle;
|
||||
ULONG WaitingOnLoaderLock;
|
||||
PVOID StackCommit;
|
||||
PVOID StackCommitMax;
|
||||
PVOID StackReserved;
|
||||
} TEB, *PTEB;
|
||||
#include <windows.h>
|
||||
|
||||
//Thanks to: https://github.com/zer0fl4g/Nanomite
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
|
||||
typedef struct _UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PWSTR Buffer;
|
||||
} UNICODE_STRING;
|
||||
|
||||
typedef struct _CLIENT_ID
|
||||
{
|
||||
HANDLE UniqueProcess;
|
||||
HANDLE UniqueThread;
|
||||
} CLIENT_ID;
|
||||
|
||||
typedef struct _PEB
|
||||
{
|
||||
BYTE InheritedAddressSpace;
|
||||
BYTE ReadImageFileExecOptions;
|
||||
BYTE BeingDebugged;
|
||||
BYTE SpareBool;
|
||||
DWORD Mutant;
|
||||
DWORD ImageBaseAddress;
|
||||
DWORD LoaderData;
|
||||
DWORD ProcessParameters;
|
||||
DWORD SubSystemData;
|
||||
DWORD ProcessHeap;
|
||||
DWORD FastPebLock;
|
||||
DWORD FastPebLockRoutine;
|
||||
DWORD FastPebUnlockRoutine;
|
||||
DWORD EnviromentUpdateCount;
|
||||
DWORD KernelCallbackTable;
|
||||
DWORD UserSharedInfoPtr;
|
||||
DWORD ThunksOrOptions;
|
||||
DWORD FreeList;
|
||||
DWORD TlsExpansionCounter;
|
||||
DWORD TlsBitmap;
|
||||
DWORD TlsBitmapBits[2];
|
||||
DWORD ReadOnlySharedMemoryBase;
|
||||
DWORD ReadOnlySharedMemoryHeap;
|
||||
DWORD ReadOnlyStaticServerData;
|
||||
DWORD AnsiCodePageData;
|
||||
DWORD OemCodePageData;
|
||||
DWORD UnicodeCaseTableData;
|
||||
DWORD NumberOfProcessors;
|
||||
DWORD NtGlobalFlag;
|
||||
DWORD Reserved;
|
||||
LARGE_INTEGER CriticalSectionTimeout;
|
||||
DWORD HeapSegmentReserve;
|
||||
DWORD HeapSegmentCommit;
|
||||
DWORD HeapDeCommitTotalFreeThreshold;
|
||||
DWORD HeapDeCommitFreeBlockThreshold;
|
||||
DWORD NumberOfHeaps;
|
||||
DWORD MaximumNumberOfHeaps;
|
||||
DWORD ProcessHeaps;
|
||||
DWORD GdiSharedHandleTable;
|
||||
DWORD ProcessStarterHelper;
|
||||
DWORD GdiDCAttributeList;
|
||||
DWORD LoaderLock;
|
||||
DWORD OSMajorVersion;
|
||||
DWORD OSMinorVersion;
|
||||
WORD OSBuildNumber;
|
||||
WORD OSCSDVersion;
|
||||
DWORD OSPlatformId;
|
||||
DWORD ImageSubsystem;
|
||||
DWORD ImageSubsystemMajorVersion;
|
||||
DWORD ImageSubsystemMinorVersion;
|
||||
DWORD ImageProcessAffinityMask;
|
||||
DWORD GdiHandleBuffer[34];
|
||||
DWORD PostProcessInitRoutine;
|
||||
DWORD TlsExpansionBitmap;
|
||||
DWORD TlsExpansionBitmapBits[32];
|
||||
DWORD SessionId;
|
||||
ULARGE_INTEGER AppCompatFlags;
|
||||
ULARGE_INTEGER AppCompatFlagsUser;
|
||||
DWORD pShimData;
|
||||
DWORD AppCompatInfo;
|
||||
UNICODE_STRING CSDVersion;
|
||||
DWORD ActivationContextData;
|
||||
DWORD ProcessAssemblyStorageMap;
|
||||
DWORD SystemDefaultActivationContextData;
|
||||
DWORD SystemAssemblyStorageMap;
|
||||
DWORD MinimumStackCommit;
|
||||
DWORD FlsCallback;
|
||||
DWORD FlsListHead_Flink;
|
||||
DWORD FlsListHead_Blink;
|
||||
DWORD FlsBitmap;
|
||||
DWORD FlsBitmapBits[4];
|
||||
DWORD FlsHighIndex;
|
||||
} PEB, *PPEB;
|
||||
|
||||
typedef struct _TEB
|
||||
{
|
||||
NT_TIB Tib;
|
||||
PVOID EnvironmentPointer;
|
||||
CLIENT_ID Cid;
|
||||
PVOID ActiveRpcInfo;
|
||||
PVOID ThreadLocalStoragePointer;
|
||||
PPEB Peb;
|
||||
ULONG LastErrorValue;
|
||||
ULONG CountOfOwnedCriticalSections;
|
||||
PVOID CsrClientThread;
|
||||
PVOID Win32ThreadInfo;
|
||||
ULONG Win32ClientInfo[0x1F];
|
||||
PVOID WOW32Reserved;
|
||||
ULONG CurrentLocale;
|
||||
ULONG FpSoftwareStatusRegister;
|
||||
PVOID SystemReserved1[0x36];
|
||||
PVOID Spare1;
|
||||
ULONG ExceptionCode;
|
||||
ULONG SpareBytes1[0x28];
|
||||
PVOID SystemReserved2[0xA];
|
||||
ULONG GdiRgn;
|
||||
ULONG GdiPen;
|
||||
ULONG GdiBrush;
|
||||
CLIENT_ID RealClientId;
|
||||
PVOID GdiCachedProcessHandle;
|
||||
ULONG GdiClientPID;
|
||||
ULONG GdiClientTID;
|
||||
PVOID GdiThreadLocaleInfo;
|
||||
PVOID UserReserved[5];
|
||||
PVOID GlDispatchTable[0x118];
|
||||
ULONG GlReserved1[0x1A];
|
||||
PVOID GlReserved2;
|
||||
PVOID GlSectionInfo;
|
||||
PVOID GlSection;
|
||||
PVOID GlTable;
|
||||
PVOID GlCurrentRC;
|
||||
PVOID GlContext;
|
||||
NTSTATUS LastStatusValue;
|
||||
UNICODE_STRING StaticUnicodeString;
|
||||
WCHAR StaticUnicodeBuffer[0x105];
|
||||
PVOID DeallocationStack;
|
||||
PVOID TlsSlots[0x40];
|
||||
LIST_ENTRY TlsLinks;
|
||||
PVOID Vdm;
|
||||
PVOID ReservedForNtRpc;
|
||||
PVOID DbgSsReserved[0x2];
|
||||
ULONG HardErrorDisabled;
|
||||
PVOID Instrumentation[0x10];
|
||||
PVOID WinSockData;
|
||||
ULONG GdiBatchCount;
|
||||
ULONG Spare2;
|
||||
ULONG Spare3;
|
||||
ULONG Spare4;
|
||||
PVOID ReservedForOle;
|
||||
ULONG WaitingOnLoaderLock;
|
||||
PVOID StackCommit;
|
||||
PVOID StackCommitMax;
|
||||
PVOID StackReserved;
|
||||
} TEB, *PTEB;
|
||||
|
|
|
@ -129,7 +129,7 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
y = getHeaderHeight();
|
||||
x += getColumnWidth(j);
|
||||
}
|
||||
emit repainted();
|
||||
emit repainted();
|
||||
}
|
||||
|
||||
|
||||
|
@ -258,7 +258,7 @@ void AbstractTableView::mouseMoveEvent(QMouseEvent* event)
|
|||
repaint();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,19 +458,19 @@ void AbstractTableView::vertSliderActionSlot(int action)
|
|||
switch(action)
|
||||
{
|
||||
case QAbstractSlider::SliderNoAction:
|
||||
break;
|
||||
break;
|
||||
case QAbstractSlider::SliderSingleStepAdd:
|
||||
wDelta = 1;
|
||||
break;
|
||||
break;
|
||||
case QAbstractSlider::SliderSingleStepSub:
|
||||
wDelta = -1;
|
||||
break;
|
||||
break;
|
||||
case QAbstractSlider::SliderPageStepAdd:
|
||||
wDelta = 30;
|
||||
break;
|
||||
break;
|
||||
case QAbstractSlider::SliderPageStepSub:
|
||||
wDelta = -30;
|
||||
break;
|
||||
break;
|
||||
case QAbstractSlider::SliderToMinimum:
|
||||
case QAbstractSlider::SliderToMaximum:
|
||||
case QAbstractSlider::SliderMove:
|
||||
|
@ -479,9 +479,9 @@ void AbstractTableView::vertSliderActionSlot(int action)
|
|||
#else
|
||||
wDelta = wSliderPos - mTableOffset;
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
// Call the hook (Usefull for disassembly)
|
||||
|
|
|
@ -1,133 +1,133 @@
|
|||
#include "CommandHelpView.h"
|
||||
#include "ui_CommandHelpView.h"
|
||||
|
||||
CommandHelpView::CommandHelpView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CommandHelpView)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Set main layout
|
||||
mMainLayout = new QVBoxLayout;
|
||||
mMainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mMainLayout->addWidget(ui->mainSplitter);
|
||||
setLayout(mMainLayout);
|
||||
|
||||
// Create reference view
|
||||
mSearchListView = new SearchListView();
|
||||
mSearchListView->mSearchStartCol = 1;
|
||||
|
||||
// Get font information
|
||||
QFont wFont("Monospace", 8);
|
||||
wFont.setStyleHint(QFont::Monospace);
|
||||
wFont.setFixedPitch(true);
|
||||
//int charwidth=QFontMetrics(wFont).width(QChar(' '));
|
||||
|
||||
// Create module list
|
||||
mModuleList = new StdTable();
|
||||
mModuleList->addColumnAt(0, "Module", false);
|
||||
|
||||
// Setup symbol list
|
||||
mSearchListView->mList->addColumnAt(0, "Command", true);
|
||||
|
||||
// Setup search list
|
||||
mSearchListView->mSearchList->addColumnAt(0, "Command", true);
|
||||
|
||||
// Setup list splitter
|
||||
ui->listSplitter->addWidget(mModuleList);
|
||||
ui->listSplitter->addWidget(mSearchListView);
|
||||
#ifdef _WIN64
|
||||
// mModuleList : mSymbolList = 40 : 100
|
||||
ui->listSplitter->setStretchFactor(0, 40);
|
||||
ui->listSplitter->setStretchFactor(1, 100);
|
||||
#else
|
||||
// mModuleList : mSymbolList = 30 : 100
|
||||
ui->listSplitter->setStretchFactor(0, 30);
|
||||
ui->listSplitter->setStretchFactor(1, 100);
|
||||
#endif //_WIN64
|
||||
|
||||
// Setup log edit
|
||||
ui->symbolLogEdit->setFont(wFont);
|
||||
ui->symbolLogEdit->setStyleSheet("QTextEdit { background-color: rgb(255, 251, 240) }");
|
||||
ui->symbolLogEdit->setUndoRedoEnabled(false);
|
||||
ui->symbolLogEdit->setReadOnly(true);
|
||||
// Log : List = 2 : 9
|
||||
ui->mainSplitter->setStretchFactor(1, 9);
|
||||
ui->mainSplitter->setStretchFactor(0, 1);
|
||||
|
||||
connect(mModuleList, SIGNAL(selectionChangedSignal(int)), this, SLOT(moduleSelectionChanged(int)));
|
||||
connect(mSearchListView->mList, SIGNAL(selectionChangedSignal(int)), this, SLOT(symbolSelectionChanged(int)));
|
||||
|
||||
//fill with example data
|
||||
mModuleList->setRowCount(2);
|
||||
mModuleList->setCellContent(0, 0, "x64_dbg");
|
||||
mModuleList->setCellContent(1, 0, "testplugin");
|
||||
|
||||
mModuleList->setSingleSelection(0);
|
||||
}
|
||||
|
||||
CommandHelpView::~CommandHelpView()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CommandHelpView::moduleSelectionChanged(int index)
|
||||
{
|
||||
mSearchListView->mList->setRowCount(0);
|
||||
|
||||
if(index==0) //x64_dbg
|
||||
{
|
||||
mCurrentMode=0;
|
||||
mSearchListView->mList->setRowCount(3);
|
||||
mSearchListView->mList->setCellContent(0, 0, "InitDebug");
|
||||
mSearchListView->mList->setCellContent(1, 0, "StopDebug");
|
||||
mSearchListView->mList->setCellContent(2, 0, "run");
|
||||
}
|
||||
else if(index==1) //testplugin
|
||||
{
|
||||
mCurrentMode=1;
|
||||
mSearchListView->mList->setRowCount(2);
|
||||
mSearchListView->mList->setCellContent(0, 0, "plugin1");
|
||||
mSearchListView->mList->setCellContent(1, 0, "grs");
|
||||
}
|
||||
|
||||
mSearchListView->mList->reloadData();
|
||||
mSearchListView->mList->setSingleSelection(0);
|
||||
mSearchListView->mList->setTableOffset(0);
|
||||
mSearchListView->mList->setFocus();
|
||||
mSearchListView->mSearchBox->setText("");
|
||||
}
|
||||
|
||||
void CommandHelpView::symbolSelectionChanged(int index)
|
||||
{
|
||||
QString info="";
|
||||
if(mCurrentMode==0) //x64_dbg
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case 0: //InitDebug
|
||||
info="Initialize debugging a file.\n\nExample:\nInitDebug \"C:\\test.exe\", commandline, \"C:\\homeDir\"";
|
||||
break;
|
||||
case 1: //StopDebug
|
||||
info="Stop debugging (terminate the target).\n\nExample:\nStopDebug";
|
||||
break;
|
||||
case 2: //run
|
||||
info="Resume debugging.\n\nExample:\nrun";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mCurrentMode==1) //testplugin
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case 0: //plugin1
|
||||
info="Just a simple plugin test command.\n\nExample:\nplugin1";
|
||||
break;
|
||||
case 1: //grs
|
||||
info="Get relocation table size.\n\nExample:\ngrs 404000";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
ui->symbolLogEdit->setText(info);
|
||||
}
|
||||
#include "CommandHelpView.h"
|
||||
#include "ui_CommandHelpView.h"
|
||||
|
||||
CommandHelpView::CommandHelpView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CommandHelpView)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Set main layout
|
||||
mMainLayout = new QVBoxLayout;
|
||||
mMainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mMainLayout->addWidget(ui->mainSplitter);
|
||||
setLayout(mMainLayout);
|
||||
|
||||
// Create reference view
|
||||
mSearchListView = new SearchListView();
|
||||
mSearchListView->mSearchStartCol = 1;
|
||||
|
||||
// Get font information
|
||||
QFont wFont("Monospace", 8);
|
||||
wFont.setStyleHint(QFont::Monospace);
|
||||
wFont.setFixedPitch(true);
|
||||
//int charwidth=QFontMetrics(wFont).width(QChar(' '));
|
||||
|
||||
// Create module list
|
||||
mModuleList = new StdTable();
|
||||
mModuleList->addColumnAt(0, "Module", false);
|
||||
|
||||
// Setup symbol list
|
||||
mSearchListView->mList->addColumnAt(0, "Command", true);
|
||||
|
||||
// Setup search list
|
||||
mSearchListView->mSearchList->addColumnAt(0, "Command", true);
|
||||
|
||||
// Setup list splitter
|
||||
ui->listSplitter->addWidget(mModuleList);
|
||||
ui->listSplitter->addWidget(mSearchListView);
|
||||
#ifdef _WIN64
|
||||
// mModuleList : mSymbolList = 40 : 100
|
||||
ui->listSplitter->setStretchFactor(0, 40);
|
||||
ui->listSplitter->setStretchFactor(1, 100);
|
||||
#else
|
||||
// mModuleList : mSymbolList = 30 : 100
|
||||
ui->listSplitter->setStretchFactor(0, 30);
|
||||
ui->listSplitter->setStretchFactor(1, 100);
|
||||
#endif //_WIN64
|
||||
|
||||
// Setup log edit
|
||||
ui->symbolLogEdit->setFont(wFont);
|
||||
ui->symbolLogEdit->setStyleSheet("QTextEdit { background-color: rgb(255, 251, 240) }");
|
||||
ui->symbolLogEdit->setUndoRedoEnabled(false);
|
||||
ui->symbolLogEdit->setReadOnly(true);
|
||||
// Log : List = 2 : 9
|
||||
ui->mainSplitter->setStretchFactor(1, 9);
|
||||
ui->mainSplitter->setStretchFactor(0, 1);
|
||||
|
||||
connect(mModuleList, SIGNAL(selectionChangedSignal(int)), this, SLOT(moduleSelectionChanged(int)));
|
||||
connect(mSearchListView->mList, SIGNAL(selectionChangedSignal(int)), this, SLOT(symbolSelectionChanged(int)));
|
||||
|
||||
//fill with example data
|
||||
mModuleList->setRowCount(2);
|
||||
mModuleList->setCellContent(0, 0, "x64_dbg");
|
||||
mModuleList->setCellContent(1, 0, "testplugin");
|
||||
|
||||
mModuleList->setSingleSelection(0);
|
||||
}
|
||||
|
||||
CommandHelpView::~CommandHelpView()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CommandHelpView::moduleSelectionChanged(int index)
|
||||
{
|
||||
mSearchListView->mList->setRowCount(0);
|
||||
|
||||
if(index==0) //x64_dbg
|
||||
{
|
||||
mCurrentMode=0;
|
||||
mSearchListView->mList->setRowCount(3);
|
||||
mSearchListView->mList->setCellContent(0, 0, "InitDebug");
|
||||
mSearchListView->mList->setCellContent(1, 0, "StopDebug");
|
||||
mSearchListView->mList->setCellContent(2, 0, "run");
|
||||
}
|
||||
else if(index==1) //testplugin
|
||||
{
|
||||
mCurrentMode=1;
|
||||
mSearchListView->mList->setRowCount(2);
|
||||
mSearchListView->mList->setCellContent(0, 0, "plugin1");
|
||||
mSearchListView->mList->setCellContent(1, 0, "grs");
|
||||
}
|
||||
|
||||
mSearchListView->mList->reloadData();
|
||||
mSearchListView->mList->setSingleSelection(0);
|
||||
mSearchListView->mList->setTableOffset(0);
|
||||
mSearchListView->mList->setFocus();
|
||||
mSearchListView->mSearchBox->setText("");
|
||||
}
|
||||
|
||||
void CommandHelpView::symbolSelectionChanged(int index)
|
||||
{
|
||||
QString info="";
|
||||
if(mCurrentMode==0) //x64_dbg
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case 0: //InitDebug
|
||||
info="Initialize debugging a file.\n\nExample:\nInitDebug \"C:\\test.exe\", commandline, \"C:\\homeDir\"";
|
||||
break;
|
||||
case 1: //StopDebug
|
||||
info="Stop debugging (terminate the target).\n\nExample:\nStopDebug";
|
||||
break;
|
||||
case 2: //run
|
||||
info="Resume debugging.\n\nExample:\nrun";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mCurrentMode==1) //testplugin
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case 0: //plugin1
|
||||
info="Just a simple plugin test command.\n\nExample:\nplugin1";
|
||||
break;
|
||||
case 1: //grs
|
||||
info="Get relocation table size.\n\nExample:\ngrs 404000";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
ui->symbolLogEdit->setText(info);
|
||||
}
|
||||
|
|
|
@ -1,41 +1,42 @@
|
|||
#ifndef COMMANDHELPVIEW_H
|
||||
#define COMMANDHELPVIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include "StdTable.h"
|
||||
#include "Bridge.h"
|
||||
#include "SearchListView.h"
|
||||
|
||||
namespace Ui {
|
||||
class CommandHelpView;
|
||||
}
|
||||
|
||||
class CommandHelpView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CommandHelpView(QWidget *parent = 0);
|
||||
~CommandHelpView();
|
||||
|
||||
private slots:
|
||||
void moduleSelectionChanged(int index);
|
||||
void symbolSelectionChanged(int index);
|
||||
|
||||
signals:
|
||||
void showCpu();
|
||||
|
||||
private:
|
||||
Ui::CommandHelpView *ui;
|
||||
QVBoxLayout* mMainLayout;
|
||||
QVBoxLayout* mSymbolLayout;
|
||||
QWidget* mSymbolPlaceHolder;
|
||||
SearchListView* mSearchListView;
|
||||
StdTable* mModuleList;
|
||||
int mCurrentMode;
|
||||
};
|
||||
|
||||
#endif // COMMANDHELPVIEW_H
|
||||
#ifndef COMMANDHELPVIEW_H
|
||||
#define COMMANDHELPVIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include "StdTable.h"
|
||||
#include "Bridge.h"
|
||||
#include "SearchListView.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CommandHelpView;
|
||||
}
|
||||
|
||||
class CommandHelpView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CommandHelpView(QWidget *parent = 0);
|
||||
~CommandHelpView();
|
||||
|
||||
private slots:
|
||||
void moduleSelectionChanged(int index);
|
||||
void symbolSelectionChanged(int index);
|
||||
|
||||
signals:
|
||||
void showCpu();
|
||||
|
||||
private:
|
||||
Ui::CommandHelpView *ui;
|
||||
QVBoxLayout* mMainLayout;
|
||||
QVBoxLayout* mSymbolLayout;
|
||||
QWidget* mSymbolPlaceHolder;
|
||||
SearchListView* mSearchListView;
|
||||
StdTable* mModuleList;
|
||||
int mCurrentMode;
|
||||
};
|
||||
|
||||
#endif // COMMANDHELPVIEW_H
|
||||
|
|
|
@ -282,7 +282,9 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
painter->setPen(Configuration::instance()->color("DisassemblyCommentColor")); //DisassemblyCommentColor
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, QString(comment));
|
||||
painter->restore();
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Configuration::instance()->color("DisassemblyCommentColor")); //DisassemblyCommentColor
|
||||
//painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, "QString(comment)");
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
#include "HistoryLineEdit.h"
|
||||
|
||||
HistoryLineEdit::HistoryLineEdit(QWidget *parent) : QLineEdit(parent)
|
||||
{
|
||||
mCmdHistory.clear();
|
||||
mCmdIndex = -1;
|
||||
}
|
||||
|
||||
void HistoryLineEdit::addLineToHistory(QString parLine)
|
||||
{
|
||||
mCmdHistory.prepend(parLine);
|
||||
|
||||
if(mCmdHistory.size() > 32)
|
||||
mCmdHistory.removeLast();
|
||||
|
||||
mCmdIndex = -1;
|
||||
}
|
||||
|
||||
void HistoryLineEdit::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
int wKey = event->key();
|
||||
|
||||
if(wKey == Qt::Key_Up || wKey == Qt::Key_Down)
|
||||
{
|
||||
if(wKey == Qt::Key_Up)
|
||||
mCmdIndex++;
|
||||
else if(wKey == Qt::Key_Down)
|
||||
mCmdIndex--;
|
||||
|
||||
mCmdIndex = mCmdIndex < -1 ? -1 : mCmdIndex;
|
||||
mCmdIndex = mCmdIndex > mCmdHistory.size() - 1 ? mCmdHistory.size() - 1 : mCmdIndex;
|
||||
|
||||
if(mCmdIndex == -1)
|
||||
{
|
||||
setText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
setText(mCmdHistory.at(mCmdIndex));
|
||||
}
|
||||
}
|
||||
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void HistoryLineEdit::setFocus()
|
||||
{
|
||||
mCmdIndex = -1;
|
||||
QLineEdit::setFocus();
|
||||
}
|
||||
|
||||
#include "HistoryLineEdit.h"
|
||||
|
||||
HistoryLineEdit::HistoryLineEdit(QWidget *parent) : QLineEdit(parent)
|
||||
{
|
||||
mCmdHistory.clear();
|
||||
mCmdIndex = -1;
|
||||
}
|
||||
|
||||
void HistoryLineEdit::addLineToHistory(QString parLine)
|
||||
{
|
||||
mCmdHistory.prepend(parLine);
|
||||
|
||||
if(mCmdHistory.size() > 32)
|
||||
mCmdHistory.removeLast();
|
||||
|
||||
mCmdIndex = -1;
|
||||
}
|
||||
|
||||
void HistoryLineEdit::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
int wKey = event->key();
|
||||
|
||||
if(wKey == Qt::Key_Up || wKey == Qt::Key_Down)
|
||||
{
|
||||
if(wKey == Qt::Key_Up)
|
||||
mCmdIndex++;
|
||||
else if(wKey == Qt::Key_Down)
|
||||
mCmdIndex--;
|
||||
|
||||
mCmdIndex = mCmdIndex < -1 ? -1 : mCmdIndex;
|
||||
mCmdIndex = mCmdIndex > mCmdHistory.size() - 1 ? mCmdHistory.size() - 1 : mCmdIndex;
|
||||
|
||||
if(mCmdIndex == -1)
|
||||
{
|
||||
setText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
setText(mCmdHistory.at(mCmdIndex));
|
||||
}
|
||||
}
|
||||
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void HistoryLineEdit::setFocus()
|
||||
{
|
||||
mCmdIndex = -1;
|
||||
QLineEdit::setFocus();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
#ifndef HISTORYLINEEDIT_H
|
||||
#define HISTORYLINEEDIT_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
|
||||
class HistoryLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HistoryLineEdit(QWidget *parent = 0);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void addLineToHistory(QString parLine);
|
||||
void setFocus();
|
||||
|
||||
signals:
|
||||
void keyPressed(int parKey);
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
private:
|
||||
QList<QString> mCmdHistory;
|
||||
int mCmdIndex;
|
||||
|
||||
};
|
||||
|
||||
#endif // HISTORYLINEEDIT_H
|
||||
#ifndef HISTORYLINEEDIT_H
|
||||
#define HISTORYLINEEDIT_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
|
||||
class HistoryLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HistoryLineEdit(QWidget *parent = 0);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void addLineToHistory(QString parLine);
|
||||
void setFocus();
|
||||
|
||||
signals:
|
||||
void keyPressed(int parKey);
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
private:
|
||||
QList<QString> mCmdHistory;
|
||||
int mCmdIndex;
|
||||
|
||||
};
|
||||
|
||||
#endif // HISTORYLINEEDIT_H
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class LineEditDialog;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,35 +87,35 @@ void MemoryMapView::stateChangedSlot(DBGSTATE state)
|
|||
// State
|
||||
switch(wMbi.State)
|
||||
{
|
||||
case MEM_FREE:
|
||||
wS = QString("FREE");
|
||||
break;
|
||||
case MEM_COMMIT:
|
||||
wS = QString("COMM");
|
||||
break;
|
||||
case MEM_RESERVE:
|
||||
wS = QString("RESV");
|
||||
break;
|
||||
default:
|
||||
wS = QString("????");
|
||||
case MEM_FREE:
|
||||
wS = QString("FREE");
|
||||
break;
|
||||
case MEM_COMMIT:
|
||||
wS = QString("COMM");
|
||||
break;
|
||||
case MEM_RESERVE:
|
||||
wS = QString("RESV");
|
||||
break;
|
||||
default:
|
||||
wS = QString("????");
|
||||
}
|
||||
setCellContent(wI, 3, wS);
|
||||
|
||||
// Type
|
||||
switch(wMbi.Type)
|
||||
{
|
||||
case MEM_IMAGE:
|
||||
wS = QString("IMG");
|
||||
break;
|
||||
case MEM_MAPPED:
|
||||
wS = QString("MAP");
|
||||
break;
|
||||
case MEM_PRIVATE:
|
||||
wS = QString("PRV");
|
||||
break;
|
||||
default:
|
||||
wS = QString("N/A");
|
||||
break;
|
||||
case MEM_IMAGE:
|
||||
wS = QString("IMG");
|
||||
break;
|
||||
case MEM_MAPPED:
|
||||
wS = QString("MAP");
|
||||
break;
|
||||
case MEM_PRIVATE:
|
||||
wS = QString("PRV");
|
||||
break;
|
||||
default:
|
||||
wS = QString("N/A");
|
||||
break;
|
||||
}
|
||||
setCellContent(wI, 3, wS);
|
||||
|
||||
|
|
|
@ -205,7 +205,8 @@ void RegistersView::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
mRegNamesList->at(mSelected) == CIP ||
|
||||
|
||||
mRegNamesList->at(mSelected) == EFLAGS)
|
||||
{ //double clicked general register
|
||||
{
|
||||
//double clicked general register
|
||||
displayEditDialog();
|
||||
}
|
||||
else if(mRegNamesList->at(mSelected) == CF ||
|
||||
|
@ -217,7 +218,8 @@ void RegistersView::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
mRegNamesList->at(mSelected) == IF ||
|
||||
mRegNamesList->at(mSelected) == DF ||
|
||||
mRegNamesList->at(mSelected) == OF)
|
||||
{ //double clicked a flag
|
||||
{
|
||||
//double clicked a flag
|
||||
setRegister(mRegNamesList->at(mSelected), mRegList->at(mSelected)->text().toInt()^1); //toggle flag (stupid way in fact)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,18 @@
|
|||
#include "WordEditDialog.h"
|
||||
#include "LineEditDialog.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class RegistersView;
|
||||
}
|
||||
|
||||
class RegistersView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
enum REGISTER_NAME {
|
||||
enum REGISTER_NAME
|
||||
{
|
||||
CAX,
|
||||
CCX,
|
||||
CDX,
|
||||
|
@ -75,7 +77,7 @@ public slots:
|
|||
void displayCustomContextMenuSlot(QPoint pos);
|
||||
void setRegister(REGISTER_NAME reg, uint_t value);
|
||||
void debugStateChangedSlot(DBGSTATE state);
|
||||
|
||||
|
||||
private:
|
||||
void displayEditDialog();
|
||||
Ui::RegistersView *ui;
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
#include "RichTextPainter.h"
|
||||
|
||||
void RichTextPainter::paintRichText(QPainter* painter, int x, int y, int w, int h, int xinc, const QList<CustomRichText_t>* richText, int charwidth)
|
||||
{
|
||||
int len=richText->size();
|
||||
for(int i=0; i<len; i++)
|
||||
{
|
||||
CustomRichText_t curRichText=richText->at(i);
|
||||
int curRichTextLength=curRichText.text.length();
|
||||
int backgroundWidth=charwidth*curRichTextLength;
|
||||
if(backgroundWidth+xinc>w)
|
||||
backgroundWidth=w-xinc;
|
||||
if(backgroundWidth<=0) //stop drawing when going outside the specified width
|
||||
break;
|
||||
switch(curRichText.flags)
|
||||
{
|
||||
case FlagNone: //defaults
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
break;
|
||||
case FlagColor: //color only
|
||||
painter->save();
|
||||
painter->setPen(QPen(curRichText.textColor));
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
painter->restore();
|
||||
break;
|
||||
case FlagBackground: //background only
|
||||
painter->save();
|
||||
if(backgroundWidth>0)
|
||||
painter->fillRect(QRect(x+xinc, y, backgroundWidth, h), QBrush(curRichText.textBackground));
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
painter->restore();
|
||||
break;
|
||||
case FlagAll: //color+background
|
||||
painter->save();
|
||||
if(backgroundWidth>0)
|
||||
painter->fillRect(QRect(x+xinc, y, backgroundWidth, h), QBrush(curRichText.textBackground));
|
||||
painter->setPen(QPen(curRichText.textColor));
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
painter->restore();
|
||||
break;
|
||||
}
|
||||
xinc+=charwidth*curRichTextLength;
|
||||
}
|
||||
}
|
||||
#include "RichTextPainter.h"
|
||||
|
||||
void RichTextPainter::paintRichText(QPainter* painter, int x, int y, int w, int h, int xinc, const QList<CustomRichText_t>* richText, int charwidth)
|
||||
{
|
||||
int len=richText->size();
|
||||
for(int i=0; i<len; i++)
|
||||
{
|
||||
CustomRichText_t curRichText=richText->at(i);
|
||||
int curRichTextLength=curRichText.text.length();
|
||||
int backgroundWidth=charwidth*curRichTextLength;
|
||||
if(backgroundWidth+xinc>w)
|
||||
backgroundWidth=w-xinc;
|
||||
if(backgroundWidth<=0) //stop drawing when going outside the specified width
|
||||
break;
|
||||
switch(curRichText.flags)
|
||||
{
|
||||
case FlagNone: //defaults
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
break;
|
||||
case FlagColor: //color only
|
||||
painter->save();
|
||||
painter->setPen(QPen(curRichText.textColor));
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
painter->restore();
|
||||
break;
|
||||
case FlagBackground: //background only
|
||||
painter->save();
|
||||
if(backgroundWidth>0)
|
||||
painter->fillRect(QRect(x+xinc, y, backgroundWidth, h), QBrush(curRichText.textBackground));
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
painter->restore();
|
||||
break;
|
||||
case FlagAll: //color+background
|
||||
painter->save();
|
||||
if(backgroundWidth>0)
|
||||
painter->fillRect(QRect(x+xinc, y, backgroundWidth, h), QBrush(curRichText.textBackground));
|
||||
painter->setPen(QPen(curRichText.textColor));
|
||||
painter->drawText(QRect(x+xinc, y, w-xinc, h), 0, curRichText.text);
|
||||
painter->restore();
|
||||
break;
|
||||
}
|
||||
xinc+=charwidth*curRichTextLength;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
#ifndef RICHTEXTPAINTER_H
|
||||
#define RICHTEXTPAINTER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QPainter>
|
||||
|
||||
//structures
|
||||
enum CustomRichTextFlags
|
||||
{
|
||||
FlagNone,
|
||||
FlagColor,
|
||||
FlagBackground,
|
||||
FlagAll
|
||||
};
|
||||
|
||||
typedef struct _CustomRichText_t
|
||||
{
|
||||
QString text;
|
||||
QColor textColor;
|
||||
QColor textBackground;
|
||||
CustomRichTextFlags flags;
|
||||
} CustomRichText_t;
|
||||
|
||||
class RichTextPainter
|
||||
{
|
||||
public:
|
||||
//functions
|
||||
static void paintRichText(QPainter* painter, int x, int y, int w, int h, int xinc, const QList<CustomRichText_t>* richText, int charwidth);
|
||||
};
|
||||
|
||||
#endif // RICHTEXTPAINTER_H
|
||||
#ifndef RICHTEXTPAINTER_H
|
||||
#define RICHTEXTPAINTER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QPainter>
|
||||
|
||||
//structures
|
||||
enum CustomRichTextFlags
|
||||
{
|
||||
FlagNone,
|
||||
FlagColor,
|
||||
FlagBackground,
|
||||
FlagAll
|
||||
};
|
||||
|
||||
typedef struct _CustomRichText_t
|
||||
{
|
||||
QString text;
|
||||
QColor textColor;
|
||||
QColor textBackground;
|
||||
CustomRichTextFlags flags;
|
||||
} CustomRichText_t;
|
||||
|
||||
class RichTextPainter
|
||||
{
|
||||
public:
|
||||
//functions
|
||||
static void paintRichText(QPainter* painter, int x, int y, int w, int h, int xinc, const QList<CustomRichText_t>* richText, int charwidth);
|
||||
};
|
||||
|
||||
#endif // RICHTEXTPAINTER_H
|
||||
|
|
|
@ -130,7 +130,7 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
case scriptjmp: //unconditional jumps
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
break;
|
||||
break;
|
||||
|
||||
case scriptjnejnz: //conditional jumps
|
||||
case scriptjejz:
|
||||
|
@ -141,16 +141,16 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
newRichText.flags=FlagAll;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.textColor=QColor("#FF0000");
|
||||
break;
|
||||
break;
|
||||
|
||||
case scriptcall: //calls
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
newRichText.flags=FlagNone;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
newRichText.text=command.left(i);
|
||||
richText.push_back(newRichText);
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include <QLineEdit>
|
||||
#include "StdTable.h"
|
||||
|
||||
namespace Ui {
|
||||
class SearchListView;
|
||||
namespace Ui
|
||||
{
|
||||
class SearchListView;
|
||||
}
|
||||
|
||||
class SearchListView : public QWidget
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "Bridge.h"
|
||||
#include "SearchListView.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class SymbolView;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,210 +1,210 @@
|
|||
#include "ThreadView.h"
|
||||
|
||||
ThreadView::ThreadView(StdTable *parent) : StdTable(parent)
|
||||
{
|
||||
int charwidth=QFontMetrics(this->font()).width(QChar(' '));
|
||||
addColumnAt(8+charwidth*sizeof(unsigned int)*2, "Number", false);
|
||||
addColumnAt(8+charwidth*sizeof(unsigned int)*2, "ID", false);
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "Entry", false);
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "TEB", false);
|
||||
#ifdef _WIN64
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "RIP", false);
|
||||
#else
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "EIP", false);
|
||||
#endif //_WIN64
|
||||
addColumnAt(8+charwidth*14, "Suspend Count", false);
|
||||
addColumnAt(8+charwidth*12, "Priority", false);
|
||||
addColumnAt(8+charwidth*16, "WaitReason", false);
|
||||
addColumnAt(8+charwidth*10, "LastError", false);
|
||||
addColumnAt(0, "", false);
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(updateThreads()), this, SLOT(updateThreadList()));
|
||||
}
|
||||
|
||||
void ThreadView::updateThreadList()
|
||||
{
|
||||
THREADLIST threadList;
|
||||
memset(&threadList, 0, sizeof(THREADLIST));
|
||||
DbgGetThreadList(&threadList);
|
||||
setRowCount(threadList.count);
|
||||
for(int i=0; i<threadList.count; i++)
|
||||
{
|
||||
if(!threadList.list[i].BasicInfo.ThreadNumber)
|
||||
setCellContent(i, 0, "Main");
|
||||
else
|
||||
setCellContent(i, 0, QString("%1").arg(threadList.list[i].BasicInfo.ThreadNumber, 0, 10));
|
||||
setCellContent(i, 1, QString("%1").arg(threadList.list[i].BasicInfo.dwThreadId, 0, 16).toUpper());
|
||||
setCellContent(i, 2, QString("%1").arg(threadList.list[i].BasicInfo.ThreadStartAddress, sizeof(int_t) * 2, 16, QChar('0')).toUpper());
|
||||
setCellContent(i, 3, QString("%1").arg(threadList.list[i].BasicInfo.ThreadLocalBase, sizeof(int_t) * 2, 16, QChar('0')).toUpper());
|
||||
setCellContent(i, 4, QString("%1").arg(threadList.list[i].ThreadCip, sizeof(int_t) * 2, 16, QChar('0')).toUpper());
|
||||
setCellContent(i, 5, QString("%1").arg(threadList.list[i].SuspendCount, 0, 10));
|
||||
QString priorityString;
|
||||
switch(threadList.list[i].Priority)
|
||||
{
|
||||
case _PriorityIdle:
|
||||
priorityString="Idle";
|
||||
break;
|
||||
case _PriorityAboveNormal:
|
||||
priorityString="AboveNormal";
|
||||
break;
|
||||
case _PriorityBelowNormal:
|
||||
priorityString="BelowNormal";
|
||||
break;
|
||||
case _PriorityHighest:
|
||||
priorityString="Highest";
|
||||
break;
|
||||
case _PriorityLowest:
|
||||
priorityString="Lowest";
|
||||
break;
|
||||
case _PriorityNormal:
|
||||
priorityString="Normal";
|
||||
break;
|
||||
case _PriorityTimeCritical:
|
||||
priorityString="TimeCritical";
|
||||
break;
|
||||
default:
|
||||
priorityString="Unknown";
|
||||
break;
|
||||
}
|
||||
setCellContent(i, 6, priorityString);
|
||||
QString waitReasonString;
|
||||
switch(threadList.list[i].WaitReason)
|
||||
{
|
||||
case _Executive:
|
||||
waitReasonString="Executive";
|
||||
break;
|
||||
case _FreePage:
|
||||
waitReasonString="FreePage";
|
||||
break;
|
||||
case _PageIn:
|
||||
waitReasonString="PageIn";
|
||||
break;
|
||||
case _PoolAllocation:
|
||||
waitReasonString="PoolAllocation";
|
||||
break;
|
||||
case _DelayExecution:
|
||||
waitReasonString="DelayExecution";
|
||||
break;
|
||||
case _Suspended:
|
||||
waitReasonString="Suspended";
|
||||
break;
|
||||
case _UserRequest:
|
||||
waitReasonString="UserRequest";
|
||||
break;
|
||||
case _WrExecutive:
|
||||
waitReasonString="WrExecutive";
|
||||
break;
|
||||
case _WrFreePage:
|
||||
waitReasonString="WrFreePage";
|
||||
break;
|
||||
case _WrPageIn:
|
||||
waitReasonString="WrPageIn";
|
||||
break;
|
||||
case _WrPoolAllocation:
|
||||
waitReasonString="WrPoolAllocation";
|
||||
break;
|
||||
case _WrDelayExecution:
|
||||
waitReasonString="WrDelayExecution";
|
||||
break;
|
||||
case _WrSuspended:
|
||||
waitReasonString="WrSuspended";
|
||||
break;
|
||||
case _WrUserRequest:
|
||||
waitReasonString="WrUserRequest";
|
||||
break;
|
||||
case _WrEventPair:
|
||||
waitReasonString="WrEventPair";
|
||||
break;
|
||||
case _WrQueue:
|
||||
waitReasonString="WrQueue";
|
||||
break;
|
||||
case _WrLpcReceive:
|
||||
waitReasonString="WrLpcReceive";
|
||||
break;
|
||||
case _WrLpcReply:
|
||||
waitReasonString="WrLpcReply";
|
||||
break;
|
||||
case _WrVirtualMemory:
|
||||
waitReasonString="WrVirtualMemory";
|
||||
break;
|
||||
case _WrPageOut:
|
||||
waitReasonString="WrPageOut";
|
||||
break;
|
||||
case _WrRendezvous:
|
||||
waitReasonString="WrRendezvous";
|
||||
break;
|
||||
case _Spare2:
|
||||
waitReasonString="Spare2";
|
||||
break;
|
||||
case _Spare3:
|
||||
waitReasonString="Spare3";
|
||||
break;
|
||||
case _Spare4:
|
||||
waitReasonString="Spare4";
|
||||
break;
|
||||
case _Spare5:
|
||||
waitReasonString="Spare5";
|
||||
break;
|
||||
case _WrCalloutStack:
|
||||
waitReasonString="WrCalloutStack";
|
||||
break;
|
||||
case _WrKernel:
|
||||
waitReasonString="WrKernel";
|
||||
break;
|
||||
case _WrResource:
|
||||
waitReasonString="WrResource";
|
||||
break;
|
||||
case _WrPushLock:
|
||||
waitReasonString="WrPushLock";
|
||||
break;
|
||||
case _WrMutex:
|
||||
waitReasonString="WrMutex";
|
||||
break;
|
||||
case _WrQuantumEnd:
|
||||
waitReasonString="WrQuantumEnd";
|
||||
break;
|
||||
case _WrDispatchInt:
|
||||
waitReasonString="WrDispatchInt";
|
||||
break;
|
||||
case _WrPreempted:
|
||||
waitReasonString="WrPreempted";
|
||||
break;
|
||||
case _WrYieldExecution:
|
||||
waitReasonString="WrYieldExecution";
|
||||
break;
|
||||
case _WrFastMutex:
|
||||
waitReasonString="WrFastMutex";
|
||||
break;
|
||||
case _WrGuardedMutex:
|
||||
waitReasonString="WrGuardedMutex";
|
||||
break;
|
||||
case _WrRundown:
|
||||
waitReasonString="WrRundown";
|
||||
break;
|
||||
default:
|
||||
waitReasonString="Unknown";
|
||||
break;
|
||||
}
|
||||
setCellContent(i, 7, waitReasonString);
|
||||
setCellContent(i, 8, QString("%1").arg(threadList.list[i].LastError, sizeof(unsigned int) * 2, 16, QChar('0')).toUpper());
|
||||
}
|
||||
if(threadList.count)
|
||||
BridgeFree(threadList.list);
|
||||
mCurrentThread=threadList.CurrentThread;
|
||||
reloadData();
|
||||
}
|
||||
|
||||
QString ThreadView::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
{
|
||||
QString ret=StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
if(rowBase+rowOffset==mCurrentThread && !col)
|
||||
{
|
||||
painter->save();
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#000000")));
|
||||
painter->setPen(QPen(QColor("#FFFFFF"))); //white text
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, ret);
|
||||
painter->restore();
|
||||
ret="";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#include "ThreadView.h"
|
||||
|
||||
ThreadView::ThreadView(StdTable *parent) : StdTable(parent)
|
||||
{
|
||||
int charwidth=QFontMetrics(this->font()).width(QChar(' '));
|
||||
addColumnAt(8+charwidth*sizeof(unsigned int)*2, "Number", false);
|
||||
addColumnAt(8+charwidth*sizeof(unsigned int)*2, "ID", false);
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "Entry", false);
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "TEB", false);
|
||||
#ifdef _WIN64
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "RIP", false);
|
||||
#else
|
||||
addColumnAt(8+charwidth*sizeof(uint_t)*2, "EIP", false);
|
||||
#endif //_WIN64
|
||||
addColumnAt(8+charwidth*14, "Suspend Count", false);
|
||||
addColumnAt(8+charwidth*12, "Priority", false);
|
||||
addColumnAt(8+charwidth*16, "WaitReason", false);
|
||||
addColumnAt(8+charwidth*10, "LastError", false);
|
||||
addColumnAt(0, "", false);
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(updateThreads()), this, SLOT(updateThreadList()));
|
||||
}
|
||||
|
||||
void ThreadView::updateThreadList()
|
||||
{
|
||||
THREADLIST threadList;
|
||||
memset(&threadList, 0, sizeof(THREADLIST));
|
||||
DbgGetThreadList(&threadList);
|
||||
setRowCount(threadList.count);
|
||||
for(int i=0; i<threadList.count; i++)
|
||||
{
|
||||
if(!threadList.list[i].BasicInfo.ThreadNumber)
|
||||
setCellContent(i, 0, "Main");
|
||||
else
|
||||
setCellContent(i, 0, QString("%1").arg(threadList.list[i].BasicInfo.ThreadNumber, 0, 10));
|
||||
setCellContent(i, 1, QString("%1").arg(threadList.list[i].BasicInfo.dwThreadId, 0, 16).toUpper());
|
||||
setCellContent(i, 2, QString("%1").arg(threadList.list[i].BasicInfo.ThreadStartAddress, sizeof(int_t) * 2, 16, QChar('0')).toUpper());
|
||||
setCellContent(i, 3, QString("%1").arg(threadList.list[i].BasicInfo.ThreadLocalBase, sizeof(int_t) * 2, 16, QChar('0')).toUpper());
|
||||
setCellContent(i, 4, QString("%1").arg(threadList.list[i].ThreadCip, sizeof(int_t) * 2, 16, QChar('0')).toUpper());
|
||||
setCellContent(i, 5, QString("%1").arg(threadList.list[i].SuspendCount, 0, 10));
|
||||
QString priorityString;
|
||||
switch(threadList.list[i].Priority)
|
||||
{
|
||||
case _PriorityIdle:
|
||||
priorityString="Idle";
|
||||
break;
|
||||
case _PriorityAboveNormal:
|
||||
priorityString="AboveNormal";
|
||||
break;
|
||||
case _PriorityBelowNormal:
|
||||
priorityString="BelowNormal";
|
||||
break;
|
||||
case _PriorityHighest:
|
||||
priorityString="Highest";
|
||||
break;
|
||||
case _PriorityLowest:
|
||||
priorityString="Lowest";
|
||||
break;
|
||||
case _PriorityNormal:
|
||||
priorityString="Normal";
|
||||
break;
|
||||
case _PriorityTimeCritical:
|
||||
priorityString="TimeCritical";
|
||||
break;
|
||||
default:
|
||||
priorityString="Unknown";
|
||||
break;
|
||||
}
|
||||
setCellContent(i, 6, priorityString);
|
||||
QString waitReasonString;
|
||||
switch(threadList.list[i].WaitReason)
|
||||
{
|
||||
case _Executive:
|
||||
waitReasonString="Executive";
|
||||
break;
|
||||
case _FreePage:
|
||||
waitReasonString="FreePage";
|
||||
break;
|
||||
case _PageIn:
|
||||
waitReasonString="PageIn";
|
||||
break;
|
||||
case _PoolAllocation:
|
||||
waitReasonString="PoolAllocation";
|
||||
break;
|
||||
case _DelayExecution:
|
||||
waitReasonString="DelayExecution";
|
||||
break;
|
||||
case _Suspended:
|
||||
waitReasonString="Suspended";
|
||||
break;
|
||||
case _UserRequest:
|
||||
waitReasonString="UserRequest";
|
||||
break;
|
||||
case _WrExecutive:
|
||||
waitReasonString="WrExecutive";
|
||||
break;
|
||||
case _WrFreePage:
|
||||
waitReasonString="WrFreePage";
|
||||
break;
|
||||
case _WrPageIn:
|
||||
waitReasonString="WrPageIn";
|
||||
break;
|
||||
case _WrPoolAllocation:
|
||||
waitReasonString="WrPoolAllocation";
|
||||
break;
|
||||
case _WrDelayExecution:
|
||||
waitReasonString="WrDelayExecution";
|
||||
break;
|
||||
case _WrSuspended:
|
||||
waitReasonString="WrSuspended";
|
||||
break;
|
||||
case _WrUserRequest:
|
||||
waitReasonString="WrUserRequest";
|
||||
break;
|
||||
case _WrEventPair:
|
||||
waitReasonString="WrEventPair";
|
||||
break;
|
||||
case _WrQueue:
|
||||
waitReasonString="WrQueue";
|
||||
break;
|
||||
case _WrLpcReceive:
|
||||
waitReasonString="WrLpcReceive";
|
||||
break;
|
||||
case _WrLpcReply:
|
||||
waitReasonString="WrLpcReply";
|
||||
break;
|
||||
case _WrVirtualMemory:
|
||||
waitReasonString="WrVirtualMemory";
|
||||
break;
|
||||
case _WrPageOut:
|
||||
waitReasonString="WrPageOut";
|
||||
break;
|
||||
case _WrRendezvous:
|
||||
waitReasonString="WrRendezvous";
|
||||
break;
|
||||
case _Spare2:
|
||||
waitReasonString="Spare2";
|
||||
break;
|
||||
case _Spare3:
|
||||
waitReasonString="Spare3";
|
||||
break;
|
||||
case _Spare4:
|
||||
waitReasonString="Spare4";
|
||||
break;
|
||||
case _Spare5:
|
||||
waitReasonString="Spare5";
|
||||
break;
|
||||
case _WrCalloutStack:
|
||||
waitReasonString="WrCalloutStack";
|
||||
break;
|
||||
case _WrKernel:
|
||||
waitReasonString="WrKernel";
|
||||
break;
|
||||
case _WrResource:
|
||||
waitReasonString="WrResource";
|
||||
break;
|
||||
case _WrPushLock:
|
||||
waitReasonString="WrPushLock";
|
||||
break;
|
||||
case _WrMutex:
|
||||
waitReasonString="WrMutex";
|
||||
break;
|
||||
case _WrQuantumEnd:
|
||||
waitReasonString="WrQuantumEnd";
|
||||
break;
|
||||
case _WrDispatchInt:
|
||||
waitReasonString="WrDispatchInt";
|
||||
break;
|
||||
case _WrPreempted:
|
||||
waitReasonString="WrPreempted";
|
||||
break;
|
||||
case _WrYieldExecution:
|
||||
waitReasonString="WrYieldExecution";
|
||||
break;
|
||||
case _WrFastMutex:
|
||||
waitReasonString="WrFastMutex";
|
||||
break;
|
||||
case _WrGuardedMutex:
|
||||
waitReasonString="WrGuardedMutex";
|
||||
break;
|
||||
case _WrRundown:
|
||||
waitReasonString="WrRundown";
|
||||
break;
|
||||
default:
|
||||
waitReasonString="Unknown";
|
||||
break;
|
||||
}
|
||||
setCellContent(i, 7, waitReasonString);
|
||||
setCellContent(i, 8, QString("%1").arg(threadList.list[i].LastError, sizeof(unsigned int) * 2, 16, QChar('0')).toUpper());
|
||||
}
|
||||
if(threadList.count)
|
||||
BridgeFree(threadList.list);
|
||||
mCurrentThread=threadList.CurrentThread;
|
||||
reloadData();
|
||||
}
|
||||
|
||||
QString ThreadView::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
{
|
||||
QString ret=StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
if(rowBase+rowOffset==mCurrentThread && !col)
|
||||
{
|
||||
painter->save();
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#000000")));
|
||||
painter->setPen(QPen(QColor("#FFFFFF"))); //white text
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, ret);
|
||||
painter->restore();
|
||||
ret="";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#ifndef THREADVIEW_H
|
||||
#define THREADVIEW_H
|
||||
|
||||
#include "StdTable.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
class ThreadView : public StdTable
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ThreadView(StdTable* parent = 0);
|
||||
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
|
||||
public slots:
|
||||
void updateThreadList();
|
||||
|
||||
private:
|
||||
int mCurrentThread;
|
||||
};
|
||||
|
||||
#endif // THREADVIEW_H
|
||||
#ifndef THREADVIEW_H
|
||||
#define THREADVIEW_H
|
||||
|
||||
#include "StdTable.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
class ThreadView : public StdTable
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ThreadView(StdTable* parent = 0);
|
||||
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
|
||||
public slots:
|
||||
void updateThreadList();
|
||||
|
||||
private:
|
||||
int mCurrentThread;
|
||||
};
|
||||
|
||||
#endif // THREADVIEW_H
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
#include <QPushButton>
|
||||
#include "Bridge.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class WordEditDialog;
|
||||
}
|
||||
|
||||
class WordEditDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit WordEditDialog(QWidget *parent = 0);
|
||||
~WordEditDialog();
|
||||
|
@ -22,7 +23,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void expressionChanged(QString s);
|
||||
|
||||
|
||||
private:
|
||||
Ui::WordEditDialog *ui;
|
||||
uint_t mWord;
|
||||
|
|
|
@ -276,13 +276,13 @@ bool Bridge::emitSelectionGet(int hWindow, SELECTIONDATA* selection)
|
|||
{
|
||||
case GUI_DISASSEMBLY:
|
||||
emit selectionDisasmGet(selection);
|
||||
break;
|
||||
break;
|
||||
case GUI_DUMP:
|
||||
emit selectionDumpGet(selection);
|
||||
break;
|
||||
break;
|
||||
case GUI_STACK:
|
||||
emit selectionStackGet(selection);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
mBridgeMutex.unlock();
|
||||
return false;
|
||||
|
@ -309,13 +309,13 @@ bool Bridge::emitSelectionSet(int hWindow, const SELECTIONDATA* selection)
|
|||
{
|
||||
case GUI_DISASSEMBLY:
|
||||
emit selectionDisasmSet(selection);
|
||||
break;
|
||||
break;
|
||||
case GUI_DUMP:
|
||||
emit selectionDumpSet(selection);
|
||||
break;
|
||||
break;
|
||||
case GUI_STACK:
|
||||
emit selectionStackSet(selection);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
mBridgeMutex.unlock();
|
||||
return false;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
************************************************************************************/
|
||||
|
||||
#ifdef BUILD_LIB
|
||||
extern "C" __declspec(dllexport) int _gui_guiinit(int argc, char *argv[]);
|
||||
extern "C" __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* param2);
|
||||
extern "C" __declspec(dllexport) int _gui_guiinit(int argc, char *argv[]);
|
||||
extern "C" __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* param2);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void CPUDisassembly::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
|
||||
default:
|
||||
Disassembly::mouseDoubleClickEvent(event);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,18 +140,18 @@ void CPUDisassembly::contextMenuEvent(QContextMenuEvent* event)
|
|||
{
|
||||
case 0:
|
||||
msetHwBPOnSlot0Action->setText("Replace Slot 0 (0x" + QString("%1").arg(wBPList.bp[wI].addr, 8, 16, QChar('0')).toUpper() + ")");
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
msetHwBPOnSlot1Action->setText("Replace Slot 1 (0x" + QString("%1").arg(wBPList.bp[wI].addr, 8, 16, QChar('0')).toUpper() + ")");
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
msetHwBPOnSlot2Action->setText("Replace Slot 2 (0x" + QString("%1").arg(wBPList.bp[wI].addr, 8, 16, QChar('0')).toUpper() + ")");
|
||||
break;
|
||||
break;
|
||||
case 3:
|
||||
msetHwBPOnSlot3Action->setText("Replace Slot 3 (0x" + QString("%1").arg(wBPList.bp[wI].addr, 8, 16, QChar('0')).toUpper() + ")");
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,261 +1,282 @@
|
|||
#include "CPUJumps.h"
|
||||
#include "Configuration.h"
|
||||
CPUJumps::CPUJumps(CPUDisassembly *Ptr, QWidget *parent) :
|
||||
QAbstractScrollArea(parent)
|
||||
{
|
||||
|
||||
topVA = -1;
|
||||
selectedVA = -1;
|
||||
viewableRows = 0;
|
||||
|
||||
CodePtr = Ptr;
|
||||
|
||||
m_DefaultFont = QFont("Monospace", 8);
|
||||
|
||||
const QFontMetrics metrics(m_DefaultFont);
|
||||
fontWidth = metrics.width('W');
|
||||
fontHeight = metrics.height();
|
||||
|
||||
InstrBuffer = CodePtr->instructionsBuffer();
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(disassembleAt(int_t, int_t)), this, SLOT(disassembleAt(int_t, int_t)));
|
||||
}
|
||||
|
||||
QSize CPUJumps::sizeHint() const
|
||||
{
|
||||
return QSize(40,this->viewport()->height());
|
||||
}
|
||||
|
||||
|
||||
void CPUJumps::disassembleAt(int_t parVA, int_t parCIP)
|
||||
{
|
||||
//repaint();
|
||||
}
|
||||
|
||||
void CPUJumps::repaint(){
|
||||
|
||||
viewport()->repaint();
|
||||
}
|
||||
|
||||
void CPUJumps::changeTopmostAddress(int i)
|
||||
{
|
||||
if(i!=topVA){
|
||||
topVA = i;
|
||||
qDebug() << i;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void CPUJumps::setViewableRows(int rows)
|
||||
{
|
||||
viewableRows = rows;
|
||||
}
|
||||
|
||||
void CPUJumps::setSelection(int_t selVA)
|
||||
{
|
||||
if(selVA != selectedVA){
|
||||
selectedVA = selVA;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
bool CPUJumps::isJump(int i) const{
|
||||
|
||||
int BranchType=InstrBuffer->at(i).disasm.Instruction.BranchType;
|
||||
if(BranchType && BranchType!=RetType && BranchType!=CallType){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPUJumps::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
if(InstrBuffer->size() ==0)
|
||||
return;
|
||||
|
||||
painter = new QPainter(viewport());
|
||||
|
||||
int jumpoffset = 0;
|
||||
|
||||
int_t last_va = InstrBuffer->last().rva + CodePtr->getBase();
|
||||
int_t first_va = InstrBuffer->first().rva + CodePtr->getBase();
|
||||
|
||||
for(int line=0;line<viewableRows;line++){
|
||||
// draw bullet
|
||||
drawBullets(line,DbgGetBpxTypeAt(InstrBuffer->at(line).rva + CodePtr->getBase()) == bp_none);
|
||||
|
||||
|
||||
if(isJump(line)){
|
||||
jumpoffset++;
|
||||
|
||||
int_t destRVA = (int_t)InstrBuffer->at(line).disasm.Instruction.AddrValue;
|
||||
|
||||
if( InstrBuffer->at(line).disasm.Instruction.Opcode == 0xFF)
|
||||
continue;
|
||||
|
||||
|
||||
bool cond = !((InstrBuffer->at(line).disasm.Instruction.Opcode == 0xEB) || InstrBuffer->at(line).disasm.Instruction.Opcode == 0xE9);
|
||||
if(destRVA <= last_va && destRVA >= first_va){
|
||||
|
||||
int destLine = line+1;
|
||||
|
||||
while(InstrBuffer->at(destLine).rva + CodePtr->getBase() != destRVA
|
||||
&& destLine <viewableRows )
|
||||
destLine++;
|
||||
|
||||
|
||||
drawJump(line,destLine,jumpoffset,cond,
|
||||
DbgIsJumpGoingToExecute(InstrBuffer->at(line).rva+CodePtr->getBase())&&CodePtr->currentEIP() == InstrBuffer->at(line).rva,
|
||||
selectedVA == InstrBuffer->at(line).rva+CodePtr->getBase());
|
||||
|
||||
|
||||
}else if(destRVA > last_va){
|
||||
drawJump(line,
|
||||
viewableRows+6,
|
||||
jumpoffset,
|
||||
cond,
|
||||
DbgIsJumpGoingToExecute(InstrBuffer->at(line).rva+CodePtr->getBase())&&CodePtr->currentEIP() == InstrBuffer->at(line).rva,
|
||||
selectedVA == InstrBuffer->at(line).rva+CodePtr->getBase());
|
||||
}else if(destRVA < first_va){
|
||||
drawJump(line,
|
||||
-6,
|
||||
jumpoffset,
|
||||
cond,
|
||||
DbgIsJumpGoingToExecute(InstrBuffer->at(line).rva+CodePtr->getBase())&&CodePtr->currentEIP() == InstrBuffer->at(line).rva,
|
||||
selectedVA == InstrBuffer->at(line).rva+CodePtr->getBase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(InstrBuffer->at(line).rva == CodePtr->currentEIP()){
|
||||
drawLabel(line,"EIP");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//delete painter;
|
||||
}
|
||||
|
||||
void CPUJumps::drawJump(int startLine,int endLine,int jumpoffset, bool conditional, bool isexecute, bool isactive){
|
||||
painter->save();
|
||||
if(!conditional){
|
||||
painter->setPen(QPen(QColor("#000000"),1, Qt::SolidLine)); // jmp
|
||||
}else{
|
||||
painter->setPen(QPen(QColor("#000000"),1, Qt::DashLine));
|
||||
}
|
||||
QPen tmp = painter->pen();
|
||||
if(isexecute){
|
||||
tmp.setWidth(2);
|
||||
//tmp.setColor(Qt::red);
|
||||
}
|
||||
if(isactive){
|
||||
tmp.setColor(Qt::red);
|
||||
}
|
||||
painter->setPen(tmp);
|
||||
|
||||
const int JumpPadding = 15;
|
||||
|
||||
const int x = viewport()->width()-jumpoffset*JumpPadding - 12;
|
||||
const int x_right = viewport()->width()- 12;
|
||||
const int y_start = fontHeight*(1+startLine)-0.5*fontHeight;
|
||||
const int y_end = fontHeight*(1+endLine)-0.5*fontHeight;
|
||||
|
||||
// vertical
|
||||
painter->drawLine(x,y_start,x,y_end);
|
||||
// start horizontal
|
||||
painter->drawLine(x,y_start,x_right,y_start);
|
||||
painter->drawLine(x,y_end,x_right,y_end);
|
||||
|
||||
const int ArrowSizeX = 2; // width of arrow tip in pixel
|
||||
const int ArrowSizeY = 3; // height of arrow tip in pixel
|
||||
|
||||
|
||||
tmp = painter->pen();
|
||||
tmp.setStyle(Qt::SolidLine);
|
||||
tmp.setWidth(2);
|
||||
painter->setPen(tmp);
|
||||
painter->drawLine(x_right-ArrowSizeX,y_end-ArrowSizeY,x_right,y_end);
|
||||
painter->drawLine(x_right-ArrowSizeX,y_end+ArrowSizeY,x_right,y_end);
|
||||
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void CPUJumps::drawBullets(int line, bool isbp){
|
||||
|
||||
|
||||
painter->save();
|
||||
|
||||
if( isbp)
|
||||
painter->setBrush(QBrush("#808080"));
|
||||
else
|
||||
painter->setBrush(QBrush(Qt::red));
|
||||
|
||||
const int y = fontHeight*(1+line)-0.8*fontHeight ;
|
||||
const int x = viewport()->width() - 10;
|
||||
const int radius = 8;
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
painter->setPen(QPen("#ffffff"));
|
||||
painter->drawEllipse(x,y,radius,radius);
|
||||
|
||||
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CPUJumps::drawLabel(int Line, QString Text){
|
||||
|
||||
painter->save();
|
||||
const int LineCoordinate = fontHeight*(1+Line);
|
||||
int length = Text.length();
|
||||
|
||||
painter->setBrush(QBrush(Configuration::instance()->color("EIPLabelBG")));
|
||||
painter->setPen(QPen(Configuration::instance()->color("EIPLabelBG")));
|
||||
int y = LineCoordinate-fontHeight;
|
||||
|
||||
painter->drawRect(1,y,length*fontWidth,fontHeight);
|
||||
painter->setPen(QPen(Configuration::instance()->color("EIPLabel")));
|
||||
painter->drawText(2,LineCoordinate-0.2*fontHeight,Text);
|
||||
|
||||
y = fontHeight*(1+Line)-0.5*fontHeight;
|
||||
painter->setPen(QPen(Configuration::instance()->color("EIPLabelBG"),2));
|
||||
painter->setBrush(QBrush(Configuration::instance()->color("EIPLabelBG")));
|
||||
|
||||
drawStraightArrow(painter,length*fontWidth,y,this->viewport()->width()-2-15,y);
|
||||
painter->restore();
|
||||
|
||||
}
|
||||
|
||||
void CPUJumps::drawStraightArrow(QPainter *painter, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
|
||||
|
||||
painter->drawLine(x1,y1,x2,y2);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// this does not work
|
||||
QPainterPath path;
|
||||
|
||||
path.moveTo( QPointF(x2, x2));
|
||||
path.lineTo (QPointF(x2-ArrowSizeX,y2-ArrowSizeY));
|
||||
path.lineTo (QPointF(x2-ArrowSizeX,y2+ArrowSizeY));
|
||||
path.closeSubpath();
|
||||
|
||||
painter->setPen (Qt :: NoPen);
|
||||
painter->fillPath (path, QBrush (color));*/
|
||||
const int ArrowSizeX = 4; // width of arrow tip in pixel
|
||||
const int ArrowSizeY = 4; // height of arrow tip in pixel
|
||||
|
||||
|
||||
painter->drawLine(x2,y2,x2-ArrowSizeX,y2-ArrowSizeY);
|
||||
painter->drawLine(x2,y2,x2-ArrowSizeX,y2+ArrowSizeY);
|
||||
|
||||
}
|
||||
|
||||
#include "CPUJumps.h"
|
||||
#include "Configuration.h"
|
||||
CPUJumps::CPUJumps(CPUDisassembly *Ptr, QWidget *parent) :
|
||||
QAbstractScrollArea(parent)
|
||||
{
|
||||
|
||||
topVA = -1;
|
||||
selectedVA = -1;
|
||||
viewableRows = 0;
|
||||
|
||||
CodePtr = Ptr;
|
||||
|
||||
m_DefaultFont = QFont("Monospace", 8);
|
||||
|
||||
const QFontMetrics metrics(m_DefaultFont);
|
||||
fontWidth = metrics.width('W');
|
||||
fontHeight = metrics.height();
|
||||
|
||||
InstrBuffer = CodePtr->instructionsBuffer();
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(disassembleAt(int_t, int_t)), this, SLOT(disassembleAt(int_t, int_t)));
|
||||
}
|
||||
|
||||
QSize CPUJumps::sizeHint() const
|
||||
{
|
||||
return QSize(40,this->viewport()->height());
|
||||
}
|
||||
|
||||
|
||||
void CPUJumps::disassembleAt(int_t parVA, int_t parCIP)
|
||||
{
|
||||
//repaint();
|
||||
}
|
||||
|
||||
void CPUJumps::repaint()
|
||||
{
|
||||
|
||||
viewport()->repaint();
|
||||
}
|
||||
|
||||
void CPUJumps::changeTopmostAddress(int i)
|
||||
{
|
||||
if(i!=topVA)
|
||||
{
|
||||
topVA = i;
|
||||
qDebug() << i;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void CPUJumps::setViewableRows(int rows)
|
||||
{
|
||||
viewableRows = rows;
|
||||
}
|
||||
|
||||
void CPUJumps::setSelection(int_t selVA)
|
||||
{
|
||||
if(selVA != selectedVA)
|
||||
{
|
||||
selectedVA = selVA;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
bool CPUJumps::isJump(int i) const
|
||||
{
|
||||
|
||||
int BranchType=InstrBuffer->at(i).disasm.Instruction.BranchType;
|
||||
if(BranchType && BranchType!=RetType && BranchType!=CallType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPUJumps::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
if(InstrBuffer->size() ==0)
|
||||
return;
|
||||
|
||||
painter = new QPainter(viewport());
|
||||
|
||||
int jumpoffset = 0;
|
||||
|
||||
int_t last_va = InstrBuffer->last().rva + CodePtr->getBase();
|
||||
int_t first_va = InstrBuffer->first().rva + CodePtr->getBase();
|
||||
|
||||
for(int line=0; line<viewableRows; line++)
|
||||
{
|
||||
// draw bullet
|
||||
drawBullets(line,DbgGetBpxTypeAt(InstrBuffer->at(line).rva + CodePtr->getBase()) == bp_none);
|
||||
|
||||
|
||||
if(isJump(line))
|
||||
{
|
||||
jumpoffset++;
|
||||
|
||||
int_t destRVA = (int_t)InstrBuffer->at(line).disasm.Instruction.AddrValue;
|
||||
|
||||
if( InstrBuffer->at(line).disasm.Instruction.Opcode == 0xFF)
|
||||
continue;
|
||||
|
||||
|
||||
bool cond = !((InstrBuffer->at(line).disasm.Instruction.Opcode == 0xEB) || InstrBuffer->at(line).disasm.Instruction.Opcode == 0xE9);
|
||||
if(destRVA <= last_va && destRVA >= first_va)
|
||||
{
|
||||
|
||||
int destLine = line+1;
|
||||
|
||||
while(InstrBuffer->at(destLine).rva + CodePtr->getBase() != destRVA
|
||||
&& destLine <viewableRows )
|
||||
destLine++;
|
||||
|
||||
|
||||
drawJump(line,destLine,jumpoffset,cond,
|
||||
DbgIsJumpGoingToExecute(InstrBuffer->at(line).rva+CodePtr->getBase())&&CodePtr->currentEIP() == InstrBuffer->at(line).rva,
|
||||
selectedVA == InstrBuffer->at(line).rva+CodePtr->getBase());
|
||||
|
||||
|
||||
}
|
||||
else if(destRVA > last_va)
|
||||
{
|
||||
drawJump(line,
|
||||
viewableRows+6,
|
||||
jumpoffset,
|
||||
cond,
|
||||
DbgIsJumpGoingToExecute(InstrBuffer->at(line).rva+CodePtr->getBase())&&CodePtr->currentEIP() == InstrBuffer->at(line).rva,
|
||||
selectedVA == InstrBuffer->at(line).rva+CodePtr->getBase());
|
||||
}
|
||||
else if(destRVA < first_va)
|
||||
{
|
||||
drawJump(line,
|
||||
-6,
|
||||
jumpoffset,
|
||||
cond,
|
||||
DbgIsJumpGoingToExecute(InstrBuffer->at(line).rva+CodePtr->getBase())&&CodePtr->currentEIP() == InstrBuffer->at(line).rva,
|
||||
selectedVA == InstrBuffer->at(line).rva+CodePtr->getBase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(InstrBuffer->at(line).rva == CodePtr->currentEIP())
|
||||
{
|
||||
drawLabel(line,"EIP");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//delete painter;
|
||||
}
|
||||
|
||||
void CPUJumps::drawJump(int startLine,int endLine,int jumpoffset, bool conditional, bool isexecute, bool isactive)
|
||||
{
|
||||
painter->save();
|
||||
if(!conditional)
|
||||
{
|
||||
painter->setPen(QPen(QColor("#000000"),1, Qt::SolidLine)); // jmp
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen(QPen(QColor("#000000"),1, Qt::DashLine));
|
||||
}
|
||||
QPen tmp = painter->pen();
|
||||
if(isexecute)
|
||||
{
|
||||
tmp.setWidth(2);
|
||||
//tmp.setColor(Qt::red);
|
||||
}
|
||||
if(isactive)
|
||||
{
|
||||
tmp.setColor(Qt::red);
|
||||
}
|
||||
painter->setPen(tmp);
|
||||
|
||||
const int JumpPadding = 15;
|
||||
|
||||
const int x = viewport()->width()-jumpoffset*JumpPadding - 12;
|
||||
const int x_right = viewport()->width()- 12;
|
||||
const int y_start = fontHeight*(1+startLine)-0.5*fontHeight;
|
||||
const int y_end = fontHeight*(1+endLine)-0.5*fontHeight;
|
||||
|
||||
// vertical
|
||||
painter->drawLine(x,y_start,x,y_end);
|
||||
// start horizontal
|
||||
painter->drawLine(x,y_start,x_right,y_start);
|
||||
painter->drawLine(x,y_end,x_right,y_end);
|
||||
|
||||
const int ArrowSizeX = 2; // width of arrow tip in pixel
|
||||
const int ArrowSizeY = 3; // height of arrow tip in pixel
|
||||
|
||||
|
||||
tmp = painter->pen();
|
||||
tmp.setStyle(Qt::SolidLine);
|
||||
tmp.setWidth(2);
|
||||
painter->setPen(tmp);
|
||||
painter->drawLine(x_right-ArrowSizeX,y_end-ArrowSizeY,x_right,y_end);
|
||||
painter->drawLine(x_right-ArrowSizeX,y_end+ArrowSizeY,x_right,y_end);
|
||||
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void CPUJumps::drawBullets(int line, bool isbp)
|
||||
{
|
||||
|
||||
|
||||
painter->save();
|
||||
|
||||
if( isbp)
|
||||
painter->setBrush(QBrush("#808080"));
|
||||
else
|
||||
painter->setBrush(QBrush(Qt::red));
|
||||
|
||||
const int y = fontHeight*(1+line)-0.8*fontHeight ;
|
||||
const int x = viewport()->width() - 10;
|
||||
const int radius = 8;
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
painter->setPen(QPen("#ffffff"));
|
||||
painter->drawEllipse(x,y,radius,radius);
|
||||
|
||||
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CPUJumps::drawLabel(int Line, QString Text)
|
||||
{
|
||||
|
||||
painter->save();
|
||||
const int LineCoordinate = fontHeight*(1+Line);
|
||||
int length = Text.length();
|
||||
|
||||
painter->setBrush(QBrush(Configuration::instance()->color("EIPLabelBG")));
|
||||
painter->setPen(QPen(Configuration::instance()->color("EIPLabelBG")));
|
||||
int y = LineCoordinate-fontHeight;
|
||||
|
||||
painter->drawRect(1,y,length*fontWidth,fontHeight);
|
||||
painter->setPen(QPen(Configuration::instance()->color("EIPLabel")));
|
||||
painter->drawText(2,LineCoordinate-0.2*fontHeight,Text);
|
||||
|
||||
y = fontHeight*(1+Line)-0.5*fontHeight;
|
||||
painter->setPen(QPen(Configuration::instance()->color("EIPLabelBG"),2));
|
||||
painter->setBrush(QBrush(Configuration::instance()->color("EIPLabelBG")));
|
||||
|
||||
drawStraightArrow(painter,length*fontWidth,y,this->viewport()->width()-2-15,y);
|
||||
painter->restore();
|
||||
|
||||
}
|
||||
|
||||
void CPUJumps::drawStraightArrow(QPainter *painter, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
|
||||
|
||||
painter->drawLine(x1,y1,x2,y2);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// this does not work
|
||||
QPainterPath path;
|
||||
|
||||
path.moveTo( QPointF(x2, x2));
|
||||
path.lineTo (QPointF(x2-ArrowSizeX,y2-ArrowSizeY));
|
||||
path.lineTo (QPointF(x2-ArrowSizeX,y2+ArrowSizeY));
|
||||
path.closeSubpath();
|
||||
|
||||
painter->setPen (Qt :: NoPen);
|
||||
painter->fillPath (path, QBrush (color));*/
|
||||
const int ArrowSizeX = 4; // width of arrow tip in pixel
|
||||
const int ArrowSizeY = 4; // height of arrow tip in pixel
|
||||
|
||||
|
||||
painter->drawLine(x2,y2,x2-ArrowSizeX,y2-ArrowSizeY);
|
||||
painter->drawLine(x2,y2,x2-ArrowSizeX,y2+ArrowSizeY);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
#ifndef CPUJUMPS_H
|
||||
#define CPUJUMPS_H
|
||||
|
||||
#include "NewTypes.h"
|
||||
#include "Bridge.h"
|
||||
#include "CPUDisassembly.h"
|
||||
#include <QAbstractScrollArea>
|
||||
|
||||
class CPUJumps : public QAbstractScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
int_t topVA;
|
||||
int_t selectedVA;
|
||||
QPainter *painter;
|
||||
QFont m_DefaultFont;
|
||||
int fontWidth, fontHeight;
|
||||
int viewableRows;
|
||||
|
||||
CPUDisassembly *CodePtr;
|
||||
QList<Instruction_t> *InstrBuffer;
|
||||
public:
|
||||
explicit CPUJumps(CPUDisassembly *Ptr, QWidget *parent = 0);
|
||||
QSize sizeHint() const;
|
||||
|
||||
void drawStraightArrow(QPainter *painter, int x1, int y1, int x2, int y2);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
void disassembleAt(int_t parVA, int_t parCIP);
|
||||
void repaint();
|
||||
void changeTopmostAddress(int i);
|
||||
void setViewableRows(int rows);
|
||||
void setSelection(int_t selVA);
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void drawLabel(int Line, QString Text);
|
||||
void drawBullets(int line, bool ispb);
|
||||
bool isJump(int i) const;
|
||||
void drawJump(int startLine, int endLine, int jumpoffset, bool conditional, bool isexecute, bool isactive);
|
||||
};
|
||||
|
||||
#endif // CPUJUMPS_H
|
||||
#ifndef CPUJUMPS_H
|
||||
#define CPUJUMPS_H
|
||||
|
||||
#include "NewTypes.h"
|
||||
#include "Bridge.h"
|
||||
#include "CPUDisassembly.h"
|
||||
#include <QAbstractScrollArea>
|
||||
|
||||
class CPUJumps : public QAbstractScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
int_t topVA;
|
||||
int_t selectedVA;
|
||||
QPainter *painter;
|
||||
QFont m_DefaultFont;
|
||||
int fontWidth, fontHeight;
|
||||
int viewableRows;
|
||||
|
||||
CPUDisassembly *CodePtr;
|
||||
QList<Instruction_t> *InstrBuffer;
|
||||
public:
|
||||
explicit CPUJumps(CPUDisassembly *Ptr, QWidget *parent = 0);
|
||||
QSize sizeHint() const;
|
||||
|
||||
void drawStraightArrow(QPainter *painter, int x1, int y1, int x2, int y2);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
void disassembleAt(int_t parVA, int_t parCIP);
|
||||
void repaint();
|
||||
void changeTopmostAddress(int i);
|
||||
void setViewableRows(int rows);
|
||||
void setSelection(int_t selVA);
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void drawLabel(int Line, QString Text);
|
||||
void drawBullets(int line, bool ispb);
|
||||
bool isJump(int i) const;
|
||||
void drawJump(int startLine, int endLine, int jumpoffset, bool conditional, bool isexecute, bool isactive);
|
||||
};
|
||||
|
||||
#endif // CPUJUMPS_H
|
||||
|
|
|
@ -11,14 +11,15 @@
|
|||
#include "InfoBox.h"
|
||||
#include "CPUJumps.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class CPUWidget;
|
||||
}
|
||||
|
||||
class CPUWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit CPUWidget(QWidget *parent = 0);
|
||||
~CPUWidget();
|
||||
|
|
|
@ -1,66 +1,73 @@
|
|||
#include "Configuration.h"
|
||||
|
||||
Configuration* Configuration::mPtr = NULL;
|
||||
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
load("config.json");
|
||||
//Colors = new QMap<QString,QColor>();
|
||||
//Colors = QMap<QString,QColor>();
|
||||
mPtr = this;
|
||||
}
|
||||
|
||||
Configuration *Configuration::instance()
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
void Configuration::load(QString filename){
|
||||
// load configuration file
|
||||
QFile configfile(filename);
|
||||
|
||||
if (!configfile.open(QIODevice::ReadOnly)) {
|
||||
qWarning("Couldn't open config file.");
|
||||
return ;
|
||||
}
|
||||
QByteArray saveData = configfile.readAll();
|
||||
Config = QJsonDocument(QJsonDocument::fromJson(saveData)).object();
|
||||
|
||||
readColors();
|
||||
|
||||
}
|
||||
|
||||
void Configuration::readColors() {
|
||||
Colors.clear();
|
||||
|
||||
QJsonArray ColorArray = Config["colors"].toArray();
|
||||
for (int idx = 0; idx < ColorArray.size(); ++idx) {
|
||||
QJsonArray colorObj = ColorArray[idx].toArray();
|
||||
Colors.insert(colorObj.at(0).toString(),QColor( colorObj.at(1).toString()));
|
||||
}
|
||||
}
|
||||
|
||||
QList<QString> Configuration::ApiFingerprints(){
|
||||
QList<QString> files;
|
||||
QJsonArray APIArray = Config["apifingerprints"].toArray();
|
||||
for (int idx = 0; idx < APIArray.size(); ++idx) {
|
||||
QString filename = "data/"+APIArray.at(idx).toString()+".txt";
|
||||
QFile mFile(filename);
|
||||
if(mFile.open(QFile::ReadOnly | QFile::Text)){
|
||||
files.append(APIArray.at(idx).toString());
|
||||
mFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
const QColor Configuration::color(QString id) const
|
||||
{
|
||||
if(Colors.contains(id))
|
||||
return Colors.constFind(id).value();
|
||||
else
|
||||
return Qt::black;
|
||||
}
|
||||
|
||||
#include "Configuration.h"
|
||||
|
||||
Configuration* Configuration::mPtr = NULL;
|
||||
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
load("config.json");
|
||||
//Colors = new QMap<QString,QColor>();
|
||||
//Colors = QMap<QString,QColor>();
|
||||
mPtr = this;
|
||||
}
|
||||
|
||||
Configuration *Configuration::instance()
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
void Configuration::load(QString filename)
|
||||
{
|
||||
// load configuration file
|
||||
QFile configfile(filename);
|
||||
|
||||
if (!configfile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qWarning("Couldn't open config file.");
|
||||
return ;
|
||||
}
|
||||
QByteArray saveData = configfile.readAll();
|
||||
Config = QJsonDocument(QJsonDocument::fromJson(saveData)).object();
|
||||
|
||||
readColors();
|
||||
|
||||
}
|
||||
|
||||
void Configuration::readColors()
|
||||
{
|
||||
Colors.clear();
|
||||
|
||||
QJsonArray ColorArray = Config["colors"].toArray();
|
||||
for (int idx = 0; idx < ColorArray.size(); ++idx)
|
||||
{
|
||||
QJsonArray colorObj = ColorArray[idx].toArray();
|
||||
Colors.insert(colorObj.at(0).toString(),QColor( colorObj.at(1).toString()));
|
||||
}
|
||||
}
|
||||
|
||||
QList<QString> Configuration::ApiFingerprints()
|
||||
{
|
||||
QList<QString> files;
|
||||
QJsonArray APIArray = Config["apifingerprints"].toArray();
|
||||
for (int idx = 0; idx < APIArray.size(); ++idx)
|
||||
{
|
||||
QString filename = "data/"+APIArray.at(idx).toString()+".txt";
|
||||
QFile mFile(filename);
|
||||
if(mFile.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
files.append(APIArray.at(idx).toString());
|
||||
mFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
const QColor Configuration::color(QString id) const
|
||||
{
|
||||
if(Colors.contains(id))
|
||||
return Colors.constFind(id).value();
|
||||
else
|
||||
return Qt::black;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,28 @@
|
|||
#ifndef CONFIGURATION_H
|
||||
#define CONFIGURATION_H
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
#include <QJsonArray>
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
||||
class Configuration
|
||||
{
|
||||
QJsonObject Config;
|
||||
|
||||
QMap<QString,QColor> Colors;
|
||||
|
||||
static Configuration* mPtr;
|
||||
public:
|
||||
Configuration();
|
||||
|
||||
static Configuration* instance();
|
||||
|
||||
void readColors();
|
||||
const QColor color(QString id) const;
|
||||
void load(QString filename);
|
||||
QList<QString> ApiFingerprints();
|
||||
};
|
||||
|
||||
#endif // CONFIGURATION_H
|
||||
#ifndef CONFIGURATION_H
|
||||
#define CONFIGURATION_H
|
||||
|
||||
#include <QFile>
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
||||
class Configuration
|
||||
{
|
||||
QJsonObject Config;
|
||||
|
||||
QMap<QString,QColor> Colors;
|
||||
|
||||
static Configuration* mPtr;
|
||||
public:
|
||||
Configuration();
|
||||
|
||||
static Configuration* instance();
|
||||
|
||||
void readColors();
|
||||
const QColor color(QString id) const;
|
||||
void load(QString filename);
|
||||
QList<QString> ApiFingerprints();
|
||||
};
|
||||
|
||||
#endif // CONFIGURATION_H
|
||||
|
|
|
@ -1,83 +1,83 @@
|
|||
#include "ExceptionRangeDialog.h"
|
||||
#include "ui_ExceptionRangeDialog.h"
|
||||
|
||||
ExceptionRangeDialog::ExceptionRangeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ExceptionRangeDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
//set window flags
|
||||
setModal(true);
|
||||
setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
setFixedSize(this->size()); //fixed size
|
||||
ui->editStart->setCursorPosition(0);
|
||||
ui->editEnd->setCursorPosition(0);
|
||||
ui->btnOk->setEnabled(false);
|
||||
}
|
||||
|
||||
ExceptionRangeDialog::~ExceptionRangeDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExceptionRangeDialog::on_editStart_textChanged(const QString &arg1)
|
||||
{
|
||||
if(!ui->editStart->text().size()) //nothing entered
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if(ui->editStart->text()=="-1")
|
||||
ui->editStart->setText("FFFFFFFF");
|
||||
bool converted=false;
|
||||
unsigned long start=ui->editStart->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
unsigned long end=ui->editEnd->text().toUInt(&converted, 16);
|
||||
if(converted && end<start)
|
||||
ui->btnOk->setEnabled(false);
|
||||
else
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void ExceptionRangeDialog::on_editEnd_textChanged(const QString &arg1)
|
||||
{
|
||||
if(!ui->editEnd->text().size() || !ui->editStart->text().size())
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if(ui->editEnd->text()=="-1")
|
||||
ui->editEnd->setText("FFFFFFFF");
|
||||
bool converted=false;
|
||||
unsigned long start=ui->editStart->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
unsigned long end=ui->editEnd->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if(end<start)
|
||||
ui->btnOk->setEnabled(false);
|
||||
else
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
|
||||
void ExceptionRangeDialog::on_btnOk_clicked()
|
||||
{
|
||||
rangeStart=ui->editStart->text().toUInt(0, 16);
|
||||
bool converted=false;
|
||||
rangeEnd=ui->editEnd->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
rangeEnd=rangeStart;
|
||||
accept();
|
||||
}
|
||||
#include "ExceptionRangeDialog.h"
|
||||
#include "ui_ExceptionRangeDialog.h"
|
||||
|
||||
ExceptionRangeDialog::ExceptionRangeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ExceptionRangeDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
//set window flags
|
||||
setModal(true);
|
||||
setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
setFixedSize(this->size()); //fixed size
|
||||
ui->editStart->setCursorPosition(0);
|
||||
ui->editEnd->setCursorPosition(0);
|
||||
ui->btnOk->setEnabled(false);
|
||||
}
|
||||
|
||||
ExceptionRangeDialog::~ExceptionRangeDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExceptionRangeDialog::on_editStart_textChanged(const QString &arg1)
|
||||
{
|
||||
if(!ui->editStart->text().size()) //nothing entered
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if(ui->editStart->text()=="-1")
|
||||
ui->editStart->setText("FFFFFFFF");
|
||||
bool converted=false;
|
||||
unsigned long start=ui->editStart->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
unsigned long end=ui->editEnd->text().toUInt(&converted, 16);
|
||||
if(converted && end<start)
|
||||
ui->btnOk->setEnabled(false);
|
||||
else
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void ExceptionRangeDialog::on_editEnd_textChanged(const QString &arg1)
|
||||
{
|
||||
if(!ui->editEnd->text().size() || !ui->editStart->text().size())
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if(ui->editEnd->text()=="-1")
|
||||
ui->editEnd->setText("FFFFFFFF");
|
||||
bool converted=false;
|
||||
unsigned long start=ui->editStart->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
unsigned long end=ui->editEnd->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
{
|
||||
ui->btnOk->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if(end<start)
|
||||
ui->btnOk->setEnabled(false);
|
||||
else
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
|
||||
void ExceptionRangeDialog::on_btnOk_clicked()
|
||||
{
|
||||
rangeStart=ui->editStart->text().toUInt(0, 16);
|
||||
bool converted=false;
|
||||
rangeEnd=ui->editEnd->text().toUInt(&converted, 16);
|
||||
if(!converted)
|
||||
rangeEnd=rangeStart;
|
||||
accept();
|
||||
}
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
#ifndef EXCEPTIONRANGEDIALOG_H
|
||||
#define EXCEPTIONRANGEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ExceptionRangeDialog;
|
||||
}
|
||||
|
||||
class ExceptionRangeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExceptionRangeDialog(QWidget *parent = 0);
|
||||
~ExceptionRangeDialog();
|
||||
|
||||
unsigned long rangeStart;
|
||||
unsigned long rangeEnd;
|
||||
|
||||
private slots:
|
||||
void on_editStart_textChanged(const QString &arg1);
|
||||
void on_editEnd_textChanged(const QString &arg1);
|
||||
void on_btnOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::ExceptionRangeDialog *ui;
|
||||
};
|
||||
|
||||
#endif // EXCEPTIONRANGEDIALOG_H
|
||||
#ifndef EXCEPTIONRANGEDIALOG_H
|
||||
#define EXCEPTIONRANGEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ExceptionRangeDialog;
|
||||
}
|
||||
|
||||
class ExceptionRangeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExceptionRangeDialog(QWidget *parent = 0);
|
||||
~ExceptionRangeDialog();
|
||||
|
||||
unsigned long rangeStart;
|
||||
unsigned long rangeEnd;
|
||||
|
||||
private slots:
|
||||
void on_editStart_textChanged(const QString &arg1);
|
||||
void on_editEnd_textChanged(const QString &arg1);
|
||||
void on_btnOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::ExceptionRangeDialog *ui;
|
||||
};
|
||||
|
||||
#endif // EXCEPTIONRANGEDIALOG_H
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include <QPalette>
|
||||
#include "Bridge.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class GotoDialog;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
mThreadView->setWindowIcon(QIcon(":/icons/images/arrow-threads.png"));
|
||||
|
||||
//Create the tab widget
|
||||
mTabWidget = new MHTabWidget(NULL);
|
||||
mTabWidget = new MHTabWidget(NULL);
|
||||
|
||||
//Setup tabs
|
||||
mTabWidget->addTab(mCpuWidget, mCpuWidget->windowIcon(), mCpuWidget->windowTitle());
|
||||
|
@ -162,12 +162,12 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::setTab(QWidget* widget)
|
||||
{
|
||||
for(int i=0; i<mTabWidget->count(); i++)
|
||||
if(mTabWidget->widget(i)==widget)
|
||||
{
|
||||
mTabWidget->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
for(int i=0; i<mTabWidget->count(); i++)
|
||||
if(mTabWidget->widget(i)==widget)
|
||||
{
|
||||
mTabWidget->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Reads recent files list from settings
|
||||
|
|
|
@ -21,14 +21,15 @@
|
|||
#include "Configuration.h"
|
||||
#include "ApiFingerprints.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
@ -76,7 +77,7 @@ private:
|
|||
Ui::MainWindow *ui;
|
||||
|
||||
CommandLineEdit* mCmdLineEdit;
|
||||
MHTabWidget* mTabWidget;
|
||||
MHTabWidget* mTabWidget;
|
||||
CPUWidget* mCpuWidget;
|
||||
MemoryMapView* mMemMapView;
|
||||
LogView* mLogView;
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include "Bridge.h"
|
||||
#include "ExceptionRangeDialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class SettingsDialog;
|
||||
namespace Ui
|
||||
{
|
||||
class SettingsDialog;
|
||||
}
|
||||
|
||||
class SettingsDialog : public QDialog
|
||||
|
|
|
@ -1,164 +1,164 @@
|
|||
// Qt includes
|
||||
#include <QApplication>
|
||||
#include <QMouseEvent>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QPaintDevice>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "tabbar.h"
|
||||
#include "tabwidget.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Constructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabBar::MHTabBar(QWidget *parent) : QTabBar(parent)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
setElideMode(Qt::ElideRight);
|
||||
setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab);
|
||||
setMovable(true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Destructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabBar::~MHTabBar(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MHTabBar::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu wMenu(this);
|
||||
QAction wDetach("&Detach", this);
|
||||
wMenu.addAction(&wDetach);
|
||||
if(wMenu.exec(event->globalPos())==&wDetach)
|
||||
{
|
||||
QPoint p(0, 0);
|
||||
OnDetachTab((int)tabAt(event->pos()), p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
m_dragStartPos = event->pos();
|
||||
|
||||
m_dragDroppedPos.setX(0);
|
||||
m_dragDroppedPos.setY(0);
|
||||
m_dragMovedPos.setX(0);
|
||||
m_dragMovedPos.setY(0);
|
||||
|
||||
m_dragInitiated = false;
|
||||
|
||||
QTabBar::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
// Distinguish a drag
|
||||
if ( !m_dragStartPos.isNull() &&
|
||||
((event->pos() - m_dragStartPos).manhattanLength() < QApplication::startDragDistance()) )
|
||||
{
|
||||
m_dragInitiated = true;
|
||||
}
|
||||
|
||||
// The left button is pressed
|
||||
// And the move could also be a drag
|
||||
// And the mouse moved outside the tab bar
|
||||
if ((event->buttons() & Qt::LeftButton) && m_dragInitiated && !geometry().contains(event->pos()))
|
||||
{
|
||||
// Stop the move to be able to convert to a drag
|
||||
{
|
||||
QMouseEvent finishMoveEvent(QEvent::MouseMove, event->pos(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
|
||||
QTabBar::mouseMoveEvent(&finishMoveEvent);
|
||||
}
|
||||
|
||||
// A crude way to distinguish tab-reordering drops from other ones
|
||||
QMimeData* mimeData = new QMimeData;
|
||||
mimeData->setData("action", "application/tab-detach");
|
||||
|
||||
// Initiate Drag
|
||||
QDrag* drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
|
||||
// Create transparent screen dump
|
||||
QPixmap pixmap = QPixmap::grabWindow(dynamic_cast<MHTabWidget*>(parentWidget())->currentWidget()->winId()).scaled(640, 480, Qt::KeepAspectRatio);
|
||||
QPixmap targetPixmap(pixmap.size());
|
||||
|
||||
QPainter painter(&targetPixmap);
|
||||
painter.setOpacity(0.5);
|
||||
painter.drawPixmap(0, 0, pixmap);
|
||||
painter.end();
|
||||
|
||||
drag->setPixmap(targetPixmap);
|
||||
|
||||
// Handle Detach and Move
|
||||
Qt::DropAction dragged = drag->exec(Qt::MoveAction | Qt::CopyAction);
|
||||
|
||||
if (dragged == Qt::IgnoreAction)
|
||||
{
|
||||
event->accept();
|
||||
OnDetachTab(tabAt(m_dragStartPos), QCursor::pos());
|
||||
}
|
||||
else if (dragged == Qt::MoveAction)
|
||||
{
|
||||
if (!m_dragDroppedPos.isNull())
|
||||
{
|
||||
event->accept();
|
||||
OnMoveTab(tabAt(m_dragStartPos), tabAt(m_dragDroppedPos));
|
||||
}
|
||||
}
|
||||
|
||||
delete drag;
|
||||
}
|
||||
else
|
||||
{
|
||||
QTabBar::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
// Only accept if it's an tab-reordering request (not a detach request)
|
||||
const QMimeData* m = event->mimeData();
|
||||
|
||||
if (m->formats().contains("action") && (m->data("action") != "application/tab-detach"))
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
QTabBar::dragEnterEvent(event);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::dragMoveEvent(QDragMoveEvent* event)
|
||||
{
|
||||
// Only accept if it's an tab-reordering request (not a detach request)
|
||||
const QMimeData* m = event->mimeData();
|
||||
|
||||
if (m->formats().contains("action") && (m->data("action") != "application/tab-detach"))
|
||||
{
|
||||
m_dragMovedPos = event->pos();
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
QTabBar::dragMoveEvent(event);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::dropEvent(QDropEvent* event)
|
||||
{
|
||||
// If a dragged Event is dropped within this widget it is not a drag but a move.
|
||||
m_dragDroppedPos = event->pos();
|
||||
|
||||
QTabBar::dropEvent(event);
|
||||
}
|
||||
*/
|
||||
// Qt includes
|
||||
#include <QApplication>
|
||||
#include <QMouseEvent>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QPaintDevice>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "tabbar.h"
|
||||
#include "tabwidget.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Constructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabBar::MHTabBar(QWidget *parent) : QTabBar(parent)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
setElideMode(Qt::ElideRight);
|
||||
setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab);
|
||||
setMovable(true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Destructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabBar::~MHTabBar(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MHTabBar::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu wMenu(this);
|
||||
QAction wDetach("&Detach", this);
|
||||
wMenu.addAction(&wDetach);
|
||||
if(wMenu.exec(event->globalPos())==&wDetach)
|
||||
{
|
||||
QPoint p(0, 0);
|
||||
OnDetachTab((int)tabAt(event->pos()), p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
m_dragStartPos = event->pos();
|
||||
|
||||
m_dragDroppedPos.setX(0);
|
||||
m_dragDroppedPos.setY(0);
|
||||
m_dragMovedPos.setX(0);
|
||||
m_dragMovedPos.setY(0);
|
||||
|
||||
m_dragInitiated = false;
|
||||
|
||||
QTabBar::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
// Distinguish a drag
|
||||
if ( !m_dragStartPos.isNull() &&
|
||||
((event->pos() - m_dragStartPos).manhattanLength() < QApplication::startDragDistance()) )
|
||||
{
|
||||
m_dragInitiated = true;
|
||||
}
|
||||
|
||||
// The left button is pressed
|
||||
// And the move could also be a drag
|
||||
// And the mouse moved outside the tab bar
|
||||
if ((event->buttons() & Qt::LeftButton) && m_dragInitiated && !geometry().contains(event->pos()))
|
||||
{
|
||||
// Stop the move to be able to convert to a drag
|
||||
{
|
||||
QMouseEvent finishMoveEvent(QEvent::MouseMove, event->pos(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
|
||||
QTabBar::mouseMoveEvent(&finishMoveEvent);
|
||||
}
|
||||
|
||||
// A crude way to distinguish tab-reordering drops from other ones
|
||||
QMimeData* mimeData = new QMimeData;
|
||||
mimeData->setData("action", "application/tab-detach");
|
||||
|
||||
// Initiate Drag
|
||||
QDrag* drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
|
||||
// Create transparent screen dump
|
||||
QPixmap pixmap = QPixmap::grabWindow(dynamic_cast<MHTabWidget*>(parentWidget())->currentWidget()->winId()).scaled(640, 480, Qt::KeepAspectRatio);
|
||||
QPixmap targetPixmap(pixmap.size());
|
||||
|
||||
QPainter painter(&targetPixmap);
|
||||
painter.setOpacity(0.5);
|
||||
painter.drawPixmap(0, 0, pixmap);
|
||||
painter.end();
|
||||
|
||||
drag->setPixmap(targetPixmap);
|
||||
|
||||
// Handle Detach and Move
|
||||
Qt::DropAction dragged = drag->exec(Qt::MoveAction | Qt::CopyAction);
|
||||
|
||||
if (dragged == Qt::IgnoreAction)
|
||||
{
|
||||
event->accept();
|
||||
OnDetachTab(tabAt(m_dragStartPos), QCursor::pos());
|
||||
}
|
||||
else if (dragged == Qt::MoveAction)
|
||||
{
|
||||
if (!m_dragDroppedPos.isNull())
|
||||
{
|
||||
event->accept();
|
||||
OnMoveTab(tabAt(m_dragStartPos), tabAt(m_dragDroppedPos));
|
||||
}
|
||||
}
|
||||
|
||||
delete drag;
|
||||
}
|
||||
else
|
||||
{
|
||||
QTabBar::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
// Only accept if it's an tab-reordering request (not a detach request)
|
||||
const QMimeData* m = event->mimeData();
|
||||
|
||||
if (m->formats().contains("action") && (m->data("action") != "application/tab-detach"))
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
QTabBar::dragEnterEvent(event);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::dragMoveEvent(QDragMoveEvent* event)
|
||||
{
|
||||
// Only accept if it's an tab-reordering request (not a detach request)
|
||||
const QMimeData* m = event->mimeData();
|
||||
|
||||
if (m->formats().contains("action") && (m->data("action") != "application/tab-detach"))
|
||||
{
|
||||
m_dragMovedPos = event->pos();
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
QTabBar::dragMoveEvent(event);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabBar::dropEvent(QDropEvent* event)
|
||||
{
|
||||
// If a dragged Event is dropped within this widget it is not a drag but a move.
|
||||
m_dragDroppedPos = event->pos();
|
||||
|
||||
QTabBar::dropEvent(event);
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
#ifndef __MHTABBAR_H__
|
||||
#define __MHTABBAR_H__
|
||||
|
||||
// Qt includes
|
||||
#include <QTabBar>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
// Qt forward class definitions
|
||||
class MHTabBar;
|
||||
class QMainWindow;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// MHTabBar implements the a Tab Bar with tear-off functionality.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class MHTabBar: public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MHTabBar (QWidget* parent);
|
||||
~MHTabBar (void);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
/*
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
void dragMoveEvent(QDragMoveEvent* event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
*/
|
||||
|
||||
signals:
|
||||
// Detach Tab
|
||||
void OnDetachTab (int index, QPoint& dropPoint);
|
||||
// Move Tab
|
||||
void OnMoveTab (int fromIndex, int toIndex);
|
||||
|
||||
private:
|
||||
/*
|
||||
QPoint m_dragStartPos;
|
||||
QPoint m_dragMovedPos;
|
||||
QPoint m_dragDroppedPos;
|
||||
bool m_dragInitiated;
|
||||
int m_dragCurrentIndex;
|
||||
*/
|
||||
};
|
||||
|
||||
#endif // __MHTABBAR_H__
|
||||
#ifndef __MHTABBAR_H__
|
||||
#define __MHTABBAR_H__
|
||||
|
||||
// Qt includes
|
||||
#include <QTabBar>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
// Qt forward class definitions
|
||||
class MHTabBar;
|
||||
class QMainWindow;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// MHTabBar implements the a Tab Bar with tear-off functionality.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class MHTabBar: public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MHTabBar (QWidget* parent);
|
||||
~MHTabBar (void);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
/*
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
void dragMoveEvent(QDragMoveEvent* event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
*/
|
||||
|
||||
signals:
|
||||
// Detach Tab
|
||||
void OnDetachTab (int index, QPoint& dropPoint);
|
||||
// Move Tab
|
||||
void OnMoveTab (int fromIndex, int toIndex);
|
||||
|
||||
private:
|
||||
/*
|
||||
QPoint m_dragStartPos;
|
||||
QPoint m_dragMovedPos;
|
||||
QPoint m_dragDroppedPos;
|
||||
bool m_dragInitiated;
|
||||
int m_dragCurrentIndex;
|
||||
*/
|
||||
};
|
||||
|
||||
#endif // __MHTABBAR_H__
|
||||
|
|
|
@ -1,191 +1,191 @@
|
|||
// Qt includes
|
||||
#include "tabbar.h"
|
||||
#include "tabwidget.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Constructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabWidget::MHTabWidget(QWidget *parent) : QTabWidget(parent)
|
||||
{
|
||||
m_tabBar = new MHTabBar(this);
|
||||
connect(m_tabBar, SIGNAL(OnDetachTab(int, QPoint&)), this, SLOT(DetachTab(int, QPoint&)));
|
||||
connect(m_tabBar, SIGNAL(OnMoveTab(int, int)), this, SLOT(MoveTab(int, int)));
|
||||
|
||||
setTabBar(m_tabBar);
|
||||
setMovable(true);
|
||||
|
||||
m_Windows.clear();
|
||||
}
|
||||
|
||||
QTabBar* MHTabWidget::tabBar()
|
||||
{
|
||||
return m_tabBar;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Destructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabWidget::~MHTabWidget(void)
|
||||
{
|
||||
disconnect(m_tabBar, SIGNAL(OnMoveTab(int, int)), this, SLOT(MoveTab(int, int)));
|
||||
disconnect(m_tabBar, SIGNAL(OnDetachTab(int, QPoint&)), this, SLOT(DetachTab(int, QPoint&)));
|
||||
delete m_tabBar;
|
||||
}
|
||||
|
||||
int MHTabWidget::count() const
|
||||
{
|
||||
return QTabWidget::count() + m_Windows.size();
|
||||
}
|
||||
|
||||
QWidget *MHTabWidget::widget(int index) const
|
||||
{
|
||||
int baseCount = QTabWidget::count();
|
||||
|
||||
// Check if it's just a normal tab
|
||||
if (index < baseCount)
|
||||
return QTabWidget::widget(index);
|
||||
|
||||
// Otherwise it's going to be a window
|
||||
return m_Windows.at(index - baseCount);
|
||||
}
|
||||
|
||||
void MHTabWidget::setCurrentIndex(int index)
|
||||
{
|
||||
// Check if it's just a normal tab
|
||||
if (index < QTabWidget::count())
|
||||
{
|
||||
QTabWidget::setCurrentIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise it's going to be a window (just bring it up)
|
||||
MHDetachedWindow* window = dynamic_cast<MHDetachedWindow*>(widget(index)->parent());
|
||||
window->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void MHTabWidget::setCurrentWidget(QWidget *widget)
|
||||
{
|
||||
widget = 0;
|
||||
// To be implemented.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabWidget::MoveTab(int fromIndex, int toIndex)
|
||||
{
|
||||
removeTab(fromIndex);
|
||||
insertTab(toIndex, widget(fromIndex), tabIcon(fromIndex), tabText(fromIndex));
|
||||
setCurrentIndex(toIndex);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabWidget::DetachTab(int index, QPoint& dropPoint)
|
||||
{
|
||||
Q_UNUSED(dropPoint);
|
||||
// Create the window
|
||||
MHDetachedWindow* detachedWidget = new MHDetachedWindow(parentWidget(), this);
|
||||
detachedWidget->setWindowModality(Qt::NonModal);
|
||||
|
||||
// Find Widget and connect
|
||||
connect(detachedWidget, SIGNAL(OnClose(QWidget*)), this, SLOT(AttachTab(QWidget*)));
|
||||
|
||||
detachedWidget->setWindowTitle(tabText(index));
|
||||
detachedWidget->setWindowIcon(tabIcon(index));
|
||||
|
||||
// Remove from tab bar
|
||||
QWidget* tearOffWidget = widget(index);
|
||||
tearOffWidget->setParent(detachedWidget);
|
||||
|
||||
// Add it to the windows list
|
||||
m_Windows.append(tearOffWidget);
|
||||
|
||||
// Make first active
|
||||
if (count() > 0)
|
||||
setCurrentIndex(0);
|
||||
|
||||
// Create and show
|
||||
detachedWidget->setCentralWidget(tearOffWidget);
|
||||
|
||||
// Needs to be done explicitly
|
||||
tearOffWidget->show();
|
||||
QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
||||
int w = 640;
|
||||
int h = 480;
|
||||
int x = (screenGeometry.width() - w) / 2;
|
||||
int y = (screenGeometry.height() - h) / 2;
|
||||
detachedWidget->show();
|
||||
detachedWidget->setGeometry(x, y, w, h);
|
||||
detachedWidget->show();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabWidget::AttachTab(QWidget *parent)
|
||||
{
|
||||
// Retrieve widget
|
||||
MHDetachedWindow* detachedWidget = dynamic_cast<MHDetachedWindow*>(parent);
|
||||
QWidget* tearOffWidget = detachedWidget->centralWidget();
|
||||
|
||||
// Reattach the tab
|
||||
int newIndex = addTab(tearOffWidget, detachedWidget->windowIcon(), detachedWidget->windowTitle());
|
||||
|
||||
// Remove it from the windows list
|
||||
for(int i = 0; i < m_Windows.size(); i++)
|
||||
{
|
||||
if (m_Windows.at(i) == tearOffWidget)
|
||||
m_Windows.removeAt(i);
|
||||
}
|
||||
|
||||
// Make Active
|
||||
if (newIndex != -1)
|
||||
setCurrentIndex(newIndex);
|
||||
|
||||
// Cleanup Window
|
||||
disconnect(detachedWidget, SIGNAL(OnClose(QWidget*)), this, SLOT(AttachTab(QWidget*)));
|
||||
detachedWidget->hide();
|
||||
detachedWidget->close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
MHDetachedWindow::MHDetachedWindow(QWidget *parent, MHTabWidget *tabwidget) : QMainWindow(parent)
|
||||
{
|
||||
m_TabWidget = tabwidget;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
MHDetachedWindow::~MHDetachedWindow(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHDetachedWindow::moveEvent(QMoveEvent *event)
|
||||
{
|
||||
QRect rect = m_TabWidget->geometry();
|
||||
QSize hint = m_TabWidget->tabBar()->sizeHint();
|
||||
|
||||
// Height of the actual top tab bar
|
||||
rect.setBottom(rect.top() + hint.height());
|
||||
QPoint pos1(rect.x(), rect.y());
|
||||
pos1=m_TabWidget->mapToGlobal(pos1);
|
||||
rect.setX(pos1.x());
|
||||
rect.setY(pos1.y());
|
||||
|
||||
if (rect.contains(event->pos()))
|
||||
{
|
||||
m_TabWidget->AttachTab(this);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMainWindow::moveEvent(event);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHDetachedWindow::closeEvent(QCloseEvent* /*event*/)
|
||||
{
|
||||
emit OnClose(this);
|
||||
}
|
||||
// Qt includes
|
||||
#include "tabbar.h"
|
||||
#include "tabwidget.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Constructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabWidget::MHTabWidget(QWidget *parent) : QTabWidget(parent)
|
||||
{
|
||||
m_tabBar = new MHTabBar(this);
|
||||
connect(m_tabBar, SIGNAL(OnDetachTab(int, QPoint&)), this, SLOT(DetachTab(int, QPoint&)));
|
||||
connect(m_tabBar, SIGNAL(OnMoveTab(int, int)), this, SLOT(MoveTab(int, int)));
|
||||
|
||||
setTabBar(m_tabBar);
|
||||
setMovable(true);
|
||||
|
||||
m_Windows.clear();
|
||||
}
|
||||
|
||||
QTabBar* MHTabWidget::tabBar()
|
||||
{
|
||||
return m_tabBar;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default Destructor
|
||||
//////////////////////////////////////////////////////////////
|
||||
MHTabWidget::~MHTabWidget(void)
|
||||
{
|
||||
disconnect(m_tabBar, SIGNAL(OnMoveTab(int, int)), this, SLOT(MoveTab(int, int)));
|
||||
disconnect(m_tabBar, SIGNAL(OnDetachTab(int, QPoint&)), this, SLOT(DetachTab(int, QPoint&)));
|
||||
delete m_tabBar;
|
||||
}
|
||||
|
||||
int MHTabWidget::count() const
|
||||
{
|
||||
return QTabWidget::count() + m_Windows.size();
|
||||
}
|
||||
|
||||
QWidget *MHTabWidget::widget(int index) const
|
||||
{
|
||||
int baseCount = QTabWidget::count();
|
||||
|
||||
// Check if it's just a normal tab
|
||||
if (index < baseCount)
|
||||
return QTabWidget::widget(index);
|
||||
|
||||
// Otherwise it's going to be a window
|
||||
return m_Windows.at(index - baseCount);
|
||||
}
|
||||
|
||||
void MHTabWidget::setCurrentIndex(int index)
|
||||
{
|
||||
// Check if it's just a normal tab
|
||||
if (index < QTabWidget::count())
|
||||
{
|
||||
QTabWidget::setCurrentIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise it's going to be a window (just bring it up)
|
||||
MHDetachedWindow* window = dynamic_cast<MHDetachedWindow*>(widget(index)->parent());
|
||||
window->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void MHTabWidget::setCurrentWidget(QWidget *widget)
|
||||
{
|
||||
widget = 0;
|
||||
// To be implemented.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabWidget::MoveTab(int fromIndex, int toIndex)
|
||||
{
|
||||
removeTab(fromIndex);
|
||||
insertTab(toIndex, widget(fromIndex), tabIcon(fromIndex), tabText(fromIndex));
|
||||
setCurrentIndex(toIndex);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabWidget::DetachTab(int index, QPoint& dropPoint)
|
||||
{
|
||||
Q_UNUSED(dropPoint);
|
||||
// Create the window
|
||||
MHDetachedWindow* detachedWidget = new MHDetachedWindow(parentWidget(), this);
|
||||
detachedWidget->setWindowModality(Qt::NonModal);
|
||||
|
||||
// Find Widget and connect
|
||||
connect(detachedWidget, SIGNAL(OnClose(QWidget*)), this, SLOT(AttachTab(QWidget*)));
|
||||
|
||||
detachedWidget->setWindowTitle(tabText(index));
|
||||
detachedWidget->setWindowIcon(tabIcon(index));
|
||||
|
||||
// Remove from tab bar
|
||||
QWidget* tearOffWidget = widget(index);
|
||||
tearOffWidget->setParent(detachedWidget);
|
||||
|
||||
// Add it to the windows list
|
||||
m_Windows.append(tearOffWidget);
|
||||
|
||||
// Make first active
|
||||
if (count() > 0)
|
||||
setCurrentIndex(0);
|
||||
|
||||
// Create and show
|
||||
detachedWidget->setCentralWidget(tearOffWidget);
|
||||
|
||||
// Needs to be done explicitly
|
||||
tearOffWidget->show();
|
||||
QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
||||
int w = 640;
|
||||
int h = 480;
|
||||
int x = (screenGeometry.width() - w) / 2;
|
||||
int y = (screenGeometry.height() - h) / 2;
|
||||
detachedWidget->show();
|
||||
detachedWidget->setGeometry(x, y, w, h);
|
||||
detachedWidget->show();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHTabWidget::AttachTab(QWidget *parent)
|
||||
{
|
||||
// Retrieve widget
|
||||
MHDetachedWindow* detachedWidget = dynamic_cast<MHDetachedWindow*>(parent);
|
||||
QWidget* tearOffWidget = detachedWidget->centralWidget();
|
||||
|
||||
// Reattach the tab
|
||||
int newIndex = addTab(tearOffWidget, detachedWidget->windowIcon(), detachedWidget->windowTitle());
|
||||
|
||||
// Remove it from the windows list
|
||||
for(int i = 0; i < m_Windows.size(); i++)
|
||||
{
|
||||
if (m_Windows.at(i) == tearOffWidget)
|
||||
m_Windows.removeAt(i);
|
||||
}
|
||||
|
||||
// Make Active
|
||||
if (newIndex != -1)
|
||||
setCurrentIndex(newIndex);
|
||||
|
||||
// Cleanup Window
|
||||
disconnect(detachedWidget, SIGNAL(OnClose(QWidget*)), this, SLOT(AttachTab(QWidget*)));
|
||||
detachedWidget->hide();
|
||||
detachedWidget->close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
MHDetachedWindow::MHDetachedWindow(QWidget *parent, MHTabWidget *tabwidget) : QMainWindow(parent)
|
||||
{
|
||||
m_TabWidget = tabwidget;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
MHDetachedWindow::~MHDetachedWindow(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHDetachedWindow::moveEvent(QMoveEvent *event)
|
||||
{
|
||||
QRect rect = m_TabWidget->geometry();
|
||||
QSize hint = m_TabWidget->tabBar()->sizeHint();
|
||||
|
||||
// Height of the actual top tab bar
|
||||
rect.setBottom(rect.top() + hint.height());
|
||||
QPoint pos1(rect.x(), rect.y());
|
||||
pos1=m_TabWidget->mapToGlobal(pos1);
|
||||
rect.setX(pos1.x());
|
||||
rect.setY(pos1.y());
|
||||
|
||||
if (rect.contains(event->pos()))
|
||||
{
|
||||
m_TabWidget->AttachTab(this);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMainWindow::moveEvent(event);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MHDetachedWindow::closeEvent(QCloseEvent* /*event*/)
|
||||
{
|
||||
emit OnClose(this);
|
||||
}
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
#ifndef __MHTABWIDGET_H__
|
||||
#define __MHTABWIDGET_H__
|
||||
|
||||
// Qt includes
|
||||
#include <QWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QMoveEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
// Qt forward class definitions
|
||||
class MHTabBar;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// MHTabWidget implements the a Tab Widget with detach and attach
|
||||
// functionality.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class MHTabWidget: public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MHTabWidget(QWidget *parent);
|
||||
virtual ~MHTabWidget(void);
|
||||
QTabBar* tabBar();
|
||||
|
||||
public slots:
|
||||
int count() const;
|
||||
QWidget *widget(int index) const;
|
||||
|
||||
// Move Tab
|
||||
void MoveTab(int fromIndex, int toIndex);
|
||||
|
||||
// Detach Tab
|
||||
void DetachTab(int index, QPoint&);
|
||||
|
||||
// Attach Tab
|
||||
void AttachTab(QWidget *parent);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCurrentIndex(int index);
|
||||
void setCurrentWidget(QWidget *widget);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
MHTabBar* m_tabBar;
|
||||
|
||||
QList<QWidget*> m_Windows;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// MHDetachedWindow implements the WindowContainer for the Detached Widget
|
||||
//
|
||||
// Conditions:
|
||||
// Header : MHTabWidget.h
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class MHDetachedWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MHDetachedWindow(QWidget *parent = 0, MHTabWidget *tabwidget = 0);
|
||||
~MHDetachedWindow(void);
|
||||
|
||||
protected:
|
||||
MHTabWidget *m_TabWidget;
|
||||
|
||||
//virtual void moveEvent(QMoveEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
signals:
|
||||
void OnClose(QWidget* widget);
|
||||
};
|
||||
|
||||
#endif // __MHTABWIDGET_H__
|
||||
|
||||
#ifndef __MHTABWIDGET_H__
|
||||
#define __MHTABWIDGET_H__
|
||||
|
||||
// Qt includes
|
||||
#include <QWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QMoveEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
// Qt forward class definitions
|
||||
class MHTabBar;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// MHTabWidget implements the a Tab Widget with detach and attach
|
||||
// functionality.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class MHTabWidget: public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MHTabWidget(QWidget *parent);
|
||||
virtual ~MHTabWidget(void);
|
||||
QTabBar* tabBar();
|
||||
|
||||
public slots:
|
||||
int count() const;
|
||||
QWidget *widget(int index) const;
|
||||
|
||||
// Move Tab
|
||||
void MoveTab(int fromIndex, int toIndex);
|
||||
|
||||
// Detach Tab
|
||||
void DetachTab(int index, QPoint&);
|
||||
|
||||
// Attach Tab
|
||||
void AttachTab(QWidget *parent);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCurrentIndex(int index);
|
||||
void setCurrentWidget(QWidget *widget);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
MHTabBar* m_tabBar;
|
||||
|
||||
QList<QWidget*> m_Windows;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// MHDetachedWindow implements the WindowContainer for the Detached Widget
|
||||
//
|
||||
// Conditions:
|
||||
// Header : MHTabWidget.h
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class MHDetachedWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MHDetachedWindow(QWidget *parent = 0, MHTabWidget *tabwidget = 0);
|
||||
~MHDetachedWindow(void);
|
||||
|
||||
protected:
|
||||
MHTabWidget *m_TabWidget;
|
||||
|
||||
//virtual void moveEvent(QMoveEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
signals:
|
||||
void OnClose(QWidget* widget);
|
||||
};
|
||||
|
||||
#endif // __MHTABWIDGET_H__
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ MapViewOfMem::MapViewOfMem(QString file)
|
|||
QFile wFile(file);
|
||||
|
||||
if(wFile.open(QIODevice::ReadOnly) == false)
|
||||
//qDebug() << "File has not been opened.";
|
||||
//qDebug() << "File has not been opened.";
|
||||
|
||||
mData = wFile.readAll();
|
||||
mData = wFile.readAll();
|
||||
//qDebug() << "Size: " << mData.size();
|
||||
|
||||
if(mData.size() == 0)
|
||||
|
|
|
@ -18,41 +18,41 @@ typedef struct _Selection_t
|
|||
class MapViewOfMem
|
||||
{
|
||||
|
||||
public:
|
||||
MapViewOfMem();
|
||||
explicit MapViewOfMem(QString file);
|
||||
explicit MapViewOfMem(uint_t startAddress , uint_t size);
|
||||
~MapViewOfMem();
|
||||
byte_t readByte(uint_t rva);
|
||||
uint_t size();
|
||||
unsigned char *data();
|
||||
public:
|
||||
MapViewOfMem();
|
||||
explicit MapViewOfMem(QString file);
|
||||
explicit MapViewOfMem(uint_t startAddress , uint_t size);
|
||||
~MapViewOfMem();
|
||||
byte_t readByte(uint_t rva);
|
||||
uint_t size();
|
||||
unsigned char *data();
|
||||
|
||||
Selection_t getSelection();
|
||||
void setSelection(Selection_t sel);
|
||||
Selection_t getSelection();
|
||||
void setSelection(Selection_t sel);
|
||||
|
||||
uint_t getBase();
|
||||
byte_t* getDataPtrForGui(uint_t rva, uint_t maxNbrOfBytesToRead, uint_t newCacheSize);
|
||||
uint_t getBase();
|
||||
byte_t* getDataPtrForGui(uint_t rva, uint_t maxNbrOfBytesToRead, uint_t newCacheSize);
|
||||
|
||||
private:
|
||||
typedef struct _MemDataCacheStruct_t
|
||||
{
|
||||
QVector<byte_t>* memDataCachePtr;
|
||||
uint_t memDataCacheSize;
|
||||
uint_t rva;
|
||||
bool isInit;
|
||||
} MemDataCacheStruct_t;
|
||||
private:
|
||||
typedef struct _MemDataCacheStruct_t
|
||||
{
|
||||
QVector<byte_t>* memDataCachePtr;
|
||||
uint_t memDataCacheSize;
|
||||
uint_t rva;
|
||||
bool isInit;
|
||||
} MemDataCacheStruct_t;
|
||||
|
||||
|
||||
uint_t mBase;
|
||||
unsigned long mStartAddress;
|
||||
unsigned long mEndAddress;
|
||||
unsigned long mSize;
|
||||
uint_t mBase;
|
||||
unsigned long mStartAddress;
|
||||
unsigned long mEndAddress;
|
||||
unsigned long mSize;
|
||||
|
||||
QByteArray mData;
|
||||
QByteArray mData;
|
||||
|
||||
Selection_t mSelectedData;
|
||||
Selection_t mSelectedData;
|
||||
|
||||
MemDataCacheStruct_t mGuiMemDataCache;
|
||||
MemDataCacheStruct_t mGuiMemDataCache;
|
||||
};
|
||||
|
||||
#endif // MAPVIEWOFMEM_H
|
||||
|
|
|
@ -119,17 +119,17 @@ void ProcessMemoryMap::printVirtualMemoryMap(QList<MEMORY_BASIC_INFORMATION> par
|
|||
// State
|
||||
switch(wMemInfo.State)
|
||||
{
|
||||
case MEM_FREE:
|
||||
wTmpStr = QString("Free");
|
||||
break;
|
||||
case MEM_COMMIT:
|
||||
wTmpStr = QString("Commited");
|
||||
break;
|
||||
case MEM_RESERVE:
|
||||
wTmpStr = QString("Reserved");
|
||||
break;
|
||||
default:
|
||||
wTmpStr = QString("N/A");
|
||||
case MEM_FREE:
|
||||
wTmpStr = QString("Free");
|
||||
break;
|
||||
case MEM_COMMIT:
|
||||
wTmpStr = QString("Commited");
|
||||
break;
|
||||
case MEM_RESERVE:
|
||||
wTmpStr = QString("Reserved");
|
||||
break;
|
||||
default:
|
||||
wTmpStr = QString("N/A");
|
||||
}
|
||||
wStr += wTmpStr + QString(" ").repeated(10 - wTmpStr.length());
|
||||
wStr += " | ";
|
||||
|
@ -145,36 +145,36 @@ void ProcessMemoryMap::printVirtualMemoryMap(QList<MEMORY_BASIC_INFORMATION> par
|
|||
{
|
||||
switch(wMemInfo.Protect & 0xFF)
|
||||
{
|
||||
case PAGE_EXECUTE:
|
||||
wTmpStr = QString("Execute");
|
||||
break;
|
||||
case PAGE_EXECUTE_READ:
|
||||
wTmpStr = QString("Execute/Read");
|
||||
break;
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
wTmpStr = QString("Execute/Read/Write");
|
||||
break;
|
||||
case PAGE_NOACCESS:
|
||||
wTmpStr = QString("No Access");
|
||||
break;
|
||||
case PAGE_READONLY:
|
||||
wTmpStr = QString("Read");
|
||||
break;
|
||||
case PAGE_READWRITE:
|
||||
wTmpStr = QString("Read/Write");
|
||||
break;
|
||||
case PAGE_WRITECOPY:
|
||||
wTmpStr = QString("Copy on Write");
|
||||
break;
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
wTmpStr = QString("Execute/Copy on Write");
|
||||
break;
|
||||
case PAGE_EXECUTE:
|
||||
wTmpStr = QString("Execute");
|
||||
break;
|
||||
case PAGE_EXECUTE_READ:
|
||||
wTmpStr = QString("Execute/Read");
|
||||
break;
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
wTmpStr = QString("Execute/Read/Write");
|
||||
break;
|
||||
case PAGE_NOACCESS:
|
||||
wTmpStr = QString("No Access");
|
||||
break;
|
||||
case PAGE_READONLY:
|
||||
wTmpStr = QString("Read");
|
||||
break;
|
||||
case PAGE_READWRITE:
|
||||
wTmpStr = QString("Read/Write");
|
||||
break;
|
||||
case PAGE_WRITECOPY:
|
||||
wTmpStr = QString("Copy on Write");
|
||||
break;
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
wTmpStr = QString("Execute/Copy on Write");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(wMemInfo.Protect & 0xFF00)
|
||||
{
|
||||
case PAGE_GUARD:
|
||||
wTmpStr += QString(" + Guard");
|
||||
case PAGE_GUARD:
|
||||
wTmpStr += QString(" + Guard");
|
||||
}
|
||||
|
||||
wStr += wTmpStr + QString(" ").repeated(30 - wTmpStr.length());
|
||||
|
@ -184,18 +184,18 @@ void ProcessMemoryMap::printVirtualMemoryMap(QList<MEMORY_BASIC_INFORMATION> par
|
|||
// Type
|
||||
switch(wMemInfo.Type)
|
||||
{
|
||||
case MEM_IMAGE:
|
||||
wTmpStr = QString("Image");
|
||||
break;
|
||||
case MEM_MAPPED:
|
||||
wTmpStr = QString("Mapped");
|
||||
break;
|
||||
case MEM_PRIVATE:
|
||||
wTmpStr = QString("Private");
|
||||
break;
|
||||
default:
|
||||
wTmpStr = QString("N/A");
|
||||
break;
|
||||
case MEM_IMAGE:
|
||||
wTmpStr = QString("Image");
|
||||
break;
|
||||
case MEM_MAPPED:
|
||||
wTmpStr = QString("Mapped");
|
||||
break;
|
||||
case MEM_PRIVATE:
|
||||
wTmpStr = QString("Private");
|
||||
break;
|
||||
default:
|
||||
wTmpStr = QString("N/A");
|
||||
break;
|
||||
}
|
||||
wStr += wTmpStr + QString(" ").repeated(10 - wTmpStr.length());
|
||||
|
||||
|
|
|
@ -1,110 +1,121 @@
|
|||
#include "ApiFingerprints.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief retrieves information (name, arguments) for given api function from database
|
||||
* @param name of dll without ".dll"
|
||||
* @param name of function
|
||||
* @remark upper or lower case doesn't matter
|
||||
* @return
|
||||
*/
|
||||
const APIFunction ApiFingerprints::function(QString dllname,QString functionname) const{
|
||||
return Library.constFind(dllname.toLower().trimmed()).value().constFind(functionname.toLower().trimmed()).value();
|
||||
/*
|
||||
* example
|
||||
* --------------------
|
||||
* "int MessageBoxA(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType)"
|
||||
*
|
||||
* APIFunction f = function("UsEr32 ","messAgebOxa");
|
||||
* f.Name = "MessageBoxA";
|
||||
* f.DLLName = "user32";
|
||||
* f.ReturnType = "int"
|
||||
* f.Arguments.at(0).Name = "hWnd";
|
||||
* f.Arguments.at(0).Type = "HWND";
|
||||
* f.Arguments.at(1).Name = "lpText";
|
||||
* f.Arguments.at(1).Type = "LPCTSTR";
|
||||
* ...
|
||||
*
|
||||
* upper / lower case doesn't matter and additional whitespace will be trimmed
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ApiFingerprints::ApiFingerprints()
|
||||
{
|
||||
// the config file should contain a list of possible data files for api calls
|
||||
QList<QString> files = Configuration::instance()->ApiFingerprints();
|
||||
|
||||
// iterate all given files
|
||||
foreach(QString file, files){
|
||||
QFile mFile("data/"+file+".txt");
|
||||
if(mFile.open(QFile::ReadOnly | QFile::Text)){
|
||||
// if file exists --> parse file
|
||||
|
||||
QMap<QString, APIFunction> Functions;
|
||||
QTextStream in(&mFile);
|
||||
while ( !in.atEnd() )
|
||||
{
|
||||
// reads raw line like "int;MessageBoxA;HWND hWnd;LPCTSTR lpText;LPCTSTR lpCaption;UINT uType;"
|
||||
QString rawFunctionDescr = in.readLine();
|
||||
QStringList functionParts = rawFunctionDescr.split(";");
|
||||
// format : retType;FunctionName;Arg1;Arg2;Arg3;...
|
||||
|
||||
|
||||
if(functionParts.count()<2){
|
||||
// each function description needs at least a return type and a name
|
||||
// if not, we ignore the data
|
||||
continue;
|
||||
}
|
||||
|
||||
// function data
|
||||
APIFunction func;
|
||||
func.DLLName = file;
|
||||
func.ReturnType = functionParts.at(0);
|
||||
func.Name = functionParts.at(1);
|
||||
|
||||
// read parameters
|
||||
for(int i=2;i<functionParts.count();i++){
|
||||
QString rawArgument = functionParts.at(i).trimmed();
|
||||
if(rawArgument.length() == 0)
|
||||
break;
|
||||
|
||||
// some functions have pointers as arguments --> use "*" to split type and name of argument
|
||||
QStringList par = rawArgument.split("*");
|
||||
APIArgument arg;
|
||||
if(par.count() > 1){
|
||||
arg.Name = par.at(1).trimmed();
|
||||
arg.Type = par.at(0).trimmed()+"*";
|
||||
|
||||
}else{
|
||||
// current argument is no pointer --> use " " to split
|
||||
par = rawArgument.split(" ");
|
||||
if(par.count()>1){
|
||||
arg.Name = par.at(1).trimmed();
|
||||
arg.Type = par.at(0).trimmed();
|
||||
}else{
|
||||
// we assume that there is only the type
|
||||
arg.Name = "";
|
||||
arg.Type = rawArgument.trimmed();
|
||||
}
|
||||
}
|
||||
|
||||
func.Arguments.append(arg);
|
||||
|
||||
}
|
||||
|
||||
Functions.insert(func.Name.toLower().trimmed(),func);
|
||||
|
||||
}
|
||||
|
||||
Library.insert(file,Functions);
|
||||
mFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#include "ApiFingerprints.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief retrieves information (name, arguments) for given api function from database
|
||||
* @param name of dll without ".dll"
|
||||
* @param name of function
|
||||
* @remark upper or lower case doesn't matter
|
||||
* @return
|
||||
*/
|
||||
const APIFunction ApiFingerprints::function(QString dllname,QString functionname) const
|
||||
{
|
||||
return Library.constFind(dllname.toLower().trimmed()).value().constFind(functionname.toLower().trimmed()).value();
|
||||
/*
|
||||
* example
|
||||
* --------------------
|
||||
* "int MessageBoxA(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType)"
|
||||
*
|
||||
* APIFunction f = function("UsEr32 ","messAgebOxa");
|
||||
* f.Name = "MessageBoxA";
|
||||
* f.DLLName = "user32";
|
||||
* f.ReturnType = "int"
|
||||
* f.Arguments.at(0).Name = "hWnd";
|
||||
* f.Arguments.at(0).Type = "HWND";
|
||||
* f.Arguments.at(1).Name = "lpText";
|
||||
* f.Arguments.at(1).Type = "LPCTSTR";
|
||||
* ...
|
||||
*
|
||||
* upper / lower case doesn't matter and additional whitespace will be trimmed
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ApiFingerprints::ApiFingerprints()
|
||||
{
|
||||
// the config file should contain a list of possible data files for api calls
|
||||
QList<QString> files = Configuration::instance()->ApiFingerprints();
|
||||
|
||||
// iterate all given files
|
||||
foreach(QString file, files)
|
||||
{
|
||||
QFile mFile("data/"+file+".txt");
|
||||
if(mFile.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
// if file exists --> parse file
|
||||
|
||||
QMap<QString, APIFunction> Functions;
|
||||
QTextStream in(&mFile);
|
||||
while ( !in.atEnd() )
|
||||
{
|
||||
// reads raw line like "int;MessageBoxA;HWND hWnd;LPCTSTR lpText;LPCTSTR lpCaption;UINT uType;"
|
||||
QString rawFunctionDescr = in.readLine();
|
||||
QStringList functionParts = rawFunctionDescr.split(";");
|
||||
// format : retType;FunctionName;Arg1;Arg2;Arg3;...
|
||||
|
||||
|
||||
if(functionParts.count()<2)
|
||||
{
|
||||
// each function description needs at least a return type and a name
|
||||
// if not, we ignore the data
|
||||
continue;
|
||||
}
|
||||
|
||||
// function data
|
||||
APIFunction func;
|
||||
func.DLLName = file;
|
||||
func.ReturnType = functionParts.at(0);
|
||||
func.Name = functionParts.at(1);
|
||||
|
||||
// read parameters
|
||||
for(int i=2; i<functionParts.count(); i++)
|
||||
{
|
||||
QString rawArgument = functionParts.at(i).trimmed();
|
||||
if(rawArgument.length() == 0)
|
||||
break;
|
||||
|
||||
// some functions have pointers as arguments --> use "*" to split type and name of argument
|
||||
QStringList par = rawArgument.split("*");
|
||||
APIArgument arg;
|
||||
if(par.count() > 1)
|
||||
{
|
||||
arg.Name = par.at(1).trimmed();
|
||||
arg.Type = par.at(0).trimmed()+"*";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// current argument is no pointer --> use " " to split
|
||||
par = rawArgument.split(" ");
|
||||
if(par.count()>1)
|
||||
{
|
||||
arg.Name = par.at(1).trimmed();
|
||||
arg.Type = par.at(0).trimmed();
|
||||
}
|
||||
else
|
||||
{
|
||||
// we assume that there is only the type
|
||||
arg.Name = "";
|
||||
arg.Type = rawArgument.trimmed();
|
||||
}
|
||||
}
|
||||
|
||||
func.Arguments.append(arg);
|
||||
|
||||
}
|
||||
|
||||
Functions.insert(func.Name.toLower().trimmed(),func);
|
||||
|
||||
}
|
||||
|
||||
Library.insert(file,Functions);
|
||||
mFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
#ifndef APIFINGERPRINTS_H
|
||||
#define APIFINGERPRINTS_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
struct APIArgument{
|
||||
QString Type;
|
||||
QString Name;
|
||||
};
|
||||
|
||||
struct APIFunction{
|
||||
QString DLLName;
|
||||
QString ReturnType;
|
||||
QString Name;
|
||||
QList<APIArgument> Arguments;
|
||||
};
|
||||
|
||||
class ApiFingerprints
|
||||
{
|
||||
QMap<QString,QMap<QString, APIFunction>> Library;
|
||||
public:
|
||||
ApiFingerprints();
|
||||
const APIFunction function(QString dllname, QString functionname) const;
|
||||
};
|
||||
|
||||
#endif // APIFINGERPRINTS_H
|
||||
#ifndef APIFINGERPRINTS_H
|
||||
#define APIFINGERPRINTS_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
struct APIArgument
|
||||
{
|
||||
QString Type;
|
||||
QString Name;
|
||||
};
|
||||
|
||||
struct APIFunction
|
||||
{
|
||||
QString DLLName;
|
||||
QString ReturnType;
|
||||
QString Name;
|
||||
QList<APIArgument> Arguments;
|
||||
};
|
||||
|
||||
class ApiFingerprints
|
||||
{
|
||||
QMap<QString,QMap<QString, APIFunction>> Library;
|
||||
public:
|
||||
ApiFingerprints();
|
||||
const APIFunction function(QString dllname, QString functionname) const;
|
||||
};
|
||||
|
||||
#endif // APIFINGERPRINTS_H
|
||||
|
|
|
@ -19,29 +19,29 @@ void Breakpoints::setBP(BPXTYPE type, uint_t va)
|
|||
|
||||
switch(type)
|
||||
{
|
||||
case bp_normal:
|
||||
{
|
||||
wCmd = "bp " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
case bp_normal:
|
||||
{
|
||||
wCmd = "bp " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
|
||||
case bp_hardware:
|
||||
{
|
||||
wCmd = "bph " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
case bp_hardware:
|
||||
{
|
||||
wCmd = "bph " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
|
||||
case bp_memory:
|
||||
{
|
||||
wCmd = "bpm " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
case bp_memory:
|
||||
{
|
||||
wCmd = "bpm " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
DbgCmdExec(wCmd.toUtf8().constData());
|
||||
|
@ -177,29 +177,29 @@ void Breakpoints::removeBP(BRIDGEBP bp)
|
|||
|
||||
switch(bp.type)
|
||||
{
|
||||
case bp_normal:
|
||||
{
|
||||
wCmd = "bc " + QString("%1").arg(bp.addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
case bp_normal:
|
||||
{
|
||||
wCmd = "bc " + QString("%1").arg(bp.addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
|
||||
case bp_hardware:
|
||||
{
|
||||
wCmd = "bphc " + QString("%1").arg(bp.addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
case bp_hardware:
|
||||
{
|
||||
wCmd = "bphc " + QString("%1").arg(bp.addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
|
||||
case bp_memory:
|
||||
{
|
||||
wCmd = "bpmc " + QString("%1").arg(bp.addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
case bp_memory:
|
||||
{
|
||||
wCmd = "bpmc " + QString("%1").arg(bp.addr, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
DbgCmdExec(wCmd.toUtf8().constData());
|
||||
|
@ -316,17 +316,17 @@ void Breakpoints::toogleBPByRemoving(BPXTYPE type, uint_t va)
|
|||
|
||||
switch(wBPList.bp[wI].type)
|
||||
{
|
||||
case bp_normal:
|
||||
wNormalWasRemoved = true;
|
||||
break;
|
||||
case bp_memory:
|
||||
wMemoryWasRemoved = true;
|
||||
break;
|
||||
case bp_hardware:
|
||||
wHardwareWasRemoved = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case bp_normal:
|
||||
wNormalWasRemoved = true;
|
||||
break;
|
||||
case bp_memory:
|
||||
wMemoryWasRemoved = true;
|
||||
break;
|
||||
case bp_hardware:
|
||||
wHardwareWasRemoved = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue