DBG: removed more redundant parameters
This commit is contained in:
parent
7a5ad909a4
commit
2d213b88e9
|
@ -16,7 +16,7 @@ AnalysisPass::AnalysisPass(uint VirtualStart, uint VirtualEnd, BBlockArray & Mai
|
|||
m_DataSize = VirtualEnd - VirtualStart;
|
||||
m_Data = (unsigned char*)BridgeAlloc(m_DataSize);
|
||||
|
||||
if(!MemRead(VirtualStart, m_Data, m_DataSize, nullptr))
|
||||
if(!MemRead(VirtualStart, m_Data, m_DataSize))
|
||||
{
|
||||
BridgeFree(m_Data);
|
||||
assert(false);
|
||||
|
|
|
@ -50,7 +50,7 @@ FunctionPass::FunctionPass(uint VirtualStart, uint VirtualEnd, BBlockArray & Mai
|
|||
m_FunctionInfo = BridgeAlloc(m_FunctionInfoSize);
|
||||
|
||||
if(m_FunctionInfo)
|
||||
MemRead(virtualOffset + m_ModuleStart, m_FunctionInfo, m_FunctionInfoSize, nullptr);
|
||||
MemRead(virtualOffset + m_ModuleStart, m_FunctionInfo, m_FunctionInfoSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void FunctionPass::AnalysisWorker(uint Start, uint End, std::vector<FunctionDef>
|
|||
if(blockItr->GetFlag(BASIC_BLOCK_FLAG_INDIRPTR))
|
||||
{
|
||||
// Read it from memory
|
||||
if(!MemRead(destination, &destination, sizeof(uint), nullptr))
|
||||
if(!MemRead(destination, &destination, sizeof(uint)))
|
||||
continue;
|
||||
|
||||
// Validity check
|
||||
|
|
|
@ -41,7 +41,7 @@ extern "C" DLL_EXPORT bool _dbg_memread(duint addr, unsigned char* dest, duint s
|
|||
|
||||
extern "C" DLL_EXPORT bool _dbg_memwrite(duint addr, const unsigned char* src, duint size, duint* written)
|
||||
{
|
||||
return MemWrite(addr, (void*)src, size, written);
|
||||
return MemWrite(addr, src, size, written);
|
||||
}
|
||||
|
||||
extern "C" DLL_EXPORT bool _dbg_memmap(MEMMAP* memmap)
|
||||
|
@ -134,7 +134,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
|||
if(disasmfast(addr, &basicinfo) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
|
||||
{
|
||||
uint val = 0;
|
||||
if(MemRead(basicinfo.memory.value, &val, sizeof(val), 0))
|
||||
if(MemRead(basicinfo.memory.value, &val, sizeof(val)))
|
||||
{
|
||||
if(SafeSymFromAddr(fdProcessInfo->hProcess, (DWORD64)val, &displacement, pSymbol) && !displacement)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ SCRIPT_EXPORT duint Script::Pattern::Find(unsigned char* data, duint datasize, c
|
|||
SCRIPT_EXPORT duint Script::Pattern::FindMem(duint start, duint size, const char* pattern)
|
||||
{
|
||||
Memory<unsigned char*> data(size, "Script::Pattern::FindMem::data");
|
||||
if(!MemRead(start, data(), size, nullptr))
|
||||
if(!MemRead(start, data(), size))
|
||||
return -1;
|
||||
return Pattern::Find(data(), data.size(), pattern) + start;
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ SCRIPT_EXPORT void Script::Pattern::Write(unsigned char* data, duint datasize, c
|
|||
SCRIPT_EXPORT void Script::Pattern::WriteMem(duint start, duint size, const char* pattern)
|
||||
{
|
||||
Memory<unsigned char*> data(size, "Script::Pattern::WriteMem::data");
|
||||
if(!MemRead(start, data(), data.size(), nullptr))
|
||||
if(!MemRead(start, data(), data.size()))
|
||||
return;
|
||||
patternwrite(data(), data.size(), pattern);
|
||||
MemWrite(start, data(), data.size(), nullptr);
|
||||
MemWrite(start, data(), data.size());
|
||||
}
|
||||
|
||||
SCRIPT_EXPORT bool Script::Pattern::SearchAndReplace(unsigned char* data, duint datasize, const char* searchpattern, const char* replacepattern)
|
||||
|
@ -37,12 +37,12 @@ SCRIPT_EXPORT bool Script::Pattern::SearchAndReplace(unsigned char* data, duint
|
|||
SCRIPT_EXPORT bool Script::Pattern::SearchAndReplaceMem(duint start, duint size, const char* searchpattern, const char* replacepattern)
|
||||
{
|
||||
Memory<unsigned char*> data(size, "Script::Pattern::SearchAndReplaceMem::data");
|
||||
if(!MemRead(start, data(), size, nullptr))
|
||||
if(!MemRead(start, data(), size))
|
||||
return false;
|
||||
duint found = patternfind(data(), data.size(), searchpattern);
|
||||
if(found == -1)
|
||||
return false;
|
||||
patternwrite(data() + found, data.size() - found, replacepattern);
|
||||
MemWrite((start + found), data() + found, data.size() - found, nullptr);
|
||||
MemWrite((start + found), data() + found, data.size() - found);
|
||||
return true;
|
||||
}
|
|
@ -154,14 +154,14 @@ bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum)
|
|||
VirtualQueryEx(fdProcessInfo->hProcess, (const void*)base, &mbi, sizeof(mbi));
|
||||
uint size = mbi.RegionSize;
|
||||
Memory<void*> buffer(size, "apienumexports:buffer");
|
||||
if(!MemRead(base, buffer(), size, 0))
|
||||
if(!MemRead(base, buffer(), size))
|
||||
return false;
|
||||
IMAGE_NT_HEADERS* pnth = (IMAGE_NT_HEADERS*)((uint)buffer() + GetPE32DataFromMappedFile((ULONG_PTR)buffer(), 0, UE_PE_OFFSET));
|
||||
uint export_dir_rva = pnth->OptionalHeader.DataDirectory[0].VirtualAddress;
|
||||
uint export_dir_size = pnth->OptionalHeader.DataDirectory[0].Size;
|
||||
IMAGE_EXPORT_DIRECTORY export_dir;
|
||||
memset(&export_dir, 0, sizeof(export_dir));
|
||||
MemRead((export_dir_rva + base), &export_dir, sizeof(export_dir), 0);
|
||||
MemRead((export_dir_rva + base), &export_dir, sizeof(export_dir));
|
||||
unsigned int NumberOfNames = export_dir.NumberOfNames;
|
||||
if(!export_dir.NumberOfFunctions || !NumberOfNames) //no named exports
|
||||
return false;
|
||||
|
@ -170,28 +170,28 @@ bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum)
|
|||
uint original_name_va = export_dir.Name + base;
|
||||
char original_name[deflen] = "";
|
||||
memset(original_name, 0, sizeof(original_name));
|
||||
MemRead(original_name_va, original_name, deflen, 0);
|
||||
MemRead(original_name_va, original_name, deflen);
|
||||
char* AddrOfFunctions_va = (char*)(export_dir.AddressOfFunctions + base); //not a valid local pointer
|
||||
char* AddrOfNames_va = (char*)(export_dir.AddressOfNames + base); //not a valid local pointer
|
||||
char* AddrOfNameOrdinals_va = (char*)(export_dir.AddressOfNameOrdinals + base); //not a valid local pointer
|
||||
for(DWORD i = 0; i < NumberOfNames; i++)
|
||||
{
|
||||
DWORD curAddrOfName = 0;
|
||||
MemRead((uint)(AddrOfNames_va + sizeof(DWORD)*i), &curAddrOfName, sizeof(DWORD), 0);
|
||||
MemRead((uint)(AddrOfNames_va + sizeof(DWORD)*i), &curAddrOfName, sizeof(DWORD));
|
||||
char* cur_name_va = (char*)(curAddrOfName + base);
|
||||
char cur_name[deflen] = "";
|
||||
memset(cur_name, 0, deflen);
|
||||
MemRead((uint)cur_name_va, cur_name, deflen, 0);
|
||||
MemRead((uint)cur_name_va, cur_name, deflen);
|
||||
WORD curAddrOfNameOrdinals = 0;
|
||||
MemRead((uint)(AddrOfNameOrdinals_va + sizeof(WORD)*i), &curAddrOfNameOrdinals, sizeof(WORD), 0);
|
||||
MemRead((uint)(AddrOfNameOrdinals_va + sizeof(WORD)*i), &curAddrOfNameOrdinals, sizeof(WORD));
|
||||
DWORD curFunctionRva = 0;
|
||||
MemRead((uint)(AddrOfFunctions_va + sizeof(DWORD)*curAddrOfNameOrdinals), &curFunctionRva, sizeof(DWORD), 0);
|
||||
MemRead((uint)(AddrOfFunctions_va + sizeof(DWORD)*curAddrOfNameOrdinals), &curFunctionRva, sizeof(DWORD));
|
||||
|
||||
if(curFunctionRva >= export_dir_rva && curFunctionRva < export_dir_rva + export_dir_size)
|
||||
{
|
||||
char forwarded_api[deflen] = "";
|
||||
memset(forwarded_api, 0, deflen);
|
||||
MemRead((curFunctionRva + base), forwarded_api, deflen, 0);
|
||||
MemRead((curFunctionRva + base), forwarded_api, deflen);
|
||||
int len = (int)strlen(forwarded_api);
|
||||
int j = 0;
|
||||
while(forwarded_api[j] != '.' && j < len)
|
||||
|
|
|
@ -6,7 +6,7 @@ Analysis::Analysis(uint base, uint size)
|
|||
_base = base;
|
||||
_size = size;
|
||||
_data = new unsigned char[_size + MAX_DISASM_BUFFER];
|
||||
MemRead(_base, _data, _size, 0);
|
||||
MemRead(_base, _data, _size);
|
||||
}
|
||||
|
||||
Analysis::~Analysis()
|
||||
|
|
|
@ -67,12 +67,12 @@ bool assembleat(uint addr, const char* instruction, int* size, char* error, bool
|
|||
if(size)
|
||||
*size = destSize;
|
||||
|
||||
bool ret = MemPatch(addr, dest, destSize, 0);
|
||||
bool ret = MemPatch(addr, dest, destSize);
|
||||
if(ret && fillnop && nopsize)
|
||||
{
|
||||
if(size)
|
||||
*size += nopsize;
|
||||
if(!MemPatch((addr + destSize), nops, nopsize, 0))
|
||||
if(!MemPatch((addr + destSize), nops, nopsize))
|
||||
ret = false;
|
||||
}
|
||||
GuiUpdatePatches();
|
||||
|
|
|
@ -569,7 +569,7 @@ static unsigned char getCIPch()
|
|||
{
|
||||
unsigned char ch = 0x90;
|
||||
uint cip = GetContextDataEx(hActiveThread, UE_CIP);
|
||||
MemRead(cip, &ch, 1, 0);
|
||||
MemRead(cip, &ch, 1);
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
@ -965,7 +965,7 @@ static void cbOutputDebugString(OUTPUT_DEBUG_STRING_INFO* DebugString)
|
|||
if(!DebugString->fUnicode) //ASCII
|
||||
{
|
||||
Memory<char*> DebugText(DebugString->nDebugStringLength + 1, "cbOutputDebugString:DebugText");
|
||||
if(MemRead((uint)DebugString->lpDebugStringData, DebugText(), DebugString->nDebugStringLength, 0))
|
||||
if(MemRead((uint)DebugString->lpDebugStringData, DebugText(), DebugString->nDebugStringLength))
|
||||
{
|
||||
String str = String(DebugText());
|
||||
if(str != lastDebugText) //fix for every string being printed twice
|
||||
|
@ -1047,7 +1047,7 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
|||
if(nameInfo.dwType == 0x1000 && nameInfo.dwFlags == 0 && ThreadIsValid(nameInfo.dwThreadID)) //passed basic checks
|
||||
{
|
||||
Memory<char*> ThreadName(MAX_THREAD_NAME_SIZE, "cbException:ThreadName");
|
||||
if(MemRead((uint)nameInfo.szName, ThreadName(), MAX_THREAD_NAME_SIZE - 1, 0))
|
||||
if(MemRead((uint)nameInfo.szName, ThreadName(), MAX_THREAD_NAME_SIZE - 1))
|
||||
{
|
||||
String ThreadNameEscaped = StringUtils::Escape(ThreadName());
|
||||
dprintf("SetThreadName(%X, \"%s\")\n", nameInfo.dwThreadID, ThreadNameEscaped.c_str());
|
||||
|
@ -1805,7 +1805,6 @@ bool dbglistprocesses(std::vector<PROCESSENTRY32>* list)
|
|||
|
||||
static bool getcommandlineaddr(uint* addr, cmdline_error_t* cmd_line_error)
|
||||
{
|
||||
SIZE_T size;
|
||||
uint pprocess_parameters;
|
||||
|
||||
cmd_line_error->addr = (uint)GetPEBLocation(fdProcessInfo->hProcess);
|
||||
|
@ -1818,7 +1817,7 @@ static bool getcommandlineaddr(uint* addr, cmdline_error_t* cmd_line_error)
|
|||
|
||||
//cast-trick to calculate the address of the remote peb field ProcessParameters
|
||||
cmd_line_error->addr = (uint) & (((PPEB) cmd_line_error->addr)->ProcessParameters);
|
||||
if(!MemRead(cmd_line_error->addr, &pprocess_parameters, sizeof(pprocess_parameters), &size))
|
||||
if(!MemRead(cmd_line_error->addr, &pprocess_parameters, sizeof(pprocess_parameters)))
|
||||
{
|
||||
cmd_line_error->type = CMDL_ERR_READ_PEBBASE;
|
||||
return false;
|
||||
|
@ -1832,11 +1831,10 @@ static bool patchcmdline(uint getcommandline, uint new_command_line, cmdline_err
|
|||
{
|
||||
uint command_line_stored = 0;
|
||||
uint aux = 0;
|
||||
SIZE_T size;
|
||||
unsigned char data[100];
|
||||
|
||||
cmd_line_error->addr = getcommandline;
|
||||
if(!MemRead(cmd_line_error->addr, & data, sizeof(data), & size))
|
||||
if(!MemRead(cmd_line_error->addr, & data, sizeof(data)))
|
||||
{
|
||||
cmd_line_error->type = CMDL_ERR_READ_GETCOMMANDLINEBASE;
|
||||
return false;
|
||||
|
@ -1870,7 +1868,7 @@ static bool patchcmdline(uint getcommandline, uint new_command_line, cmdline_err
|
|||
#endif
|
||||
|
||||
//update the pointer in the debuggee
|
||||
if(!MemWrite(command_line_stored, &new_command_line, sizeof(new_command_line), &size))
|
||||
if(!MemWrite(command_line_stored, &new_command_line, sizeof(new_command_line)))
|
||||
{
|
||||
cmd_line_error->addr = command_line_stored;
|
||||
cmd_line_error->type = CMDL_ERR_WRITE_GETCOMMANDLINESTORED;
|
||||
|
@ -1913,7 +1911,6 @@ bool dbgsetcmdline(const char* cmd_line, cmdline_error_t* cmd_line_error)
|
|||
{
|
||||
cmdline_error_t cmd_line_error_aux;
|
||||
UNICODE_STRING new_command_line;
|
||||
SIZE_T size;
|
||||
uint command_line_addr;
|
||||
|
||||
if(cmd_line_error == NULL)
|
||||
|
@ -1946,14 +1943,14 @@ bool dbgsetcmdline(const char* cmd_line, cmdline_error_t* cmd_line_error)
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!MemWrite(mem, new_command_line.Buffer, new_command_line.Length, &size))
|
||||
if(!MemWrite(mem, new_command_line.Buffer, new_command_line.Length))
|
||||
{
|
||||
cmd_line_error->addr = mem;
|
||||
cmd_line_error->type = CMDL_ERR_WRITE_UNICODE_COMMANDLINE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!MemWrite((mem + new_command_line.Length), (void*)cmd_line, strlen(cmd_line) + 1, &size))
|
||||
if(!MemWrite((mem + new_command_line.Length), (void*)cmd_line, strlen(cmd_line) + 1))
|
||||
{
|
||||
cmd_line_error->addr = mem + new_command_line.Length;
|
||||
cmd_line_error->type = CMDL_ERR_WRITE_ANSI_COMMANDLINE;
|
||||
|
@ -1964,7 +1961,7 @@ bool dbgsetcmdline(const char* cmd_line, cmdline_error_t* cmd_line_error)
|
|||
return false;
|
||||
|
||||
new_command_line.Buffer = (PWSTR) mem;
|
||||
if(!MemWrite(command_line_addr, &new_command_line, sizeof(new_command_line), &size))
|
||||
if(!MemWrite(command_line_addr, &new_command_line, sizeof(new_command_line)))
|
||||
{
|
||||
cmd_line_error->addr = command_line_addr;
|
||||
cmd_line_error->type = CMDL_ERR_WRITE_PEBUNICODE_COMMANDLINE;
|
||||
|
@ -1976,7 +1973,6 @@ bool dbgsetcmdline(const char* cmd_line, cmdline_error_t* cmd_line_error)
|
|||
|
||||
bool dbggetcmdline(char** cmd_line, cmdline_error_t* cmd_line_error)
|
||||
{
|
||||
SIZE_T size;
|
||||
UNICODE_STRING CommandLine;
|
||||
cmdline_error_t cmd_line_error_aux;
|
||||
|
||||
|
@ -1986,7 +1982,7 @@ bool dbggetcmdline(char** cmd_line, cmdline_error_t* cmd_line_error)
|
|||
if(!getcommandlineaddr(&cmd_line_error->addr, cmd_line_error))
|
||||
return false;
|
||||
|
||||
if(!MemRead(cmd_line_error->addr, &CommandLine, sizeof(CommandLine), &size))
|
||||
if(!MemRead(cmd_line_error->addr, &CommandLine, sizeof(CommandLine)))
|
||||
{
|
||||
cmd_line_error->type = CMDL_ERR_READ_PROCPARM_PTR;
|
||||
return false;
|
||||
|
@ -1995,7 +1991,7 @@ bool dbggetcmdline(char** cmd_line, cmdline_error_t* cmd_line_error)
|
|||
Memory<wchar_t*> wstr_cmd(CommandLine.Length + sizeof(wchar_t));
|
||||
|
||||
cmd_line_error->addr = (uint) CommandLine.Buffer;
|
||||
if(!MemRead(cmd_line_error->addr, wstr_cmd(), CommandLine.Length, &size))
|
||||
if(!MemRead(cmd_line_error->addr, wstr_cmd(), CommandLine.Length))
|
||||
{
|
||||
cmd_line_error->type = CMDL_ERR_READ_PROCPARM_CMDLINE;
|
||||
return false;
|
||||
|
|
|
@ -238,7 +238,7 @@ CMDRESULT cbDebugSetBPX(int argc, char* argv[]) //bp addr [,name [,type]]
|
|||
dprintf("Error setting breakpoint at "fhex"! (IsBPXEnabled)\n", addr);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
else if(!MemRead(addr, &oldbytes, sizeof(short), 0))
|
||||
else if(!MemRead(addr, &oldbytes, sizeof(short)))
|
||||
{
|
||||
dprintf("Error setting breakpoint at "fhex"! (memread)\n", addr);
|
||||
return STATUS_ERROR;
|
||||
|
@ -1897,7 +1897,7 @@ CMDRESULT cbDebugLoadLib(int argc, char* argv[])
|
|||
return STATUS_ERROR;
|
||||
}
|
||||
|
||||
if(!MemWrite(DLLNameMem, argv[1], strlen(argv[1]), NULL))
|
||||
if(!MemWrite(DLLNameMem, argv[1], strlen(argv[1])))
|
||||
{
|
||||
dprintf("Error: couldn't write process memory");
|
||||
return STATUS_ERROR;
|
||||
|
|
|
@ -103,7 +103,7 @@ bool disasmfast(unsigned char* data, uint addr, BASIC_INSTRUCTION_INFO* basicinf
|
|||
bool disasmfast(uint addr, BASIC_INSTRUCTION_INFO* basicinfo)
|
||||
{
|
||||
unsigned int data[16];
|
||||
if(!MemRead(addr, data, sizeof(data), nullptr))
|
||||
if(!MemRead(addr, data, sizeof(data)))
|
||||
return false;
|
||||
return disasmfast((unsigned char*)data, addr, basicinfo);
|
||||
}
|
|
@ -278,7 +278,7 @@ bool disasmispossiblestring(uint addr)
|
|||
{
|
||||
unsigned char data[11];
|
||||
memset(data, 0, sizeof(data));
|
||||
if(!MemRead(addr, data, sizeof(data) - 3, 0))
|
||||
if(!MemRead(addr, data, sizeof(data) - 3))
|
||||
return false;
|
||||
uint test = 0;
|
||||
memcpy(&test, data, sizeof(uint));
|
||||
|
@ -294,7 +294,7 @@ bool disasmgetstringat(uint addr, STRING_TYPE* type, char* ascii, char* unicode,
|
|||
if(!disasmispossiblestring(addr))
|
||||
return false;
|
||||
Memory<unsigned char*> data((maxlen + 1) * 2, "disasmgetstringat:data");
|
||||
if(!MemRead(addr, data(), (maxlen + 1) * 2, 0))
|
||||
if(!MemRead(addr, data(), (maxlen + 1) * 2))
|
||||
return false;
|
||||
uint test = 0;
|
||||
memcpy(&test, data(), sizeof(uint));
|
||||
|
@ -388,7 +388,7 @@ int disasmgetsize(uint addr, unsigned char* data)
|
|||
int disasmgetsize(uint addr)
|
||||
{
|
||||
char data[MAX_DISASM_BUFFER];
|
||||
if(!MemRead(addr, data, sizeof(data), 0))
|
||||
if(!MemRead(addr, data, sizeof(data)))
|
||||
return 1;
|
||||
return disasmgetsize(addr, (unsigned char*)data);
|
||||
}
|
|
@ -187,7 +187,7 @@ CMDRESULT cbInstrMov(int argc, char* argv[])
|
|||
data()[j] = res;
|
||||
}
|
||||
//Move data to destination
|
||||
if(!MemWrite(dest, data(), data.size(), 0))
|
||||
if(!MemWrite(dest, data(), data.size()))
|
||||
{
|
||||
dprintf("failed to write to "fhex"\n", dest);
|
||||
return STATUS_ERROR;
|
||||
|
@ -1067,7 +1067,7 @@ CMDRESULT cbInstrCopystr(int argc, char* argv[])
|
|||
dprintf("invalid address \"%s\"!\n", argv[1]);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
if(!MemPatch(addr, string(), strlen(string()), 0))
|
||||
if(!MemPatch(addr, string(), strlen(string())))
|
||||
{
|
||||
dputs("memwrite failed!");
|
||||
return STATUS_ERROR;
|
||||
|
@ -1105,7 +1105,7 @@ CMDRESULT cbInstrFind(int argc, char* argv[])
|
|||
return STATUS_ERROR;
|
||||
}
|
||||
Memory<unsigned char*> data(size, "cbInstrFind:data");
|
||||
if(!MemRead(base, data(), size, 0))
|
||||
if(!MemRead(base, data(), size))
|
||||
{
|
||||
dputs("failed to read memory!");
|
||||
return STATUS_ERROR;
|
||||
|
@ -1157,7 +1157,7 @@ CMDRESULT cbInstrFindAll(int argc, char* argv[])
|
|||
return STATUS_ERROR;
|
||||
}
|
||||
Memory<unsigned char*> data(size, "cbInstrFindAll:data");
|
||||
if(!MemRead(base, data(), size, 0))
|
||||
if(!MemRead(base, data(), size))
|
||||
{
|
||||
dputs("failed to read memory!");
|
||||
return STATUS_ERROR;
|
||||
|
@ -1217,7 +1217,7 @@ CMDRESULT cbInstrFindAll(int argc, char* argv[])
|
|||
if(findData)
|
||||
{
|
||||
Memory<unsigned char*> printData(searchpattern.size(), "cbInstrFindAll:printData");
|
||||
MemRead(result, printData(), printData.size(), 0);
|
||||
MemRead(result, printData(), printData.size());
|
||||
for(size_t j = 0, k = 0; j < printData.size(); j++)
|
||||
{
|
||||
if(j)
|
||||
|
@ -1712,7 +1712,7 @@ CMDRESULT cbInstrYara(int argc, char* argv[])
|
|||
base = addr;
|
||||
}
|
||||
Memory<uint8_t*> data(size);
|
||||
if(!MemRead(base, data(), size, 0))
|
||||
if(!MemRead(base, data(), size))
|
||||
{
|
||||
dprintf("failed to read memory page %p[%X]!\n", base, size);
|
||||
return STATUS_ERROR;
|
||||
|
@ -1842,7 +1842,7 @@ CMDRESULT cbInstrCapstone(int argc, char* argv[])
|
|||
}
|
||||
|
||||
unsigned char data[16];
|
||||
if(!MemRead(addr, data, sizeof(data), 0))
|
||||
if(!MemRead(addr, data, sizeof(data)))
|
||||
{
|
||||
dprintf("could not read memory at %p\n", addr);
|
||||
return STATUS_ERROR;
|
||||
|
@ -1963,7 +1963,7 @@ CMDRESULT cbInstrVisualize(int argc, char* argv[])
|
|||
uint _base = start;
|
||||
uint _size = maxaddr - start;
|
||||
Memory<unsigned char*> _data(_size);
|
||||
MemRead(_base, _data(), _size, nullptr);
|
||||
MemRead(_base, _data(), _size);
|
||||
FunctionClear();
|
||||
|
||||
//linear search with some trickery
|
||||
|
|
|
@ -290,7 +290,7 @@ bool MemPatch(uint BaseAddress, const void* Buffer, uint Size, uint* NumberOfByt
|
|||
// Allocate the memory
|
||||
Memory<unsigned char*> oldData(Size, "mempatch:oldData");
|
||||
|
||||
if(!MemRead(BaseAddress, oldData(), Size, nullptr))
|
||||
if(!MemRead(BaseAddress, oldData(), Size))
|
||||
{
|
||||
// If no memory can be read, no memory can be written. Fail out
|
||||
// of this function.
|
||||
|
@ -306,7 +306,7 @@ bool MemPatch(uint BaseAddress, const void* Buffer, uint Size, uint* NumberOfByt
|
|||
bool MemIsValidReadPtr(uint Address)
|
||||
{
|
||||
unsigned char a = 0;
|
||||
return MemRead(Address, &a, sizeof(unsigned char), nullptr);
|
||||
return MemRead(Address, &a, sizeof(unsigned char));
|
||||
}
|
||||
|
||||
bool MemIsCanonicalAddress(uint Address)
|
||||
|
|
|
@ -106,7 +106,7 @@ bool PatchDelete(uint Address, bool Restore)
|
|||
|
||||
// Restore the original byte at this address
|
||||
if(Restore)
|
||||
MemWrite((found->second.addr + ModBaseFromAddr(Address)), &found->second.oldbyte, sizeof(char), nullptr);
|
||||
MemWrite((found->second.addr + ModBaseFromAddr(Address)), &found->second.oldbyte, sizeof(char));
|
||||
|
||||
// Finally remove it from the list
|
||||
patches.erase(found);
|
||||
|
@ -147,7 +147,7 @@ void PatchDelRange(uint Start, uint End, bool Restore)
|
|||
{
|
||||
// Restore the original byte if necessary
|
||||
if(Restore)
|
||||
MemWrite((currentPatch.addr + moduleBase), ¤tPatch.oldbyte, sizeof(char), nullptr);
|
||||
MemWrite((currentPatch.addr + moduleBase), ¤tPatch.oldbyte, sizeof(char));
|
||||
|
||||
itr = patches.erase(itr);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ int RefFind(uint Address, uint Size, CBREF Callback, void* UserData, bool Silent
|
|||
// Allocate and read a buffer from the remote process
|
||||
Memory<unsigned char*> data(scanSize, "reffind:data");
|
||||
|
||||
if(!MemRead(scanStart, data(), scanSize, nullptr))
|
||||
if(!MemRead(scanStart, data(), scanSize))
|
||||
{
|
||||
if(!Silent)
|
||||
dprintf("Error reading memory in reference search\n");
|
||||
|
|
|
@ -15,7 +15,7 @@ bool stackcommentget(uint addr, STACK_COMMENT* comment)
|
|||
{
|
||||
uint data = 0;
|
||||
memset(comment, 0, sizeof(STACK_COMMENT));
|
||||
MemRead(addr, &data, sizeof(uint), 0);
|
||||
MemRead(addr, &data, sizeof(uint));
|
||||
if(!MemIsValidReadPtr(data)) //the stack value is no pointer
|
||||
return false;
|
||||
|
||||
|
@ -25,7 +25,7 @@ bool stackcommentget(uint addr, STACK_COMMENT* comment)
|
|||
if(readStart < base)
|
||||
readStart = base;
|
||||
unsigned char disasmData[256];
|
||||
MemRead(readStart, disasmData, sizeof(disasmData), 0);
|
||||
MemRead(readStart, disasmData, sizeof(disasmData));
|
||||
uint prev = disasmback(disasmData, 0, sizeof(disasmData), data - readStart, 1);
|
||||
uint previousInstr = readStart + prev;
|
||||
|
||||
|
@ -126,7 +126,7 @@ void stackgetcallstack(uint csp, CALLSTACK* callstack)
|
|||
while(i != stackbase + stacksize)
|
||||
{
|
||||
uint data = 0;
|
||||
MemRead(i, &data, sizeof(uint), 0);
|
||||
MemRead(i, &data, sizeof(uint));
|
||||
if(MemIsValidReadPtr(data)) //the stack value is a pointer
|
||||
{
|
||||
uint size = 0;
|
||||
|
@ -135,7 +135,7 @@ void stackgetcallstack(uint csp, CALLSTACK* callstack)
|
|||
if(readStart < base)
|
||||
readStart = base;
|
||||
unsigned char disasmData[256];
|
||||
MemRead(readStart, disasmData, sizeof(disasmData), 0);
|
||||
MemRead(readStart, disasmData, sizeof(disasmData));
|
||||
uint prev = disasmback(disasmData, 0, sizeof(disasmData), data - readStart, 1);
|
||||
uint previousInstr = readStart + prev;
|
||||
BASIC_INSTRUCTION_INFO basicinfo;
|
||||
|
|
|
@ -126,7 +126,7 @@ bool ThreadGetTeb(uint TEBAddress, TEB* Teb)
|
|||
//
|
||||
memset(Teb, 0, sizeof(TEB));
|
||||
|
||||
return MemRead(TEBAddress, Teb, sizeof(TEB), nullptr);
|
||||
return MemRead(TEBAddress, Teb, sizeof(TEB));
|
||||
}
|
||||
|
||||
int ThreadGetSuspendCount(HANDLE Thread)
|
||||
|
|
|
@ -1550,7 +1550,7 @@ bool valfromstring_noexpr(const char* string, uint* value, bool silent, bool bas
|
|||
}
|
||||
uint addr = *value;
|
||||
*value = 0;
|
||||
if(!MemRead(addr, value, read_size, 0))
|
||||
if(!MemRead(addr, value, read_size))
|
||||
{
|
||||
if(!silent)
|
||||
dputs("failed to read memory");
|
||||
|
@ -2151,7 +2151,7 @@ bool valtostring(const char* string, uint value, bool silent)
|
|||
return false;
|
||||
}
|
||||
uint value_ = value;
|
||||
if(!MemPatch(temp, &value_, read_size, 0))
|
||||
if(!MemPatch(temp, &value_, read_size))
|
||||
{
|
||||
if(!silent)
|
||||
dputs("failed to write memory");
|
||||
|
|
Loading…
Reference in New Issue