DBG+GUI: format
This commit is contained in:
parent
4eabd557af
commit
e6658562ca
|
@ -67,9 +67,9 @@ static bool _patchinrange(duint start, duint end)
|
|||
if(start > end)
|
||||
std::swap(start, end);
|
||||
|
||||
for (duint i = start; i <= end; i++)
|
||||
for(duint i = start; i <= end; i++)
|
||||
{
|
||||
if (_patchget(i))
|
||||
if(_patchget(i))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ static bool _mempatch(duint va, const unsigned char* src, duint size)
|
|||
|
||||
static void _patchrestorerange(duint start, duint end)
|
||||
{
|
||||
if (start > end)
|
||||
if(start > end)
|
||||
std::swap(start, end);
|
||||
|
||||
for(duint i = start; i <= end; i++)
|
||||
|
|
|
@ -61,7 +61,7 @@ extern "C" DLL_EXPORT bool _dbg_memmap(MEMMAP* memmap)
|
|||
// Copy all elements over
|
||||
int i = 0;
|
||||
|
||||
for (auto& itr : memoryPages)
|
||||
for(auto & itr : memoryPages)
|
||||
memcpy(&memmap->page[i++], &itr.second, sizeof(MEMPAGE));
|
||||
|
||||
// Done
|
||||
|
|
|
@ -78,7 +78,7 @@ void dbload()
|
|||
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;
|
||||
|
@ -104,7 +104,7 @@ void dbload()
|
|||
// This corrects a bug when a file exists, but there is no data inside.
|
||||
JSON root = nullptr;
|
||||
|
||||
if (jsonFileSize > 0)
|
||||
if(jsonFileSize > 0)
|
||||
root = json_loadf(jsonFile, 0, 0);
|
||||
|
||||
// Release the file handle and re-compress
|
||||
|
|
|
@ -190,13 +190,13 @@ DWORD WINAPI updateCallStackThread(void* ptr)
|
|||
void DebugUpdateGui(uint disasm_addr, bool stack)
|
||||
{
|
||||
uint cip = GetContextDataEx(hActiveThread, UE_CIP);
|
||||
if (MemIsValidReadPtr(disasm_addr))
|
||||
if(MemIsValidReadPtr(disasm_addr))
|
||||
{
|
||||
if (bEnableSourceDebugging)
|
||||
if(bEnableSourceDebugging)
|
||||
{
|
||||
char szSourceFile[MAX_STRING_SIZE] = "";
|
||||
int line = 0;
|
||||
if (SymGetSourceLine(cip, szSourceFile, &line))
|
||||
if(SymGetSourceLine(cip, szSourceFile, &line))
|
||||
GuiLoadSourceFile(szSourceFile, line);
|
||||
}
|
||||
GuiDisasmAt(disasm_addr, cip);
|
||||
|
@ -1035,7 +1035,7 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
|||
if(nameInfo.dwType == 0x1000 and nameInfo.dwFlags == 0 and ThreadIsValid(nameInfo.dwThreadID)) //passed basic checks
|
||||
{
|
||||
Memory<char*> ThreadName(MAX_THREAD_NAME_SIZE, "cbException:ThreadName");
|
||||
if(MemRead((void *)nameInfo.szName, ThreadName, MAX_THREAD_NAME_SIZE - 1, 0))
|
||||
if(MemRead((void*)nameInfo.szName, ThreadName, MAX_THREAD_NAME_SIZE - 1, 0))
|
||||
{
|
||||
String ThreadNameEscaped = StringUtils::Escape(ThreadName);
|
||||
dprintf("SetThreadName(%X, \"%s\")\n", nameInfo.dwThreadID, ThreadNameEscaped.c_str());
|
||||
|
@ -1891,7 +1891,7 @@ bool dbgsetcmdline(const char* cmd_line, cmdline_error_t* cmd_line_error)
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!MemWrite((void*)(mem + new_command_line.Length), (void *)cmd_line, strlen(cmd_line) + 1, &size))
|
||||
if(!MemWrite((void*)(mem + new_command_line.Length), (void*)cmd_line, strlen(cmd_line) + 1, &size))
|
||||
{
|
||||
cmd_line_error->addr = mem + new_command_line.Length;
|
||||
cmd_line_error->type = CMDL_ERR_WRITE_ANSI_COMMANDLINE;
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
~Memory()
|
||||
{
|
||||
if (m_Ptr)
|
||||
if(m_Ptr)
|
||||
efree(m_Ptr);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename U>
|
||||
T operator+(const U& Other)
|
||||
T operator+(const U & Other)
|
||||
{
|
||||
return m_Ptr + Other;
|
||||
}
|
||||
|
|
|
@ -9,19 +9,19 @@ std::unordered_map<uint, LABELSINFO> labels;
|
|||
bool LabelSet(uint Address, const char* Text, bool Manual)
|
||||
{
|
||||
// CHECK: Exported/Command function
|
||||
if (!DbgIsDebugging())
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
|
||||
// A valid memory address must be supplied
|
||||
if (!MemIsValidReadPtr(Address))
|
||||
if(!MemIsValidReadPtr(Address))
|
||||
return false;
|
||||
|
||||
// Make sure the string is supplied, within bounds, and not a special delimiter
|
||||
if (!Text || Text[0] == '\1' || strlen(Text) >= MAX_LABEL_SIZE - 1)
|
||||
if(!Text || Text[0] == '\1' || strlen(Text) >= MAX_LABEL_SIZE - 1)
|
||||
return false;
|
||||
|
||||
// Labels cannot be "address" of actual variables
|
||||
if (strstr(Text, "&"))
|
||||
if(strstr(Text, "&"))
|
||||
return false;
|
||||
|
||||
// Delete the label if no text was supplied
|
||||
|
@ -54,13 +54,13 @@ bool LabelFromString(const char* Text, uint* Address)
|
|||
|
||||
SHARED_ACQUIRE(LockLabels);
|
||||
|
||||
for (auto& itr : labels)
|
||||
for(auto & itr : labels)
|
||||
{
|
||||
// Check if the actual label name matches
|
||||
if (strcmp(itr.second.text, Text))
|
||||
if(strcmp(itr.second.text, Text))
|
||||
continue;
|
||||
|
||||
if (Address)
|
||||
if(Address)
|
||||
*Address = itr.second.addr + ModBaseFromName(itr.second.mod);
|
||||
|
||||
// Set status to indicate if label was ever found
|
||||
|
@ -104,12 +104,12 @@ bool LabelDelete(uint Address)
|
|||
void LabelDelRange(uint Start, uint End)
|
||||
{
|
||||
// CHECK: Export function
|
||||
if (!DbgIsDebugging())
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
||||
// Are all comments going to be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
if (Start == 0 && End == ~0)
|
||||
if(Start == 0 && End == ~0)
|
||||
{
|
||||
EXCLUSIVE_ACQUIRE(LockLabels);
|
||||
labels.clear();
|
||||
|
@ -119,21 +119,21 @@ void LabelDelRange(uint Start, uint End)
|
|||
// Make sure 'Start' and 'End' reference the same module
|
||||
uint moduleBase = ModBaseFromAddr(Start);
|
||||
|
||||
if (moduleBase != ModBaseFromAddr(End))
|
||||
if(moduleBase != ModBaseFromAddr(End))
|
||||
return;
|
||||
|
||||
EXCLUSIVE_ACQUIRE(LockLabels);
|
||||
for (auto itr = labels.begin(); itr != labels.end();)
|
||||
for(auto itr = labels.begin(); itr != labels.end();)
|
||||
{
|
||||
// Ignore manually set entries
|
||||
if (itr->second.manual)
|
||||
if(itr->second.manual)
|
||||
{
|
||||
itr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// [Start, End)
|
||||
if (itr->second.addr >= Start && itr->second.addr < End)
|
||||
if(itr->second.addr >= Start && itr->second.addr < End)
|
||||
itr = labels.erase(itr);
|
||||
else
|
||||
itr++;
|
||||
|
@ -150,7 +150,7 @@ void LabelCacheSave(JSON Root)
|
|||
const JSON jsonAutoLabels = json_array();
|
||||
|
||||
// Iterator each label
|
||||
for(auto& itr : labels)
|
||||
for(auto & itr : labels)
|
||||
{
|
||||
JSON jsonLabel = json_object();
|
||||
json_object_set_new(jsonLabel, "module", json_string(itr.second.mod));
|
||||
|
@ -193,7 +193,7 @@ void LabelCacheLoad(JSON Root)
|
|||
// Module
|
||||
const char* mod = json_string_value(json_object_get(value, "module"));
|
||||
|
||||
if (mod && strlen(mod) < MAX_MODULE_SIZE)
|
||||
if(mod && strlen(mod) < MAX_MODULE_SIZE)
|
||||
strcpy_s(labelInfo.mod, mod);
|
||||
else
|
||||
labelInfo.mod[0] = '\0';
|
||||
|
@ -205,7 +205,7 @@ void LabelCacheLoad(JSON Root)
|
|||
// Text string
|
||||
const char* text = json_string_value(json_object_get(value, "text"));
|
||||
|
||||
if (text)
|
||||
if(text)
|
||||
strcpy_s(labelInfo.text, text);
|
||||
else
|
||||
{
|
||||
|
@ -214,9 +214,9 @@ void LabelCacheLoad(JSON Root)
|
|||
}
|
||||
|
||||
// Go through the string replacing '&' with spaces
|
||||
for (char *ptr = labelInfo.text; ptr[0] != '\0'; ptr++)
|
||||
for(char* ptr = labelInfo.text; ptr[0] != '\0'; ptr++)
|
||||
{
|
||||
if (ptr[0] == '&')
|
||||
if(ptr[0] == '&')
|
||||
ptr[0] = ' ';
|
||||
}
|
||||
|
||||
|
@ -234,11 +234,11 @@ void LabelCacheLoad(JSON Root)
|
|||
const JSON jsonAutoLabels = json_object_get(Root, "autolabels");
|
||||
|
||||
// Load user-set labels
|
||||
if (jsonLabels)
|
||||
if(jsonLabels)
|
||||
AddLabels(jsonLabels, true);
|
||||
|
||||
// Load auto-set labels
|
||||
if (jsonAutoLabels)
|
||||
if(jsonAutoLabels)
|
||||
AddLabels(jsonAutoLabels, false);
|
||||
}
|
||||
|
||||
|
@ -259,13 +259,13 @@ bool LabelEnum(LABELSINFO* List, size_t* Size)
|
|||
{
|
||||
*Size = labels.size() * sizeof(LABELSINFO);
|
||||
|
||||
if (!List)
|
||||
if(!List)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fill out the return list while converting the offset
|
||||
// to a virtual address
|
||||
for (auto& itr : labels)
|
||||
for(auto & itr : labels)
|
||||
{
|
||||
*List = itr.second;
|
||||
List->addr += ModBaseFromName(itr.second.mod);
|
||||
|
|
|
@ -13,11 +13,11 @@ bool LoopAdd(uint Start, uint End, bool Manual)
|
|||
return false;
|
||||
|
||||
// Loop must begin before it ends
|
||||
if (Start > End)
|
||||
if(Start > End)
|
||||
return false;
|
||||
|
||||
// Memory addresses must be valid
|
||||
if (!MemIsValidReadPtr(Start) || !MemIsValidReadPtr(End))
|
||||
if(!MemIsValidReadPtr(Start) || !MemIsValidReadPtr(End))
|
||||
return false;
|
||||
|
||||
// Check if loop boundaries are in the same module range
|
||||
|
@ -102,14 +102,14 @@ bool LoopOverlaps(int Depth, uint Start, uint End, int* FinalDepth)
|
|||
SHARED_ACQUIRE(LockLoops);
|
||||
|
||||
// Check if the new loop fits in the old loop
|
||||
for(auto& itr : loops)
|
||||
for(auto & itr : loops)
|
||||
{
|
||||
// Only look in the current module
|
||||
if(itr.first.second.first != key)
|
||||
continue;
|
||||
|
||||
// Loop must be at this recursive depth
|
||||
if (itr.second.depth != Depth)
|
||||
if(itr.second.depth != Depth)
|
||||
continue;
|
||||
|
||||
if(itr.second.start < curStart && itr.second.end > curEnd)
|
||||
|
@ -121,14 +121,14 @@ bool LoopOverlaps(int Depth, uint Start, uint End, int* FinalDepth)
|
|||
*FinalDepth = Depth;
|
||||
|
||||
// Check for loop overlaps
|
||||
for (auto& itr : loops)
|
||||
for(auto & itr : loops)
|
||||
{
|
||||
// Only look in the current module
|
||||
if (itr.first.second.first != key)
|
||||
if(itr.first.second.first != key)
|
||||
continue;
|
||||
|
||||
// Loop must be at this recursive depth
|
||||
if (itr.second.depth != Depth)
|
||||
if(itr.second.depth != Depth)
|
||||
continue;
|
||||
|
||||
if(itr.second.start <= curEnd && itr.second.end >= curStart)
|
||||
|
@ -153,9 +153,9 @@ void LoopCacheSave(JSON Root)
|
|||
const JSON jsonAutoLoops = json_array();
|
||||
|
||||
// Write all entries
|
||||
for(auto& itr : loops)
|
||||
for(auto & itr : loops)
|
||||
{
|
||||
const LOOPSINFO& currentLoop = itr.second;
|
||||
const LOOPSINFO & currentLoop = itr.second;
|
||||
JSON currentJson = json_object();
|
||||
|
||||
json_object_set_new(currentJson, "module", json_string(currentLoop.mod));
|
||||
|
@ -200,7 +200,7 @@ void LoopCacheLoad(JSON Root)
|
|||
// Module name
|
||||
const char* mod = json_string_value(json_object_get(value, "module"));
|
||||
|
||||
if (mod && strlen(mod) < MAX_MODULE_SIZE)
|
||||
if(mod && strlen(mod) < MAX_MODULE_SIZE)
|
||||
strcpy_s(loopInfo.mod, mod);
|
||||
else
|
||||
loopInfo.mod[0] = '\0';
|
||||
|
@ -213,7 +213,7 @@ void LoopCacheLoad(JSON Root)
|
|||
loopInfo.manual = Manual;
|
||||
|
||||
// Sanity check: Make sure the loop starts before it ends
|
||||
if (loopInfo.end < loopInfo.start)
|
||||
if(loopInfo.end < loopInfo.start)
|
||||
continue;
|
||||
|
||||
// Insert into global list
|
||||
|
@ -228,11 +228,11 @@ void LoopCacheLoad(JSON Root)
|
|||
const JSON jsonAutoLoops = json_object_get(Root, "autoloops");
|
||||
|
||||
// Load user-set loops
|
||||
if (jsonLoops)
|
||||
if(jsonLoops)
|
||||
AddLoops(jsonLoops, true);
|
||||
|
||||
// Load auto-set loops
|
||||
if (jsonAutoLoops)
|
||||
if(jsonAutoLoops)
|
||||
AddLoops(jsonAutoLoops, false);
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ bool LoopEnum(LOOPSINFO* List, size_t* Size)
|
|||
return true;
|
||||
}
|
||||
|
||||
for (auto& itr : loops)
|
||||
for(auto & itr : loops)
|
||||
{
|
||||
*List = itr.second;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "module.h"
|
||||
|
||||
#define PAGE_SHIFT (12)
|
||||
#define PAGE_SIZE (4096)
|
||||
//#define PAGE_SIZE (4096)
|
||||
#define PAGE_ALIGN(Va) ((ULONG_PTR)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
|
||||
#define BYTES_TO_PAGES(Size) (((Size) >> PAGE_SHIFT) + (((Size) & (PAGE_SIZE - 1)) != 0))
|
||||
#define ROUND_TO_PAGES(Size) (((ULONG_PTR)(Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
|
@ -159,30 +159,30 @@ uint MemFindBaseAddr(uint Address, uint* Size, bool Refresh)
|
|||
bool MemRead(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytesRead)
|
||||
{
|
||||
// Fast fail if address is invalid
|
||||
if (!MemIsCanonicalAddress((uint)BaseAddress))
|
||||
if(!MemIsCanonicalAddress((uint)BaseAddress))
|
||||
return false;
|
||||
|
||||
// Buffer must be supplied and size must be greater than 0
|
||||
if (!Buffer || Size <= 0)
|
||||
if(!Buffer || Size <= 0)
|
||||
return false;
|
||||
|
||||
// If the 'bytes read' parameter is null, use a temp
|
||||
SIZE_T bytesReadTemp = 0;
|
||||
|
||||
if (!NumberOfBytesRead)
|
||||
if(!NumberOfBytesRead)
|
||||
NumberOfBytesRead = &bytesReadTemp;
|
||||
|
||||
// Normal single-call read
|
||||
bool ret = MemoryReadSafe(fdProcessInfo->hProcess, BaseAddress, Buffer, Size, NumberOfBytesRead);
|
||||
|
||||
if (ret && *NumberOfBytesRead == Size)
|
||||
if(ret && *NumberOfBytesRead == Size)
|
||||
return true;
|
||||
|
||||
// Read page-by-page (Skip if only 1 page exists)
|
||||
// If (SIZE > PAGE_SIZE) or (ADDRESS exceeds boundary), multiple reads will be needed
|
||||
SIZE_T pageCount = BYTES_TO_PAGES(Size);
|
||||
|
||||
if (pageCount > 1)
|
||||
if(pageCount > 1)
|
||||
{
|
||||
// Determine the number of bytes between ADDRESS and the next page
|
||||
uint offset = 0;
|
||||
|
@ -192,11 +192,11 @@ bool MemRead(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytes
|
|||
// Reset the bytes read count
|
||||
*NumberOfBytesRead = 0;
|
||||
|
||||
for (SIZE_T i = 0; i < pageCount; i++)
|
||||
for(SIZE_T i = 0; i < pageCount; i++)
|
||||
{
|
||||
SIZE_T bytesRead = 0;
|
||||
|
||||
if (MemoryReadSafe(fdProcessInfo->hProcess, (PVOID)readBase, ((PBYTE)Buffer + offset), readSize, &bytesRead))
|
||||
if(MemoryReadSafe(fdProcessInfo->hProcess, (PVOID)readBase, ((PBYTE)Buffer + offset), readSize, &bytesRead))
|
||||
*NumberOfBytesRead += bytesRead;
|
||||
|
||||
offset += readSize;
|
||||
|
@ -214,7 +214,7 @@ bool MemRead(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytes
|
|||
bool MemWrite(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfBytesWritten)
|
||||
{
|
||||
// Fast fail if address is invalid
|
||||
if (!MemIsCanonicalAddress((uint)BaseAddress))
|
||||
if(!MemIsCanonicalAddress((uint)BaseAddress))
|
||||
return false;
|
||||
|
||||
// Buffer must be supplied and size must be greater than 0
|
||||
|
@ -237,7 +237,7 @@ bool MemWrite(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfByte
|
|||
// See: MemRead
|
||||
SIZE_T pageCount = BYTES_TO_PAGES(Size);
|
||||
|
||||
if (pageCount > 1)
|
||||
if(pageCount > 1)
|
||||
{
|
||||
// Determine the number of bytes between ADDRESS and the next page
|
||||
uint offset = 0;
|
||||
|
@ -247,11 +247,11 @@ bool MemWrite(void* BaseAddress, void* Buffer, SIZE_T Size, SIZE_T* NumberOfByte
|
|||
// Reset the bytes read count
|
||||
*NumberOfBytesWritten = 0;
|
||||
|
||||
for (SIZE_T i = 0; i < pageCount; i++)
|
||||
for(SIZE_T i = 0; i < pageCount; i++)
|
||||
{
|
||||
SIZE_T bytesWritten = 0;
|
||||
|
||||
if (MemoryWriteSafe(fdProcessInfo->hProcess, (PVOID)writeBase, ((PBYTE)Buffer + offset), writeSize, &bytesWritten))
|
||||
if(MemoryWriteSafe(fdProcessInfo->hProcess, (PVOID)writeBase, ((PBYTE)Buffer + offset), writeSize, &bytesWritten))
|
||||
*NumberOfBytesWritten += bytesWritten;
|
||||
|
||||
offset += writeSize;
|
||||
|
|
|
@ -12,7 +12,7 @@ MESSAGE_STACK* MsgAllocStack()
|
|||
// Allocate memory for the structure
|
||||
PVOID memoryBuffer = emalloc(sizeof(MESSAGE_STACK), "MsgAllocStack:memoryBuffer");
|
||||
|
||||
if (!memoryBuffer)
|
||||
if(!memoryBuffer)
|
||||
return nullptr;
|
||||
|
||||
// Use placement new to ensure all constructors are called correctly
|
||||
|
|
|
@ -17,7 +17,7 @@ std::unordered_map<uint, PATCHINFO> patches;
|
|||
bool PatchSet(uint Address, unsigned char OldByte, unsigned char NewByte)
|
||||
{
|
||||
// CHECK: Exported function
|
||||
if (!DbgIsDebugging())
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
|
||||
// Address must be valid
|
||||
|
@ -117,12 +117,12 @@ bool PatchDelete(uint Address, bool Restore)
|
|||
void PatchDelRange(uint Start, uint End, bool Restore)
|
||||
{
|
||||
// CHECK: Export call
|
||||
if (!DbgIsDebugging())
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
||||
// Are all bookmarks going to be deleted?
|
||||
// 0x00000000 - 0xFFFFFFFF
|
||||
if (Start == 0 && End == ~0)
|
||||
if(Start == 0 && End == ~0)
|
||||
{
|
||||
EXCLUSIVE_ACQUIRE(LockPatches);
|
||||
patches.clear();
|
||||
|
@ -132,7 +132,7 @@ void PatchDelRange(uint Start, uint End, bool Restore)
|
|||
// Make sure 'Start' and 'End' reference the same module
|
||||
uint moduleBase = ModBaseFromAddr(Start);
|
||||
|
||||
if (moduleBase != ModBaseFromAddr(End))
|
||||
if(moduleBase != ModBaseFromAddr(End))
|
||||
return;
|
||||
|
||||
// VA to RVA in module
|
||||
|
@ -140,13 +140,13 @@ void PatchDelRange(uint Start, uint End, bool Restore)
|
|||
End -= moduleBase;
|
||||
|
||||
EXCLUSIVE_ACQUIRE(LockPatches);
|
||||
for (auto itr = patches.begin(); itr != patches.end();)
|
||||
for(auto itr = patches.begin(); itr != patches.end();)
|
||||
{
|
||||
// [Start, End)
|
||||
if (itr->second.addr >= Start && itr->second.addr < End)
|
||||
if(itr->second.addr >= Start && itr->second.addr < End)
|
||||
{
|
||||
// Restore the original byte if necessary
|
||||
if (Restore)
|
||||
if(Restore)
|
||||
MemWrite((void*)(itr->second.addr + moduleBase), &itr->second.oldbyte, sizeof(char), nullptr);
|
||||
|
||||
itr = patches.erase(itr);
|
||||
|
@ -174,12 +174,12 @@ bool PatchEnum(PATCHINFO* List, size_t* Size)
|
|||
{
|
||||
*Size = patches.size() * sizeof(PATCHINFO);
|
||||
|
||||
if (!List)
|
||||
if(!List)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Copy each vector entry to a C-style array
|
||||
for(auto& itr : patches)
|
||||
for(auto & itr : patches)
|
||||
{
|
||||
*List = itr.second;
|
||||
List->addr += ModBaseFromName(itr.second.mod);;
|
||||
|
@ -209,11 +209,11 @@ int PatchFile(const PATCHINFO* List, int Count, const char* FileName, char* Erro
|
|||
strcpy_s(moduleName, List[0].mod);
|
||||
|
||||
// Check if all patches are in the same module
|
||||
for (int i = 0; i < Count; i++)
|
||||
for(int i = 0; i < Count; i++)
|
||||
{
|
||||
if (_stricmp(List[i].mod, moduleName))
|
||||
if(_stricmp(List[i].mod, moduleName))
|
||||
{
|
||||
if (Error)
|
||||
if(Error)
|
||||
sprintf_s(Error, MAX_ERROR_SIZE, "not all patches are in module %s", moduleName);
|
||||
|
||||
return -1;
|
||||
|
@ -255,7 +255,7 @@ int PatchFile(const PATCHINFO* List, int Count, const char* FileName, char* Erro
|
|||
DWORD loadedSize;
|
||||
HANDLE fileMap;
|
||||
ULONG_PTR fileMapVa;
|
||||
if (!StaticFileLoadW(StringUtils::Utf8ToUtf16(FileName).c_str(), UE_ACCESS_ALL, false, &fileHandle, &loadedSize, &fileMap, &fileMapVa))
|
||||
if(!StaticFileLoadW(StringUtils::Utf8ToUtf16(FileName).c_str(), UE_ACCESS_ALL, false, &fileHandle, &loadedSize, &fileMap, &fileMapVa))
|
||||
{
|
||||
strcpy_s(Error, MAX_ERROR_SIZE, "StaticFileLoad failed");
|
||||
return -1;
|
||||
|
@ -288,7 +288,7 @@ int PatchFile(const PATCHINFO* List, int Count, const char* FileName, char* Erro
|
|||
}
|
||||
|
||||
// Zero the error message and return count
|
||||
if (Error)
|
||||
if(Error)
|
||||
memset(Error, 0, MAX_ERROR_SIZE * sizeof(char));
|
||||
|
||||
return patchCount;
|
||||
|
@ -299,7 +299,7 @@ void PatchClear(const char* Module)
|
|||
EXCLUSIVE_ACQUIRE(LockPatches);
|
||||
|
||||
// Was a module specified?
|
||||
if (!Module || Module[0] == '\0')
|
||||
if(!Module || Module[0] == '\0')
|
||||
{
|
||||
// No specific entries to delete, so remove all of them
|
||||
patches.clear();
|
||||
|
@ -308,9 +308,9 @@ void PatchClear(const char* Module)
|
|||
{
|
||||
// Otherwise iterate over each patch and check the owner
|
||||
// module for the address
|
||||
for (auto itr = patches.begin(); itr != patches.end();)
|
||||
for(auto itr = patches.begin(); itr != patches.end();)
|
||||
{
|
||||
if (!_stricmp(itr->second.mod, Module))
|
||||
if(!_stricmp(itr->second.mod, Module))
|
||||
itr = patches.erase(itr);
|
||||
else
|
||||
itr++;
|
||||
|
|
|
@ -353,7 +353,7 @@ void plugincbcall(CBTYPE cbType, void* callbackInfo)
|
|||
if(pluginCallbackList.at(i).cbType == cbType)
|
||||
{
|
||||
CBPLUGIN cbPlugin = pluginCallbackList.at(i).cbPlugin;
|
||||
if(!IsBadReadPtr((const void *)cbPlugin, sizeof(uint)))
|
||||
if(!IsBadReadPtr((const void*)cbPlugin, sizeof(uint)))
|
||||
cbPlugin(cbType, callbackInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent
|
|||
uint scanSize = regionSize;
|
||||
|
||||
// Otherwise use custom boundaries if size was supplied
|
||||
if (Size)
|
||||
if(Size)
|
||||
{
|
||||
uint maxsize = Size - (Address - regionBase);
|
||||
|
||||
|
@ -53,7 +53,7 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent
|
|||
char fullName[deflen];
|
||||
char moduleName[MAX_MODULE_SIZE];
|
||||
|
||||
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);
|
||||
|
@ -77,7 +77,7 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent
|
|||
Callback(0, 0, &refInfo);
|
||||
|
||||
//concurrency::parallel_for(uint(0), scanSize, [&](uint i)
|
||||
for (uint i = 0; i < scanSize;)
|
||||
for(uint i = 0; i < scanSize;)
|
||||
{
|
||||
// Print the progress every 4096 bytes
|
||||
if((i % 0x1000) == 0)
|
||||
|
|
|
@ -101,7 +101,7 @@ void SymUpdateModuleList()
|
|||
|
||||
// Create a new array to be sent to the GUI thread
|
||||
size_t moduleCount = modList.size();
|
||||
SYMBOLMODULEINFO *data = (SYMBOLMODULEINFO *)BridgeAlloc(moduleCount * sizeof(SYMBOLMODULEINFO));
|
||||
SYMBOLMODULEINFO* data = (SYMBOLMODULEINFO*)BridgeAlloc(moduleCount * sizeof(SYMBOLMODULEINFO));
|
||||
|
||||
// Direct copy from std::vector data
|
||||
memcpy(data, modList.data(), moduleCount * sizeof(SYMBOLMODULEINFO));
|
||||
|
@ -267,10 +267,10 @@ bool SymGetSourceLine(uint Cip, char* FileName, int* Line)
|
|||
*Line = lineInfo.LineNumber;
|
||||
|
||||
// Copy file name if requested
|
||||
if (FileName)
|
||||
if(FileName)
|
||||
{
|
||||
// Check if it was a full path
|
||||
if (lineInfo.FileName[1] == ':' && lineInfo.FileName[2] == '\\')
|
||||
if(lineInfo.FileName[1] == ':' && lineInfo.FileName[2] == '\\')
|
||||
{
|
||||
// Success: no more parsing
|
||||
strcpy_s(FileName, MAX_STRING_SIZE, lineInfo.FileName);
|
||||
|
@ -282,13 +282,13 @@ bool SymGetSourceLine(uint Cip, char* FileName, int* Line)
|
|||
memset(&modInfo, 0, sizeof(IMAGEHLP_MODULE64));
|
||||
modInfo.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
|
||||
|
||||
if (!SafeSymGetModuleInfo64(fdProcessInfo->hProcess, Cip, &modInfo))
|
||||
if(!SafeSymGetModuleInfo64(fdProcessInfo->hProcess, Cip, &modInfo))
|
||||
return false;
|
||||
|
||||
// Strip the full path, leaving only the file name
|
||||
char* fileName = strrchr(modInfo.LoadedPdbName, '\\');
|
||||
|
||||
if (fileName)
|
||||
if(fileName)
|
||||
fileName[1] = '\0';
|
||||
|
||||
// Copy back to the caller's buffer
|
||||
|
|
|
@ -164,12 +164,12 @@ DWORD ThreadGetLastError(DWORD ThreadId)
|
|||
SHARED_ACQUIRE(LockThreads);
|
||||
|
||||
TEB teb;
|
||||
for (auto & entry : threadList)
|
||||
for(auto & entry : threadList)
|
||||
{
|
||||
if (entry.ThreadId != ThreadId)
|
||||
if(entry.ThreadId != ThreadId)
|
||||
continue;
|
||||
|
||||
if (!ThreadGetTeb(entry.ThreadLocalBase, &teb))
|
||||
if(!ThreadGetTeb(entry.ThreadLocalBase, &teb))
|
||||
{
|
||||
// TODO: Assert (Why would the TEB fail?)
|
||||
return 0;
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
#ifdef _DEBUG
|
||||
// TODO: Assert that the lock count is zero on destructor
|
||||
if (m_LockCount > 0)
|
||||
if(m_LockCount > 0)
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ void varfree()
|
|||
// because there are sub-allocations
|
||||
VAR_VALUE emptyValue;
|
||||
|
||||
for (auto& itr : variables)
|
||||
for(auto & itr : variables)
|
||||
varsetvalue(&itr.second, &emptyValue);
|
||||
|
||||
// Now clear all vector elements
|
||||
|
|
|
@ -162,22 +162,22 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Intel C++ Compiler XE 15.0</PlatformToolset>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Intel C++ Compiler XE 15.0</PlatformToolset>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Intel C++ Compiler XE 15.0</PlatformToolset>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Intel C++ Compiler XE 15.0</PlatformToolset>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -20,8 +20,8 @@ limitations under the License.
|
|||
#ifdef _MSC_VER
|
||||
#include <float.h>
|
||||
#define isnan _isnan
|
||||
#define INFINITY (DBL_MAX + DBL_MAX)
|
||||
#define NAN (INFINITY-INFINITY)
|
||||
//#define INFINITY (DBL_MAX + DBL_MAX)
|
||||
//#define NAN (INFINITY-INFINITY)
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
|
|
|
@ -306,7 +306,7 @@ void MemoryMapView::followDisassemblerSlot()
|
|||
|
||||
// If there was no address loaded, the length
|
||||
// will only be the command length
|
||||
if (commandText.length() <= 8)
|
||||
if(commandText.length() <= 8)
|
||||
return;
|
||||
|
||||
DbgCmdExecDirect(commandText.toUtf8().constData());
|
||||
|
|
Loading…
Reference in New Issue