DBG: Auto-formatting
This commit is contained in:
parent
5e21927f7b
commit
8edc982597
|
@ -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)
|
||||
{
|
||||
duint threadWorkStart = (workAmount * i);
|
||||
duint threadWorkStop = min((threadWorkStart + workAmount), m_MainBlocks.size());
|
||||
|
@ -263,7 +263,7 @@ bool FunctionPass::ResolveFunctionEnd(FunctionDef* Function, BasicBlock* LastBlo
|
|||
|
||||
if(!block)
|
||||
{
|
||||
ASSERT_ALWAYS("Block should exist at this point");
|
||||
ASSERT_ALWAYS("Block should exist at this point");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ bool FunctionPass::ResolveFunctionEnd(FunctionDef* Function, BasicBlock* LastBlo
|
|||
}
|
||||
|
||||
// Sanity check
|
||||
ASSERT_TRUE(maximumAddr >= block->VirtualStart);
|
||||
ASSERT_TRUE(maximumAddr >= block->VirtualStart);
|
||||
|
||||
// Does this node contain the maximum address?
|
||||
if(maximumAddr >= block->VirtualStart && maximumAddr < block->VirtualEnd)
|
||||
|
|
|
@ -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);
|
||||
|
@ -97,7 +97,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);
|
||||
|
|
|
@ -7,7 +7,7 @@ std::unordered_map<duint, BOOKMARKSINFO> bookmarks;
|
|||
|
||||
bool BookmarkSet(duint Address, bool Manual)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Validate the incoming address
|
||||
if(!MemIsValidReadPtr(Address))
|
||||
|
@ -32,7 +32,7 @@ bool BookmarkSet(duint Address, bool Manual)
|
|||
|
||||
bool BookmarkGet(duint Address)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
SHARED_ACQUIRE(LockBookmarks);
|
||||
|
||||
return (bookmarks.count(ModHashFromAddr(Address)) > 0);
|
||||
|
@ -40,7 +40,7 @@ bool BookmarkGet(duint Address)
|
|||
|
||||
bool BookmarkDelete(duint Address)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
EXCLUSIVE_ACQUIRE(LockBookmarks);
|
||||
|
||||
return (bookmarks.erase(ModHashFromAddr(Address)) > 0);
|
||||
|
@ -48,7 +48,7 @@ bool BookmarkDelete(duint Address)
|
|||
|
||||
void BookmarkDelRange(duint Start, duint End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Are all bookmarks going to be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
|
@ -91,7 +91,7 @@ void BookmarkDelRange(duint Start, duint End)
|
|||
|
||||
void BookmarkCacheSave(JSON Root)
|
||||
{
|
||||
EXCLUSIVE_ACQUIRE(LockBookmarks);
|
||||
EXCLUSIVE_ACQUIRE(LockBookmarks);
|
||||
|
||||
const JSON jsonBookmarks = json_array();
|
||||
const JSON jsonAutoBookmarks = json_array();
|
||||
|
@ -168,7 +168,7 @@ void BookmarkCacheLoad(JSON Root)
|
|||
bool BookmarkEnum(BOOKMARKSINFO* List, size_t* Size)
|
||||
{
|
||||
// The array container must be set, or the size must be set, or both
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
SHARED_ACQUIRE(LockBookmarks);
|
||||
|
||||
// Return the size if set
|
||||
|
|
|
@ -50,7 +50,7 @@ int BpGetList(std::vector<BREAKPOINT>* List)
|
|||
|
||||
bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE Type, DWORD TitanType, const char* Name)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Fail if the address is a bad memory region
|
||||
if(!MemIsValidReadPtr(Address))
|
||||
|
@ -87,7 +87,7 @@ bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE
|
|||
|
||||
bool BpGet(duint Address, BP_TYPE Type, const char* Name, BREAKPOINT* Bp)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
SHARED_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// Name is optional
|
||||
|
@ -133,8 +133,8 @@ bool BpGet(duint Address, BP_TYPE Type, const char* Name, BREAKPOINT* Bp)
|
|||
|
||||
bool BpDelete(duint Address, BP_TYPE Type)
|
||||
{
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// Erase the index from the global list
|
||||
return (breakpoints.erase(BreakpointKey(Type, ModHashFromAddr(Address))) > 0);
|
||||
|
@ -142,7 +142,7 @@ bool BpDelete(duint Address, BP_TYPE Type)
|
|||
|
||||
bool BpEnable(duint Address, BP_TYPE Type, bool Enable)
|
||||
{
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// Check if the breakpoint exists first
|
||||
|
@ -157,8 +157,8 @@ bool BpEnable(duint Address, BP_TYPE Type, bool Enable)
|
|||
|
||||
bool BpSetName(duint Address, BP_TYPE Type, const char* Name)
|
||||
{
|
||||
ASSERT_DEBUGGING("Future(?): This is not used anywhere");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
ASSERT_DEBUGGING("Future(?): This is not used anywhere");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// If a name wasn't supplied, set to nothing
|
||||
if(!Name)
|
||||
|
@ -176,7 +176,7 @@ bool BpSetName(duint Address, BP_TYPE Type, const char* Name)
|
|||
|
||||
bool BpSetTitanType(duint Address, BP_TYPE Type, int TitanType)
|
||||
{
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// Set the TitanEngine type, separate from BP_TYPE
|
||||
|
@ -191,7 +191,7 @@ bool BpSetTitanType(duint Address, BP_TYPE Type, int TitanType)
|
|||
|
||||
bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
SHARED_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// Loop each entry, executing the user's callback
|
||||
|
@ -262,8 +262,8 @@ void BpToBridge(const BREAKPOINT* Bp, BRIDGEBP* BridgeBp)
|
|||
// Convert a debugger breakpoint to an open/exported
|
||||
// bridge breakpoint
|
||||
//
|
||||
ASSERT_NONNULL(Bp);
|
||||
ASSERT_NONNULL(BridgeBp);
|
||||
ASSERT_NONNULL(Bp);
|
||||
ASSERT_NONNULL(BridgeBp);
|
||||
|
||||
memset(BridgeBp, 0, sizeof(BRIDGEBP));
|
||||
strcpy_s(BridgeBp->mod, Bp->mod);
|
||||
|
|
|
@ -152,7 +152,7 @@ int Capstone::Size() const
|
|||
|
||||
duint Capstone::Address() const
|
||||
{
|
||||
return duint(GetInstr()->address);
|
||||
return duint (GetInstr()->address);
|
||||
}
|
||||
|
||||
const cs_x86 & Capstone::x86() const
|
||||
|
|
|
@ -7,7 +7,7 @@ std::unordered_map<duint, COMMENTSINFO> comments;
|
|||
|
||||
bool CommentSet(duint Address, const char* Text, bool Manual)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// A valid memory address must be supplied
|
||||
if(!MemIsValidReadPtr(Address))
|
||||
|
@ -43,7 +43,7 @@ bool CommentSet(duint Address, const char* Text, bool Manual)
|
|||
|
||||
bool CommentGet(duint Address, char* Text)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
SHARED_ACQUIRE(LockComments);
|
||||
|
||||
// Get an existing comment and copy the string buffer
|
||||
|
@ -63,7 +63,7 @@ bool CommentGet(duint Address, char* Text)
|
|||
|
||||
bool CommentDelete(duint Address)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
EXCLUSIVE_ACQUIRE(LockComments);
|
||||
|
||||
return (comments.erase(ModHashFromAddr(Address)) > 0);
|
||||
|
@ -71,7 +71,7 @@ bool CommentDelete(duint Address)
|
|||
|
||||
void CommentDelRange(duint Start, duint End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Are all comments going to be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
|
@ -202,10 +202,10 @@ void CommentCacheLoad(JSON Root)
|
|||
|
||||
bool CommentEnum(COMMENTSINFO* List, size_t* Size)
|
||||
{
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
ASSERT_DEBUGGING("Command function call");
|
||||
|
||||
// At least 1 parameter must be supplied
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
SHARED_ACQUIRE(LockComments);
|
||||
|
||||
// Check if the user requested size only
|
||||
|
|
|
@ -7,7 +7,7 @@ std::map<ModuleRange, FUNCTIONSINFO, ModuleRangeCompare> functions;
|
|||
|
||||
bool FunctionAdd(duint Start, duint End, bool Manual)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Make sure memory is readable
|
||||
if(!MemIsValidReadPtr(Start))
|
||||
|
@ -38,7 +38,7 @@ bool FunctionAdd(duint Start, duint End, bool Manual)
|
|||
|
||||
bool FunctionGet(duint Address, duint* Start, duint* End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
const duint moduleBase = ModBaseFromAddr(Address);
|
||||
|
||||
|
@ -62,7 +62,7 @@ bool FunctionGet(duint Address, duint* Start, duint* End)
|
|||
|
||||
bool FunctionOverlaps(duint Start, duint End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// A function can't end before it begins
|
||||
if(Start > End)
|
||||
|
@ -76,7 +76,7 @@ bool FunctionOverlaps(duint Start, duint End)
|
|||
|
||||
bool FunctionDelete(duint Address)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
const duint moduleBase = ModBaseFromAddr(Address);
|
||||
|
||||
|
@ -86,7 +86,7 @@ bool FunctionDelete(duint Address)
|
|||
|
||||
void FunctionDelRange(duint Start, duint End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Should all functions be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
|
@ -211,10 +211,10 @@ void FunctionCacheLoad(JSON Root)
|
|||
|
||||
bool FunctionEnum(FUNCTIONSINFO* List, size_t* Size)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// If a list isn't passed and the size not requested, fail
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
SHARED_ACQUIRE(LockFunctions);
|
||||
|
||||
// Did the caller request the buffer size needed?
|
||||
|
|
|
@ -1325,7 +1325,7 @@ CMDRESULT cbInstrFindMemAll(int argc, char* argv[])
|
|||
std::vector<SimplePage> searchPages;
|
||||
for(auto & itr : memoryPages)
|
||||
{
|
||||
SimplePage page(duint(itr.second.mbi.BaseAddress), itr.second.mbi.RegionSize);
|
||||
SimplePage page(duint (itr.second.mbi.BaseAddress), itr.second.mbi.RegionSize);
|
||||
if(page.address >= addr && page.address + page.size <= endAddr)
|
||||
searchPages.push_back(page);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ std::unordered_map<duint, LABELSINFO> labels;
|
|||
|
||||
bool LabelSet(duint Address, const char* Text, bool Manual)
|
||||
{
|
||||
ASSERT_DEBUGGING("Exported/Command function");
|
||||
ASSERT_DEBUGGING("Exported/Command function");
|
||||
|
||||
// A valid memory address must be supplied
|
||||
if(!MemIsValidReadPtr(Address))
|
||||
|
@ -45,7 +45,7 @@ bool LabelSet(duint Address, const char* Text, bool Manual)
|
|||
|
||||
bool LabelFromString(const char* Text, duint* Address)
|
||||
{
|
||||
ASSERT_DEBUGGING("Future(?): Currently not used");
|
||||
ASSERT_DEBUGGING("Future(?): Currently not used");
|
||||
SHARED_ACQUIRE(LockLabels);
|
||||
|
||||
for(auto & itr : labels)
|
||||
|
@ -66,7 +66,7 @@ bool LabelFromString(const char* Text, duint* Address)
|
|||
|
||||
bool LabelGet(duint Address, char* Text)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
SHARED_ACQUIRE(LockLabels);
|
||||
|
||||
// Was the label at this address exist?
|
||||
|
@ -84,7 +84,7 @@ bool LabelGet(duint Address, char* Text)
|
|||
|
||||
bool LabelDelete(duint Address)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
EXCLUSIVE_ACQUIRE(LockLabels);
|
||||
|
||||
return (labels.erase(ModHashFromAddr(Address)) > 0);
|
||||
|
@ -92,7 +92,7 @@ bool LabelDelete(duint Address)
|
|||
|
||||
void LabelDelRange(duint Start, duint End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Are all comments going to be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
|
@ -229,7 +229,7 @@ void LabelCacheLoad(JSON Root)
|
|||
|
||||
bool LabelEnum(LABELSINFO* List, size_t* Size)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// At least 1 parameter is required
|
||||
if(!List && !Size)
|
||||
|
|
|
@ -7,7 +7,7 @@ std::map<DepthModuleRange, LOOPSINFO, DepthModuleRangeCompare> loops;
|
|||
|
||||
bool LoopAdd(duint Start, duint End, bool Manual)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Loop must begin before it ends
|
||||
if(Start > End)
|
||||
|
@ -53,7 +53,7 @@ bool LoopAdd(duint Start, duint End, bool Manual)
|
|||
// Get the start/end of a loop at a certain depth and address
|
||||
bool LoopGet(int Depth, duint Address, duint* Start, duint* End)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Get the virtual address module
|
||||
const duint moduleBase = ModBaseFromAddr(Address);
|
||||
|
@ -82,7 +82,7 @@ bool LoopGet(int Depth, duint Address, duint* Start, duint* End)
|
|||
// Check if a loop overlaps a range, inside is not overlapping
|
||||
bool LoopOverlaps(int Depth, duint Start, duint End, int* FinalDepth)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Determine module addresses and lookup keys
|
||||
const duint moduleBase = ModBaseFromAddr(Start);
|
||||
|
@ -133,7 +133,7 @@ bool LoopOverlaps(int Depth, duint Start, duint End, int* FinalDepth)
|
|||
// This should delete a loop and all sub-loops that matches a certain addr
|
||||
bool LoopDelete(int Depth, duint Address)
|
||||
{
|
||||
ASSERT_ALWAYS("Function unimplemented");
|
||||
ASSERT_ALWAYS("Function unimplemented");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void LoopCacheLoad(JSON Root)
|
|||
bool LoopEnum(LOOPSINFO* List, size_t* Size)
|
||||
{
|
||||
// If list or size is not requested, fail
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
SHARED_ACQUIRE(LockLoops);
|
||||
|
||||
// See if the caller requested an output size
|
||||
|
|
|
@ -341,7 +341,7 @@ duint MemAllocRemote(duint Address, duint Size, DWORD Type, DWORD Protect)
|
|||
|
||||
bool MemFreeRemote(duint Address)
|
||||
{
|
||||
return VirtualFreeEx(fdProcessInfo->hProcess, (LPVOID)Address, 0, MEM_RELEASE) == TRUE;
|
||||
return VirtualFreeEx(fdProcessInfo->hProcess, (LPVOID)Address, 0, MEM_RELEASE) == TRUE;
|
||||
}
|
||||
|
||||
duint MemGetPageAligned(duint Address)
|
||||
|
@ -381,7 +381,7 @@ bool MemSetPageRights(duint Address, const char* Rights)
|
|||
return false;
|
||||
|
||||
DWORD oldProtect;
|
||||
return VirtualProtectEx(fdProcessInfo->hProcess, (void*)Address, PAGE_SIZE, protect, &oldProtect) == TRUE;
|
||||
return VirtualProtectEx(fdProcessInfo->hProcess, (void*)Address, PAGE_SIZE, protect, &oldProtect) == TRUE;
|
||||
}
|
||||
|
||||
bool MemGetPageRights(duint Address, char* Rights)
|
||||
|
@ -428,7 +428,7 @@ bool MemPageRightsToString(DWORD Protect, char* Rights)
|
|||
break;
|
||||
}
|
||||
|
||||
strcat_s(Rights, RIGHTS_STRING_SIZE, ((Protect & PAGE_GUARD) == PAGE_GUARD) ? "G" : "-");
|
||||
strcat_s(Rights, RIGHTS_STRING_SIZE, ((Protect & PAGE_GUARD) == PAGE_GUARD) ? "G" : "-");
|
||||
// Rights[5] = ((Protect & PAGE_NOCACHE) == PAGE_NOCACHE) ? '' : '-';
|
||||
// Rights[6] = ((Protect & PAGE_WRITECOMBINE) == PAGE_GUARD) ? '' : '-';
|
||||
|
||||
|
@ -437,7 +437,7 @@ bool MemPageRightsToString(DWORD Protect, char* Rights)
|
|||
|
||||
bool MemPageRightsFromString(DWORD* Protect, const char* Rights)
|
||||
{
|
||||
ASSERT_TRUE(strlen(Rights) >= 2);
|
||||
ASSERT_TRUE(strlen(Rights) >= 2);
|
||||
*Protect = 0;
|
||||
|
||||
// Check for the PAGE_GUARD flag
|
||||
|
@ -502,13 +502,13 @@ bool MemFindInMap(const std::vector<SimplePage> & pages, const std::vector<Patte
|
|||
{
|
||||
if(!MemFindInPage(page, 0, pattern, results, maxresults))
|
||||
return false;
|
||||
if (progress)
|
||||
if(progress)
|
||||
GuiReferenceSetProgress(int(floor((float(count) / float(total)) * 100.0f)));
|
||||
if(results.size() >= maxresults)
|
||||
break;
|
||||
count++;
|
||||
}
|
||||
if (progress)
|
||||
if(progress)
|
||||
{
|
||||
GuiReferenceSetProgress(100);
|
||||
GuiReferenceReloadData();
|
||||
|
|
|
@ -193,7 +193,7 @@ MODINFO* ModInfoFromAddr(duint Address)
|
|||
|
||||
bool ModNameFromAddr(duint Address, char* Name, bool Extension)
|
||||
{
|
||||
ASSERT_NONNULL(Name);
|
||||
ASSERT_NONNULL(Name);
|
||||
SHARED_ACQUIRE(LockModules);
|
||||
|
||||
// Get a pointer to module information
|
||||
|
@ -239,16 +239,16 @@ duint ModHashFromAddr(duint Address)
|
|||
duint ModHashFromName(const char* Module)
|
||||
{
|
||||
// return MODINFO.hash (based on the name)
|
||||
ASSERT_NONNULL(Module);
|
||||
ASSERT_FALSE(Module[0] == '\0');
|
||||
ASSERT_NONNULL(Module);
|
||||
ASSERT_FALSE(Module[0] == '\0');
|
||||
|
||||
return murmurhash(Module, (int)strlen(Module));
|
||||
}
|
||||
|
||||
duint ModBaseFromName(const char* Module)
|
||||
{
|
||||
ASSERT_NONNULL(Module);
|
||||
ASSERT_TRUE(strlen(Module) < MAX_MODULE_SIZE);
|
||||
ASSERT_NONNULL(Module);
|
||||
ASSERT_TRUE(strlen(Module) < MAX_MODULE_SIZE);
|
||||
SHARED_ACQUIRE(LockModules);
|
||||
|
||||
for(const auto & i : modinfo)
|
||||
|
|
|
@ -3,67 +3,67 @@
|
|||
// Allocate a message stack
|
||||
MESSAGE_STACK* MsgAllocStack()
|
||||
{
|
||||
auto stack = new MESSAGE_STACK;
|
||||
auto stack = new MESSAGE_STACK;
|
||||
|
||||
stack->WaitingCalls = 0;
|
||||
stack->Destroy = false;
|
||||
stack->WaitingCalls = 0;
|
||||
stack->Destroy = false;
|
||||
|
||||
return stack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
// Free a message stack
|
||||
void MsgFreeStack(MESSAGE_STACK* Stack)
|
||||
{
|
||||
ASSERT_NONNULL(Stack);
|
||||
ASSERT_NONNULL(Stack);
|
||||
|
||||
// Update termination variable
|
||||
Stack->Destroy = true;
|
||||
// Update termination variable
|
||||
Stack->Destroy = true;
|
||||
|
||||
// Notify each thread
|
||||
for (int i = 0; i < Stack->WaitingCalls + 1; i++)
|
||||
{
|
||||
MESSAGE newMessage;
|
||||
Stack->msgs.enqueue(newMessage);
|
||||
}
|
||||
// Notify each thread
|
||||
for(int i = 0; i < Stack->WaitingCalls + 1; i++)
|
||||
{
|
||||
MESSAGE newMessage;
|
||||
Stack->msgs.enqueue(newMessage);
|
||||
}
|
||||
|
||||
// Delete allocate structure
|
||||
delete Stack;
|
||||
// Delete allocate structure
|
||||
delete Stack;
|
||||
}
|
||||
|
||||
// Add a message to the stack
|
||||
bool MsgSend(MESSAGE_STACK* Stack, int Msg, duint Param1, duint Param2)
|
||||
{
|
||||
if (Stack->Destroy)
|
||||
return false;
|
||||
if(Stack->Destroy)
|
||||
return false;
|
||||
|
||||
MESSAGE newMessage;
|
||||
newMessage.msg = Msg;
|
||||
newMessage.param1 = Param1;
|
||||
newMessage.param2 = Param2;
|
||||
MESSAGE newMessage;
|
||||
newMessage.msg = Msg;
|
||||
newMessage.param1 = Param1;
|
||||
newMessage.param2 = Param2;
|
||||
|
||||
// Asynchronous send
|
||||
asend(Stack->msgs, newMessage);
|
||||
// Asynchronous send
|
||||
asend(Stack->msgs, newMessage);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get a message from the stack (will return false when there are no messages)
|
||||
bool MsgGet(MESSAGE_STACK* Stack, MESSAGE* Msg)
|
||||
{
|
||||
if (Stack->Destroy)
|
||||
return false;
|
||||
if(Stack->Destroy)
|
||||
return false;
|
||||
|
||||
// Don't increment the wait count because this does not wait
|
||||
return try_receive(Stack->msgs, *Msg);
|
||||
// Don't increment the wait count because this does not wait
|
||||
return try_receive(Stack->msgs, *Msg);
|
||||
}
|
||||
|
||||
// Wait for a message on the specified stack
|
||||
void MsgWait(MESSAGE_STACK* Stack, MESSAGE* Msg)
|
||||
{
|
||||
if (Stack->Destroy)
|
||||
return;
|
||||
if(Stack->Destroy)
|
||||
return;
|
||||
|
||||
// Increment/decrement wait count
|
||||
InterlockedIncrement((volatile long *)&Stack->WaitingCalls);
|
||||
*Msg = Stack->msgs.dequeue();
|
||||
InterlockedDecrement((volatile long *)&Stack->WaitingCalls);
|
||||
// Increment/decrement wait count
|
||||
InterlockedIncrement((volatile long*)&Stack->WaitingCalls);
|
||||
*Msg = Stack->msgs.dequeue();
|
||||
InterlockedDecrement((volatile long*)&Stack->WaitingCalls);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ struct MESSAGE
|
|||
class MESSAGE_STACK
|
||||
{
|
||||
public:
|
||||
Concurrency::unbounded_buffer<MESSAGE> msgs;
|
||||
Concurrency::unbounded_buffer<MESSAGE> msgs;
|
||||
|
||||
int WaitingCalls; // Number of threads waiting
|
||||
bool Destroy; // Destroy stack as soon as possible
|
||||
int WaitingCalls; // Number of threads waiting
|
||||
bool Destroy; // Destroy stack as soon as possible
|
||||
};
|
||||
|
||||
// Function definitions
|
||||
|
|
|
@ -14,7 +14,7 @@ std::unordered_map<duint, PATCHINFO> patches;
|
|||
|
||||
bool PatchSet(duint Address, unsigned char OldByte, unsigned char NewByte)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Address must be valid
|
||||
if(!MemIsValidReadPtr(Address))
|
||||
|
@ -62,7 +62,7 @@ bool PatchSet(duint Address, unsigned char OldByte, unsigned char NewByte)
|
|||
|
||||
bool PatchGet(duint Address, PATCHINFO* Patch)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
SHARED_ACQUIRE(LockPatches);
|
||||
|
||||
// Find this specific address in the list
|
||||
|
@ -84,7 +84,7 @@ bool PatchGet(duint Address, PATCHINFO* Patch)
|
|||
|
||||
bool PatchDelete(duint Address, bool Restore)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
EXCLUSIVE_ACQUIRE(LockPatches);
|
||||
|
||||
// Do a list lookup with hash
|
||||
|
@ -104,7 +104,7 @@ bool PatchDelete(duint Address, bool Restore)
|
|||
|
||||
void PatchDelRange(duint Start, duint End, bool Restore)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
|
||||
// Are all bookmarks going to be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
|
@ -146,8 +146,8 @@ void PatchDelRange(duint Start, duint End, bool Restore)
|
|||
|
||||
bool PatchEnum(PATCHINFO* List, size_t* Size)
|
||||
{
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
ASSERT_DEBUGGING("Export call");
|
||||
ASSERT_FALSE(!List && !Size);
|
||||
SHARED_ACQUIRE(LockPatches);
|
||||
|
||||
// Did the user request the size?
|
||||
|
|
|
@ -69,7 +69,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
|||
|
||||
Callback(0, 0, &refInfo);
|
||||
|
||||
//concurrency::parallel_for(duint(0), scanSize, [&](duint i)
|
||||
//concurrency::parallel_for(duint (0), scanSize, [&](duint i)
|
||||
for(duint i = 0; i < scanSize;)
|
||||
{
|
||||
// Print the progress every 4096 bytes
|
||||
|
|
|
@ -132,7 +132,7 @@ DWORD64 CALLBACK StackGetModuleBaseProc64(HANDLE hProcess, DWORD64 Address)
|
|||
|
||||
DWORD64 CALLBACK StackTranslateAddressProc64(HANDLE hProcess, HANDLE hThread, LPADDRESS64 lpaddr)
|
||||
{
|
||||
ASSERT_ALWAYS("This function should never be called");
|
||||
ASSERT_ALWAYS("This function should never be called");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ void stackgetcallstack(duint csp, CALLSTACK* callstack)
|
|||
|
||||
// Container for each callstack entry (20 pre-allocated entries)
|
||||
std::vector<CALLSTACKENTRY> callstackVector;
|
||||
callstackVector.reserve(20);
|
||||
callstackVector.reserve(20);
|
||||
|
||||
while(true)
|
||||
{
|
||||
|
|
|
@ -375,9 +375,9 @@ extern "C" DLL_EXPORT void _dbg_dbgexitsignal()
|
|||
dputs("Unloading plugins...");
|
||||
pluginunload();
|
||||
dputs("Stopping command thread...");
|
||||
bStopCommandLoopThread = true;
|
||||
MsgFreeStack(gMsgStack);
|
||||
WaitForThreadTermination(hCommandLoopThread);
|
||||
bStopCommandLoopThread = true;
|
||||
MsgFreeStack(gMsgStack);
|
||||
WaitForThreadTermination(hCommandLoopThread);
|
||||
dputs("Cleaning up allocated data...");
|
||||
cmdfree(command_list);
|
||||
varfree();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Code originally from:
|
||||
*
|
||||
*
|
||||
* (c) 2015 Alexandro Sanchez Bach. All rights reserved.
|
||||
* https://github.com/AlexAltea/nucleus/blob/9103d7eb52cc861cb6e317f0007246bd03d663a2/nucleus/assert.h
|
||||
* https://github.com/AlexAltea/nucleus/blob/9103d7eb52cc861cb6e317f0007246bd03d663a2/LICENSE
|
||||
|
|
|
@ -13,20 +13,20 @@
|
|||
#undef COMPILE_32
|
||||
|
||||
#ifdef _WIN64
|
||||
#define COMPILE_64 1 // Program is being compiled as 64-bit
|
||||
#define COMPILE_64 1 // Program is being compiled as 64-bit
|
||||
#else
|
||||
#define COMPILE_32 1 // Program is being compiled as 32-bit
|
||||
#define COMPILE_32 1 // Program is being compiled as 32-bit
|
||||
#endif // _WIN64
|
||||
|
||||
//
|
||||
// Define types
|
||||
//
|
||||
#ifdef COMPILE_64
|
||||
typedef unsigned long long duint;
|
||||
typedef signed long long dsint;
|
||||
typedef unsigned long long duint;
|
||||
typedef signed long long dsint;
|
||||
#else
|
||||
typedef unsigned long __w64 duint;
|
||||
typedef signed long __w64 dsint;
|
||||
typedef signed long __w64 dsint;
|
||||
#endif // COMPILE_64
|
||||
|
||||
typedef short int16;
|
||||
|
|
|
@ -92,8 +92,8 @@ void CrashDumpCreate(EXCEPTION_POINTERS* ExceptionPointers)
|
|||
|
||||
LONG CALLBACK CrashDumpVectoredHandler(EXCEPTION_POINTERS* ExceptionInfo)
|
||||
{
|
||||
// Any "exception" under 0x1000 is usually just a failed RPC call
|
||||
if (ExceptionInfo && ExceptionInfo->ExceptionRecord->ExceptionCode > 0x00001000)
|
||||
// Any "exception" under 0x1000 is usually just a failed RPC call
|
||||
if(ExceptionInfo && ExceptionInfo->ExceptionRecord->ExceptionCode > 0x00001000)
|
||||
{
|
||||
// Skip DBG_PRINTEXCEPTION_C and DBG_PRINTEXCEPTION_WIDE_C
|
||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||
|
|
|
@ -15,7 +15,7 @@ BeaTokenizer::BeaTokenizer()
|
|||
}
|
||||
|
||||
void BeaTokenizer::AddToken(BeaInstructionToken* instr, const BeaTokenType type, const QString text, const BeaTokenValue* value)
|
||||
{
|
||||
{
|
||||
BeaSingleToken token;
|
||||
token.type = type;
|
||||
if(type != TokenSpace && type != TokenArgumentSpace && type != TokenMemoryOperatorSpace)
|
||||
|
|
|
@ -1266,7 +1266,7 @@ void RegistersView::paintEvent(QPaintEvent* event)
|
|||
wPainter.fillRect(wPainter.viewport(), QBrush(ConfigColor("RegistersBackgroundColor")));
|
||||
|
||||
// Don't draw the registers if a program isn't actually running
|
||||
if (!DbgIsDebugging())
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
||||
// Iterate all registers
|
||||
|
|
Loading…
Reference in New Issue