1
0
Fork 0

PROJECT+DBG+GUI: formatting (forgot to commit the correct formatting options for x64dbg)

This commit is contained in:
Mr. eXoDia 2015-12-25 14:02:34 +01:00
parent 5582730485
commit 96f04cdb63
88 changed files with 1094 additions and 1093 deletions

Binary file not shown.

View File

@ -16,7 +16,7 @@ extern GUISENDMESSAGEASYNC _gui_sendmessageasync;
//DBG typedefs
typedef const char* (*DBGDBGINIT)();
typedef duint (*DBGMEMFINDBASEADDR)(duint addr, duint* size);
typedef duint(*DBGMEMFINDBASEADDR)(duint addr, duint* size);
typedef bool (*DBGMEMREAD)(duint addr, unsigned char* dest, duint size, duint* read);
typedef bool (*DBGMEMWRITE)(duint addr, const unsigned char* src, duint size, duint* written);
typedef bool (*DBGDBGCMDEXEC)(const char* cmd);
@ -27,14 +27,14 @@ typedef bool (*DBGISDEBUGGING)();
typedef bool (*DBGISJUMPGOINGTOEXECUTE)(duint addr);
typedef bool (*DBGADDRINFOGET)(duint addr, SEGMENTREG segment, ADDRINFO* addrinfo);
typedef bool (*DBGADDRINFOSET)(duint addr, ADDRINFO* addrinfo);
typedef BPXTYPE (*DBGBPGETTYPEAT)(duint addr);
typedef BPXTYPE(*DBGBPGETTYPEAT)(duint addr);
typedef bool (*DBGGETREGDUMP)(REGDUMP* regdump);
typedef bool (*DBGVALTOSTRING)(const char* string, duint value);
typedef bool (*DBGMEMISVALIDREADPTR)(duint addr);
typedef int (*DBGGETBPLIST)(BPXTYPE type, BPMAP* bplist);
typedef bool (*DBGDBGCMDEXECDIRECT)(const char* cmd);
typedef duint (*DBGGETBRANCHDESTINATION)(duint addr);
typedef duint (*DBGSENDMESSAGE)(DBGMSG type, void* param1, void* param2);
typedef duint(*DBGGETBRANCHDESTINATION)(duint addr);
typedef duint(*DBGSENDMESSAGE)(DBGMSG type, void* param1, void* param2);
//DBG functions
extern DBGDBGINIT _dbg_dbginit;

View File

@ -249,7 +249,7 @@ BRIDGE_IMPEXP bool DbgMemRead(duint va, unsigned char* dest, duint size)
return false;
}
if (!_dbg_memread(va, dest, size, 0))
if(!_dbg_memread(va, dest, size, 0))
{
// Zero the buffer on failure
memset(dest, 0, size);
@ -1251,7 +1251,7 @@ BRIDGE_IMPEXP void GuiDumpAtN(duint va, int index)
}
BRIDGE_IMPEXP void GuiDisplayWarning(const char *title, const char *text)
BRIDGE_IMPEXP void GuiDisplayWarning(const char* title, const char* text)
{
_gui_sendmessage(GUI_DISPLAY_WARNING, (void*) title, (void*) text);
}

View File

@ -145,7 +145,6 @@ typedef enum
DBG_SCRIPT_SETIP, // param1=int line, param2=unused
DBG_SCRIPT_GETBRANCHINFO, // param1=int line, param2=SCRIPTBRANCH* info
DBG_SYMBOL_ENUM, // param1=SYMBOLCBINFO* cbInfo, param2=unused
DBG_SYMBOL_ENUM_FROMCACHE, // param1=SYMBOLCBINFO* cbInfo, param2=unused
DBG_ASSEMBLE_AT, // param1=duint addr, param2=const char* instruction
DBG_MODBASE_FROM_NAME, // param1=const char* modname, param2=unused
DBG_DISASM_AT, // param1=duint addr, param2=DISASM_INSTR* instr
@ -178,7 +177,8 @@ typedef enum
DBG_WIN_EVENT_GLOBAL, // param1=MSG* message, param2=unused
DBG_INITIALIZE_LOCKS, // param1=unused, param2=unused
DBG_DEINITIALIZE_LOCKS, // param1=unused, param2=unused
DBG_GET_TIME_WASTED_COUNTER // param1=unused, param2=unused
DBG_GET_TIME_WASTED_COUNTER, // param1=unused, param2=unused
DBG_SYMBOL_ENUM_FROMCACHE, // param1=SYMBOLCBINFO* cbInfo, param2=unused
} DBGMSG;
typedef enum
@ -888,7 +888,7 @@ BRIDGE_IMPEXP void GuiGetGlobalNotes(char** text);
BRIDGE_IMPEXP void GuiSetDebuggeeNotes(const char* text);
BRIDGE_IMPEXP void GuiGetDebuggeeNotes(char** text);
BRIDGE_IMPEXP void GuiDumpAtN(duint va, int index);
BRIDGE_IMPEXP void GuiDisplayWarning(const char *title, const char *text);
BRIDGE_IMPEXP void GuiDisplayWarning(const char* title, const char* text);
#ifdef __cplusplus
}

View File

@ -75,7 +75,7 @@ bool FunctionPass::Analyse()
// Initialize thread vector
auto threadFunctions = new std::vector<FunctionDef>[IdealThreadCount()];
concurrency::parallel_for(duint (0), IdealThreadCount(), [&](duint i)
concurrency::parallel_for(duint(0), IdealThreadCount(), [&](duint i)
{
// Memory allocation optimization
// TODO: Option to conserve memory
@ -174,23 +174,23 @@ void FunctionPass::AnalysisWorker(duint Start, duint End, std::vector<FunctionDe
BasicBlock* finalBlock = &m_MainBlocks.back();
duint virtEnd = 0;
for (duint i = Start; i < End; i++, ++blockItr)
for(duint i = Start; i < End; i++, ++blockItr)
{
if (blockItr->VirtualStart < virtEnd)
if(blockItr->VirtualStart < virtEnd)
continue;
// Skip padding
if (blockItr->GetFlag(BASIC_BLOCK_FLAG_PAD))
if(blockItr->GetFlag(BASIC_BLOCK_FLAG_PAD))
continue;
// Is the block untouched?
if (blockItr->GetFlag(BASIC_BLOCK_FLAG_FUNCTION))
if(blockItr->GetFlag(BASIC_BLOCK_FLAG_FUNCTION))
continue;
// Try to define a function
FunctionDef def { blockItr->VirtualStart, 0, 0, 0, 0 };
if (ResolveFunctionEnd(&def, finalBlock))
if(ResolveFunctionEnd(&def, finalBlock))
{
Blocks->push_back(def);
virtEnd = def.VirtualEnd;
@ -268,7 +268,7 @@ bool FunctionPass::ResolveKnownFunctionEnd(FunctionDef* Function)
Function->BBlockEnd = FindBBlockIndex(endBlock);
// Set the flag for blocks that have been scanned
for (BasicBlock* block = startBlock; (duint)block <= (duint)endBlock; block++)
for(BasicBlock* block = startBlock; (duint)block <= (duint)endBlock; block++)
{
// Block now in use
block->SetFlag(BASIC_BLOCK_FLAG_FUNCTION);
@ -302,7 +302,7 @@ bool FunctionPass::ResolveFunctionEnd(FunctionDef* Function, BasicBlock* LastBlo
// Loop forever until the end is found
for(; (duint)block <= (duint)LastBlock; block++)
{
if (block->GetFlag(BASIC_BLOCK_FLAG_CALL_TARGET) && block->VirtualStart != Function->VirtualStart)
if(block->GetFlag(BASIC_BLOCK_FLAG_CALL_TARGET) && block->VirtualStart != Function->VirtualStart)
{
block--;
break;
@ -320,14 +320,14 @@ bool FunctionPass::ResolveFunctionEnd(FunctionDef* Function, BasicBlock* LastBlo
// Find maximum jump target
if(!block->GetFlag(BASIC_BLOCK_FLAG_CALL) && !block->GetFlag(BASIC_BLOCK_FLAG_INDIRECT))
{
if (block->Target != 0 && block->Target >= maximumAddr)
if(block->Target != 0 && block->Target >= maximumAddr)
{
// Here's a problem: Compilers add tail-call elimination with a jump.
// Solve this by creating a maximum jump limit.
auto targetBlock = FindBBlockInRange(block->Target);
// If (target block found) and (target block is not called)
if (targetBlock && !targetBlock->GetFlag(BASIC_BLOCK_FLAG_CALL_TARGET))
if(targetBlock && !targetBlock->GetFlag(BASIC_BLOCK_FLAG_CALL_TARGET))
{
duint blockEnd = targetBlock->VirtualEnd;
@ -344,19 +344,19 @@ bool FunctionPass::ResolveFunctionEnd(FunctionDef* Function, BasicBlock* LastBlo
// Where INT3 will align "some_func" to 4, 8, 12, or 16.
// INT3 padding is also optional (if the jump fits perfectly).
//
if (true/*block->GetFlag(BASIC_BLOCK_FLAG_ABSJMP)*/)
if(true/*block->GetFlag(BASIC_BLOCK_FLAG_ABSJMP)*/)
{
{
// Check if padding is aligned to 4
auto nextBlock = block + 1;
if ((duint)nextBlock <= (duint)LastBlock)
if((duint)nextBlock <= (duint)LastBlock)
{
if (nextBlock->GetFlag(BASIC_BLOCK_FLAG_PAD))
if(nextBlock->GetFlag(BASIC_BLOCK_FLAG_PAD))
{
// If this block is aligned to 4 bytes at the end
if ((nextBlock->VirtualEnd + 1) % 4 == 0)
if((nextBlock->VirtualEnd + 1) % 4 == 0)
blockEnd = block->VirtualEnd;
}
}
@ -392,7 +392,7 @@ bool FunctionPass::ResolveFunctionEnd(FunctionDef* Function, BasicBlock* LastBlo
if(block->GetFlag(BASIC_BLOCK_FLAG_ABSJMP))
{
// 2.
if (block->VirtualEnd == maximumAddr)
if(block->VirtualEnd == maximumAddr)
break;
// 3.
@ -422,7 +422,7 @@ void FunctionPass::EnumerateFunctionRuntimeEntries64(std::function<bool (PRUNTIM
size_t totalCount = (m_FunctionInfoSize / sizeof(RUNTIME_FUNCTION));
// Enumerate each entry
for (size_t i = 0; i < totalCount; i++)
for(size_t i = 0; i < totalCount; i++)
{
if(!Callback(&functionTable[i]))
break;

View File

@ -33,7 +33,7 @@ bool LinearPass::Analyse()
// Initialize thread vector
auto threadBlocks = new std::vector<BasicBlock>[IdealThreadCount()];
concurrency::parallel_for(duint (0), IdealThreadCount(), [&](duint i)
concurrency::parallel_for(duint(0), IdealThreadCount(), [&](duint i)
{
duint threadWorkStart = m_VirtualStart + (workAmount * i);
duint threadWorkStop = min((threadWorkStart + workAmount), m_VirtualEnd);
@ -95,7 +95,7 @@ void LinearPass::AnalyseOverlaps()
// Initialize thread vectors
auto threadInserts = new std::vector<BasicBlock>[IdealThreadCount()];
concurrency::parallel_for(duint (0), IdealThreadCount(), [&](duint i)
concurrency::parallel_for(duint(0), IdealThreadCount(), [&](duint i)
{
duint threadWorkStart = (workAmount * i);
duint threadWorkStop = min((threadWorkStart + workAmount), workTotal);
@ -208,16 +208,16 @@ void LinearPass::AnalysisWorker(duint Start, duint End, BBlockArray* Blocks)
lastBlock->InstrCount = insnCount;
insnCount = 0;
if (!padding)
if(!padding)
{
// Check if absolute jump, regardless of operand
if (disasm.GetId() == X86_INS_JMP)
if(disasm.GetId() == X86_INS_JMP)
block->SetFlag(BASIC_BLOCK_FLAG_ABSJMP);
// Figure out the operand type(s)
const auto& operand = disasm.x86().operands[0];
const auto & operand = disasm.x86().operands[0];
if (operand.type == X86_OP_IMM)
if(operand.type == X86_OP_IMM)
{
// Branch target immediate
block->Target = (duint)operand.imm;
@ -227,7 +227,7 @@ void LinearPass::AnalysisWorker(duint Start, duint End, BBlockArray* Blocks)
// Indirects (no operand, register, or memory)
block->SetFlag(BASIC_BLOCK_FLAG_INDIRECT);
if (operand.type == X86_OP_MEM &&
if(operand.type == X86_OP_MEM &&
operand.mem.base == X86_REG_RIP &&
operand.mem.index == X86_REG_INVALID &&
operand.mem.scale == 1)
@ -288,13 +288,13 @@ void LinearPass::AnalysisOverlapWorker(duint Start, duint End, BBlockArray* Inse
{
removal = FindBBlockInRange(curr->Target);
if (removal)
if(removal)
{
if (curr->GetFlag(BASIC_BLOCK_FLAG_CALL))
if(curr->GetFlag(BASIC_BLOCK_FLAG_CALL))
removal->SetFlag(BASIC_BLOCK_FLAG_CALL_TARGET);
// If the target does not equal the block start...
if (curr->Target != removal->VirtualStart)
if(curr->Target != removal->VirtualStart)
{
// Mark for deletion
removal->SetFlag(BASIC_BLOCK_FLAG_DELETE);

View File

@ -36,9 +36,9 @@ typedef struct
typedef bool (*ASSEMBLEATEX)(duint addr, const char* instruction, char* error, bool fillnop);
typedef bool (*SECTIONFROMADDR)(duint addr, char* section);
typedef bool (*MODNAMEFROMADDR)(duint addr, char* modname, bool extension);
typedef duint (*MODBASEFROMADDR)(duint addr);
typedef duint (*MODBASEFROMNAME)(const char* modname);
typedef duint (*MODSIZEFROMADDR)(duint addr);
typedef duint(*MODBASEFROMADDR)(duint addr);
typedef duint(*MODBASEFROMNAME)(const char* modname);
typedef duint(*MODSIZEFROMADDR)(duint addr);
typedef bool (*ASSEMBLE)(duint addr, unsigned char* dest, int* size, const char* instruction, char* error);
typedef bool (*PATCHGET)(duint addr);
typedef bool (*PATCHINRANGE)(duint start, duint end);
@ -63,9 +63,9 @@ typedef bool (*PAGERIGHTSTOSTRING)(DWORD protect, char* rights);
typedef bool (*ISPROCESSELEVATED)();
typedef bool (*GETCMDLINE)(char* cmdline, size_t* cbsize);
typedef bool (*SETCMDLINE)(const char* cmdline);
typedef duint (*FILEOFFSETTOVA)(const char* modname, duint offset);
typedef duint (*VATOFILEOFFSET)(duint va);
typedef duint (*GETADDRFROMLINE)(const char* szSourceFile, int line);
typedef duint(*FILEOFFSETTOVA)(const char* modname, duint offset);
typedef duint(*VATOFILEOFFSET)(duint va);
typedef duint(*GETADDRFROMLINE)(const char* szSourceFile, int line);
typedef bool (*GETSOURCEFROMADDR)(duint addr, char* szSourceFile, int* line);
typedef bool (*VALFROMSTRING)(const char* string, duint* value);

View File

@ -103,11 +103,11 @@ extern "C" DLL_EXPORT bool _dbg_isjumpgoingtoexecute(duint addr)
static bool shouldFilterSymbol(const char* name)
{
if (!name)
if(!name)
return true;
if (!strcmp(name, "`string'"))
if(!strcmp(name, "`string'"))
return true;
if (strstr(name, "__imp_") == name || strstr(name, "_imp_") == name)
if(strstr(name, "__imp_") == name || strstr(name, "_imp_") == name)
return true;
return false;
}
@ -115,7 +115,7 @@ static bool shouldFilterSymbol(const char* name)
static bool getLabel(duint addr, char* label)
{
bool retval = false;
if (LabelGet(addr, label))
if(LabelGet(addr, label))
retval = true;
else //no user labels
{
@ -124,45 +124,45 @@ static bool getLabel(duint addr, char* label)
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_LABEL_SIZE;
if (SafeSymFromAddr(fdProcessInfo->hProcess, (DWORD64)addr, &displacement, pSymbol) && !displacement)
if(SafeSymFromAddr(fdProcessInfo->hProcess, (DWORD64)addr, &displacement, pSymbol) && !displacement)
{
pSymbol->Name[pSymbol->MaxNameLen - 1] = '\0';
if (!bUndecorateSymbolNames || !SafeUnDecorateSymbolName(pSymbol->Name, label, MAX_LABEL_SIZE, UNDNAME_COMPLETE))
if(!bUndecorateSymbolNames || !SafeUnDecorateSymbolName(pSymbol->Name, label, MAX_LABEL_SIZE, UNDNAME_COMPLETE))
strcpy_s(label, MAX_LABEL_SIZE, pSymbol->Name);
retval = !shouldFilterSymbol(label);
}
if (!retval) //search for CALL <jmp.&user32.MessageBoxA>
if(!retval) //search for CALL <jmp.&user32.MessageBoxA>
{
BASIC_INSTRUCTION_INFO basicinfo;
memset(&basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO));
if (disasmfast(addr, &basicinfo) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
if(disasmfast(addr, &basicinfo) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
{
duint val = 0;
if (MemRead(basicinfo.memory.value, &val, sizeof(val)))
if(MemRead(basicinfo.memory.value, &val, sizeof(val)))
{
if (SafeSymFromAddr(fdProcessInfo->hProcess, (DWORD64)val, &displacement, pSymbol) && !displacement)
if(SafeSymFromAddr(fdProcessInfo->hProcess, (DWORD64)val, &displacement, pSymbol) && !displacement)
{
pSymbol->Name[pSymbol->MaxNameLen - 1] = '\0';
if (!bUndecorateSymbolNames || !SafeUnDecorateSymbolName(pSymbol->Name, label, MAX_LABEL_SIZE, UNDNAME_COMPLETE))
if(!bUndecorateSymbolNames || !SafeUnDecorateSymbolName(pSymbol->Name, label, MAX_LABEL_SIZE, UNDNAME_COMPLETE))
sprintf_s(label, MAX_LABEL_SIZE, "JMP.&%s", pSymbol->Name);
retval = !shouldFilterSymbol(label);
}
}
}
}
if (!retval) //search for module entry
if(!retval) //search for module entry
{
duint entry = ModEntryFromAddr(addr);
if (entry && entry == addr)
if(entry && entry == addr)
{
strcpy_s(label, MAX_LABEL_SIZE, "EntryPoint");
retval = true;
}
}
if (!retval) //search for function+offset
if(!retval) //search for function+offset
{
duint start;
if (FunctionGet(addr, &start, nullptr) && addr == start)
if(FunctionGet(addr, &start, nullptr) && addr == start)
{
sprintf_s(label, MAX_LABEL_SIZE, "sub_%" fext "X", start);
retval = true;
@ -193,7 +193,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
}
if(addrinfo->flags & flagfunction)
{
if (FunctionGet(addr, &addrinfo->function.start, &addrinfo->function.end, &addrinfo->function.instrcount))
if(FunctionGet(addr, &addrinfo->function.start, &addrinfo->function.end, &addrinfo->function.instrcount))
retval = true;
}
if(addrinfo->flags & flagloop)

View File

@ -60,7 +60,7 @@ void* erealloc(void* ptr, size_t size, const char* reason)
ASSERT_NONZERO(size);
// Free the memory if the pointer was set (as per documentation).
if (ptr)
if(ptr)
efree(ptr);
return emalloc(size, reason);

View File

@ -5,13 +5,13 @@
namespace Script
{
namespace Assembler
{
SCRIPT_EXPORT bool Assemble(duint addr, unsigned char* dest, int* size, const char* instruction); //dest[16]
SCRIPT_EXPORT bool AssembleEx(duint addr, unsigned char* dest, int* size, const char* instruction, char* error); //dest[16], error[MAX_ERROR_SIZE]
SCRIPT_EXPORT bool AssembleMem(duint addr, const char* instruction);
SCRIPT_EXPORT bool AssembleMemEx(duint addr, const char* instruction, int* size, char* error, bool fillnop); //error[MAX_ERROR_SIZE]
}; //Assembler
namespace Assembler
{
SCRIPT_EXPORT bool Assemble(duint addr, unsigned char* dest, int* size, const char* instruction); //dest[16]
SCRIPT_EXPORT bool AssembleEx(duint addr, unsigned char* dest, int* size, const char* instruction, char* error); //dest[16], error[MAX_ERROR_SIZE]
SCRIPT_EXPORT bool AssembleMem(duint addr, const char* instruction);
SCRIPT_EXPORT bool AssembleMemEx(duint addr, const char* instruction, int* size, char* error, bool fillnop); //error[MAX_ERROR_SIZE]
}; //Assembler
}; //Script
#endif //_SCRIPTAPI_ASSEMBLER_H

View File

@ -5,27 +5,27 @@
namespace Script
{
namespace Debug
{
enum HardwareType
{
HardwareAccess,
HardwareWrite,
HardwareExecute
};
namespace Debug
{
enum HardwareType
{
HardwareAccess,
HardwareWrite,
HardwareExecute
};
SCRIPT_EXPORT void Wait();
SCRIPT_EXPORT void Run();
SCRIPT_EXPORT void Pause();
SCRIPT_EXPORT void Stop();
SCRIPT_EXPORT void StepIn();
SCRIPT_EXPORT void StepOver();
SCRIPT_EXPORT void StepOut();
SCRIPT_EXPORT bool SetBreakpoint(duint address);
SCRIPT_EXPORT bool DeleteBreakpoint(duint address);
SCRIPT_EXPORT bool SetHardwareBreakpoint(duint address, HardwareType type = HardwareExecute);
SCRIPT_EXPORT bool DeleteHardwareBreakpoint(duint address);
}; //Debug
SCRIPT_EXPORT void Wait();
SCRIPT_EXPORT void Run();
SCRIPT_EXPORT void Pause();
SCRIPT_EXPORT void Stop();
SCRIPT_EXPORT void StepIn();
SCRIPT_EXPORT void StepOver();
SCRIPT_EXPORT void StepOut();
SCRIPT_EXPORT bool SetBreakpoint(duint address);
SCRIPT_EXPORT bool DeleteBreakpoint(duint address);
SCRIPT_EXPORT bool SetHardwareBreakpoint(duint address, HardwareType type = HardwareExecute);
SCRIPT_EXPORT bool DeleteHardwareBreakpoint(duint address);
}; //Debug
}; //Script
#endif //_SCRIPTAPI_DEBUG_H

View File

@ -5,43 +5,43 @@
namespace Script
{
namespace Flag
{
enum FlagEnum
{
ZF,
OF,
CF,
PF,
SF,
TF,
AF,
DF,
IF
};
namespace Flag
{
enum FlagEnum
{
ZF,
OF,
CF,
PF,
SF,
TF,
AF,
DF,
IF
};
SCRIPT_EXPORT bool Get(FlagEnum flag);
SCRIPT_EXPORT bool Set(FlagEnum flag, bool value);
SCRIPT_EXPORT bool Get(FlagEnum flag);
SCRIPT_EXPORT bool Set(FlagEnum flag, bool value);
SCRIPT_EXPORT bool GetZF();
SCRIPT_EXPORT bool SetZF(bool value);
SCRIPT_EXPORT bool GetOF();
SCRIPT_EXPORT bool SetOF(bool value);
SCRIPT_EXPORT bool GetCF();
SCRIPT_EXPORT bool SetCF(bool value);
SCRIPT_EXPORT bool GetPF();
SCRIPT_EXPORT bool SetPF(bool value);
SCRIPT_EXPORT bool GetSF();
SCRIPT_EXPORT bool SetSF(bool value);
SCRIPT_EXPORT bool GetTF();
SCRIPT_EXPORT bool SetTF(bool value);
SCRIPT_EXPORT bool GetAF();
SCRIPT_EXPORT bool SetAF(bool value);
SCRIPT_EXPORT bool GetDF();
SCRIPT_EXPORT bool SetDF(bool value);
SCRIPT_EXPORT bool GetIF();
SCRIPT_EXPORT bool SetIF(bool value);
};
SCRIPT_EXPORT bool GetZF();
SCRIPT_EXPORT bool SetZF(bool value);
SCRIPT_EXPORT bool GetOF();
SCRIPT_EXPORT bool SetOF(bool value);
SCRIPT_EXPORT bool GetCF();
SCRIPT_EXPORT bool SetCF(bool value);
SCRIPT_EXPORT bool GetPF();
SCRIPT_EXPORT bool SetPF(bool value);
SCRIPT_EXPORT bool GetSF();
SCRIPT_EXPORT bool SetSF(bool value);
SCRIPT_EXPORT bool GetTF();
SCRIPT_EXPORT bool SetTF(bool value);
SCRIPT_EXPORT bool GetAF();
SCRIPT_EXPORT bool SetAF(bool value);
SCRIPT_EXPORT bool GetDF();
SCRIPT_EXPORT bool SetDF(bool value);
SCRIPT_EXPORT bool GetIF();
SCRIPT_EXPORT bool SetIF(bool value);
};
};
#endif //_SCRIPTAPI_FLAG_H

View File

@ -5,56 +5,56 @@
namespace Script
{
namespace Gui
{
namespace Disassembly
{
SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Disassembly
namespace Gui
{
namespace Disassembly
{
SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Disassembly
namespace Dump
{
SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Dump
namespace Dump
{
SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Dump
namespace Stack
{
SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Stack
}; //Gui
namespace Stack
{
SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Stack
}; //Gui
namespace Gui
{
enum Window
{
DisassemblyWindow,
DumpWindow,
StackWindow
};
namespace Gui
{
enum Window
{
DisassemblyWindow,
DumpWindow,
StackWindow
};
SCRIPT_EXPORT bool SelectionGet(Window window, duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(Window window, duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart(Window window);
SCRIPT_EXPORT duint SelectionGetEnd(Window window);
SCRIPT_EXPORT void Message(const char* message);
SCRIPT_EXPORT bool MessageYesNo(const char* message);
SCRIPT_EXPORT bool InputLine(const char* title, char* text); //text[GUI_MAX_LINE_SIZE]
SCRIPT_EXPORT bool InputValue(const char* title, duint* value);
SCRIPT_EXPORT void Refresh();
SCRIPT_EXPORT void AddQWidgetTab(void* qWidget);
SCRIPT_EXPORT void ShowQWidgetTab(void* qWidget);
SCRIPT_EXPORT void CloseQWidgetTab(void* qWidget);
SCRIPT_EXPORT bool SelectionGet(Window window, duint* start, duint* end);
SCRIPT_EXPORT bool SelectionSet(Window window, duint start, duint end);
SCRIPT_EXPORT duint SelectionGetStart(Window window);
SCRIPT_EXPORT duint SelectionGetEnd(Window window);
SCRIPT_EXPORT void Message(const char* message);
SCRIPT_EXPORT bool MessageYesNo(const char* message);
SCRIPT_EXPORT bool InputLine(const char* title, char* text); //text[GUI_MAX_LINE_SIZE]
SCRIPT_EXPORT bool InputValue(const char* title, duint* value);
SCRIPT_EXPORT void Refresh();
SCRIPT_EXPORT void AddQWidgetTab(void* qWidget);
SCRIPT_EXPORT void ShowQWidgetTab(void* qWidget);
SCRIPT_EXPORT void CloseQWidgetTab(void* qWidget);
}; //Gui
}; //Gui
}; //Script
#endif //_SCRIPTAPI_GUI_H

View File

@ -5,25 +5,25 @@
namespace Script
{
namespace Memory
{
SCRIPT_EXPORT bool Read(duint addr, void* data, duint size, duint* sizeRead);
SCRIPT_EXPORT bool Write(duint addr, const void* data, duint size, duint* sizeWritten);
SCRIPT_EXPORT bool IsValidPtr(duint addr);
SCRIPT_EXPORT duint RemoteAlloc(duint addr, duint size);
SCRIPT_EXPORT bool RemoteFree(duint addr);
namespace Memory
{
SCRIPT_EXPORT bool Read(duint addr, void* data, duint size, duint* sizeRead);
SCRIPT_EXPORT bool Write(duint addr, const void* data, duint size, duint* sizeWritten);
SCRIPT_EXPORT bool IsValidPtr(duint addr);
SCRIPT_EXPORT duint RemoteAlloc(duint addr, duint size);
SCRIPT_EXPORT bool RemoteFree(duint addr);
SCRIPT_EXPORT unsigned char ReadByte(duint addr);
SCRIPT_EXPORT bool WriteByte(duint addr, unsigned char data);
SCRIPT_EXPORT unsigned short ReadWord(duint addr);
SCRIPT_EXPORT bool WriteWord(duint addr, unsigned short data);
SCRIPT_EXPORT unsigned int ReadDword(duint addr);
SCRIPT_EXPORT bool WriteDword(duint addr, unsigned int data);
SCRIPT_EXPORT unsigned long long ReadQword(duint addr);
SCRIPT_EXPORT bool WriteQword(duint addr, unsigned long long data);
SCRIPT_EXPORT duint ReadPtr(duint addr);
SCRIPT_EXPORT bool WritePtr(duint addr, duint data);
}; //Memory
SCRIPT_EXPORT unsigned char ReadByte(duint addr);
SCRIPT_EXPORT bool WriteByte(duint addr, unsigned char data);
SCRIPT_EXPORT unsigned short ReadWord(duint addr);
SCRIPT_EXPORT bool WriteWord(duint addr, unsigned short data);
SCRIPT_EXPORT unsigned int ReadDword(duint addr);
SCRIPT_EXPORT bool WriteDword(duint addr, unsigned int data);
SCRIPT_EXPORT unsigned long long ReadQword(duint addr);
SCRIPT_EXPORT bool WriteQword(duint addr, unsigned long long data);
SCRIPT_EXPORT duint ReadPtr(duint addr);
SCRIPT_EXPORT bool WritePtr(duint addr, duint data);
}; //Memory
}; //Script
#endif //_SCRIPTAPI_MEMORY_H

View File

@ -5,14 +5,14 @@
namespace Script
{
namespace Misc
{
SCRIPT_EXPORT bool ParseExpression(const char* expression, duint* value);
SCRIPT_EXPORT duint RemoteGetProcAddress(const char* module, const char* api);
SCRIPT_EXPORT duint ResolveLabel(const char* label);
SCRIPT_EXPORT void* Alloc(duint size);
SCRIPT_EXPORT void Free(void* ptr);
}; //Misc
namespace Misc
{
SCRIPT_EXPORT bool ParseExpression(const char* expression, duint* value);
SCRIPT_EXPORT duint RemoteGetProcAddress(const char* module, const char* api);
SCRIPT_EXPORT duint ResolveLabel(const char* label);
SCRIPT_EXPORT void* Alloc(duint size);
SCRIPT_EXPORT void Free(void* ptr);
}; //Misc
}; //Script
#endif //_SCRIPTAPI_MISC_H

View File

@ -5,52 +5,52 @@
namespace Script
{
namespace Module
{
struct ModuleInfo
{
duint base;
duint size;
duint entry;
int sectionCount;
char name[MAX_MODULE_SIZE];
char path[MAX_PATH];
};
namespace Module
{
struct ModuleInfo
{
duint base;
duint size;
duint entry;
int sectionCount;
char name[MAX_MODULE_SIZE];
char path[MAX_PATH];
};
struct ModuleSectionInfo
{
duint addr;
duint size;
char name[MAX_SECTION_SIZE * 5];
};
struct ModuleSectionInfo
{
duint addr;
duint size;
char name[MAX_SECTION_SIZE * 5];
};
SCRIPT_EXPORT bool InfoFromAddr(duint addr, ModuleInfo* info);
SCRIPT_EXPORT bool InfoFromName(const char* name, ModuleInfo* info);
SCRIPT_EXPORT duint BaseFromAddr(duint addr);
SCRIPT_EXPORT duint BaseFromName(const char* name);
SCRIPT_EXPORT duint SizeFromAddr(duint addr);
SCRIPT_EXPORT duint SizeFromName(const char* name);
SCRIPT_EXPORT bool NameFromAddr(duint addr, char* name); //name[MAX_MODULE_SIZE]
SCRIPT_EXPORT bool PathFromAddr(duint addr, char* path); //path[MAX_MODULE_PATH_SIZE]
SCRIPT_EXPORT bool PathFromName(const char* name, char* path); //path[MAX_PATH]
SCRIPT_EXPORT duint EntryFromAddr(duint addr);
SCRIPT_EXPORT duint EntryFromName(const char* name);
SCRIPT_EXPORT int SectionCountFromAddr(duint addr);
SCRIPT_EXPORT int SectionCountFromName(const char* name);
SCRIPT_EXPORT bool SectionFromAddr(duint addr, int number, ModuleSectionInfo* section);
SCRIPT_EXPORT bool SectionFromName(const char* name, int number, ModuleSectionInfo* section);
SCRIPT_EXPORT bool SectionListFromAddr(duint addr, ListOf(ModuleSectionInfo) listInfo);
SCRIPT_EXPORT bool SectionListFromName(const char* name, ListOf(ModuleSectionInfo) listInfo);
SCRIPT_EXPORT bool GetMainModuleInfo(ModuleInfo* info);
SCRIPT_EXPORT duint GetMainModuleBase();
SCRIPT_EXPORT duint GetMainModuleSize();
SCRIPT_EXPORT duint GetMainModuleEntry();
SCRIPT_EXPORT int GetMainModuleSectionCount();
SCRIPT_EXPORT bool GetMainModuleName(char* name); //name[MAX_MODULE_SIZE]
SCRIPT_EXPORT bool GetMainModulePath(char* path); //path[MAX_PATH]
SCRIPT_EXPORT bool GetMainModuleSectionList(ListOf(ModuleSectionInfo) listInfo); //caller has the responsibility to free the list
SCRIPT_EXPORT bool GetList(ListOf(ModuleInfo) listInfo); //caller has the responsibility to free the list
}; //Module
SCRIPT_EXPORT bool InfoFromAddr(duint addr, ModuleInfo* info);
SCRIPT_EXPORT bool InfoFromName(const char* name, ModuleInfo* info);
SCRIPT_EXPORT duint BaseFromAddr(duint addr);
SCRIPT_EXPORT duint BaseFromName(const char* name);
SCRIPT_EXPORT duint SizeFromAddr(duint addr);
SCRIPT_EXPORT duint SizeFromName(const char* name);
SCRIPT_EXPORT bool NameFromAddr(duint addr, char* name); //name[MAX_MODULE_SIZE]
SCRIPT_EXPORT bool PathFromAddr(duint addr, char* path); //path[MAX_MODULE_PATH_SIZE]
SCRIPT_EXPORT bool PathFromName(const char* name, char* path); //path[MAX_PATH]
SCRIPT_EXPORT duint EntryFromAddr(duint addr);
SCRIPT_EXPORT duint EntryFromName(const char* name);
SCRIPT_EXPORT int SectionCountFromAddr(duint addr);
SCRIPT_EXPORT int SectionCountFromName(const char* name);
SCRIPT_EXPORT bool SectionFromAddr(duint addr, int number, ModuleSectionInfo* section);
SCRIPT_EXPORT bool SectionFromName(const char* name, int number, ModuleSectionInfo* section);
SCRIPT_EXPORT bool SectionListFromAddr(duint addr, ListOf(ModuleSectionInfo) listInfo);
SCRIPT_EXPORT bool SectionListFromName(const char* name, ListOf(ModuleSectionInfo) listInfo);
SCRIPT_EXPORT bool GetMainModuleInfo(ModuleInfo* info);
SCRIPT_EXPORT duint GetMainModuleBase();
SCRIPT_EXPORT duint GetMainModuleSize();
SCRIPT_EXPORT duint GetMainModuleEntry();
SCRIPT_EXPORT int GetMainModuleSectionCount();
SCRIPT_EXPORT bool GetMainModuleName(char* name); //name[MAX_MODULE_SIZE]
SCRIPT_EXPORT bool GetMainModulePath(char* path); //path[MAX_PATH]
SCRIPT_EXPORT bool GetMainModuleSectionList(ListOf(ModuleSectionInfo) listInfo); //caller has the responsibility to free the list
SCRIPT_EXPORT bool GetList(ListOf(ModuleInfo) listInfo); //caller has the responsibility to free the list
}; //Module
}; //Script
#endif //_SCRIPTAPI_MODULE_H

View File

@ -5,15 +5,15 @@
namespace Script
{
namespace Pattern
{
SCRIPT_EXPORT duint Find(unsigned char* data, duint datasize, const char* pattern);
SCRIPT_EXPORT duint FindMem(duint start, duint size, const char* pattern);
SCRIPT_EXPORT void Write(unsigned char* data, duint datasize, const char* pattern);
SCRIPT_EXPORT void WriteMem(duint start, duint size, const char* pattern);
SCRIPT_EXPORT bool SearchAndReplace(unsigned char* data, duint datasize, const char* searchpattern, const char* replacepattern);
SCRIPT_EXPORT bool SearchAndReplaceMem(duint start, duint size, const char* searchpattern, const char* replacepattern);
};
namespace Pattern
{
SCRIPT_EXPORT duint Find(unsigned char* data, duint datasize, const char* pattern);
SCRIPT_EXPORT duint FindMem(duint start, duint size, const char* pattern);
SCRIPT_EXPORT void Write(unsigned char* data, duint datasize, const char* pattern);
SCRIPT_EXPORT void WriteMem(duint start, duint size, const char* pattern);
SCRIPT_EXPORT bool SearchAndReplace(unsigned char* data, duint datasize, const char* searchpattern, const char* replacepattern);
SCRIPT_EXPORT bool SearchAndReplaceMem(duint start, duint size, const char* searchpattern, const char* replacepattern);
};
};
#endif //_SCRIPTAPI_FIND_H

View File

@ -5,261 +5,261 @@
namespace Script
{
namespace Register
{
enum RegisterEnum
{
DR0,
DR1,
DR2,
DR3,
DR6,
DR7,
namespace Register
{
enum RegisterEnum
{
DR0,
DR1,
DR2,
DR3,
DR6,
DR7,
EAX,
AX,
AH,
AL,
EBX,
BX,
BH,
BL,
ECX,
CX,
CH,
CL,
EDX,
DX,
DH,
DL,
EDI,
DI,
ESI,
SI,
EBP,
BP,
ESP,
SP,
EIP,
EAX,
AX,
AH,
AL,
EBX,
BX,
BH,
BL,
ECX,
CX,
CH,
CL,
EDX,
DX,
DH,
DL,
EDI,
DI,
ESI,
SI,
EBP,
BP,
ESP,
SP,
EIP,
#ifdef _WIN64
RAX,
RBX,
RCX,
RDX,
RSI,
SIL,
RDI,
DIL,
RBP,
BPL,
RSP,
SPL,
RIP,
R8,
R8D,
R8W,
R8B,
R9,
R9D,
R9W,
R9B,
R10,
R10D,
R10W,
R10B,
R11,
R11D,
R11W,
R11B,
R12,
R12D,
R12W,
R12B,
R13,
R13D,
R13W,
R13B,
R14,
R14D,
R14W,
R14B,
R15,
R15D,
R15W,
R15B,
RAX,
RBX,
RCX,
RDX,
RSI,
SIL,
RDI,
DIL,
RBP,
BPL,
RSP,
SPL,
RIP,
R8,
R8D,
R8W,
R8B,
R9,
R9D,
R9W,
R9B,
R10,
R10D,
R10W,
R10B,
R11,
R11D,
R11W,
R11B,
R12,
R12D,
R12W,
R12B,
R13,
R13D,
R13W,
R13B,
R14,
R14D,
R14W,
R14B,
R15,
R15D,
R15W,
R15B,
#endif //_WIN64
CIP,
CSP,
}; //RegisterEnum
CIP,
CSP,
}; //RegisterEnum
SCRIPT_EXPORT duint Get(RegisterEnum reg);
SCRIPT_EXPORT bool Set(RegisterEnum reg, duint value);
SCRIPT_EXPORT int Size(); //gets architecture register size in bytes
SCRIPT_EXPORT duint Get(RegisterEnum reg);
SCRIPT_EXPORT bool Set(RegisterEnum reg, duint value);
SCRIPT_EXPORT int Size(); //gets architecture register size in bytes
SCRIPT_EXPORT duint GetDR0();
SCRIPT_EXPORT bool SetDR0(duint value);
SCRIPT_EXPORT duint GetDR1();
SCRIPT_EXPORT bool SetDR1(duint value);
SCRIPT_EXPORT duint GetDR2();
SCRIPT_EXPORT bool SetDR2(duint value);
SCRIPT_EXPORT duint GetDR3();
SCRIPT_EXPORT bool SetDR3(duint value);
SCRIPT_EXPORT duint GetDR6();
SCRIPT_EXPORT bool SetDR6(duint value);
SCRIPT_EXPORT duint GetDR7();
SCRIPT_EXPORT bool SetDR7(duint value);
SCRIPT_EXPORT duint GetDR0();
SCRIPT_EXPORT bool SetDR0(duint value);
SCRIPT_EXPORT duint GetDR1();
SCRIPT_EXPORT bool SetDR1(duint value);
SCRIPT_EXPORT duint GetDR2();
SCRIPT_EXPORT bool SetDR2(duint value);
SCRIPT_EXPORT duint GetDR3();
SCRIPT_EXPORT bool SetDR3(duint value);
SCRIPT_EXPORT duint GetDR6();
SCRIPT_EXPORT bool SetDR6(duint value);
SCRIPT_EXPORT duint GetDR7();
SCRIPT_EXPORT bool SetDR7(duint value);
SCRIPT_EXPORT unsigned int GetEAX();
SCRIPT_EXPORT bool SetEAX(unsigned int value);
SCRIPT_EXPORT unsigned short GetAX();
SCRIPT_EXPORT bool SetAX(unsigned short value);
SCRIPT_EXPORT unsigned char GetAH();
SCRIPT_EXPORT bool SetAH(unsigned char value);
SCRIPT_EXPORT unsigned char GetAL();
SCRIPT_EXPORT bool SetAL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEBX();
SCRIPT_EXPORT bool SetEBX(unsigned int value);
SCRIPT_EXPORT unsigned short GetBX();
SCRIPT_EXPORT bool SetBX(unsigned short value);
SCRIPT_EXPORT unsigned char GetBH();
SCRIPT_EXPORT bool SetBH(unsigned char value);
SCRIPT_EXPORT unsigned char GetBL();
SCRIPT_EXPORT bool SetBL(unsigned char value);
SCRIPT_EXPORT unsigned int GetECX();
SCRIPT_EXPORT bool SetECX(unsigned int value);
SCRIPT_EXPORT unsigned short GetCX();
SCRIPT_EXPORT bool SetCX(unsigned short value);
SCRIPT_EXPORT unsigned char GetCH();
SCRIPT_EXPORT bool SetCH(unsigned char value);
SCRIPT_EXPORT unsigned char GetCL();
SCRIPT_EXPORT bool SetCL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEDX();
SCRIPT_EXPORT bool SetEDX(unsigned int value);
SCRIPT_EXPORT unsigned short GetDX();
SCRIPT_EXPORT bool SetDX(unsigned short value);
SCRIPT_EXPORT unsigned char GetDH();
SCRIPT_EXPORT bool SetDH(unsigned char value);
SCRIPT_EXPORT unsigned char GetDL();
SCRIPT_EXPORT bool SetDL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEDI();
SCRIPT_EXPORT bool SetEDI(unsigned int value);
SCRIPT_EXPORT unsigned short GetDI();
SCRIPT_EXPORT bool SetDI(unsigned short value);
SCRIPT_EXPORT unsigned int GetESI();
SCRIPT_EXPORT bool SetESI(unsigned int value);
SCRIPT_EXPORT unsigned short GetSI();
SCRIPT_EXPORT bool SetSI(unsigned short value);
SCRIPT_EXPORT unsigned int GetEBP();
SCRIPT_EXPORT bool SetEBP(unsigned int value);
SCRIPT_EXPORT unsigned short GetBP();
SCRIPT_EXPORT bool SetBP(unsigned short value);
SCRIPT_EXPORT unsigned int GetESP();
SCRIPT_EXPORT bool SetESP(unsigned int value);
SCRIPT_EXPORT unsigned short GetSP();
SCRIPT_EXPORT bool SetSP(unsigned short value);
SCRIPT_EXPORT unsigned int GetEIP();
SCRIPT_EXPORT bool SetEIP(unsigned int value);
SCRIPT_EXPORT unsigned int GetEAX();
SCRIPT_EXPORT bool SetEAX(unsigned int value);
SCRIPT_EXPORT unsigned short GetAX();
SCRIPT_EXPORT bool SetAX(unsigned short value);
SCRIPT_EXPORT unsigned char GetAH();
SCRIPT_EXPORT bool SetAH(unsigned char value);
SCRIPT_EXPORT unsigned char GetAL();
SCRIPT_EXPORT bool SetAL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEBX();
SCRIPT_EXPORT bool SetEBX(unsigned int value);
SCRIPT_EXPORT unsigned short GetBX();
SCRIPT_EXPORT bool SetBX(unsigned short value);
SCRIPT_EXPORT unsigned char GetBH();
SCRIPT_EXPORT bool SetBH(unsigned char value);
SCRIPT_EXPORT unsigned char GetBL();
SCRIPT_EXPORT bool SetBL(unsigned char value);
SCRIPT_EXPORT unsigned int GetECX();
SCRIPT_EXPORT bool SetECX(unsigned int value);
SCRIPT_EXPORT unsigned short GetCX();
SCRIPT_EXPORT bool SetCX(unsigned short value);
SCRIPT_EXPORT unsigned char GetCH();
SCRIPT_EXPORT bool SetCH(unsigned char value);
SCRIPT_EXPORT unsigned char GetCL();
SCRIPT_EXPORT bool SetCL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEDX();
SCRIPT_EXPORT bool SetEDX(unsigned int value);
SCRIPT_EXPORT unsigned short GetDX();
SCRIPT_EXPORT bool SetDX(unsigned short value);
SCRIPT_EXPORT unsigned char GetDH();
SCRIPT_EXPORT bool SetDH(unsigned char value);
SCRIPT_EXPORT unsigned char GetDL();
SCRIPT_EXPORT bool SetDL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEDI();
SCRIPT_EXPORT bool SetEDI(unsigned int value);
SCRIPT_EXPORT unsigned short GetDI();
SCRIPT_EXPORT bool SetDI(unsigned short value);
SCRIPT_EXPORT unsigned int GetESI();
SCRIPT_EXPORT bool SetESI(unsigned int value);
SCRIPT_EXPORT unsigned short GetSI();
SCRIPT_EXPORT bool SetSI(unsigned short value);
SCRIPT_EXPORT unsigned int GetEBP();
SCRIPT_EXPORT bool SetEBP(unsigned int value);
SCRIPT_EXPORT unsigned short GetBP();
SCRIPT_EXPORT bool SetBP(unsigned short value);
SCRIPT_EXPORT unsigned int GetESP();
SCRIPT_EXPORT bool SetESP(unsigned int value);
SCRIPT_EXPORT unsigned short GetSP();
SCRIPT_EXPORT bool SetSP(unsigned short value);
SCRIPT_EXPORT unsigned int GetEIP();
SCRIPT_EXPORT bool SetEIP(unsigned int value);
#ifdef _WIN64
SCRIPT_EXPORT unsigned long long GetRAX();
SCRIPT_EXPORT bool SetRAX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRBX();
SCRIPT_EXPORT bool SetRBX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRCX();
SCRIPT_EXPORT bool SetRCX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRDX();
SCRIPT_EXPORT bool SetRDX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRSI();
SCRIPT_EXPORT bool SetRSI(unsigned long long value);
SCRIPT_EXPORT unsigned char GetSIL();
SCRIPT_EXPORT bool SetSIL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRDI();
SCRIPT_EXPORT bool SetRDI(unsigned long long value);
SCRIPT_EXPORT unsigned char GetDIL();
SCRIPT_EXPORT bool SetDIL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRBP();
SCRIPT_EXPORT bool SetRBP(unsigned long long value);
SCRIPT_EXPORT unsigned char GetBPL();
SCRIPT_EXPORT bool SetBPL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRSP();
SCRIPT_EXPORT bool SetRSP(unsigned long long value);
SCRIPT_EXPORT unsigned char GetSPL();
SCRIPT_EXPORT bool SetSPL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRIP();
SCRIPT_EXPORT bool SetRIP(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetR8();
SCRIPT_EXPORT bool SetR8(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR8D();
SCRIPT_EXPORT bool SetR8D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR8W();
SCRIPT_EXPORT bool SetR8W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR8B();
SCRIPT_EXPORT bool SetR8B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR9();
SCRIPT_EXPORT bool SetR9(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR9D();
SCRIPT_EXPORT bool SetR9D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR9W();
SCRIPT_EXPORT bool SetR9W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR9B();
SCRIPT_EXPORT bool SetR9B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR10();
SCRIPT_EXPORT bool SetR10(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR10D();
SCRIPT_EXPORT bool SetR10D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR10W();
SCRIPT_EXPORT bool SetR10W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR10B();
SCRIPT_EXPORT bool SetR10B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR11();
SCRIPT_EXPORT bool SetR11(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR11D();
SCRIPT_EXPORT bool SetR11D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR11W();
SCRIPT_EXPORT bool SetR11W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR11B();
SCRIPT_EXPORT bool SetR11B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR12();
SCRIPT_EXPORT bool SetR12(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR12D();
SCRIPT_EXPORT bool SetR12D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR12W();
SCRIPT_EXPORT bool SetR12W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR12B();
SCRIPT_EXPORT bool SetR12B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR13();
SCRIPT_EXPORT bool SetR13(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR13D();
SCRIPT_EXPORT bool SetR13D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR13W();
SCRIPT_EXPORT bool SetR13W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR13B();
SCRIPT_EXPORT bool SetR13B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR14();
SCRIPT_EXPORT bool SetR14(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR14D();
SCRIPT_EXPORT bool SetR14D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR14W();
SCRIPT_EXPORT bool SetR14W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR14B();
SCRIPT_EXPORT bool SetR14B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR15();
SCRIPT_EXPORT bool SetR15(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR15D();
SCRIPT_EXPORT bool SetR15D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR15W();
SCRIPT_EXPORT bool SetR15W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR15B();
SCRIPT_EXPORT bool SetR15B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRAX();
SCRIPT_EXPORT bool SetRAX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRBX();
SCRIPT_EXPORT bool SetRBX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRCX();
SCRIPT_EXPORT bool SetRCX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRDX();
SCRIPT_EXPORT bool SetRDX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRSI();
SCRIPT_EXPORT bool SetRSI(unsigned long long value);
SCRIPT_EXPORT unsigned char GetSIL();
SCRIPT_EXPORT bool SetSIL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRDI();
SCRIPT_EXPORT bool SetRDI(unsigned long long value);
SCRIPT_EXPORT unsigned char GetDIL();
SCRIPT_EXPORT bool SetDIL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRBP();
SCRIPT_EXPORT bool SetRBP(unsigned long long value);
SCRIPT_EXPORT unsigned char GetBPL();
SCRIPT_EXPORT bool SetBPL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRSP();
SCRIPT_EXPORT bool SetRSP(unsigned long long value);
SCRIPT_EXPORT unsigned char GetSPL();
SCRIPT_EXPORT bool SetSPL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRIP();
SCRIPT_EXPORT bool SetRIP(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetR8();
SCRIPT_EXPORT bool SetR8(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR8D();
SCRIPT_EXPORT bool SetR8D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR8W();
SCRIPT_EXPORT bool SetR8W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR8B();
SCRIPT_EXPORT bool SetR8B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR9();
SCRIPT_EXPORT bool SetR9(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR9D();
SCRIPT_EXPORT bool SetR9D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR9W();
SCRIPT_EXPORT bool SetR9W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR9B();
SCRIPT_EXPORT bool SetR9B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR10();
SCRIPT_EXPORT bool SetR10(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR10D();
SCRIPT_EXPORT bool SetR10D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR10W();
SCRIPT_EXPORT bool SetR10W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR10B();
SCRIPT_EXPORT bool SetR10B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR11();
SCRIPT_EXPORT bool SetR11(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR11D();
SCRIPT_EXPORT bool SetR11D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR11W();
SCRIPT_EXPORT bool SetR11W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR11B();
SCRIPT_EXPORT bool SetR11B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR12();
SCRIPT_EXPORT bool SetR12(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR12D();
SCRIPT_EXPORT bool SetR12D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR12W();
SCRIPT_EXPORT bool SetR12W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR12B();
SCRIPT_EXPORT bool SetR12B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR13();
SCRIPT_EXPORT bool SetR13(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR13D();
SCRIPT_EXPORT bool SetR13D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR13W();
SCRIPT_EXPORT bool SetR13W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR13B();
SCRIPT_EXPORT bool SetR13B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR14();
SCRIPT_EXPORT bool SetR14(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR14D();
SCRIPT_EXPORT bool SetR14D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR14W();
SCRIPT_EXPORT bool SetR14W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR14B();
SCRIPT_EXPORT bool SetR14B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR15();
SCRIPT_EXPORT bool SetR15(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR15D();
SCRIPT_EXPORT bool SetR15D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR15W();
SCRIPT_EXPORT bool SetR15W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR15B();
SCRIPT_EXPORT bool SetR15B(unsigned char value);
#endif //_WIN64
SCRIPT_EXPORT duint GetCIP();
SCRIPT_EXPORT bool SetCIP(duint value);
SCRIPT_EXPORT duint GetCSP();
SCRIPT_EXPORT bool SetCSP(duint value);
}; //Register
SCRIPT_EXPORT duint GetCIP();
SCRIPT_EXPORT bool SetCIP(duint value);
SCRIPT_EXPORT duint GetCSP();
SCRIPT_EXPORT bool SetCSP(duint value);
}; //Register
}; //Script
#endif //_SCRIPTAPI_REGISTER_H

View File

@ -5,12 +5,12 @@
namespace Script
{
namespace Stack
{
SCRIPT_EXPORT duint Pop();
SCRIPT_EXPORT duint Push(duint value); //returns the previous top, equal to Peek(1)
SCRIPT_EXPORT duint Peek(int offset = 0); //offset is in multiples of Register::Size(), for easy x32/x64 portability
}; //Stack
namespace Stack
{
SCRIPT_EXPORT duint Pop();
SCRIPT_EXPORT duint Push(duint value); //returns the previous top, equal to Peek(1)
SCRIPT_EXPORT duint Peek(int offset = 0); //offset is in multiples of Register::Size(), for easy x32/x64 portability
}; //Stack
}; //Script
#endif //_SCRIPTAPI_STACK_H

View File

@ -108,10 +108,10 @@ bool apienumimports(duint base, IMPORTENUMCALLBACK cbEnum)
// Get page size
VirtualQueryEx(fdProcessInfo->hProcess, (const void*)base, &mbi, sizeof(mbi));
regionSize = mbi.RegionSize;
Memory<void* > buffer(regionSize, "apienumimports:buffer");
Memory<void*> buffer(regionSize, "apienumimports:buffer");
// Read first page into buffer
if (!MemRead(base, buffer(), regionSize))
if(!MemRead(base, buffer(), regionSize))
return false;
// Import Table address and size
@ -119,7 +119,7 @@ bool apienumimports(duint base, IMPORTENUMCALLBACK cbEnum)
importTableSize = GetPE32DataFromMappedFile((duint)buffer(), 0, UE_IMPORTTABLESIZE);
// Return if no imports
if (!importTableSize)
if(!importTableSize)
return false;
importTableVa = (PIMAGE_IMPORT_DESCRIPTOR)(base + importTableRva);
@ -127,7 +127,7 @@ bool apienumimports(duint base, IMPORTENUMCALLBACK cbEnum)
readSuccess = MemRead((duint)importTableVa, &importDescriptor, sizeof(importDescriptor));
// Loop through all dlls
while (readSuccess && importDescriptor.FirstThunk)
while(readSuccess && importDescriptor.FirstThunk)
{
// Copy module name into importModuleName
MemRead((duint)(base + importDescriptor.Name), &importModuleName, MAX_MODULE_SIZE);
@ -135,19 +135,19 @@ bool apienumimports(duint base, IMPORTENUMCALLBACK cbEnum)
imageIATVa = (PIMAGE_THUNK_DATA)(base + importDescriptor.FirstThunk);
imageINTVa = (PIMAGE_THUNK_DATA)(base + importDescriptor.OriginalFirstThunk);
if (!MemRead((duint)imageIATVa, &imageFtThunkData, sizeof(imageFtThunkData)))
if(!MemRead((duint)imageIATVa, &imageFtThunkData, sizeof(imageFtThunkData)))
return false;
if (!MemRead((duint)imageINTVa, &imageOftThunkData, sizeof(imageOftThunkData)))
if(!MemRead((duint)imageINTVa, &imageOftThunkData, sizeof(imageOftThunkData)))
return false;
// Loop through all imported function in this dll
while (imageFtThunkData.u1.Function)
while(imageFtThunkData.u1.Function)
{
pImageImportByNameVa = (PIMAGE_IMPORT_BY_NAME)(base + imageOftThunkData.u1.AddressOfData);
// Read every IMPORT_BY_NAME.name
if (!MemRead((duint)pImageImportByNameVa + sizeof(WORD), buffer(), regionSize))
if(!MemRead((duint)pImageImportByNameVa + sizeof(WORD), buffer(), regionSize))
return false;
// Alloc buffer for name and copy name import name to buffer
@ -165,7 +165,7 @@ bool apienumimports(duint base, IMPORTENUMCALLBACK cbEnum)
// Move to next address in the IAT and read it into imageFtThunkData
imageIATVa++;
if (!MemRead((duint)imageIATVa, &imageFtThunkData, sizeof(imageFtThunkData)))
if(!MemRead((duint)imageIATVa, &imageFtThunkData, sizeof(imageFtThunkData)))
return false;
}

View File

@ -69,16 +69,16 @@ bool assembleat(duint addr, const char* instruction, int* size, char* error, boo
*size = destSize;
// Check if the instruction doesn't set IP to non-executable memory
if (isInstructionPointingToExMemory(addr, dest) == NX_MEMORY)
if(isInstructionPointingToExMemory(addr, dest) == NX_MEMORY)
GuiDisplayWarning("Non-executable memory region", "Assembled instruction points to non-executable memory region !");
bool ret = MemPatch(addr, dest, destSize);
if (ret)
if(ret)
{
if (fillnop && nopsize)
if(fillnop && nopsize)
{
if (size)
if(size)
*size += nopsize;
// Ignored if the memory patch for NOPs fail (although it should not)
@ -102,7 +102,7 @@ INSTR_POINTING_TO isInstructionPointingToExMemory(duint addr, const unsigned cha
MEMMAP wMemMapStruct;
DISASM_ARG arg;
DISASM_INSTR wDisasInstrStruct;
MEMORY_BASIC_INFORMATION *wMbiStruct = NULL;
MEMORY_BASIC_INFORMATION* wMbiStruct = NULL;
duint instrArgCount;
dsint instrMemValues[3] = {0};
duint instrMemValuesIndex = 0;
@ -111,20 +111,20 @@ INSTR_POINTING_TO isInstructionPointingToExMemory(duint addr, const unsigned cha
disasmget((unsigned char*)dest, 0, &wDisasInstrStruct);
instrArgCount = wDisasInstrStruct.argcount;
if (instrArgCount)
if(instrArgCount)
{
// Loop through all arguements
for (int i = 0; i < wDisasInstrStruct.argcount; i++)
for(int i = 0; i < wDisasInstrStruct.argcount; i++)
{
arg = wDisasInstrStruct.arg[i];
// Check if any of the arguments is a memory
if (arg.type == arg_memory)
if(arg.type == arg_memory)
{
instrMemValues[instrMemValuesIndex] = addr + arg.memvalue; // add current instruction VA for rip-relative addressing
instrMemValuesIndex++;
}
else if (wDisasInstrStruct.type == instr_branch)
else if(wDisasInstrStruct.type == instr_branch)
{
instrMemValues[instrMemValuesIndex] = addr + arg.value;
instrMemValuesIndex++;
@ -133,24 +133,25 @@ INSTR_POINTING_TO isInstructionPointingToExMemory(duint addr, const unsigned cha
}
// No memory pointer in the instruction, no need to go further
if (!instrMemValuesIndex)
if(!instrMemValuesIndex)
return NO_POINTER;
// TODO: this can be heavily optimized (both in code size and speed) by using memory.cpp (std::map)
// Get memory map to locate the sections to which the instr memory address belongs to
DbgMemMap(&wMemMapStruct);
// For each memPointerValue
for (auto & memValue : instrMemValues)
for(auto & memValue : instrMemValues)
{
// Loop through the memMaps
for (int i = 0; i < wMemMapStruct.count; i++)
for(int i = 0; i < wMemMapStruct.count; i++)
{
wMbiStruct = &(wMemMapStruct.page)[i].mbi;
mbiBaseAddr = (dsint)wMbiStruct->BaseAddress;
mbiEndAddr = (dsint)wMbiStruct->BaseAddress + (dsint)wMbiStruct->RegionSize;
if (memValue >= mbiBaseAddr && memValue < mbiEndAddr)
if(memValue >= mbiBaseAddr && memValue < mbiEndAddr)
{
if (wMbiStruct->Protect == PAGE_EXECUTE ||
if(wMbiStruct->Protect == PAGE_EXECUTE ||
wMbiStruct->Protect == PAGE_EXECUTE_READ ||
wMbiStruct->Protect == PAGE_EXECUTE_READWRITE ||
wMbiStruct->Protect == PAGE_EXECUTE_WRITECOPY)
@ -161,13 +162,13 @@ INSTR_POINTING_TO isInstructionPointingToExMemory(duint addr, const unsigned cha
BOOL bPermanentDep;
// DEP is disabled if lpFlagsDep == 0
typedef BOOL (WINAPI *GETPROCESSDEPPOLICY)(
typedef BOOL (WINAPI * GETPROCESSDEPPOLICY)(
_In_ HANDLE hProcess,
_Out_ LPDWORD lpFlags,
_Out_ PBOOL lpPermanent
);
static GETPROCESSDEPPOLICY GPDP = (GETPROCESSDEPPOLICY)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetProcessDEPPolicy");
if (GPDP && GPDP(fdProcessInfo->hProcess, &lpFlagsDep, &bPermanentDep) && lpFlagsDep != 0)
if(GPDP && GPDP(fdProcessInfo->hProcess, &lpFlagsDep, &bPermanentDep) && lpFlagsDep != 0)
return EX_MEMORY;
#else
// DEP enabled on x64

View File

@ -154,9 +154,9 @@ bool BpEnable(duint Address, BP_TYPE Type, bool Enable)
bpInfo->enabled = Enable;
//Re-read oldbytes
if (Enable && Type == BPNORMAL)
if(Enable && Type == BPNORMAL)
{
if (!MemRead(Address, &bpInfo->oldbytes, sizeof(bpInfo->oldbytes)))
if(!MemRead(Address, &bpInfo->oldbytes, sizeof(bpInfo->oldbytes)))
return false;
}
return true;
@ -204,7 +204,7 @@ bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module)
// Loop each entry, executing the user's callback
bool callbackStatus = true;
for (auto i = breakpoints.begin(); i != breakpoints.end();)
for(auto i = breakpoints.begin(); i != breakpoints.end();)
{
auto j = i;
++i; // Increment here, because the callback might remove the current entry

View File

@ -75,11 +75,11 @@ void cmdfree()
*/
bool cmdnew(const char* name, CBCOMMAND cbCommand, bool debugonly)
{
if (!cmd_list || !cbCommand || !name || !*name || cmdfind(name, 0))
if(!cmd_list || !cbCommand || !name || !*name || cmdfind(name, 0))
return false;
COMMAND* cmd;
bool nonext = false;
if (!cmd_list->name)
if(!cmd_list->name)
{
cmd = cmd_list;
nonext = true;
@ -156,7 +156,7 @@ bool cmddel(const char* name)
if(!found)
return false;
efree(found->name, "cmddel:found->name");
if (found == cmd_list)
if(found == cmd_list)
{
COMMAND* next = cmd_list->next;
if(next)

View File

@ -16,12 +16,12 @@ char* getCommandLineArgs()
char* commandLineArguments = NULL;
char* extensionPtr = strchr(commandLine, '.');
if (!extensionPtr)
if(!extensionPtr)
return NULL;
commandLineArguments = strchr(extensionPtr, ' ');
if (!commandLineArguments)
if(!commandLineArguments)
return NULL;
return (commandLineArguments + 1);
@ -33,7 +33,7 @@ void CmdLineCacheSave(JSON Root)
EXCLUSIVE_ACQUIRE(LockCmdLine);
// return if command line is empty
if (!strlen(commandLine))
if(!strlen(commandLine))
return;
// Create a JSON array to store each sub-object with a breakpoint
@ -56,10 +56,10 @@ void CmdLineCacheLoad(JSON Root)
const JSON jsonCmdLine = json_object_get(Root, "commandLine");
// Return if there was nothing to load
if (!jsonCmdLine)
if(!jsonCmdLine)
return;
const char *cmdLine = json_string_value(json_object_get(jsonCmdLine, "cmdLine"));
const char* cmdLine = json_string_value(json_object_get(jsonCmdLine, "cmdLine"));
strcpy_s(commandLine, cmdLine);
@ -75,7 +75,7 @@ CMDRESULT SetCommandLine()
{
cmdline_error_t cmdline_error = { (cmdline_error_type_t)0, 0 };
if (!dbgsetcmdline(commandLine, &cmdline_error))
if(!dbgsetcmdline(commandLine, &cmdline_error))
{
showcommandlineerror(&cmdline_error);
return STATUS_ERROR;

View File

@ -12,7 +12,7 @@
void dputs(const char* Text)
{
// Only append the newline if the caller didn't
if (Text[strlen(Text) - 1] != '\n')
if(Text[strlen(Text) - 1] != '\n')
dprintf("%s\n", Text);
else
dprintf("%s", Text);

View File

@ -39,12 +39,12 @@ void DBSave(LOAD_SAVE_DB_TYPE saveType)
JSON root = json_object();
// Save only command line
if (saveType == COMMAND_LINE_ONLY || saveType == ALL)
if(saveType == COMMAND_LINE_ONLY || saveType == ALL)
{
CmdLineCacheSave(root);
}
if (saveType == ALL_BUT_COMMAND_LINE || saveType == ALL)
if(saveType == ALL_BUT_COMMAND_LINE || saveType == ALL)
{
CommentCacheSave(root);
LabelCacheSave(root);
@ -56,7 +56,7 @@ void DBSave(LOAD_SAVE_DB_TYPE saveType)
//save notes
char* text = nullptr;
GuiGetDebuggeeNotes(&text);
if (text)
if(text)
{
json_object_set_new(root, "notes", json_string(text));
BridgeFree(text);
@ -65,10 +65,10 @@ void DBSave(LOAD_SAVE_DB_TYPE saveType)
}
WString wdbpath = StringUtils::Utf8ToUtf16(dbpath);
if (json_object_size(root))
if(json_object_size(root))
{
Handle hFile = CreateFileW(wdbpath.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
if (!hFile)
if(!hFile)
{
dputs("\nFailed to open database for writing!");
json_decref(root); //free root
@ -77,7 +77,7 @@ void DBSave(LOAD_SAVE_DB_TYPE saveType)
SetEndOfFile(hFile);
char* jsonText = json_dumps(root, JSON_INDENT(4));
DWORD written = 0;
if (!WriteFile(hFile, jsonText, (DWORD)strlen(jsonText), &written, 0))
if(!WriteFile(hFile, jsonText, (DWORD)strlen(jsonText), &written, 0))
{
json_free(jsonText);
dputs("\nFailed to write database file!");
@ -86,7 +86,7 @@ void DBSave(LOAD_SAVE_DB_TYPE saveType)
}
hFile.Close();
json_free(jsonText);
if (!settingboolget("Engine", "DisableDatabaseCompression"))
if(!settingboolget("Engine", "DisableDatabaseCompression"))
LZ4_compress_fileW(wdbpath.c_str(), wdbpath.c_str());
}
else //remove database when nothing is in there
@ -98,7 +98,7 @@ void DBSave(LOAD_SAVE_DB_TYPE saveType)
void DBLoad(LOAD_SAVE_DB_TYPE loadType)
{
// If the file doesn't exist, there is no DB to load
if (!FileExists(dbpath))
if(!FileExists(dbpath))
return;
dprintf("Loading database...");
@ -114,7 +114,7 @@ void DBLoad(LOAD_SAVE_DB_TYPE loadType)
lzmaStatus = LZ4_decompress_fileW(databasePathW.c_str(), databasePathW.c_str());
// Check return code
if (useCompression && lzmaStatus != LZ4_SUCCESS && lzmaStatus != LZ4_INVALID_ARCHIVE)
if(useCompression && lzmaStatus != LZ4_SUCCESS && lzmaStatus != LZ4_INVALID_ARCHIVE)
{
dputs("\nInvalid database file!");
return;
@ -123,14 +123,14 @@ void DBLoad(LOAD_SAVE_DB_TYPE loadType)
// Read the database file
Handle hFile = CreateFileW(databasePathW.c_str(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (!hFile)
if(!hFile)
{
dputs("\nFailed to open database file!");
return;
}
unsigned int jsonFileSize = GetFileSize(hFile, 0);
if (!jsonFileSize)
if(!jsonFileSize)
{
dputs("\nEmpty database file!");
return;
@ -138,7 +138,7 @@ void DBLoad(LOAD_SAVE_DB_TYPE loadType)
Memory<char*> jsonText(jsonFileSize + 1);
DWORD read = 0;
if (!ReadFile(hFile, jsonText(), jsonFileSize, &read, 0))
if(!ReadFile(hFile, jsonText(), jsonFileSize, &read, 0))
{
dputs("\nFailed to read database file!");
return;
@ -148,23 +148,23 @@ void DBLoad(LOAD_SAVE_DB_TYPE loadType)
// Deserialize JSON
JSON root = json_loads(jsonText(), 0, 0);
if (lzmaStatus != LZ4_INVALID_ARCHIVE && useCompression)
if(lzmaStatus != LZ4_INVALID_ARCHIVE && useCompression)
LZ4_compress_fileW(databasePathW.c_str(), databasePathW.c_str());
// Validate JSON load status
if (!root)
if(!root)
{
dputs("\nInvalid database file (JSON)!");
return;
}
// Load only command line
if (loadType == COMMAND_LINE_ONLY || loadType == ALL)
if(loadType == COMMAND_LINE_ONLY || loadType == ALL)
{
CmdLineCacheLoad(root);
}
if (loadType == ALL_BUT_COMMAND_LINE || loadType == ALL)
if(loadType == ALL_BUT_COMMAND_LINE || loadType == ALL)
{
// Finally load all structures
CommentCacheLoad(root);
@ -196,10 +196,10 @@ void DBClose()
PatchClear();
}
void DBSetPath(const char *Directory, const char *ModulePath)
void DBSetPath(const char* Directory, const char* ModulePath)
{
// Initialize directory if it was only supplied
if (Directory)
if(Directory)
{
ASSERT_TRUE(strlen(Directory) > 0);
@ -207,22 +207,22 @@ void DBSetPath(const char *Directory, const char *ModulePath)
strcpy_s(dbbasepath, Directory);
// Create directory
if (!CreateDirectoryW(StringUtils::Utf8ToUtf16(Directory).c_str(), nullptr))
if(!CreateDirectoryW(StringUtils::Utf8ToUtf16(Directory).c_str(), nullptr))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
if(GetLastError() != ERROR_ALREADY_EXISTS)
dprintf("Warning: Failed to create database folder '%s'. Path may be read only.\n", Directory);
}
}
// The database file path may be relative (dbbasepath) or a full path
if (ModulePath)
if(ModulePath)
{
ASSERT_TRUE(strlen(ModulePath) > 0);
#ifdef _WIN64
const char *dbType = "dd64";
const char* dbType = "dd64";
#else
const char *dbType = "dd32";
const char* dbType = "dd32";
#endif // _WIN64
// Get the module name and directory
@ -235,7 +235,7 @@ void DBSetPath(const char *Directory, const char *ModulePath)
// Find the last instance of a path delimiter (slash)
char* fileStart = strrchr(fileDir, '\\');
if (fileStart)
if(fileStart)
{
strcpy_s(dbName, fileStart + 1);
fileStart[0] = '\0';
@ -247,7 +247,7 @@ void DBSetPath(const char *Directory, const char *ModulePath)
}
}
if (settingboolget("Engine", "SaveDatabaseInProgramDirectory"))
if(settingboolget("Engine", "SaveDatabaseInProgramDirectory"))
{
// Absolute path in the program directory
sprintf_s(dbpath, "%s\\%s.%s", fileDir, dbName, dbType);

View File

@ -12,4 +12,4 @@ enum LOAD_SAVE_DB_TYPE
void DBSave(LOAD_SAVE_DB_TYPE saveType);
void DBLoad(LOAD_SAVE_DB_TYPE loadType);
void DBClose();
void DBSetPath(const char *Directory, const char *ModulePath);
void DBSetPath(const char* Directory, const char* ModulePath);

View File

@ -242,10 +242,10 @@ void DebugUpdateGui(duint disasm_addr, bool stack)
void DebugUpdateStack(duint dumpAddr, duint csp, bool forceDump)
{
if (!forceDump && bFreezeStack)
if(!forceDump && bFreezeStack)
{
SELECTIONDATA selection;
if (GuiSelectionGet(GUI_STACK, &selection))
if(GuiSelectionGet(GUI_STACK, &selection))
dumpAddr = selection.start;
}
GuiStackDumpAt(dumpAddr, csp);
@ -523,9 +523,9 @@ bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
case BPNORMAL:
{
unsigned short oldbytes;
if (MemRead(bp->addr, &oldbytes, sizeof(oldbytes)))
if(MemRead(bp->addr, &oldbytes, sizeof(oldbytes)))
{
if (oldbytes != bp->oldbytes)
if(oldbytes != bp->oldbytes)
{
dprintf("Breakpoint " fhex " has been disabled because the bytes don't match! Expected: %02X %02X, Found: %02X %02X\n",
bp->addr,
@ -533,7 +533,7 @@ bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
((unsigned char*)&oldbytes)[0], ((unsigned char*)&oldbytes)[1]);
BpEnable(bp->addr, BPNORMAL, false);
}
else if (!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
else if(!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
dprintf("Could not set breakpoint " fhex "! (SetBPX)\n", bp->addr);
}
else
@ -1158,12 +1158,12 @@ DWORD WINAPI threadDebugLoop(void* lpParameter)
DBSetPath(nullptr, szFileName);
DBLoad(COMMAND_LINE_ONLY);
if (!isCmdLineEmpty())
if(!isCmdLineEmpty())
{
char* commandLineArguments = NULL;
commandLineArguments = getCommandLineArgs();
if (commandLineArguments)
if(commandLineArguments)
init->commandline = commandLineArguments;
}

View File

@ -1027,10 +1027,10 @@ CMDRESULT cbDebugDump(int argc, char* argv[])
dprintf("Invalid address \"%s\"!\n", argv[1]);
return STATUS_ERROR;
}
if (argc > 2)
if(argc > 2)
{
duint index = 0;
if (!valfromstring(argv[2], &index))
if(!valfromstring(argv[2], &index))
{
dprintf("Invalid address \"%s\"!\n", argv[2]);
return STATUS_ERROR;
@ -2105,7 +2105,7 @@ CMDRESULT cbDebugSkip(int argc, char* argv[])
CMDRESULT cbDebugSetfreezestack(int argc, char* argv[])
{
if (argc < 2)
if(argc < 2)
{
dputs("Not enough arguments!");
return STATUS_ERROR;

View File

@ -3,26 +3,26 @@
bool FileHelper::ReadAllData(const String & fileName, std::vector<unsigned char> & content)
{
Handle hFile = CreateFileW(StringUtils::Utf8ToUtf16(fileName).c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
if(hFile == INVALID_HANDLE_VALUE)
return false;
unsigned int filesize = GetFileSize(hFile, 0);
if (!filesize)
if(!filesize)
{
content.clear();
return true;
}
Memory<char*> filedata(filesize + 1, "FileReader::ReadAllData:filedata");
DWORD read = 0;
if (!ReadFile(hFile, filedata(), filesize, &read, nullptr))
if(!ReadFile(hFile, filedata(), filesize, &read, nullptr))
return false;
content = std::vector<unsigned char>(filedata(), filedata() + filesize);
return true;
}
bool FileHelper::WriteAllData(const String& fileName, const void* data, size_t size)
bool FileHelper::WriteAllData(const String & fileName, const void* data, size_t size)
{
Handle hFile = CreateFileW(StringUtils::Utf8ToUtf16(fileName).c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
if(hFile == INVALID_HANDLE_VALUE)
return false;
DWORD written = 0;
return !!WriteFile(hFile, data, DWORD(size), &written, nullptr);
@ -31,7 +31,7 @@ bool FileHelper::WriteAllData(const String& fileName, const void* data, size_t s
bool FileHelper::ReadAllText(const String & fileName, String & content)
{
std::vector<unsigned char> data;
if (!ReadAllData(fileName, data))
if(!ReadAllData(fileName, data))
return false;
data.push_back(0);
content = String((const char*)data.data());

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,11 @@ bool IsProcessElevated()
{
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID SecurityIdentifier;
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &SecurityIdentifier))
if(!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &SecurityIdentifier))
return 0;
BOOL IsAdminMember;
if (!CheckTokenMembership(NULL, SecurityIdentifier, &IsAdminMember))
if(!CheckTokenMembership(NULL, SecurityIdentifier, &IsAdminMember))
IsAdminMember = FALSE;
FreeSid(SecurityIdentifier);
@ -22,14 +22,14 @@ static bool readwritejitkey(wchar_t* jit_key_value, DWORD* jit_key_vale_size, ch
HKEY hKey;
DWORD dwDisposition;
if (error != NULL)
if(error != NULL)
*error = ERROR_RW;
if (write)
if(write)
{
if (!IsProcessElevated())
if(!IsProcessElevated())
{
if (error != NULL)
if(error != NULL)
*error = ERROR_RW_NOTADMIN;
return false;
}
@ -38,9 +38,9 @@ static bool readwritejitkey(wchar_t* jit_key_value, DWORD* jit_key_vale_size, ch
else
key_flags = KEY_READ;
if (arch_out != NULL)
if(arch_out != NULL)
{
if (arch_in != x64 && arch_in != x32)
if(arch_in != x64 && arch_in != x32)
{
#ifdef _WIN64
*arch_out = x64;
@ -52,29 +52,29 @@ static bool readwritejitkey(wchar_t* jit_key_value, DWORD* jit_key_vale_size, ch
*arch_out = arch_in;
}
if (arch_in == x64)
if(arch_in == x64)
{
#ifndef _WIN64
if (!IsWow64())
if(!IsWow64())
{
if (error != NULL)
if(error != NULL)
*error = ERROR_RW_NOTWOW64;
return false;
}
key_flags |= KEY_WOW64_64KEY;
#endif //_WIN64
}
else if (arch_in == x32)
else if(arch_in == x32)
{
#ifdef _WIN64
key_flags |= KEY_WOW64_32KEY;
#endif
}
if (write)
if(write)
{
lRv = RegCreateKeyExW(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, key_flags, NULL, &hKey, &dwDisposition);
if (lRv != ERROR_SUCCESS)
if(lRv != ERROR_SUCCESS)
return false;
lRv = RegSetValueExW(hKey, StringUtils::Utf8ToUtf16(key).c_str(), 0, REG_SZ, (BYTE*)jit_key_value, (DWORD)(*jit_key_vale_size) + 1);
@ -82,17 +82,17 @@ static bool readwritejitkey(wchar_t* jit_key_value, DWORD* jit_key_vale_size, ch
else
{
lRv = RegOpenKeyExW(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, key_flags, &hKey);
if (lRv != ERROR_SUCCESS)
if(lRv != ERROR_SUCCESS)
{
if (error != NULL)
if(error != NULL)
*error = ERROR_RW_FILE_NOT_FOUND;
return false;
}
lRv = RegQueryValueExW(hKey, StringUtils::Utf8ToUtf16(key).c_str(), 0, NULL, (LPBYTE)jit_key_value, jit_key_vale_size);
if (lRv != ERROR_SUCCESS)
if(lRv != ERROR_SUCCESS)
{
if (error != NULL)
if(error != NULL)
*error = ERROR_RW_FILE_NOT_FOUND;
}
}
@ -107,19 +107,19 @@ bool dbggetjitauto(bool* auto_on, arch arch_in, arch* arch_out, readwritejitkey_
DWORD jit_entry_size = sizeof(jit_entry) - 1;
readwritejitkey_error_t rw_error;
if (!readwritejitkey(jit_entry, &jit_entry_size, "Auto", arch_in, arch_out, &rw_error, false))
if(!readwritejitkey(jit_entry, &jit_entry_size, "Auto", arch_in, arch_out, &rw_error, false))
{
if (rw_error == ERROR_RW_FILE_NOT_FOUND)
if(rw_error == ERROR_RW_FILE_NOT_FOUND)
{
if (rw_error_out != NULL)
if(rw_error_out != NULL)
*rw_error_out = rw_error;
return true;
}
return false;
}
if (_wcsicmp(jit_entry, L"1") == 0)
if(_wcsicmp(jit_entry, L"1") == 0)
*auto_on = true;
else if (_wcsicmp(jit_entry, L"0") == 0)
else if(_wcsicmp(jit_entry, L"0") == 0)
*auto_on = false;
else
return false;
@ -130,19 +130,19 @@ bool dbgsetjitauto(bool auto_on, arch arch_in, arch* arch_out, readwritejitkey_e
{
DWORD auto_string_size = sizeof(L"1");
readwritejitkey_error_t rw_error;
if (!auto_on)
if(!auto_on)
{
wchar_t jit_entry[4] = L"";
DWORD jit_entry_size = sizeof(jit_entry) - 1;
if (!readwritejitkey(jit_entry, &jit_entry_size, "Auto", arch_in, arch_out, &rw_error, false))
if(!readwritejitkey(jit_entry, &jit_entry_size, "Auto", arch_in, arch_out, &rw_error, false))
{
if (rw_error == ERROR_RW_FILE_NOT_FOUND)
if(rw_error == ERROR_RW_FILE_NOT_FOUND)
return true;
}
}
if (!readwritejitkey(auto_on ? L"1" : L"0", &auto_string_size, "Auto", arch_in, arch_out, &rw_error, true))
if(!readwritejitkey(auto_on ? L"1" : L"0", &auto_string_size, "Auto", arch_in, arch_out, &rw_error, true))
{
if (rw_error_out != NULL)
if(rw_error_out != NULL)
*rw_error_out = rw_error;
return false;
}
@ -154,9 +154,9 @@ bool dbggetjit(char jit_entry[JIT_ENTRY_MAX_SIZE], arch arch_in, arch* arch_out,
wchar_t wszJitEntry[JIT_ENTRY_MAX_SIZE] = L"";
DWORD jit_entry_size = JIT_ENTRY_MAX_SIZE * sizeof(wchar_t);
readwritejitkey_error_t rw_error;
if (!readwritejitkey(wszJitEntry, &jit_entry_size, "Debugger", arch_in, arch_out, &rw_error, false))
if(!readwritejitkey(wszJitEntry, &jit_entry_size, "Debugger", arch_in, arch_out, &rw_error, false))
{
if (rw_error_out != NULL)
if(rw_error_out != NULL)
*rw_error_out = rw_error;
return false;
}
@ -180,9 +180,9 @@ bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out, readwritejitkey_erro
{
DWORD jit_cmd_size = (DWORD)strlen(jit_cmd) * sizeof(wchar_t);
readwritejitkey_error_t rw_error;
if (!readwritejitkey((wchar_t*)StringUtils::Utf8ToUtf16(jit_cmd).c_str(), &jit_cmd_size, "Debugger", arch_in, arch_out, &rw_error, true))
if(!readwritejitkey((wchar_t*)StringUtils::Utf8ToUtf16(jit_cmd).c_str(), &jit_cmd_size, "Debugger", arch_in, arch_out, &rw_error, true))
{
if (rw_error_out != NULL)
if(rw_error_out != NULL)
*rw_error_out = rw_error;
return false;
}

View File

@ -17,7 +17,7 @@ typedef enum
} readwritejitkey_error_t;
bool IsProcessElevated();
bool dbggetjit(char *jit_entry, arch arch_in, arch* arch_out, readwritejitkey_error_t* rw_error_out);
bool dbggetjit(char* jit_entry, arch arch_in, arch* arch_out, readwritejitkey_error_t* rw_error_out);
bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out, readwritejitkey_error_t* rw_error_out);
bool dbggetjitauto(bool* auto_on, arch arch_in, arch* arch_out, readwritejitkey_error_t* rw_error_out);
bool dbgsetjitauto(bool auto_on, arch arch_in, arch* arch_out, readwritejitkey_error_t* rw_error_out);

View File

@ -50,16 +50,16 @@ void MemUpdateMap()
memset(&curPage, 0, sizeof(MEMPAGE));
memcpy(&curPage.mbi, &mbi, sizeof(mbi));
if (!ModNameFromAddr(pageStart, curPage.info, true))
if(!ModNameFromAddr(pageStart, curPage.info, true))
{
// Module lookup failed; check if it's a file mapping
wchar_t szMappedName[sizeof(curPage.info)] = L"";
if ((mbi.Type == MEM_MAPPED) &&
if((mbi.Type == MEM_MAPPED) &&
(GetMappedFileNameW(fdProcessInfo->hProcess, mbi.AllocationBase, szMappedName, MAX_MODULE_SIZE) != 0))
{
bool bFileNameOnly = false; //TODO: setting for this
auto fileStart = wcsrchr(szMappedName, L'\\');
if (bFileNameOnly && fileStart)
if(bFileNameOnly && fileStart)
strcpy_s(curPage.info, StringUtils::Utf16ToUtf8(fileStart + 1).c_str());
else
strcpy_s(curPage.info, StringUtils::Utf16ToUtf8(szMappedName).c_str());
@ -160,26 +160,26 @@ void MemUpdateMap()
THREADLIST threadList;
ThreadGetList(&threadList);
for (auto & page : pageVector)
for(auto & page : pageVector)
{
const duint pageBase = (duint)page.mbi.BaseAddress;
const duint pageSize = (duint)page.mbi.RegionSize;
// Check for windows specific data
if (pageBase == 0x7FFE0000)
if(pageBase == 0x7FFE0000)
{
strcpy_s(page.info, "KUSER_SHARED_DATA");
continue;
}
// Check in threads
for (int i = 0; i < threadList.count; i++)
for(int i = 0; i < threadList.count; i++)
{
duint tebBase = threadList.list[i].BasicInfo.ThreadLocalBase;
DWORD threadId = threadList.list[i].BasicInfo.ThreadId;
// Mark TEB
if (pageBase == tebBase)
if(pageBase == tebBase)
{
sprintf_s(page.info, "Thread %X TEB", threadId);
break;
@ -187,19 +187,19 @@ void MemUpdateMap()
// Read the TEB to get stack information
TEB teb;
if (!ThreadGetTeb(tebBase, &teb))
if(!ThreadGetTeb(tebBase, &teb))
continue;
// The stack will be a specific range only, not always the base address
duint stackAddr = (duint)teb.Tib.StackLimit;
if (stackAddr >= pageBase && stackAddr < (pageBase + pageSize))
if(stackAddr >= pageBase && stackAddr < (pageBase + pageSize))
sprintf_s(page.info, "Thread %X Stack", threadId);
}
}
// Only free thread data if it was allocated
if (threadList.list)
if(threadList.list)
BridgeFree(threadList.list);
// Convert the vector to a map
@ -360,9 +360,9 @@ bool MemPatch(duint BaseAddress, const void* Buffer, duint Size, duint* NumberOf
}
// Are we able to write on this page?
if (MemWrite(BaseAddress, Buffer, Size, NumberOfBytesWritten))
if(MemWrite(BaseAddress, Buffer, Size, NumberOfBytesWritten))
{
for (duint i = 0; i < Size; i++)
for(duint i = 0; i < Size; i++)
PatchSet(BaseAddress + i, oldData()[i], ((const unsigned char*)Buffer)[i]);
// Done

View File

@ -301,7 +301,7 @@ bool ModImportsFromAddr(duint Address, std::vector<MODIMPORTINFO>* Imports)
auto module = ModInfoFromAddr(Address);
if (!module)
if(!module)
return false;
// Copy vector <-> vector
@ -351,23 +351,23 @@ bool ModAddImportToModule(duint Base, MODIMPORTINFO importInfo)
{
SHARED_ACQUIRE(LockModules);
if (!Base || !importInfo.addr)
if(!Base || !importInfo.addr)
return false;
auto module = ModInfoFromAddr(Base);
if (!module)
if(!module)
return false;
// Search in Import Vector
std::vector<MODIMPORTINFO> *pImports = &(module->imports);
std::vector<MODIMPORTINFO>* pImports = &(module->imports);
auto it = std::find_if(pImports->begin(), pImports->end(), [&importInfo](MODIMPORTINFO currentImportInfo)->bool
{
return (importInfo.addr == currentImportInfo.addr);
});
// Import in the list already
if (it != pImports->end())
if(it != pImports->end())
return false;
// Add import to imports vector

View File

@ -216,14 +216,14 @@ int PatchFile(const PATCHINFO* List, int Count, const char* FileName, char* Erro
char modPath[MAX_PATH] = "";
if(!ModPathFromAddr(moduleBase, modPath, MAX_PATH))
{
if (Error)
if(Error)
sprintf_s(Error, MAX_ERROR_SIZE, "Failed to get module path of module %s", moduleName);
return -1;
}
// Create a temporary backup file
if (!CopyFileW(StringUtils::Utf8ToUtf16(modPath).c_str(), StringUtils::Utf8ToUtf16(FileName).c_str(), false))
if(!CopyFileW(StringUtils::Utf8ToUtf16(modPath).c_str(), StringUtils::Utf8ToUtf16(FileName).c_str(), false))
{
if(Error)
strcpy_s(Error, MAX_ERROR_SIZE, "Failed to make a copy of the original file (patch target is in use?)");

View File

@ -18,15 +18,15 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
REFINFO refInfo;
// Search in current Region
if (type == CURRENT_REGION)
if(type == CURRENT_REGION)
{
duint regionSize = 0;
duint regionBase = MemFindBaseAddr(Address, &regionSize, true);
// If the memory page wasn't found, fail
if (!regionBase || !regionSize)
if(!regionBase || !regionSize)
{
if (!Silent)
if(!Silent)
dprintf("Invalid memory page 0x%p\n", Address);
return 0;
@ -47,7 +47,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
}
// Determine the full module name
if (ModNameFromAddr(scanStart, moduleName, true))
if(ModNameFromAddr(scanStart, moduleName, true))
sprintf_s(fullName, "%s (Region %s)", Name, moduleName);
else
sprintf_s(fullName, "%s (Region %p)", Name, scanStart);
@ -69,20 +69,20 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
GuiReferenceReloadData();
if (!refFindInRangeRet)
if(!refFindInRangeRet)
return refFindInRangeRet;
refInfo.refcount += refFindInRangeRet;
}
// Search in current Module
else if (type == CURRENT_MODULE)
else if(type == CURRENT_MODULE)
{
MODINFO *modInfo = ModInfoFromAddr(Address);
MODINFO* modInfo = ModInfoFromAddr(Address);
if (!modInfo)
if(!modInfo)
{
if (!Silent)
if(!Silent)
dprintf("Couldn't locate module for 0x%p\n", Address);
return 0;
@ -95,7 +95,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
scanSize = modSize;
// Determine the full module name
if (ModNameFromAddr(scanStart, moduleName, true))
if(ModNameFromAddr(scanStart, moduleName, true))
sprintf_s(fullName, "%s (%s)", Name, moduleName);
else
sprintf_s(fullName, "%s (%p)", Name, scanStart);
@ -115,22 +115,22 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
});
if (!refFindInRangeRet)
if(!refFindInRangeRet)
return refFindInRangeRet;
GuiReferenceReloadData();
}
// Search in all Modules
else if (type == ALL_MODULES)
else if(type == ALL_MODULES)
{
bool initCallBack = true;
std::vector<MODINFO > modList;
std::vector<MODINFO> modList;
ModGetList(modList);
if (!modList.size())
if(!modList.size())
{
if (!Silent)
if(!Silent)
dprintf("Couldn't get module list");
return 0;
@ -147,12 +147,12 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
refInfo.userinfo = UserData;
refInfo.name = fullName;
for (duint i = 0; i < modList.size(); i++)
for(duint i = 0; i < modList.size(); i++)
{
scanStart = modList[i].base;
scanSize = modList[i].size;
if (i != 0)
if(i != 0)
initCallBack = false;
refFindInRangeRet = RefFindInRange(scanStart, scanSize, Callback, UserData, Silent, refInfo, cp, initCallBack, [&i, &modList](int percent)
@ -170,7 +170,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
});
if (!refFindInRangeRet)
if(!refFindInRangeRet)
return refFindInRangeRet;
GuiReferenceReloadData();
@ -183,7 +183,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
}
int RefFindInRange(duint scanStart, duint scanSize, CBREF Callback, void* UserData, bool Silent, REFINFO &refInfo, Capstone &cp, bool initCallBack, CBPROGRESS cbUpdateProgress)
int RefFindInRange(duint scanStart, duint scanSize, CBREF Callback, void* UserData, bool Silent, REFINFO & refInfo, Capstone & cp, bool initCallBack, CBPROGRESS cbUpdateProgress)
{
// Allocate and read a buffer from the remote process
Memory<unsigned char*> data(scanSize, "reffind:data");
@ -216,7 +216,7 @@ int RefFindInRange(duint scanStart, duint scanSize, CBREF Callback, void* UserDa
int disasmMaxSize = min(MAX_DISASM_BUFFER, (int)(scanSize - i)); // Prevent going past the boundary
int disasmLen = 1;
if (cp.Disassemble(scanStart, data() + i, disasmMaxSize))
if(cp.Disassemble(scanStart, data() + i, disasmMaxSize))
{
BASIC_INSTRUCTION_INFO basicinfo;
fillbasicinfo(&cp, &basicinfo);

View File

@ -20,7 +20,7 @@ typedef enum
// Reference callback typedef
typedef bool (*CBREF)(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo);
typedef std::function<void(int) > CBPROGRESS;
typedef std::function<void(int)> CBPROGRESS;
int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Silent, const char* Name, REFFINDTYPE type);
int RefFindInRange(duint scanStart, duint scanSize, CBREF Callback, void* UserData, bool Silent, REFINFO &refInfo, Capstone &cp, bool initCallBack, CBPROGRESS cbUpdateProgress);
int RefFindInRange(duint scanStart, duint scanSize, CBREF Callback, void* UserData, bool Silent, REFINFO & refInfo, Capstone & cp, bool initCallBack, CBPROGRESS cbUpdateProgress);

View File

@ -157,7 +157,7 @@ static bool scriptcreatelinemap(const char* filename)
//temp. remove comments from the raw line
char line_comment[256] = "";
char* comment = strstr(&cur.raw[0], "//");
if (!comment)
if(!comment)
comment = strstr(&cur.raw[0], ";");
if(comment && comment != cur.raw) //only when the line doesnt start with a comment
{
@ -178,7 +178,7 @@ static bool scriptcreatelinemap(const char* filename)
{
cur.type = lineempty;
}
else if (!strncmp(cur.raw, "//", 2) || *cur.raw == ';') //comment
else if(!strncmp(cur.raw, "//", 2) || *cur.raw == ';') //comment
{
cur.type = linecomment;
strcpy_s(cur.u.comment, cur.raw);

View File

@ -4,15 +4,15 @@
namespace ValueType
{
enum ValueType
{
Unknown,
SignedDecimal,
UnsignedDecimal,
Hex,
Pointer,
String
};
enum ValueType
{
Unknown,
SignedDecimal,
UnsignedDecimal,
Hex,
Pointer,
String
};
}
static String printValue(FormatValueType value, ValueType::ValueType type)

View File

@ -31,7 +31,7 @@ BOOL CALLBACK EnumSymbols(PSYMBOL_INFO SymInfo, ULONG SymbolSize, PVOID UserCont
// Convert from SYMBOL_INFO to SYMBOLINFO
returnValue = SymGetSymbolInfo(SymInfo, &curSymbol, false);
if (!returnValue)
if(!returnValue)
return false;
// Add to the cache
@ -62,12 +62,12 @@ void SymEnumFromCache(duint Base, CBSYMBOLENUM EnumCallback, void* UserData)
symbolCbData.user = UserData;
// Check if this module is cached in the list
if (modulesCacheList.find(Base) != modulesCacheList.end())
if(modulesCacheList.find(Base) != modulesCacheList.end())
{
SymEnumImports(Base, &symbolCbData);
// Callback
for (duint i = 0; i < modulesCacheList[Base].size(); i++)
for(duint i = 0; i < modulesCacheList[Base].size(); i++)
symbolCbData.cbSymbolEnum(&modulesCacheList[Base].at(i), symbolCbData.user);
}
else
@ -320,12 +320,12 @@ bool SymGetSourceLine(duint Cip, char* FileName, int* Line)
void SymClearMemoryCache()
{
for (auto& itr : modulesCacheList)
for(auto & itr : modulesCacheList)
{
SYMBOLINFOVECTOR* pModuleVector = &itr.second;
// Free up previously allocated memory
for (duint i = 0; i < pModuleVector->size(); i++)
for(duint i = 0; i < pModuleVector->size(); i++)
{
BridgeFree(pModuleVector->at(i).decoratedSymbol);
BridgeFree(pModuleVector->at(i).undecoratedSymbol);
@ -348,20 +348,20 @@ bool SymGetSymbolInfo(PSYMBOL_INFO SymInfo, SYMBOLINFO* curSymbol, bool isImport
strcpy_s(curSymbol->decoratedSymbol, strlen(SymInfo->Name) + 1, SymInfo->Name);
// Skip bad ordinals
if (strstr(SymInfo->Name, "Ordinal"))
if(strstr(SymInfo->Name, "Ordinal"))
{
// Does the symbol point to the module base?
if (SymInfo->Address == SymInfo->ModBase)
if(SymInfo->Address == SymInfo->ModBase)
return FALSE;
}
// Convert a mangled/decorated C++ name to a readable format
if (!SafeUnDecorateSymbolName(SymInfo->Name, curSymbol->undecoratedSymbol, MAX_SYM_NAME, UNDNAME_COMPLETE))
if(!SafeUnDecorateSymbolName(SymInfo->Name, curSymbol->undecoratedSymbol, MAX_SYM_NAME, UNDNAME_COMPLETE))
{
BridgeFree(curSymbol->undecoratedSymbol);
curSymbol->undecoratedSymbol = nullptr;
}
else if (!strcmp(curSymbol->decoratedSymbol, curSymbol->undecoratedSymbol))
else if(!strcmp(curSymbol->decoratedSymbol, curSymbol->undecoratedSymbol))
{
BridgeFree(curSymbol->undecoratedSymbol);
curSymbol->undecoratedSymbol = nullptr;
@ -387,7 +387,7 @@ void SymEnumImports(duint Base, SYMBOLCBDATA* pSymbolCbData)
pSymInfo->MaxNameLen = MAX_SYM_NAME;
// Enum imports if none found
if (ModImportsFromAddr(Base, &imports) && !imports.size())
if(ModImportsFromAddr(Base, &imports) && !imports.size())
{
// Enum imports from current module
apienumimports(Base, [](duint Base, duint Address, char* name, char* moduleName)
@ -403,15 +403,15 @@ void SymEnumImports(duint Base, SYMBOLCBDATA* pSymbolCbData)
}
// Get imports
if (ModImportsFromAddr(Base, &imports) && imports.size())
if(ModImportsFromAddr(Base, &imports) && imports.size())
{
for (duint i = 0; i < imports.size(); i++)
for(duint i = 0; i < imports.size(); i++)
{
// Can we get symbol for the import address?
if (SafeSymFromAddr(fdProcessInfo->hProcess, (duint)imports[i].addr, 0, pSymInfo))
if(SafeSymFromAddr(fdProcessInfo->hProcess, (duint)imports[i].addr, 0, pSymInfo))
{
// Does the symbol point to the module base?
if (!SymGetSymbolInfo(pSymInfo, &curSymbol, true))
if(!SymGetSymbolInfo(pSymInfo, &curSymbol, true))
continue;
}
else
@ -427,9 +427,9 @@ void SymEnumImports(duint Base, SYMBOLCBDATA* pSymbolCbData)
strcpy_s(modImportString, imports[i].moduleName);
// Trim the extension if present
char *modExt = strrchr(modImportString, '.');
char* modExt = strrchr(modImportString, '.');
if (modExt)
if(modExt)
*modExt = '\0';
// Buffers to hold the decorated and undecorated strings. Must be declared
@ -437,7 +437,7 @@ void SymEnumImports(duint Base, SYMBOLCBDATA* pSymbolCbData)
char undecBuf[MAX_IMPORT_SIZE];
char decBuf[MAX_IMPORT_SIZE];
if (curSymbol.undecoratedSymbol)
if(curSymbol.undecoratedSymbol)
{
// module.undecorated
strcpy_s(undecBuf, modImportString);
@ -446,7 +446,7 @@ void SymEnumImports(duint Base, SYMBOLCBDATA* pSymbolCbData)
curSymbol.undecoratedSymbol = undecBuf;
}
if (curSymbol.decoratedSymbol)
if(curSymbol.decoratedSymbol)
{
// module.decorated
strcpy_s(decBuf, modImportString);

View File

@ -78,7 +78,7 @@ void ThreadGetList(THREADLIST* List)
List->count = (int)threadList.size();
List->list = nullptr;
if (List->count <= 0)
if(List->count <= 0)
return;
// Allocate C-style array

View File

@ -1641,7 +1641,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
*isvar = true;
return true;
}
else if (strstr(string, "sub_") == string) //then come sub_ functions
else if(strstr(string, "sub_") == string) //then come sub_ functions
{
auto result = sscanf(string, "sub_%" fext "X", value) == 1;
duint start;

View File

@ -249,10 +249,10 @@ static DWORD WINAPI DbgCommandLoopThread(void* a)
extern "C" DLL_EXPORT const char* _dbg_dbginit()
{
if (!EngineCheckStructAlignment(UE_STRUCT_TITAN_ENGINE_CONTEXT, sizeof(TITAN_ENGINE_CONTEXT_t)))
if(!EngineCheckStructAlignment(UE_STRUCT_TITAN_ENGINE_CONTEXT, sizeof(TITAN_ENGINE_CONTEXT_t)))
return "Invalid TITAN_ENGINE_CONTEXT_t alignment!";
if (sizeof(TITAN_ENGINE_CONTEXT_t) != sizeof(REGISTERCONTEXT))
if(sizeof(TITAN_ENGINE_CONTEXT_t) != sizeof(REGISTERCONTEXT))
return "Invalid REGISTERCONTEXT alignment!";
dputs("Initializing wait objects...");

View File

@ -422,7 +422,7 @@ typedef struct _IMAGE_RESOURCE_DATA_ENTRY
DWORD Size;
DWORD CodePage;
DWORD Reserved;
} IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
} IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
typedef struct _IMAGE_RESOURCE_DIRECTORY

View File

@ -183,7 +183,7 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
if(i < mNbrOfLineToPrint)
{
// Don't draw cells if the flag is set, and no process is running
if (!mDrawDebugOnly || DbgIsDebugging())
if(!mDrawDebugOnly || DbgIsDebugging())
{
QString wStr = paintContent(&wPainter, mTableOffset, i, j, x, y, getColumnWidth(j), getRowHeight());

View File

@ -149,7 +149,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
{
if(bpxtype & bp_normal) //normal breakpoint
{
QColor& bpColor = mBreakpointBackgroundColor;
QColor & bpColor = mBreakpointBackgroundColor;
if(!bpColor.alpha()) //we don't want transparent text
bpColor = mBreakpointColor;
if(bpColor == mCipBackgroundColor)

View File

@ -53,7 +53,7 @@ ReferenceView::ReferenceView()
connect(Bridge::getBridge(), SIGNAL(referenceReloadData()), this, SLOT(reloadData()));
connect(Bridge::getBridge(), SIGNAL(referenceSetSingleSelection(int, bool)), this, SLOT(setSingleSelection(int, bool)));
connect(Bridge::getBridge(), SIGNAL(referenceSetProgress(int)), this, SLOT(referenceSetProgressSlot(int)));
connect(Bridge::getBridge(), SIGNAL(referenceSetCurrentTaskProgress(int,QString)), this, SLOT(referenceSetCurrentTaskProgressSlot(int,QString)));
connect(Bridge::getBridge(), SIGNAL(referenceSetCurrentTaskProgress(int, QString)), this, SLOT(referenceSetCurrentTaskProgressSlot(int, QString)));
connect(Bridge::getBridge(), SIGNAL(referenceSetSearchStartCol(int)), this, SLOT(setSearchStartCol(int)));
connect(this, SIGNAL(listContextMenuSignal(QMenu*)), this, SLOT(referenceContextMenu(QMenu*)));
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followGenericAddress()));

View File

@ -61,10 +61,10 @@ SearchListView::SearchListView(QWidget* parent) :
connect(mSearchAction, SIGNAL(triggered()), this, SLOT(searchSlot()));
// Slots
// connect(mList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
// connect(mList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
connect(mList, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(listContextMenu(QPoint)));
connect(mList, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));
// connect(mSearchList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
// connect(mSearchList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
connect(mSearchList, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(listContextMenu(QPoint)));
connect(mSearchList, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));
connect(mSearchBox, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
@ -213,7 +213,7 @@ void SearchListView::addCharToSearchBox(char ch)
}
}
void SearchListView::deleteTextFromSearchBox(QKeyEvent *keyEvent)
void SearchListView::deleteTextFromSearchBox(QKeyEvent* keyEvent)
{
QString newText;
newText = mSearchBox->text();
@ -245,7 +245,7 @@ void SearchListView::deleteTextFromSearchBox(QKeyEvent *keyEvent)
if(keyEvent->key() == Qt::Key_Backspace)
{
if(mCursorPosition > 0)
newText.remove(mCursorPosition-1, 1);
newText.remove(mCursorPosition - 1, 1);
(mCursorPosition - 1) < 0 ? mCursorPosition = 0 : mCursorPosition--;
}
@ -261,7 +261,7 @@ void SearchListView::deleteTextFromSearchBox(QKeyEvent *keyEvent)
mSearchBox->setText(newText);
}
bool SearchListView::eventFilter(QObject *obj, QEvent *event)
bool SearchListView::eventFilter(QObject* obj, QEvent* event)
{
// Click in searchBox
if(obj == mSearchBox && event->type() == QEvent::MouseButtonPress)
@ -269,8 +269,8 @@ bool SearchListView::eventFilter(QObject *obj, QEvent *event)
// Give focus to current list to avoid having it elsewhere when you click on a different searchbox
mCurList->setFocus();
QMouseEvent *mouseEvent = static_cast<QMouseEvent* >(event);
QLineEdit *lineEdit = static_cast<QLineEdit* >(obj);
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
QLineEdit* lineEdit = static_cast<QLineEdit*>(obj);
mCursorPosition = lineEdit->cursorPositionAt(mouseEvent->pos());
lineEdit->setFocusPolicy(Qt::NoFocus);
@ -280,7 +280,7 @@ bool SearchListView::eventFilter(QObject *obj, QEvent *event)
// KeyPress in List
else if((obj == mList || obj == mSearchList || obj == mSearchBox) && event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent* >(event);
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
char ch = keyEvent->text().toUtf8().constData()[0];
//add a char to the search box

View File

@ -9,7 +9,7 @@
namespace Ui
{
class SearchListView;
class SearchListView;
}
class SearchListView : public QWidget
@ -48,10 +48,10 @@ private:
QAction* mSearchAction;
int mCursorPosition;
void addCharToSearchBox(char ch);
void deleteTextFromSearchBox(QKeyEvent *keyEvent);
void deleteTextFromSearchBox(QKeyEvent* keyEvent);
protected:
bool eventFilter(QObject *obj, QEvent *event);
bool eventFilter(QObject* obj, QEvent* event);
};
#endif // SEARCHLISTVIEW_H

View File

@ -382,7 +382,7 @@ bool CapstoneTokenizer::tokenizeRegOperand(const cs_x86_op & op)
bool CapstoneTokenizer::tokenizeImmOperand(const cs_x86_op & op)
{
duint value = duint (op.imm);
duint value = duint(op.imm);
auto valueType = TokenType::Value;
if(_cp.InGroup(CS_GRP_JUMP) || _cp.InGroup(CS_GRP_CALL) || _cp.IsLoop())
{
@ -440,7 +440,7 @@ bool CapstoneTokenizer::tokenizeMemOperand(const cs_x86_op & op)
//stuff inside the brackets
if(mem.base == X86_REG_RIP) //rip-relative (#replacement)
{
duint addr = _cp.Address() + duint (mem.disp) + _cp.Size();
duint addr = _cp.Address() + duint(mem.disp) + _cp.Size();
TokenValue value = TokenValue(op.size, addr);
auto displacementType = DbgMemIsValidReadPtr(addr) ? TokenType::Address : TokenType::Value;
addToken(displacementType, printValue(value, false, _maxModuleLength), value);
@ -468,13 +468,13 @@ bool CapstoneTokenizer::tokenizeMemOperand(const cs_x86_op & op)
if(mem.disp)
{
char operatorText = '+';
TokenValue value(op.size, duint (mem.disp));
auto displacementType = DbgMemIsValidReadPtr(duint (mem.disp)) ? TokenType::Address : TokenType::Value;
TokenValue value(op.size, duint(mem.disp));
auto displacementType = DbgMemIsValidReadPtr(duint(mem.disp)) ? TokenType::Address : TokenType::Value;
QString valueText;
if(mem.disp < 0)
{
operatorText = '-';
valueText = printValue(TokenValue(op.size, duint (mem.disp * -1)), false, _maxModuleLength);
valueText = printValue(TokenValue(op.size, duint(mem.disp * -1)), false, _maxModuleLength);
}
else
valueText = printValue(value, false, _maxModuleLength);

View File

@ -6,7 +6,7 @@
namespace Ui
{
class AppearanceDialog;
class AppearanceDialog;
}
class AppearanceDialog : public QDialog

View File

@ -4,7 +4,7 @@
bool AssembleDialog::bWarningShowedOnce = false;
AssembleDialog::AssembleDialog(QWidget *parent) :
AssembleDialog::AssembleDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::AssembleDialog)
{
@ -24,7 +24,7 @@ AssembleDialog::AssembleDialog(QWidget *parent) :
mValidateThread->setOnExpressionChangedCallback(std::bind(&AssembleDialog::validateInstruction, this, std::placeholders::_1));
connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(textChangedSlot(QString)));
connect(mValidateThread, SIGNAL(instructionChanged(dsint,QString)), this, SLOT(instructionChangedSlot(dsint, QString)));
connect(mValidateThread, SIGNAL(instructionChanged(dsint, QString)), this, SLOT(instructionChangedSlot(dsint, QString)));
}
AssembleDialog::~AssembleDialog()
@ -32,7 +32,7 @@ AssembleDialog::~AssembleDialog()
delete ui;
}
void AssembleDialog::setTextEditValue(const QString &text)
void AssembleDialog::setTextEditValue(const QString & text)
{
ui->lineEdit->setText(text);
}
@ -43,7 +43,7 @@ void AssembleDialog::setKeepSizeChecked(bool checked)
bKeepSizeChecked = checked;
}
void AssembleDialog::setKeepSizeLabel(const QString &text)
void AssembleDialog::setKeepSizeLabel(const QString & text)
{
ui->labelKeepSize->setText(text);
}
@ -54,7 +54,7 @@ void AssembleDialog::setFillWithNopsChecked(bool checked)
bFillWithNopsChecked = checked;
}
void AssembleDialog::setFillWithNopsLabel(const QString &text)
void AssembleDialog::setFillWithNopsLabel(const QString & text)
{
ui->labelFillWithNops->setText(text);
}
@ -99,7 +99,7 @@ void AssembleDialog::validateInstruction(QString expression)
emit mValidateThread->emitInstructionChanged(sizeDifference, "");
}
void AssembleDialog::hideEvent(QHideEvent *event)
void AssembleDialog::hideEvent(QHideEvent* event)
{
Q_UNUSED(event);
mValidateThread->stop();
@ -162,7 +162,7 @@ void AssembleDialog::instructionChangedSlot(dsint sizeDifference, QString error)
}
}
void AssembleDialog::on_lineEdit_textChanged(const QString &arg1)
void AssembleDialog::on_lineEdit_textChanged(const QString & arg1)
{
editText = arg1;

View File

@ -8,7 +8,7 @@
namespace Ui
{
class AssembleDialog;
class AssembleDialog;
}
class AssembleDialog : public QDialog
@ -16,7 +16,7 @@ class AssembleDialog : public QDialog
Q_OBJECT
public:
explicit AssembleDialog(QWidget *parent = 0);
explicit AssembleDialog(QWidget* parent = 0);
~AssembleDialog();
QString editText;
static bool bWarningShowedOnce;
@ -34,19 +34,19 @@ public:
void setOkButtonEnabled(bool enabled);
void validateInstruction(QString expression);
void hideEvent(QHideEvent *event);
void hideEvent(QHideEvent* event);
private slots:
void textChangedSlot(QString text);
void instructionChangedSlot(dsint sizeDifference, QString error);
void on_lineEdit_textChanged(const QString &arg1);
void on_lineEdit_textChanged(const QString & arg1);
void on_checkBoxKeepSize_clicked(bool checked);
void on_checkBoxFillWithNops_clicked(bool checked);
private:
Ui::AssembleDialog *ui;
Ui::AssembleDialog* ui;
duint mSelectedInstrVa;
ValidateExpressionThread *mValidateThread;
ValidateExpressionThread* mValidateThread;
};

View File

@ -5,7 +5,7 @@
namespace Ui
{
class AttachDialog;
class AttachDialog;
}
class AttachDialog : public QDialog

View File

@ -223,7 +223,7 @@ void CPUDisassembly::setupRightClickContextMenu()
QAction* replaceSlot2Action = makeMenuAction(replaceSlotMenu, "Replace Slot 2 (Free)", SLOT(setHwBpOnSlot2ActionSlot()));
QAction* replaceSlot3Action = makeMenuAction(replaceSlotMenu, "Replace Slot 3 (Free)", SLOT(setHwBpOnSlot3ActionSlot()));
mMenuBuilder->addMenu(makeMenu(QIcon(":/icons/images/breakpoint.png"), "Breakpoint"), [=](QMenu* menu)
mMenuBuilder->addMenu(makeMenu(QIcon(":/icons/images/breakpoint.png"), "Breakpoint"), [ = ](QMenu * menu)
{
BPXTYPE bpType = DbgGetBpxTypeAt(rvaToVa(getInitialSelection()));
@ -281,7 +281,7 @@ void CPUDisassembly::setupRightClickContextMenu()
return true;
});
mMenuBuilder->addMenu(makeMenu("&Follow in Dump"), [this](QMenu* menu)
mMenuBuilder->addMenu(makeMenu("&Follow in Dump"), [this](QMenu * menu)
{
setupFollowReferenceMenu(rvaToVa(getInitialSelection()), menu, false);
return true;
@ -404,7 +404,7 @@ void CPUDisassembly::setupRightClickContextMenu()
mReferenceSelectedAddressAction = makeShortcutAction("&Selected Address(es)", SLOT(findReferencesSlot()), "ActionFindReferencesToSelectedAddress");
mReferenceSelectedAddressAction->setFont(QFont("Courier New", 8));
mMenuBuilder->addMenu(makeMenu("Find &references to"), [this](QMenu* menu)
mMenuBuilder->addMenu(makeMenu("Find &references to"), [this](QMenu * menu)
{
setupFollowReferenceMenu(rvaToVa(getInitialSelection()), menu, true);
return true;
@ -415,7 +415,7 @@ void CPUDisassembly::setupRightClickContextMenu()
Bridge::getBridge()->emitMenuAddToList(this, mPluginMenu, GUI_DISASM_MENU);
mMenuBuilder->addSeparator();
mMenuBuilder->addBuilder(new MenuBuilder(this, [this](QMenu* menu)
mMenuBuilder->addBuilder(new MenuBuilder(this, [this](QMenu * menu)
{
menu->addActions(mPluginMenu->actions());
return true;
@ -1180,8 +1180,8 @@ void CPUDisassembly::findCommandSlot()
LineEditDialog mLineEdit(this);
mLineEdit.enableCheckBox(false);
// mLineEdit.setCheckBoxText("Entire &Block");
// mLineEdit.setCheckBox(ConfigBool("Disassembler", "FindCommandEntireBlock"));
// mLineEdit.setCheckBoxText("Entire &Block");
// mLineEdit.setCheckBox(ConfigBool("Disassembler", "FindCommandEntireBlock"));
mLineEdit.setWindowTitle("Find Command");
if(mLineEdit.exec() != QDialog::Accepted)
return;
@ -1251,7 +1251,7 @@ void CPUDisassembly::paintEvent(QPaintEvent* event)
// Ensures the two widgets are synced and prevents "draw lag"
auto sidebar = mParentCPUWindow->getSidebarWidget();
if (sidebar)
if(sidebar)
sidebar->repaint();
// Signal to render the original content

View File

@ -115,7 +115,7 @@ private:
GotoDialog* mGoto;
// Parent CPU window
CPUWidget *mParentCPUWindow;
CPUWidget* mParentCPUWindow;
MenuBuilder* mMenuBuilder;

View File

@ -178,9 +178,9 @@ void CPUDump::setupContextMenu()
#endif //_WIN64
int maxDumps = mMultiDump->getMaxCPUTabs();
for(int i=0; i<maxDumps; i++)
for(int i = 0; i < maxDumps; i++)
{
QAction* action = new QAction(QString("Dump %1").arg(i+1), this);
QAction* action = new QAction(QString("Dump %1").arg(i + 1), this);
connect(action, SIGNAL(triggered()), this, SLOT(followInDumpNSlot()));
mFollowInDumpMenu->addAction(action);
mFollowInDumpActions.push_back(action);
@ -626,7 +626,7 @@ void CPUDump::contextMenuEvent(QContextMenuEvent* event)
QList<QString> tabNames;
mMultiDump->getTabNames(tabNames);
for(int i=0; i<tabNames.length(); i++)
for(int i = 0; i < tabNames.length(); i++)
mFollowInDumpActions[i]->setText(tabNames[i]);
if((DbgGetBpxTypeAt(selectedAddr) & bp_hardware) == bp_hardware) //hardware breakpoint set
@ -697,7 +697,7 @@ void CPUDump::mouseDoubleClickEvent(QMouseEvent* event)
}
}
void CPUDump::mouseMoveEvent(QMouseEvent *event)
void CPUDump::mouseMoveEvent(QMouseEvent* event)
{
dsint ptr = 0, ptrValue = 0;
@ -1676,7 +1676,7 @@ void CPUDump::copyRvaSlot()
void CPUDump::followInDumpNSlot()
{
for(int i=0; i<mFollowInDumpActions.length(); i++)
for(int i = 0; i < mFollowInDumpActions.length(); i++)
{
if(mFollowInDumpActions[i] == sender())
{

View File

@ -41,7 +41,7 @@ void CPUMultiDump::getTabNames(QList<QString> & names)
{
bool addedDetachedWindows = false;
names.clear();
for(int i=0; i<count(); i++)
for(int i = 0; i < count(); i++)
{
// If empty name, then widget is detached
if(this->tabBar()->tabText(i).length() == 0)
@ -52,7 +52,7 @@ void CPUMultiDump::getTabNames(QList<QString> & names)
QString windowName;
// Loop through all detached widgets
for(int n=0; n < this->windows().size(); n++)
for(int n = 0; n < this->windows().size(); n++)
{
// Get the name and add it to the list
windowName = ((MHDetachedWindow*)this->windows().at(n)->parent())->windowTitle();

View File

@ -281,7 +281,7 @@ void CPUSideBar::mouseReleaseEvent(QMouseEvent* e)
}
}
void CPUSideBar::mouseMoveEvent(QMouseEvent *event)
void CPUSideBar::mouseMoveEvent(QMouseEvent* event)
{
if(!DbgIsDebugging() || !mInstrBuffer->size())
{
@ -486,8 +486,8 @@ void CPUSideBar::drawLabel(QPainter* painter, int Line, QString Text)
const int LineCoordinate = fontHeight * (1 + Line);
int length = Text.length();
const QColor& IPLabel = mCipLabelColor;
const QColor& IPLabelBG = mCipLabelBackgroundColor;
const QColor & IPLabel = mCipLabelColor;
const QColor & IPLabelBG = mCipLabelBackgroundColor;
int width = length * fontWidth + 2;
int x = 1;

View File

@ -12,7 +12,7 @@
namespace Ui
{
class CPUWidget;
class CPUWidget;
}
class CPUWidget : public QWidget

View File

@ -7,7 +7,7 @@
namespace Ui
{
class CalculatorDialog;
class CalculatorDialog;
}
class CalculatorDialog : public QDialog

View File

@ -6,7 +6,7 @@
namespace Ui
{
class CloseDialog;
class CloseDialog;
}
class CloseDialog : public QDialog

View File

@ -7,7 +7,7 @@
namespace Ui
{
class CommandHelpView;
class CommandHelpView;
}
class CommandHelpView : public QWidget

View File

@ -11,20 +11,20 @@ CommandLineEdit::CommandLineEdit(QWidget* parent) : HistoryLineEdit(parent)
this->setCompleter(mCompleter);
//Setup signals & slots
connect(mCompleter, SIGNAL(activated(const QString&)), this, SLOT(clear()), Qt::QueuedConnection);
connect(mCompleter, SIGNAL(activated(const QString &)), this, SLOT(clear()), Qt::QueuedConnection);
connect(Bridge::getBridge(), SIGNAL(autoCompleteAddCmd(QString)), this, SLOT(autoCompleteAddCmd(QString)));
connect(Bridge::getBridge(), SIGNAL(autoCompleteDelCmd(QString)), this, SLOT(autoCompleteDelCmd(QString)));
connect(Bridge::getBridge(), SIGNAL(autoCompleteClearAll()), this, SLOT(autoCompleteClearAll()));
}
void CommandLineEdit::keyPressEvent(QKeyEvent *event)
void CommandLineEdit::keyPressEvent(QKeyEvent* event)
{
if(event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if(keyEvent->key() == Qt::Key_Tab)
{
QStringListModel *strListModel = (QStringListModel*)(mCompleter->model());
QStringListModel* strListModel = (QStringListModel*)(mCompleter->model());
QStringList stringList = strListModel->stringList();
if(stringList.size())
@ -39,7 +39,7 @@ void CommandLineEdit::keyPressEvent(QKeyEvent *event)
// If popup list is not visible, selected next suggested command
if(!mCompleter->popup()->isVisible())
{
for(int row=0; row < mCompleter->popup()->model()->rowCount(); row++)
for(int row = 0; row < mCompleter->popup()->model()->rowCount(); row++)
{
QModelIndex modelIndex = mCompleter->popup()->model()->index(row, 0);

View File

@ -10,7 +10,7 @@ class CommandLineEdit : public HistoryLineEdit
public:
explicit CommandLineEdit(QWidget* parent = 0);
void keyPressEvent(QKeyEvent *event);
void keyPressEvent(QKeyEvent* event);
bool focusNextPrevChild(bool next);
public slots:

View File

@ -7,7 +7,7 @@
namespace Ui
{
class DataCopyDialog;
class DataCopyDialog;
}
class DataCopyDialog : public QDialog

View File

@ -5,7 +5,7 @@
namespace Ui
{
class EntropyDialog;
class EntropyDialog;
}
class EntropyDialog : public QDialog

View File

@ -5,7 +5,7 @@
namespace Ui
{
class ExceptionRangeDialog;
class ExceptionRangeDialog;
}
class ExceptionRangeDialog : public QDialog

View File

@ -7,7 +7,7 @@
namespace Ui
{
class GotoDialog;
class GotoDialog;
}
class GotoDialog : public QDialog

View File

@ -6,7 +6,7 @@
namespace Ui
{
class HexEditDialog;
class HexEditDialog;
}
class HexEditDialog : public QDialog

View File

@ -5,7 +5,7 @@
namespace Ui
{
class LineEditDialog;
class LineEditDialog;
}
class LineEditDialog : public QDialog

View File

@ -249,7 +249,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
connect(mCpuWidget->getDisasmWidget(), SIGNAL(decompileAt(dsint, dsint)), this, SLOT(decompileAt(dsint, dsint)));
connect(mCpuWidget->getDumpWidget(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
connect(mCpuWidget->getStackWidget(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
connect(mTabWidget, SIGNAL(tabMovedTabWidget(int,int)), this, SLOT(tabMovedSlot(int, int)));
connect(mTabWidget, SIGNAL(tabMovedTabWidget(int, int)), this, SLOT(tabMovedSlot(int, int)));
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcuts()));
@ -319,7 +319,7 @@ void MainWindow::loadTabDefaultOrder()
clearTabWidget();
// Setup tabs
for(int i=0; i < mWidgetList.size(); i++)
for(int i = 0; i < mWidgetList.size(); i++)
addQWidgetTab(mWidgetList[i]);
}
@ -327,10 +327,10 @@ void MainWindow::loadTabSavedOrder()
{
clearTabWidget();
QMap<duint, QWidget* > tabIndexToWidget;
QMap<duint, QWidget*> tabIndexToWidget;
// Get tabIndex for each widget and add them to tabIndexToWidget
for(int i=0; i < mWidgetList.size(); i++)
for(int i = 0; i < mWidgetList.size(); i++)
{
QString tabName = mWidgetList[i]->windowTitle();
tabName = tabName.replace(" ", "") + "Tab";
@ -339,7 +339,7 @@ void MainWindow::loadTabSavedOrder()
}
// Setup tabs
QMap<duint, QWidget* >::iterator it = tabIndexToWidget.begin();
QMap<duint, QWidget*>::iterator it = tabIndexToWidget.begin();
for(it; it != tabIndexToWidget.end(); it++)
{
addQWidgetTab(it.value());
@ -351,7 +351,7 @@ void MainWindow::clearTabWidget()
if(!mTabWidget->count())
return;
for(int i=mTabWidget->count()-1; i >= 0; i--)
for(int i = mTabWidget->count() - 1; i >= 0; i--)
{
mTabWidget->removeTab(i);
}
@ -527,7 +527,7 @@ QString MainWindow::getMRUEntry(int index)
void MainWindow::executeCommand()
{
QString& wCmd = mCmdLineEdit->text();
QString & wCmd = mCmdLineEdit->text();
DbgCmdExec(wCmd.toUtf8().constData());
@ -764,7 +764,7 @@ void MainWindow::displaySnowmanWidget()
void MainWindow::openSettings()
{
SettingsDialog *settings = new SettingsDialog(this);
SettingsDialog* settings = new SettingsDialog(this);
connect(settings, SIGNAL(chkSaveLoadTabOrderStateChanged(bool)), this, SLOT(chkSaveloadTabSavedOrderStateChangedSlot(bool)));
settings->lastException = lastException;
settings->exec();
@ -1215,7 +1215,7 @@ void MainWindow::executeOnGuiThread(void* cbGuiThread)
void MainWindow::tabMovedSlot(int from, int to)
{
for(int i=0; i < mTabWidget->count(); i++)
for(int i = 0; i < mTabWidget->count(); i++)
{
// Remove space in widget name and append Tab to get config settings (CPUTab, MemoryMapTab, etc...)
QString tabName = mTabWidget->tabText(i).replace(" ", "") + "Tab";

View File

@ -28,7 +28,7 @@
namespace Ui
{
class MainWindow;
class MainWindow;
}
class MainWindow : public QMainWindow
@ -192,7 +192,7 @@ private:
bool bCanClose;
MainWindowCloseThread* mCloseThread;
QVector<QWidget* > mWidgetList;
QVector<QWidget*> mWidgetList;
protected:
void dragEnterEvent(QDragEnterEvent* pEvent);

View File

@ -6,7 +6,7 @@
namespace Ui
{
class PageMemoryRights;
class PageMemoryRights;
}
class PageMemoryRights : public QDialog

View File

@ -8,7 +8,7 @@
namespace Ui
{
class PatchDialog;
class PatchDialog;
}
class PatchDialog : public QDialog

View File

@ -6,7 +6,7 @@
namespace Ui
{
class PatchDialogGroupSelector;
class PatchDialogGroupSelector;
}
class PatchDialogGroupSelector : public QDialog

View File

@ -18,7 +18,7 @@ typedef struct
namespace Ui
{
class RegistersView;
class RegistersView;
}
class RegistersView : public QScrollArea

View File

@ -6,7 +6,7 @@
namespace Ui
{
class SelectFields;
class SelectFields;
}
class SelectFields : public QDialog

View File

@ -5,7 +5,7 @@
namespace Ui
{
class SettingsDialog;
class SettingsDialog;
}
class SettingsDialog : public QDialog

View File

@ -7,7 +7,7 @@
namespace Ui
{
class ShortcutsDialog;
class ShortcutsDialog;
}
class ShortcutsDialog : public QDialog

View File

@ -49,13 +49,13 @@ void StatusLabel::debugStateChangedSlot(DBGSTATE state)
void StatusLabel::logUpdate(QString message)
{
if (labelText.contains('\n'))
if(labelText.contains('\n'))
labelText = "";
// Split each newline into a separate string
QStringList lineList = message.split('\n', QString::SkipEmptyParts);
if (lineList.size() > 0)
if(lineList.size() > 0)
{
// Get a substring for the last line only
labelText += lineList[lineList.size() - 1] + "\n";

View File

@ -6,7 +6,7 @@
namespace Ui
{
class SymbolView;
class SymbolView;
}
class SymbolView : public QWidget

View File

@ -11,7 +11,7 @@ MHTabWidget::MHTabWidget(QWidget* parent, bool allowDetach, bool allowDelete) :
connect(m_tabBar, SIGNAL(OnDetachTab(int, QPoint &)), this, SLOT(DetachTab(int, QPoint &)));
connect(m_tabBar, SIGNAL(OnMoveTab(int, int)), this, SLOT(MoveTab(int, int)));
connect(m_tabBar, SIGNAL(OnDeleteTab(int)), this, SLOT(DeleteTab(int)));
connect(m_tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int, int)));
connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int)));
setTabBar(m_tabBar);
setMovable(true);
@ -47,7 +47,7 @@ int MHTabWidget::count() const
return QTabWidget::count() + m_Windows.size();
}
QList<QWidget *> MHTabWidget::windows()
QList<QWidget*> MHTabWidget::windows()
{
return m_Windows;
}

View File

@ -8,7 +8,7 @@
namespace Ui
{
class WordEditDialog;
class WordEditDialog;
}
class WordEditDialog : public QDialog

View File

@ -5,7 +5,7 @@
namespace Ui
{
class YaraRuleSelectionDialog;
class YaraRuleSelectionDialog;
}
class YaraRuleSelectionDialog : public QDialog

View File

@ -42,7 +42,7 @@ public:
inline QMenu* addMenu(QMenu* submenu, BuildCallback callback)
{
addBuilder(new MenuBuilder(submenu->parent(), [submenu, callback](QMenu* menu)
addBuilder(new MenuBuilder(submenu->parent(), [submenu, callback](QMenu * menu)
{
submenu->clear();
if(callback(submenu))
@ -54,7 +54,7 @@ public:
inline QMenu* addMenu(QMenu* submenu, MenuBuilder* builder)
{
addBuilder(new MenuBuilder(submenu->parent(), [submenu, builder](QMenu* menu)
addBuilder(new MenuBuilder(submenu->parent(), [submenu, builder](QMenu * menu)
{
submenu->clear();
builder->build(submenu);

View File

@ -6,7 +6,7 @@
#include <functional>
#include "Imports.h"
typedef std::function<void(QString expression) > EXPRESSIONCHANGEDCB;
typedef std::function<void(QString expression)> EXPRESSIONCHANGEDCB;
class ValidateExpressionThread : public QThread
{