1
0
Fork 0

DBG+GUI+BRIDGE+PROJECT: updated AStyle and formatting

This commit is contained in:
mrexodia 2017-03-16 03:32:09 +01:00
parent 033a495925
commit d5e578ee6a
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
62 changed files with 264 additions and 289 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,30 +1,5 @@
# hooks
This contains two binaries `AStyleWhore.exe` and `AStyle.dll` to format any code before you commit. They are signed with GPG.
This contains two binaries `AStyleWhore.exe` and `AStyle.dll` to format any code before you commit. They are signed with the serial number `37 ba b6 0f 84 53 0e 5e e5 76 ba d2 6d 45 4b 58`.
To verify:
```
gpg --verify AStyle.dll.sig AStyle.dll
gpg: Signature made 07/08/16 06:01:39 W. Europe Daylight Time using RSA key ID AA0073B4
gpg: Good signature from "Duncan Ogilvie <mr.exodia.tpodt@gmail.com>" [ultimate]
gpg --verify AStyleWhore.exe.sig AStyleWhore.exe
gpg: Signature made 07/08/16 06:01:42 W. Europe Daylight Time using RSA key ID AA0073B4
gpg: Good signature from "Duncan Ogilvie <mr.exodia.tpodt@gmail.com>" [ultimate]
```
The *key ID* should match the last 8 characters of the signature of [this commit](https://github.com/x64dbg/x64dbg/commit/c855c15fd79870312ea5b4a1fbf3cb0dd8ae6240).
Git hashes are:
```
git ls-files -s
100644 6ef20910c6ab4e94cc2270e289a5b73d712c9c50 0 AStyle.dll
100644 5ea8a5daf0580e030406cedb83fb73ca9c187138 0 AStyle.dll.sig
100644 10dd63522b059eb3a43c01b35b807a9d50b5034d 0 AStyleWhore.exe
100644 d910d7ff178703b1452bc717491e5c24b9db1945 0 AStyleWhore.exe.sig
100644 0706138f1ec594c0b5d41978900b9d45cd2d99d7 0 pre-commit
```
If you are unsure about the integrity of the files, don't hesitate to contact me (mrexodia). The source code is available at [BitBucket](https://bitbucket.org/mrexodia/astylewhore). The version of `AStyle.dll` is compiled from `AStyle_2.04_windows.zip` which came from [Sourceforge](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.04/AStyle_2.04_windows.zip/download).
If you are unsure about the integrity of the files, don't hesitate to contact me (mrexodia). The source code is available at [BitBucket](https://bitbucket.org/mrexodia/astylewhore). The version of `AStyle.dll` is compiled from `AStyle_2.06_windows.zip` which came from [Sourceforge](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.06/AStyle_2.06_windows.zip/download).

View File

@ -54,7 +54,7 @@ public:
*/
int Count() const
{
if(_listInfo.size != _listInfo.count * sizeof(Type)) //make sure the user is using the correct type.
if(_listInfo.size != _listInfo.count * sizeof(Type)) //make sure the user is using the correct type.
__debugbreak();
return _listInfo.count;
}
@ -88,7 +88,7 @@ public:
*/
Type & operator[](size_t index) const
{
if(index >= size_t(Count())) //make sure the out-of-bounds access is caught as soon as possible.
if(index >= size_t(Count())) //make sure the out-of-bounds access is caught as soon as possible.
__debugbreak();
return Data()[index];
}

View File

@ -234,7 +234,7 @@ BRIDGE_IMPEXP bool BridgeSettingRead(int* errorLine)
}
CloseHandle(hFile);
}
if(success) //if we failed to read the file, the current settings are better than none at all
if(success) //if we failed to read the file, the current settings are better than none at all
{
EnterCriticalSection(&csIni);
int errline = 0;

@ -1 +1 @@
Subproject commit c1bf5682a05836e5f54319db92248116a4a9ccc6
Subproject commit 05adc360018b6810cb0a6bbaa247de6522bdf9c5

View File

@ -202,11 +202,11 @@ static bool getLabel(duint addr, char* label, bool noFuncOffset)
strncat_s(label, MAX_LABEL_SIZE, temp, _TRUNCATE);
}
}
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, true) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
if(disasmfast(addr, &basicinfo, true) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
{
duint val = 0;
if(MemRead(basicinfo.memory.value, &val, sizeof(val), nullptr, true))
@ -229,7 +229,7 @@ static bool getLabel(duint addr, char* label, bool noFuncOffset)
}
}
}
if(!retval) //search for module entry
if(!retval) //search for module entry
{
if(addr != 0 && ModEntryFromAddr(addr) == addr)
{
@ -825,7 +825,7 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
{
if(dbgisstopped())
{
switch(type) //ignore win events
switch(type) //ignore win events
{
//these functions are safe to call when we did not initialize yet
case DBG_DEINITIALIZE_LOCKS:

View File

@ -125,7 +125,7 @@ PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript)
PLUG_IMPEXP bool _plugin_waituntilpaused()
{
while(DbgIsDebugging() && dbgisrunning()) //wait until the debugger paused
while(DbgIsDebugging() && dbgisrunning()) //wait until the debugger paused
{
Sleep(1);
GuiProcessEvents(); //workaround for scripts being executed on the GUI thread

View File

@ -85,7 +85,7 @@ void AdvancedAnalysis::analyzeFunction(duint entryPoint, bool writedata)
{
auto start = queue.front();
queue.pop();
if(visited.count(start) || !inRange(start)) //already visited or out of range
if(visited.count(start) || !inRange(start)) //already visited or out of range
continue;
visited.insert(start);
@ -106,11 +106,11 @@ void AdvancedAnalysis::analyzeFunction(duint entryPoint, bool writedata)
for(int i = 1; i < mCp.Size(); i++)
mEncMap[node.end - mBase + i] = (byte)enc_middle;
}
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //jump
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //jump
{
//set the branch destinations
node.brtrue = mCp.BranchDestination();
if(mCp.GetId() != X86_INS_JMP) //unconditional jumps dont have a brfalse
if(mCp.GetId() != X86_INS_JMP) //unconditional jumps dont have a brfalse
node.brfalse = node.end + mCp.Size();
//add node to the function graph
@ -124,14 +124,14 @@ void AdvancedAnalysis::analyzeFunction(duint entryPoint, bool writedata)
break;
}
if(mCp.InGroup(CS_GRP_CALL)) //call
if(mCp.InGroup(CS_GRP_CALL)) //call
{
//TODO: handle no return
duint target = mCp.BranchDestination();
if(inRange(target) && mEntryPoints.find(target) == mEntryPoints.end())
mCandidateEPs.insert(target);
}
if(mCp.InGroup(CS_GRP_RET)) //return
if(mCp.InGroup(CS_GRP_RET)) //return
{
node.terminal = true;
graph.AddNode(node);

View File

@ -154,14 +154,14 @@ void ControlFlowAnalysis::BasicBlockStarts()
{
bSkipFilling = true; //skip INT3/NOP/whatever filling bytes (those are not part of the control flow)
}
else if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //branches
else if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //branches
{
auto dest1 = getReferenceOperand();
duint dest2 = 0;
if(mCp.GetId() != X86_INS_JMP) //conditional jump
if(mCp.GetId() != X86_INS_JMP) //conditional jump
dest2 = addr + mCp.Size();
if(!dest1 && !dest2) //TODO: better code for this (make sure absolutely no filling is inserted)
if(!dest1 && !dest2) //TODO: better code for this (make sure absolutely no filling is inserted)
bSkipFilling = true;
if(dest1)
mBlockStarts.insert(dest1);
@ -224,7 +224,7 @@ void ControlFlowAnalysis::BasicBlocks()
}
else
addr++;
if(addr == nextStart) //special case handling overlapping blocks
if(addr == nextStart) //special case handling overlapping blocks
{
insertBlock(BasicBlock(start, prevaddr, 0, nextStart));
insertParent(nextStart, start);
@ -263,7 +263,7 @@ void ControlFlowAnalysis::Functions()
auto parents = findParents(block->start);
if(!block->function)
{
if(!parents || mFunctionStarts.count(block->start)) //no parents = function start
if(!parents || mFunctionStarts.count(block->start)) //no parents = function start
{
auto functionStart = block->start;
block->function = functionStart;
@ -274,7 +274,7 @@ void ControlFlowAnalysis::Functions()
else //in function
{
auto function = findFunctionStart(block, parents);
if(!function) //this happens with loops / unreferenced blocks sometimes
if(!function) //this happens with loops / unreferenced blocks sometimes
delayedBlocks.push_back(DelayedBlock(block, parents));
else
block->function = function;
@ -315,7 +315,7 @@ void ControlFlowAnalysis::Functions()
for(const auto & block : mBlocks)
{
auto found = mFunctions.find(block.second.function);
if(found == mFunctions.end()) //unreferenced block
if(found == mFunctions.end()) //unreferenced block
{
unreferencedCount++;
continue;
@ -425,7 +425,7 @@ duint ControlFlowAnalysis::getReferenceOperand() const
else if(op.type == X86_OP_MEM)
{
auto dest = duint(op.mem.disp);
if(op.mem.base == X86_REG_RIP) //rip-relative
if(op.mem.base == X86_REG_RIP) //rip-relative
dest += mCp.Address() + mCp.Size();
if(inRange(dest))
return dest;

View File

@ -62,7 +62,7 @@ void LinearAnalysis::analyseFunctions()
for(size_t i = 0; i < mFunctions.size(); i++)
{
auto & function = mFunctions[i];
if(function.end) //skip already-analysed functions
if(function.end) //skip already-analysed functions
continue;
auto maxaddr = mBase + mSize;
if(i < mFunctions.size() - 1)
@ -96,19 +96,19 @@ duint LinearAnalysis::findFunctionEnd(duint start, duint maxaddr)
{
if(mCp.Disassemble(addr, translateAddr(addr), MAX_DISASM_BUFFER))
{
if(addr + mCp.Size() > maxaddr) //we went past the maximum allowed address
if(addr + mCp.Size() > maxaddr) //we went past the maximum allowed address
break;
const auto & op = mCp.x86().operands[0];
if((mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) && op.type == X86_OP_IMM) //jump
if((mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) && op.type == X86_OP_IMM) //jump
{
auto dest = duint(op.imm);
if(dest >= maxaddr) //jump across function boundaries
if(dest >= maxaddr) //jump across function boundaries
{
//currently unused
}
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
{
fardest = dest;
}
@ -117,10 +117,10 @@ duint LinearAnalysis::findFunctionEnd(duint start, duint maxaddr)
jumpback = addr;
}
}
else if(mCp.InGroup(CS_GRP_RET)) //possible function end?
else if(mCp.InGroup(CS_GRP_RET)) //possible function end?
{
end = addr;
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
break;
}
@ -137,9 +137,9 @@ duint LinearAnalysis::getReferenceOperand() const
for(auto i = 0; i < mCp.OpCount(); i++)
{
const auto & op = mCp.x86().operands[i];
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //skip jumps/loops
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //skip jumps/loops
continue;
if(op.type == X86_OP_IMM) //we are looking for immediate references
if(op.type == X86_OP_IMM) //we are looking for immediate references
{
auto dest = duint(op.imm);
if(inRange(dest))

View File

@ -120,7 +120,7 @@ void RecursiveAnalysis::analyzeFunction(duint entryPoint)
{
//set the branch destinations
node.brtrue = mCp.BranchDestination();
if(mCp.GetId() != X86_INS_JMP && mCp.GetId() != X86_INS_LJMP) //unconditional jumps dont have a brfalse
if(mCp.GetId() != X86_INS_JMP && mCp.GetId() != X86_INS_LJMP) //unconditional jumps dont have a brfalse
node.brfalse = node.end + mCp.Size();
//consider register/memory branches as terminal nodes

View File

@ -17,7 +17,7 @@ std::map<BreakpointKey, BREAKPOINT> breakpoints;
static void setBpActive(BREAKPOINT & bp)
{
if(bp.type == BPHARDWARE) //TODO: properly implement this (check debug registers)
if(bp.type == BPHARDWARE) //TODO: properly implement this (check debug registers)
bp.active = true;
else if(bp.type == BPDLL || bp.type == BPEXCEPTION)
bp.active = true;
@ -478,7 +478,7 @@ bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module, duint base)
BREAKPOINT bpInfo = j->second;
if(bpInfo.type != BPDLL && bpInfo.type != BPEXCEPTION)
{
if(base) //workaround for some Windows bullshit with compatibility mode
if(base) //workaround for some Windows bullshit with compatibility mode
bpInfo.addr += base;
else
bpInfo.addr += ModBaseFromName(bpInfo.mod);

@ -1 +1 @@
Subproject commit 90eed9913a12ef5afec007b4d91f77301b66cc76
Subproject commit d5034cf6d647e98cb01e9e1fc4efa5086f8fc6a5

View File

@ -155,12 +155,12 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
dputs(QT_TRANSLATE_NOOP("DBG", "This may take very long, depending on your network connection and data in the debug directory..."));
Memory<char*> szDefaultStore(MAX_SETTING_SIZE + 1);
const char* szSymbolStore = szDefaultStore();
if(!BridgeSettingGet("Symbols", "DefaultStore", szDefaultStore())) //get default symbol store from settings
if(!BridgeSettingGet("Symbols", "DefaultStore", szDefaultStore())) //get default symbol store from settings
{
strcpy_s(szDefaultStore(), MAX_SETTING_SIZE, "https://msdl.microsoft.com/download/symbols");
BridgeSettingSet("Symbols", "DefaultStore", szDefaultStore());
}
if(argc < 2) //no arguments
if(argc < 2) //no arguments
{
SymDownloadAllSymbols(szSymbolStore); //download symbols for all modules
GuiSymbolRefreshCurrent();
@ -181,7 +181,7 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
return false;
}
wchar_t szOldSearchPath[MAX_PATH] = L"";
if(!SafeSymGetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath, MAX_PATH)) //backup current search path
if(!SafeSymGetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath, MAX_PATH)) //backup current search path
{
dputs(QT_TRANSLATE_NOOP("DBG", "SymGetSearchPath failed!"));
return false;
@ -190,12 +190,12 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
if(argc > 2)
szSymbolStore = argv[2];
sprintf_s(szServerSearchPath, "SRV*%s*%s", szSymbolCachePath, szSymbolStore);
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(szServerSearchPath).c_str())) //set new search path
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(szServerSearchPath).c_str())) //set new search path
{
dputs(QT_TRANSLATE_NOOP("DBG", "SymSetSearchPath (1) failed!"));
return false;
}
if(!SafeSymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)modbase)) //unload module
if(!SafeSymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)modbase)) //unload module
{
SafeSymSetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath);
dputs(QT_TRANSLATE_NOOP("DBG", "SymUnloadModule64 failed!"));
@ -203,7 +203,7 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
}
auto symOptions = SafeSymGetOptions();
SafeSymSetOptions(symOptions & ~SYMOPT_IGNORE_CVREC);
if(!SymLoadModuleExW(fdProcessInfo->hProcess, 0, wszModulePath, 0, (DWORD64)modbase, 0, 0, 0)) //load module
if(!SymLoadModuleExW(fdProcessInfo->hProcess, 0, wszModulePath, 0, (DWORD64)modbase, 0, 0, 0)) //load module
{
dputs(QT_TRANSLATE_NOOP("DBG", "SymLoadModuleEx failed!"));
SafeSymSetOptions(symOptions);
@ -405,7 +405,7 @@ bool cbInstrExinfo(int argc, char* argv[])
dputs_untranslated("EXCEPTION_DEBUG_INFO:");
dprintf_untranslated(" dwFirstChance: %X\n", info.dwFirstChance);
auto exceptionName = ExceptionCodeToName(record.ExceptionCode);
if(!exceptionName.size()) //if no exception was found, try the error codes (RPC_S_*)
if(!exceptionName.size()) //if no exception was found, try the error codes (RPC_S_*)
exceptionName = ErrorCodeToName(record.ExceptionCode);
if(exceptionName.size())
dprintf_untranslated(" ExceptionCode: %08X (%s)\n", record.ExceptionCode, exceptionName.c_str());

View File

@ -142,14 +142,14 @@ bool cbDebugSetBPX(int argc, char* argv[]) //bp addr [,name [,type]]
bool cbDebugDeleteBPX(int argc, char* argv[])
{
if(argc < 2) //delete all breakpoints
if(argc < 2) //delete all breakpoints
{
if(!BpGetCount(BPNORMAL))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No breakpoints to delete!"));
return true;
}
if(!BpEnumAll(cbDeleteAllBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDeleteAllBreakpoints)) //at least one deletion failed
{
GuiUpdateAllViews();
return false;
@ -159,7 +159,7 @@ bool cbDebugDeleteBPX(int argc, char* argv[])
return true;
}
BREAKPOINT found;
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
{
if(!BpDelete(found.addr, BPNORMAL))
{
@ -177,7 +177,7 @@ bool cbDebugDeleteBPX(int argc, char* argv[])
return true;
}
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
return false;
@ -202,21 +202,21 @@ bool cbDebugDeleteBPX(int argc, char* argv[])
bool cbDebugEnableBPX(int argc, char* argv[])
{
if(argc < 2) //enable all breakpoints
if(argc < 2) //enable all breakpoints
{
if(!BpGetCount(BPNORMAL))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No breakpoints to enable!"));
return true;
}
if(!BpEnumAll(cbEnableAllBreakpoints)) //at least one enable failed
if(!BpEnumAll(cbEnableAllBreakpoints)) //at least one enable failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All breakpoints enabled!"));
GuiUpdateAllViews();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
{
if(!SetBPX(found.addr, found.titantype, (void*)cbUserBreakpoint))
{
@ -232,7 +232,7 @@ bool cbDebugEnableBPX(int argc, char* argv[])
return true;
}
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
return false;
@ -260,21 +260,21 @@ bool cbDebugEnableBPX(int argc, char* argv[])
bool cbDebugDisableBPX(int argc, char* argv[])
{
if(argc < 2) //delete all breakpoints
if(argc < 2) //delete all breakpoints
{
if(!BpGetCount(BPNORMAL))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No breakpoints to disable!"));
return true;
}
if(!BpEnumAll(cbDisableAllBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDisableAllBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All breakpoints disabled!"));
GuiUpdateAllViews();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
{
if(!BpEnable(found.addr, BPNORMAL, false))
{
@ -293,7 +293,7 @@ bool cbDebugDisableBPX(int argc, char* argv[])
return true;
}
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
return false;
@ -475,21 +475,21 @@ bool cbDebugSetHardwareBreakpoint(int argc, char* argv[])
bool cbDebugDeleteHardwareBreakpoint(int argc, char* argv[])
{
if(argc < 2) //delete all breakpoints
if(argc < 2) //delete all breakpoints
{
if(!BpGetCount(BPHARDWARE))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No hardware breakpoints to delete!"));
return true;
}
if(!BpEnumAll(cbDeleteAllHardwareBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDeleteAllHardwareBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All hardware breakpoints deleted!"));
GuiUpdateAllViews();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPHARDWARE, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPHARDWARE, argv[1], &found)) //found a breakpoint with name
{
if(!BpDelete(found.addr, BPHARDWARE))
{
@ -504,7 +504,7 @@ bool cbDebugDeleteHardwareBreakpoint(int argc, char* argv[])
return true;
}
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such hardware breakpoint \"%s\"\n"), argv[1]);
return false;
@ -532,14 +532,14 @@ bool cbDebugEnableHardwareBreakpoint(int argc, char* argv[])
dputs(QT_TRANSLATE_NOOP("DBG", "You can only set 4 hardware breakpoints"));
return false;
}
if(argc < 2) //enable all hardware breakpoints
if(argc < 2) //enable all hardware breakpoints
{
if(!BpGetCount(BPHARDWARE))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No hardware breakpoints to enable!"));
return true;
}
if(!BpEnumAll(cbEnableAllHardwareBreakpoints)) //at least one enable failed
if(!BpEnumAll(cbEnableAllHardwareBreakpoints)) //at least one enable failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All hardware breakpoints enabled!"));
GuiUpdateAllViews();
@ -547,7 +547,7 @@ bool cbDebugEnableHardwareBreakpoint(int argc, char* argv[])
}
BREAKPOINT found;
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such hardware breakpoint \"%s\"\n"), argv[1]);
return false;
@ -577,14 +577,14 @@ bool cbDebugEnableHardwareBreakpoint(int argc, char* argv[])
bool cbDebugDisableHardwareBreakpoint(int argc, char* argv[])
{
if(argc < 2) //delete all hardware breakpoints
if(argc < 2) //delete all hardware breakpoints
{
if(!BpGetCount(BPHARDWARE))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No hardware breakpoints to disable!"));
return true;
}
if(!BpEnumAll(cbDisableAllHardwareBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDisableAllHardwareBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All hardware breakpoints disabled!"));
GuiUpdateAllViews();
@ -592,7 +592,7 @@ bool cbDebugDisableHardwareBreakpoint(int argc, char* argv[])
}
BREAKPOINT found;
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such hardware breakpoint \"%s\"\n"), argv[1]);
return false;
@ -744,21 +744,21 @@ bool cbDebugSetMemoryBpx(int argc, char* argv[])
bool cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
{
if(argc < 2) //delete all breakpoints
if(argc < 2) //delete all breakpoints
{
if(!BpGetCount(BPMEMORY))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No memory breakpoints to delete!"));
return true;
}
if(!BpEnumAll(cbDeleteAllMemoryBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDeleteAllMemoryBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All memory breakpoints deleted!"));
GuiUpdateAllViews();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPMEMORY, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPMEMORY, argv[1], &found)) //found a breakpoint with name
{
duint size;
MemFindBaseAddr(found.addr, &size);
@ -775,7 +775,7 @@ bool cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
return true;
}
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such memory breakpoint \"%s\"\n"), argv[1]);
return false;
@ -799,14 +799,14 @@ bool cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
bool cbDebugEnableMemoryBreakpoint(int argc, char* argv[])
{
if(argc < 2) //enable all memory breakpoints
if(argc < 2) //enable all memory breakpoints
{
if(!BpGetCount(BPMEMORY))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No memory breakpoints to enable!"));
return true;
}
if(!BpEnumAll(cbEnableAllMemoryBreakpoints)) //at least one enable failed
if(!BpEnumAll(cbEnableAllMemoryBreakpoints)) //at least one enable failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All memory breakpoints enabled!"));
GuiUpdateAllViews();
@ -814,7 +814,7 @@ bool cbDebugEnableMemoryBreakpoint(int argc, char* argv[])
}
BREAKPOINT found;
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such memory breakpoint \"%s\"\n"), argv[1]);
return false;
@ -844,14 +844,14 @@ bool cbDebugEnableMemoryBreakpoint(int argc, char* argv[])
bool cbDebugDisableMemoryBreakpoint(int argc, char* argv[])
{
if(argc < 2) //disable all memory breakpoints
if(argc < 2) //disable all memory breakpoints
{
if(!BpGetCount(BPMEMORY))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No memory breakpoints to disable!"));
return true;
}
if(!BpEnumAll(cbDisableAllMemoryBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDisableAllMemoryBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All memory breakpoints disabled!"));
GuiUpdateAllViews();
@ -859,7 +859,7 @@ bool cbDebugDisableMemoryBreakpoint(int argc, char* argv[])
}
BREAKPOINT found;
duint addr = 0;
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such memory breakpoint \"%s\"\n"), argv[1]);
return false;
@ -984,7 +984,7 @@ bool cbDebugBcDll(int argc, char* argv[])
dputs(QT_TRANSLATE_NOOP("DBG", "No DLL breakpoints to delete!"));
return true;
}
if(!BpEnumAll(cbDeleteAllDllBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDeleteAllDllBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All DLL breakpoints deleted!"));
DebugUpdateBreakpointsViewAsync();
@ -1010,14 +1010,14 @@ bool cbDebugBcDll(int argc, char* argv[])
bool cbDebugBpDllEnable(int argc, char* argv[])
{
if(argc < 2) //disable all DLL breakpoints
if(argc < 2) //disable all DLL breakpoints
{
if(!BpGetCount(BPDLL))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No DLL breakpoints to enable!"));
return true;
}
if(!BpEnumAll(cbEnableAllDllBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbEnableAllDllBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All DLL breakpoints enabled!"));
GuiUpdateAllViews();
@ -1025,7 +1025,7 @@ bool cbDebugBpDllEnable(int argc, char* argv[])
}
BREAKPOINT found;
duint addr = 0;
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such DLL breakpoint \"%s\"\n"), argv[1]);
return false;
@ -1051,14 +1051,14 @@ bool cbDebugBpDllEnable(int argc, char* argv[])
bool cbDebugBpDllDisable(int argc, char* argv[])
{
if(argc < 2) //disable all DLL breakpoints
if(argc < 2) //disable all DLL breakpoints
{
if(!BpGetCount(BPDLL))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No DLL breakpoints to disable!"));
return true;
}
if(!BpEnumAll(cbDisableAllDllBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDisableAllDllBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All DLL breakpoints disabled!"));
GuiUpdateAllViews();
@ -1066,7 +1066,7 @@ bool cbDebugBpDllDisable(int argc, char* argv[])
}
BREAKPOINT found;
duint addr = 0;
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such DLL breakpoint \"%s\"\n"), argv[1]);
return false;
@ -1183,14 +1183,14 @@ bool cbDebugDeleteExceptionBPX(int argc, char* argv[])
dputs(QT_TRANSLATE_NOOP("DBG", "No exception breakpoints to delete!"));
return true;
}
if(!BpEnumAll(cbDeleteAllExceptionBreakpoints)) //at least one enable failed
if(!BpEnumAll(cbDeleteAllExceptionBreakpoints)) //at least one enable failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All exception breakpoints deleted!"));
DebugUpdateBreakpointsViewAsync();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
{
if(!BpDelete(found.addr, BPEXCEPTION))
{
@ -1200,7 +1200,7 @@ bool cbDebugDeleteExceptionBPX(int argc, char* argv[])
return true;
}
duint addr = 0;
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such exception breakpoint \"%s\"\n"), argv[1]);
return false;
@ -1217,21 +1217,21 @@ bool cbDebugDeleteExceptionBPX(int argc, char* argv[])
bool cbDebugEnableExceptionBPX(int argc, char* argv[])
{
if(argc < 2) //enable all breakpoints
if(argc < 2) //enable all breakpoints
{
if(!BpGetCount(BPEXCEPTION))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No exception breakpoints to enable!"));
return true;
}
if(!BpEnumAll(cbEnableAllExceptionBreakpoints)) //at least one enable failed
if(!BpEnumAll(cbEnableAllExceptionBreakpoints)) //at least one enable failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All exception breakpoints enabled!"));
DebugUpdateBreakpointsViewAsync();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
{
if(!BpEnable(found.addr, BPEXCEPTION, true))
{
@ -1242,7 +1242,7 @@ bool cbDebugEnableExceptionBPX(int argc, char* argv[])
return true;
}
duint addr = 0;
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such exception breakpoint \"%s\"\n"), argv[1]);
return false;
@ -1265,21 +1265,21 @@ bool cbDebugEnableExceptionBPX(int argc, char* argv[])
bool cbDebugDisableExceptionBPX(int argc, char* argv[])
{
if(argc < 2) //disable all breakpoints
if(argc < 2) //disable all breakpoints
{
if(!BpGetCount(BPEXCEPTION))
{
dputs(QT_TRANSLATE_NOOP("DBG", "No exception breakpoints to disable!"));
return true;
}
if(!BpEnumAll(cbDisableAllExceptionBreakpoints)) //at least one deletion failed
if(!BpEnumAll(cbDisableAllExceptionBreakpoints)) //at least one deletion failed
return false;
dputs(QT_TRANSLATE_NOOP("DBG", "All exception breakpoints disabled!"));
GuiUpdateAllViews();
return true;
}
BREAKPOINT found;
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
{
if(!BpEnable(found.addr, BPEXCEPTION, false))
{
@ -1290,7 +1290,7 @@ bool cbDebugDisableExceptionBPX(int argc, char* argv[])
return true;
}
duint addr = 0;
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such exception breakpoint \"%s\"\n"), argv[1]);
return false;

View File

@ -134,7 +134,7 @@ bool cbDebugStop(int argc, char* argv[])
//history
HistoryClear();
DWORD BeginTick = GetTickCount();
while(waitislocked(WAITID_STOP)) //custom waiting
while(waitislocked(WAITID_STOP)) //custom waiting
{
unlock(WAITID_RUN);
Sleep(100);

View File

@ -26,7 +26,7 @@ static bool ReadWriteVariable(const char* varname, const std::function<bool(duin
if(!isvar || !valtostring(varname, set_value, true))
{
duint value;
if(valfromstring(varname, &value)) //if the var is a value already it's an invalid destination
if(valfromstring(varname, &value)) //if the var is a value already it's an invalid destination
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid variable \"%s\"\n"), varname);
return false;
@ -288,7 +288,7 @@ bool cbInstrCmp(int argc, char* argv[])
ezflag = 1;
else
ezflag = 0;
if(valuesignedcalc()) //signed comparision
if(valuesignedcalc()) //signed comparision
{
if((dsint)arg1 < (dsint)arg2)
bsflag = 0;
@ -313,7 +313,7 @@ bool cbInstrMov(int argc, char* argv[])
if(IsArgumentsLessThan(argc, 3))
return false;
String srcText = argv[2];
if(srcText[0] == '#' && srcText[srcText.length() - 1] == '#') //handle mov addr, #DATA#
if(srcText[0] == '#' && srcText[srcText.length() - 1] == '#') //handle mov addr, #DATA#
{
//do some checks on the data
String dataText = srcText.substr(1, srcText.length() - 2);
@ -355,7 +355,7 @@ bool cbInstrMov(int argc, char* argv[])
if(!isvar || !valtostring(argv[1], set_value, true))
{
duint value;
if(valfromstring(argv[1], &value)) //if the var is a value already it's an invalid destination
if(valfromstring(argv[1], &value)) //if the var is a value already it's an invalid destination
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid dest \"%s\"\n"), argv[1]);
return false;

View File

@ -37,12 +37,12 @@ bool cbInstrLog(int argc, char* argv[])
dputs_untranslated(msg);
scriptlog(msg);
};
if(argc == 1) //just log newline
if(argc == 1) //just log newline
{
logputs("");
return true;
}
if(argc == 2) //inline logging: log "format {rax}"
if(argc == 2) //inline logging: log "format {rax}"
{
logputs(stringformatinline(argv[1]).c_str());
}

View File

@ -284,7 +284,7 @@ bool cbInstrFindAllMem(int argc, char* argv[])
static bool cbFindAsm(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
{
if(!disasm || !basicinfo) //initialize
if(!disasm || !basicinfo) //initialize
{
GuiReferenceInitialize(refinfo->name);
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
@ -372,7 +372,7 @@ struct VALUERANGE
static bool cbRefFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
{
if(!disasm || !basicinfo) //initialize
if(!disasm || !basicinfo) //initialize
{
GuiReferenceInitialize(refinfo->name);
GuiReferenceAddColumn(sizeof(duint) * 2, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
@ -454,7 +454,7 @@ bool cbInstrRefFindRange(int argc, char* argv[])
static bool cbRefStr(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
{
if(!disasm || !basicinfo) //initialize
if(!disasm || !basicinfo) //initialize
{
GuiReferenceInitialize(refinfo->name);
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
@ -467,7 +467,7 @@ static bool cbRefStr(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINF
}
bool found = false;
char string[MAX_STRING_SIZE] = "";
if(basicinfo->branch) //branches have no strings (jmp dword [401000])
if(basicinfo->branch) //branches have no strings (jmp dword [401000])
return false;
auto addRef = [&]()
{
@ -524,7 +524,7 @@ bool cbInstrRefStr(int argc, char* argv[])
static bool cbModCallFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
{
if(!disasm || !basicinfo) //initialize
if(!disasm || !basicinfo) //initialize
{
GuiReferenceInitialize(refinfo->name);
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
@ -537,7 +537,7 @@ static bool cbModCallFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, R
bool found = false;
char label[MAX_LABEL_SIZE] = "";
char module[MAX_MODULE_SIZE] = "";
if(basicinfo->call) //we are looking for calls
if(basicinfo->call) //we are looking for calls
{
duint ptr = basicinfo->addr > 0 ? basicinfo->addr : basicinfo->memory.value;
found = DbgGetLabelAt(ptr, SEG_DEFAULT, label) && !LabelGet(ptr, label) && !strstr(label, "sub_") && DbgGetModuleAt(ptr, module); //a non-user label
@ -674,7 +674,7 @@ struct GUIDRefInfo
static bool cbGUIDFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
{
if(!disasm || !basicinfo) //initialize
if(!disasm || !basicinfo) //initialize
{
GuiReferenceInitialize(refinfo->name);
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
@ -942,7 +942,7 @@ static int yaraScanCallback(int message, void* message_data, void* user_data)
pattern = yara_print_string(match->data, match->match_length);
auto offset = duint(match->base + match->offset);
duint addr;
if(scanInfo->rawFile) //convert raw offset to virtual offset
if(scanInfo->rawFile) //convert raw offset to virtual offset
addr = valfileoffsettova(scanInfo->modname, offset);
else
addr = base + offset;
@ -1019,7 +1019,7 @@ bool cbInstrYara(int argc, char* argv[])
base = addr;
}
std::vector<unsigned char> rawFileData;
if(rawFile) //read the file from disk
if(rawFile) //read the file from disk
{
char modPath[MAX_PATH] = "";
if(!ModPathFromAddr(base, modPath, MAX_PATH))
@ -1055,7 +1055,7 @@ bool cbInstrYara(int argc, char* argv[])
if(yr_compiler_create(&yrCompiler) == ERROR_SUCCESS)
{
yr_compiler_set_callback(yrCompiler, yaraCompilerCallback, 0);
if(yr_compiler_add_string(yrCompiler, rulesContent.c_str(), nullptr) == 0) //no errors found
if(yr_compiler_add_string(yrCompiler, rulesContent.c_str(), nullptr) == 0) //no errors found
{
YR_RULES* yrRules;
if(yr_compiler_get_rules(yrCompiler, &yrRules) == ERROR_SUCCESS)

View File

@ -50,7 +50,7 @@ bool cbDebugSwitchthread(int argc, char* argv[])
if(argc > 1)
if(!valfromstring(argv[1], &threadid, false))
return false;
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
return false;
@ -72,7 +72,7 @@ bool cbDebugSuspendthread(int argc, char* argv[])
if(argc > 1)
if(!valfromstring(argv[1], &threadid, false))
return false;
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
return false;
@ -94,7 +94,7 @@ bool cbDebugResumethread(int argc, char* argv[])
if(argc > 1)
if(!valfromstring(argv[1], &threadid, false))
return false;
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
return false;
@ -120,7 +120,7 @@ bool cbDebugKillthread(int argc, char* argv[])
if(argc > 2)
if(!valfromstring(argv[2], &exitcode, false))
return false;
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
return false;
@ -184,7 +184,7 @@ bool cbDebugSetPriority(int argc, char* argv[])
}
else
{
switch((int)priority) //check if the priority value is valid
switch((int)priority) //check if the priority value is valid
{
case THREAD_PRIORITY_NORMAL:
case THREAD_PRIORITY_ABOVE_NORMAL:
@ -199,7 +199,7 @@ bool cbDebugSetPriority(int argc, char* argv[])
return false;
}
}
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
return false;

View File

@ -19,7 +19,7 @@ bool cbBadCmd(int argc, char* argv[])
int valsize = 0;
bool isvar = false;
bool hexonly = false;
if(valfromstring(*argv, &value, false, false, &valsize, &isvar, &hexonly, true)) //dump variable/value/register/etc
if(valfromstring(*argv, &value, false, false, &valsize, &isvar, &hexonly, true)) //dump variable/value/register/etc
{
varset("$ans", value, true);
if(valsize)
@ -30,11 +30,11 @@ bool cbBadCmd(int argc, char* argv[])
auto symbolic = SymGetSymbolicName(value);
if(symbolic.length())
symbolic = " " + symbolic;
if(isvar) // and *cmd!='.' and *cmd!='x') //prevent stupid 0=0 stuff
if(isvar) // and *cmd!='.' and *cmd!='x') //prevent stupid 0=0 stuff
{
if(value > 9 && !hexonly)
{
if(!valuesignedcalc()) //signed numbers
if(!valuesignedcalc()) //signed numbers
#ifdef _WIN64
sprintf_s(format_str, "%%s=%%.%dllX (%%llud)%%s\n", valsize); // TODO: This and the following statements use "%llX" for a "int"-typed variable. Maybe we can use "%X" everywhere?
#else //x86
@ -58,7 +58,7 @@ bool cbBadCmd(int argc, char* argv[])
{
if(value > 9 && !hexonly)
{
if(!valuesignedcalc()) //signed numbers
if(!valuesignedcalc()) //signed numbers
#ifdef _WIN64
sprintf_s(format_str, "%%s=%%.%dllX (%%llud)%%s\n", valsize);
#else //x86
@ -354,31 +354,31 @@ bool cbInstrVisualize(int argc, char* argv[])
const unsigned char* curData = (addr >= _base && addr < _base + _size) ? _data() + (addr - _base) : nullptr;
if(_cp.Disassemble(addr, curData, MAX_DISASM_BUFFER))
{
if(addr + _cp.Size() > maxaddr) //we went past the maximum allowed address
if(addr + _cp.Size() > maxaddr) //we went past the maximum allowed address
break;
const cs_x86_op & operand = _cp.x86().operands[0];
if((_cp.InGroup(CS_GRP_JUMP) || _cp.IsLoop()) && operand.type == X86_OP_IMM) //jump
if((_cp.InGroup(CS_GRP_JUMP) || _cp.IsLoop()) && operand.type == X86_OP_IMM) //jump
{
duint dest = (duint)operand.imm;
if(dest >= maxaddr) //jump across function boundaries
if(dest >= maxaddr) //jump across function boundaries
{
//currently unused
}
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
{
fardest = dest;
}
else if(end && dest < end && _cp.GetId() == X86_INS_JMP) //save the last JMP backwards
else if(end && dest < end && _cp.GetId() == X86_INS_JMP) //save the last JMP backwards
{
jumpback = addr;
}
}
else if(_cp.InGroup(CS_GRP_RET)) //possible function end?
else if(_cp.InGroup(CS_GRP_RET)) //possible function end?
{
end = addr;
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
break;
}

View File

@ -641,7 +641,7 @@ static void printSoftBpInfo(const BREAKPOINT & bp)
static void printHwBpInfo(const BREAKPOINT & bp)
{
const char* bpsize = "";
switch(TITANGETSIZE(bp.titantype)) //size
switch(TITANGETSIZE(bp.titantype)) //size
{
case UE_HARDWARE_SIZE_1:
bpsize = "byte, ";
@ -659,7 +659,7 @@ static void printHwBpInfo(const BREAKPOINT & bp)
#endif //_WIN64
}
char* bptype;
switch(TITANGETTYPE(bp.titantype)) //type
switch(TITANGETTYPE(bp.titantype)) //type
{
case UE_HARDWARE_EXECUTE:
bptype = _strdup(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "execute")));
@ -765,9 +765,9 @@ static void printExceptionBpInfo(const BREAKPOINT & bp, duint CIP)
static bool getConditionValue(const char* expression)
{
auto word = *(uint16*)expression;
if(word == '0') // short circuit for condition "0\0"
if(word == '0') // short circuit for condition "0\0"
return false;
if(word == '1') //short circuit for condition "1\0"
if(word == '1') //short circuit for condition "1\0"
return true;
duint value;
if(valfromstring(expression, &value))
@ -862,7 +862,7 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr
default:
break;
}
if(!(bpPtr && bpPtr->enabled)) //invalid / disabled breakpoint hit (most likely a bug)
if(!(bpPtr && bpPtr->enabled)) //invalid / disabled breakpoint hit (most likely a bug)
{
if(bptype != BPDLL || !BpUpdateDllPath(reinterpret_cast<const char*>(ExceptionAddress), &bpPtr))
{
@ -899,7 +899,7 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr
breakCondition = getConditionValue(bp.breakCondition);
else
breakCondition = true; //break if no condition is set
if(bp.fastResume && !breakCondition) // fast resume: ignore GUI/Script/Plugin/Other if the debugger would not break
if(bp.fastResume && !breakCondition) // fast resume: ignore GUI/Script/Plugin/Other if the debugger would not break
return;
if(*bp.logCondition)
logCondition = getConditionValue(bp.logCondition);
@ -929,11 +929,11 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr
// Update breakpoint view
DebugUpdateBreakpointsViewAsync();
if(*bp.logText && logCondition) //log
if(*bp.logText && logCondition) //log
{
dprintf_untranslated("%s\n", stringformatinline(bp.logText).c_str());
}
if(*bp.commandText && commandCondition) //command
if(*bp.commandText && commandCondition) //command
{
//TODO: commands like run/step etc will fuck up your shit
varset("$breakpointcondition", breakCondition ? 1 : 0, false);
@ -951,7 +951,7 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr
breakCondition = false;
}
}
if(breakCondition) //break the debugger
if(breakCondition) //break the debugger
{
dbgsetforeground();
dbgsetskipexceptions(false);
@ -1860,7 +1860,7 @@ static void cbOutputDebugString(OUTPUT_DEBUG_STRING_INFO* DebugString)
if(MemRead((duint)DebugString->lpDebugStringData, DebugText(), DebugString->nDebugStringLength))
{
String str = String(DebugText());
if(str != lastDebugText) //fix for every string being printed twice
if(str != lastDebugText) //fix for every string being printed twice
{
if(str != "\n")
dprintf(QT_TRANSLATE_NOOP("DBG", "DebugString: \"%s\"\n"), StringUtils::Escape(str).c_str());
@ -1977,7 +1977,7 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
if(bVerboseExceptionLogging)
DbgCmdExecDirect("exinfo"); //show extended exception information
auto exceptionName = ExceptionCodeToName(ExceptionCode);
if(!exceptionName.size()) //if no exception was found, try the error codes (RPC_S_*)
if(!exceptionName.size()) //if no exception was found, try the error codes (RPC_S_*)
exceptionName = ErrorCodeToName(ExceptionCode);
if(ExceptionData->dwFirstChance) //first chance exception
{
@ -2134,9 +2134,9 @@ bool dbglistprocesses(std::vector<PROCESSENTRY32>* infoList, std::vector<std::st
char* nextSlash = strchr(exeNameInCmdTmp, '\\') ? strchr(exeNameInCmdTmp, '\\') :
strchr(exeNameInCmdTmp, '/') ? strchr(exeNameInCmdTmp, '/') : NULL;
if(nextSlash && posEnum.posEnum == NO_QOUTES) //if there NO_QOUTES, then the path to PE in cmdline can't contain spaces
if(nextSlash && posEnum.posEnum == NO_QOUTES) //if there NO_QOUTES, then the path to PE in cmdline can't contain spaces
{
if(strchr(exeNameInCmdTmp, ' ') < nextSlash) //slash is in arguments
if(strchr(exeNameInCmdTmp, ' ') < nextSlash) //slash is in arguments
{
peNameInCmd = exeNameInCmdTmp;
break;
@ -2146,7 +2146,7 @@ bool dbglistprocesses(std::vector<PROCESSENTRY32>* infoList, std::vector<std::st
}
else if(nextSlash && posEnum.posEnum == QOUTES_AROUND_EXE)
{
if((cmdline + posEnum.secondPos) < nextSlash) //slash is in arguments
if((cmdline + posEnum.secondPos) < nextSlash) //slash is in arguments
{
peNameInCmd = exeNameInCmdTmp;
break;
@ -2181,9 +2181,9 @@ bool dbglistprocesses(std::vector<PROCESSENTRY32>* infoList, std::vector<std::st
char* nextSlash = strchr(basicNameInCmdTmp, '\\') ? strchr(basicNameInCmdTmp, '\\') :
strchr(basicNameInCmdTmp, '/') ? strchr(basicNameInCmdTmp, '/') : NULL;
if(nextSlash && posEnum.posEnum == NO_QOUTES) //if there NO_QOUTES, then the path to PE in cmdline can't contain spaces
if(nextSlash && posEnum.posEnum == NO_QOUTES) //if there NO_QOUTES, then the path to PE in cmdline can't contain spaces
{
if(strchr(basicNameInCmdTmp, ' ') < nextSlash) //slash is in arguments
if(strchr(basicNameInCmdTmp, ' ') < nextSlash) //slash is in arguments
{
peNameInCmd = basicNameInCmdTmp;
break;
@ -2193,7 +2193,7 @@ bool dbglistprocesses(std::vector<PROCESSENTRY32>* infoList, std::vector<std::st
}
else if(nextSlash && posEnum.posEnum == QOUTES_AROUND_EXE)
{
if((cmdline + posEnum.secondPos) < nextSlash) //slash is in arguments
if((cmdline + posEnum.secondPos) < nextSlash) //slash is in arguments
{
peNameInCmd = basicNameInCmdTmp;
break;

View File

@ -72,7 +72,7 @@ void fillbasicinfo(Capstone* cp, BASIC_INSTRUCTION_INFO* basicinfo, bool instrTe
if(instrText)
strcpy_s(basicinfo->memory.mnemonic, cp->OperandText(i).c_str());
basicinfo->memory.size = MEMORY_SIZE(op.size);
if(op.mem.base == X86_REG_RIP) //rip-relative
if(op.mem.base == X86_REG_RIP) //rip-relative
{
basicinfo->memory.value = ULONG_PTR(cp->Address() + op.mem.disp + basicinfo->size);
basicinfo->type |= TYPE_MEMORY;

View File

@ -64,7 +64,7 @@ bool ExHandlerGetSEH(std::vector<duint> & Entries)
while(addr_ExRegRecord != 0xFFFFFFFF && MAX_DEPTH)
{
Entries.push_back(addr_ExRegRecord);
if(!MemRead(addr_ExRegRecord , &sehr, sizeof(EXCEPTION_REGISTRATION_RECORD)))
if(!MemRead(addr_ExRegRecord, &sehr, sizeof(EXCEPTION_REGISTRATION_RECORD)))
break;
addr_ExRegRecord = (duint)sehr.Next;
MAX_DEPTH--;

View File

@ -395,7 +395,7 @@ void ExpressionParser::shuntingYard()
case Token::Type::Comma:
while(true)
{
if(stack.empty()) //empty stack = problems
if(stack.empty()) //empty stack = problems
{
mIsValidExpression = false;
return;
@ -414,14 +414,14 @@ void ExpressionParser::shuntingYard()
{
while(true)
{
if(stack.empty()) //empty stack = bracket mismatch
if(stack.empty()) //empty stack = bracket mismatch
{
mIsValidExpression = false;
return;
}
auto curToken = stack[stack.size() - 1];
stack.pop_back();
if(curToken.type() == Token::Type::OpenBracket) //the bracket is already popped here
if(curToken.type() == Token::Type::OpenBracket) //the bracket is already popped here
break;
queue.push_back(curToken);
}
@ -456,7 +456,7 @@ void ExpressionParser::shuntingYard()
while(!stack.empty())
{
const auto & curToken = stack[stack.size() - 1];
if(curToken.type() == Token::Type::OpenBracket || curToken.type() == Token::Type::CloseBracket) //brackets on the stack means invalid expression
if(curToken.type() == Token::Type::OpenBracket || curToken.type() == Token::Type::CloseBracket) //brackets on the stack means invalid expression
{
mIsValidExpression = false;
return;

View File

@ -84,7 +84,7 @@ void MemUpdateMap()
else
{
// Otherwise append the page to the last created entry
if(pageVector.size()) //make sure to not dereference an invalid pointer
if(pageVector.size()) //make sure to not dereference an invalid pointer
pageVector.back().mbi.RegionSize += mbi.RegionSize;
}
}
@ -106,7 +106,7 @@ void MemUpdateMap()
for(int i = pagecount - 1; i > -1; i--)
{
auto & currentPage = pageVector.at(i);
if(!currentPage.info[0] || (scmp(curMod, currentPage.info) && !bListAllPages)) //there is a module
if(!currentPage.info[0] || (scmp(curMod, currentPage.info) && !bListAllPages)) //there is a module
continue; //skip non-modules
strcpy(curMod, pageVector.at(i).info);
if(!ModBaseFromName(currentPage.info))
@ -116,9 +116,9 @@ void MemUpdateMap()
if(!ModSectionsFromAddr(base, &sections))
continue;
int SectionNumber = (int)sections.size();
if(!SectionNumber) //no sections = skip
if(!SectionNumber) //no sections = skip
continue;
if(!bListAllPages) //normal view
if(!bListAllPages) //normal view
{
MEMPAGE newPage;
//remove the current module page (page = size of module at this point) and insert the module sections
@ -129,7 +129,7 @@ void MemUpdateMap()
memset(&newPage, 0, sizeof(MEMPAGE));
VirtualQueryEx(fdProcessInfo->hProcess, (LPCVOID)currentSection.addr, &newPage.mbi, sizeof(MEMORY_BASIC_INFORMATION));
duint SectionSize = currentSection.size;
if(SectionSize % PAGE_SIZE) //unaligned page size
if(SectionSize % PAGE_SIZE) //unaligned page size
SectionSize += PAGE_SIZE - (SectionSize % PAGE_SIZE); //fix this
if(SectionSize)
newPage.mbi.RegionSize = SectionSize;
@ -151,16 +151,16 @@ void MemUpdateMap()
const auto & currentSection = sections.at(j);
duint secStart = currentSection.addr;
duint SectionSize = currentSection.size;
if(SectionSize % PAGE_SIZE) //unaligned page size
if(SectionSize % PAGE_SIZE) //unaligned page size
SectionSize += PAGE_SIZE - (SectionSize % PAGE_SIZE); //fix this
duint secEnd = secStart + SectionSize;
if(secStart >= start && secEnd <= end) //section is inside the memory page
if(secStart >= start && secEnd <= end) //section is inside the memory page
{
if(k)
k += sprintf_s(currentPage.info + k, MAX_MODULE_SIZE - k, ",");
k += sprintf_s(currentPage.info + k, MAX_MODULE_SIZE - k, " \"%s\"", currentSection.name);
}
else if(start >= secStart && end <= secEnd) //memory page is inside the section
else if(start >= secStart && end <= secEnd) //memory page is inside the section
{
if(k)
k += sprintf_s(currentPage.info + k, MAX_MODULE_SIZE - k, ",");
@ -523,7 +523,7 @@ bool MemGetPageRights(duint Address, char* Rights)
bool MemPageRightsToString(DWORD Protect, char* Rights)
{
if(!Protect) //reserved pages don't have a protection (https://goo.gl/Izkk0c)
if(!Protect) //reserved pages don't have a protection (https://goo.gl/Izkk0c)
{
*Rights = '\0';
return true;

View File

@ -62,19 +62,19 @@ String MnemonicHelp::getUniversalMnemonic(const String & mnem)
};
if(mnemLower == "jmp")
return mnemLower;
if(mnemLower == "loop") //LOOP
if(mnemLower == "loop") //LOOP
return mnemLower;
if(startsWith("int")) //INT n
if(startsWith("int")) //INT n
return "int n";
if(startsWith("cmov")) //CMOVcc
if(startsWith("cmov")) //CMOVcc
return "cmovcc";
if(startsWith("fcmov")) //FCMOVcc
if(startsWith("fcmov")) //FCMOVcc
return "fcmovcc";
if(startsWith("j")) //Jcc
if(startsWith("j")) //Jcc
return "jcc";
if(startsWith("loop")) //LOOPcc
if(startsWith("loop")) //LOOPcc
return "loopcc";
if(startsWith("set")) //SETcc
if(startsWith("set")) //SETcc
return "setcc";
return mnemLower;
}
@ -90,7 +90,7 @@ String MnemonicHelp::getDescription(const char* mnem, int depth)
auto found = MnemonicMap.find(mnemuni);
if(found == MnemonicMap.end())
{
if(mnemuni[0] == 'v') //v/vm
if(mnemuni[0] == 'v') //v/vm
{
found = MnemonicMap.find(mnemuni.c_str() + 1);
if(found == MnemonicMap.end())
@ -100,7 +100,7 @@ String MnemonicHelp::getDescription(const char* mnem, int depth)
return "";
}
const auto & description = found->second;
if(StringUtils::StartsWith(description, "-R:")) //redirect
if(StringUtils::StartsWith(description, "-R:")) //redirect
return getDescription(description.c_str() + 3, depth + 1);
return description;
}
@ -116,12 +116,12 @@ String MnemonicHelp::getBriefDescription(const char* mnem)
auto found = MnemonicBriefMap.find(mnemLower);
if(found == MnemonicBriefMap.end())
{
if(mnemLower[0] == 'v') //v/vm
if(mnemLower[0] == 'v') //v/vm
{
found = MnemonicBriefMap.find(mnemLower.c_str() + 1);
if(found != MnemonicBriefMap.end())
{
if(mnemLower.length() > 1 && mnemLower[1] == 'm') //vm
if(mnemLower.length() > 1 && mnemLower[1] == 'm') //vm
return "vm " + found->second;
return "vector " + found->second;
}

View File

@ -151,15 +151,15 @@ bool patternsnr(unsigned char* data, size_t datasize, const char* searchpattern,
size_t patternfind(const unsigned char* data, size_t datasize, const std::vector<PatternByte> & pattern)
{
size_t searchpatternsize = pattern.size();
for(size_t i = 0, pos = 0; i < datasize; i++) //search for the pattern
for(size_t i = 0, pos = 0; i < datasize; i++) //search for the pattern
{
if(patternmatchbyte(data[i], pattern.at(pos))) //check if our pattern matches the current byte
if(patternmatchbyte(data[i], pattern.at(pos))) //check if our pattern matches the current byte
{
pos++;
if(pos == searchpatternsize) //everything matched
if(pos == searchpatternsize) //everything matched
return i - searchpatternsize + 1;
}
else if(pos > 0) //fix by Computer_Angel
else if(pos > 0) //fix by Computer_Angel
{
i -= pos;
pos = 0; //reset current pattern position

View File

@ -144,7 +144,7 @@ bool pluginload(const char* pluginName, bool loadall)
SetCurrentDirectoryW(currentDir);
return false;
}
if(pluginData.initStruct.sdkVersion < PLUG_SDKVERSION) //the plugin SDK is not compatible
if(pluginData.initStruct.sdkVersion < PLUG_SDKVERSION) //the plugin SDK is not compatible
{
dprintf(QT_TRANSLATE_NOOP("DBG", "[PLUGIN] %s is incompatible with this SDK version\n"), pluginData.initStruct.pluginName);
for(int i = CB_INITDEBUG; i < CB_LAST; i++)

View File

@ -117,7 +117,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
GuiReferenceSetProgress(percent);
}, disasmText);
}
else if(type == ALL_MODULES) // Search in all Modules
else if(type == ALL_MODULES) // Search in all Modules
{
bool initCallBack = true;
std::vector<MODINFO> modList;

View File

@ -391,7 +391,7 @@ struct AddrInfoHashMap : SerializableModuleHashMap<TLock, TValue, TSerializer>
{
this->DeleteRangeWhere(start, end, [manual](duint start, duint end, const TValue & value)
{
if(manual ? !value.manual : value.manual) //ignore non-matching entries
if(manual ? !value.manual : value.manual) //ignore non-matching entries
return false;
return value.addr >= start && value.addr < end;
});

View File

@ -175,7 +175,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);
@ -234,7 +234,7 @@ static bool scriptcreatelinemap(const char* filename)
for(int i = 0; i < linemapsize; i++)
{
auto & currentLine = linemap.at(i);
if(currentLine.type == linebranch) //invalid branch label
if(currentLine.type == linebranch) //invalid branch label
{
int labelline = scriptlabelfind(currentLine.u.branch.branchlabel);
if(!labelline) //invalid branch label

View File

@ -261,12 +261,12 @@ String stringformatinline(String format)
continue;
}
//handle actual formatting
if(format[i] == '{' && !inFormatter) //opening bracket
if(format[i] == '{' && !inFormatter) //opening bracket
{
inFormatter = true;
formatString.clear();
}
else if(format[i] == '}' && inFormatter) //closing bracket
else if(format[i] == '}' && inFormatter) //closing bracket
{
inFormatter = false;
if(formatString.length())
@ -275,7 +275,7 @@ String stringformatinline(String format)
formatString.clear();
}
}
else if(inFormatter) //inside brackets
else if(inFormatter) //inside brackets
formatString += format[i];
else //outside brackets
output += format[i];

View File

@ -53,7 +53,7 @@ String StringUtils::Escape(unsigned char ch)
case '\"':
return "\\\"";
default:
if(!isprint(ch)) //unknown unprintable character
if(!isprint(ch)) //unknown unprintable character
sprintf_s(buf, "\\x%02X", ch);
else
*buf = ch;
@ -143,7 +143,7 @@ String StringUtils::Escape(const String & s)
memcpy(buf, s.c_str() + i, UTF8CharSize);
i += UTF8CharSize - 1;
}
else if(!isprint(ch)) //unknown unprintable character
else if(!isprint(ch)) //unknown unprintable character
sprintf_s(buf, "\\x%02X", ch);
else
*buf = ch;
@ -181,7 +181,7 @@ bool StringUtils::Unescape(const String & s, String & result, bool quoted)
}
if(mLastChar == '\r' || mLastChar == '\n')
return false; //unexpected newline in string literal (1)
if(quoted && mLastChar == '\"') //end of quoted string literal
if(quoted && mLastChar == '\"') //end of quoted string literal
break;
if(mLastChar == '\\') //escape sequence
{
@ -208,7 +208,7 @@ bool StringUtils::Unescape(const String & s, String & result, bool quoted)
mLastChar = '\v';
else if(mLastChar == '0')
mLastChar = '\0';
else if(mLastChar == 'x') //\xHH
else if(mLastChar == 'x') //\xHH
{
auto ch1 = nextChar();
auto ch2 = nextChar();

View File

@ -64,7 +64,7 @@ template<class S1, class S2> struct concat;
template<unsigned... I1, unsigned... I2>
struct concat<seq<I1...>, seq<I2...>>
: seq < I1..., (sizeof...(I1) + I2)... > {};
: seq < I1..., (sizeof...(I1) + I2)... > {};
template<class S1, class S2> using Concat = Invoke<concat<S1, S2>>;

View File

@ -85,7 +85,7 @@ bool TypeManager::AddMember(const std::string & parent, const std::string & type
m.type = type;
m.offset = offset;
if(offset >= 0) //user-defined offset
if(offset >= 0) //user-defined offset
{
if(offset < s.size)
return false;
@ -363,7 +363,7 @@ bool TypeManager::visitMember(const Member & root, Visitor & visitor) const
{
if(!isDefined(t.pointto))
return false;
if(visitor.visitPtr(root, t)) //allow the visitor to bail out
if(visitor.visitPtr(root, t)) //allow the visitor to bail out
{
if(!Visit(t.pointto, "*" + root.name, visitor))
return false;

View File

@ -1607,7 +1607,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
int read_size = sizeof(duint);
int prefix_size = 1;
size_t seg_offset = 0;
if(string[1] == ':') //n:[ (number of bytes to read)
if(string[1] == ':') //n:[ (number of bytes to read)
{
prefix_size = 3;
int new_size = string[0] - '0';
@ -1617,7 +1617,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
else if(string[1] == 's' && string[2] == ':')
{
prefix_size = 4;
if(string[0] == 'f') // fs:[...]
if(string[0] == 'f') // fs:[...]
{
// TODO: get real segment offset instead of assuming them
#ifdef _WIN64
@ -1626,7 +1626,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
seg_offset = (size_t)GetTEBLocation(hActiveThread);
#endif //_WIN64
}
else if(string[0] == 'g') // gs:[...]
else if(string[0] == 'g') // gs:[...]
{
#ifdef _WIN64
seg_offset = (size_t)GetTEBLocation(hActiveThread);
@ -1670,13 +1670,13 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
*isvar = true;
return true;
}
else if(varget(string, value, value_size, 0)) //then come variables
else if(varget(string, value, value_size, 0)) //then come variables
{
if(isvar)
*isvar = true;
return true;
}
else if(isregister(string)) //register
else if(isregister(string)) //register
{
if(!DbgIsDebugging())
{
@ -1694,7 +1694,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
*isvar = true;
return true;
}
else if(*string == '_' && isflag(string + 1)) //flag
else if(*string == '_' && isflag(string + 1)) //flag
{
if(!DbgIsDebugging())
{
@ -1718,7 +1718,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
*isvar = true;
return true;
}
else if(isdecnumber(string)) //decimal numbers come 'first'
else if(isdecnumber(string)) //decimal numbers come 'first'
{
if(value_size)
*value_size = 0;
@ -1726,7 +1726,7 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
*isvar = false;
return convertNumber(string + 1, *value, 10);
}
else if(ishexnumber(string)) //then hex numbers
else if(ishexnumber(string)) //then hex numbers
{
if(value_size)
*value_size = 0;
@ -1763,13 +1763,13 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
if(baseonly)
return false;
if(valapifromstring(string, value, value_size, true, silent, hexonly)) //then come APIs
if(valapifromstring(string, value, value_size, true, silent, hexonly)) //then come APIs
return true;
else if(LabelFromString(string, value)) //then come labels
else if(LabelFromString(string, value)) //then come labels
return true;
else if(SymAddrFromName(string, value)) //then come symbols
else if(SymAddrFromName(string, value)) //then come symbols
return true;
else if(strstr(string, "sub_") == string) //then come sub_ functions
else if(strstr(string, "sub_") == string) //then come sub_ functions
{
#ifdef _WIN64
bool result = sscanf(string, "sub_%llX", value) == 1;
@ -2329,7 +2329,7 @@ bool valtostring(const char* string, duint value, bool silent)
GuiUpdateAllViews(); //repaint gui
return ok;
}
else if(*string == '_' && isflag(string + 1)) //flag
else if(*string == '_' && isflag(string + 1)) //flag
{
if(!DbgIsDebugging())
{

View File

@ -43,7 +43,7 @@ bool varset(const char* Name, VAR_VALUE* Value, bool ReadOnly)
name_ = "$";
name_ += Name;
auto found = variables.find(name_);
if(found == variables.end()) //not found
if(found == variables.end()) //not found
return false;
if(found->second.alias.length())
return varset(found->second.alias.c_str(), Value, ReadOnly);

View File

@ -711,11 +711,11 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
wchar_t** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
if(argc == 2) //1 argument (init filename)
DbgCmdExec(StringUtils::Utf16ToUtf8(StringUtils::sprintf(L"init \"%s\"", argv[1])).c_str());
else if(argc == 3) //2 arguments (init filename, cmdline)
else if(argc == 3) //2 arguments (init filename, cmdline)
DbgCmdExec(StringUtils::Utf16ToUtf8(StringUtils::sprintf(L"init \"%s\", \"%s\"", argv[1], argv[2])).c_str());
else if(argc == 4) //3 arguments (init filename, cmdline, currentdir)
else if(argc == 4) //3 arguments (init filename, cmdline, currentdir)
DbgCmdExec(StringUtils::Utf16ToUtf8(StringUtils::sprintf(L"init \"%s\", \"%s\", \"%s\"", argv[1], argv[2], argv[3])).c_str());
else if(argc == 5 && !_wcsicmp(argv[1], L"-a") && !_wcsicmp(argv[3], L"-e")) //4 arguments (JIT)
else if(argc == 5 && !_wcsicmp(argv[1], L"-a") && !_wcsicmp(argv[3], L"-e")) //4 arguments (JIT)
DbgCmdExec(StringUtils::Utf16ToUtf8(StringUtils::sprintf(L"attach .%s, .%s", argv[2], argv[4])).c_str()); //attach pid, event
LocalFree(argv);

View File

@ -124,7 +124,7 @@ typedef struct _YR_COMPILER
compiler->last_error_extra_info, \
info, \
sizeof(compiler->last_error_extra_info)); \
#define yr_compiler_set_error_extra_info_fmt(compiler, fmt, ...) \
snprintf( \

View File

@ -295,7 +295,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
for (block = iterator->first(iterator); \
block != NULL; \
block = iterator->next(iterator)) \
#define first_memory_block(context) \
(context)->iterator->first((context)->iterator)

View File

@ -389,7 +389,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
}
}
}
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, addrText);
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, addrText);
}
break;
@ -443,7 +443,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
}
int charwidth = getCharWidth();
painter->drawText(QRect(x + funcsize, y , charwidth , h), Qt::AlignVCenter | Qt::AlignLeft, indicator);
painter->drawText(QRect(x + funcsize, y, charwidth, h), Qt::AlignVCenter | Qt::AlignLeft, indicator);
funcsize += charwidth;
//draw jump arrows
@ -621,7 +621,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
width = w;
if(width)
painter->fillRect(QRect(x + argsize, y, width, h), QBrush(backgroundColor)); //fill comment color
painter->drawText(QRect(x + argsize, y , width , h), Qt::AlignVCenter | Qt::AlignLeft, comment);
painter->drawText(QRect(x + argsize, y, width, h), Qt::AlignVCenter | Qt::AlignLeft, comment);
argsize += width + 3;
}
else if(DbgGetLabelAt(cur_addr, SEG_DEFAULT, label)) // label but no comment
@ -659,7 +659,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
width = w;
if(width)
painter->fillRect(QRect(x + argsize, y, width, h), QBrush(mMnemonicBriefBackgroundColor)); //mnemonic brief background color
painter->drawText(QRect(x + argsize, y , width, h), Qt::AlignVCenter | Qt::AlignLeft, mnemBrief);
painter->drawText(QRect(x + argsize, y, width, h), Qt::AlignVCenter | Qt::AlignLeft, mnemBrief);
}
break;
}
@ -1130,7 +1130,7 @@ int Disassembly::paintJumpsGraphic(QPainter* painter, int x, int y, dsint addr,
{
QPoint wPoints[] =
{
QPoint(x , y + halfRow + 1),
QPoint(x, y + halfRow + 1),
QPoint(x + 2, y + halfRow - 1),
QPoint(x + 4, y + halfRow + 1),
};
@ -1141,7 +1141,7 @@ int Disassembly::paintJumpsGraphic(QPainter* painter, int x, int y, dsint addr,
{
QPoint wPoints[] =
{
QPoint(x , y + halfRow - 1),
QPoint(x, y + halfRow - 1),
QPoint(x + 2, y + halfRow + 1),
QPoint(x + 4, y + halfRow - 1),
};
@ -1363,7 +1363,7 @@ dsint Disassembly::getPreviousInstructionRVA(dsint rva, duint count)
mMemPage->read(wBuffer.data(), wBottomByteRealRVA, wBuffer.size());
dsint addr = mDisasm->DisassembleBack((byte_t*)wBuffer.data(), rvaToVa(wBottomByteRealRVA), wBuffer.size(), wVirtualRVA , count);
dsint addr = mDisasm->DisassembleBack((byte_t*)wBuffer.data(), rvaToVa(wBottomByteRealRVA), wBuffer.size(), wVirtualRVA, count);
addr += rva - wVirtualRVA;

View File

@ -263,7 +263,7 @@ QString SearchListViewTable::paintContent(QPainter* painter, dsint rowBase, int
}
}
}
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, text);
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, text);
text = "";
}
else if(highlightText.length() && text.contains(highlightText, Qt::CaseInsensitive))

View File

@ -343,11 +343,11 @@ QString CapstoneTokenizer::printValue(const TokenValue & value, bool expandModul
moduleText += ".";
QString addrText = ToHexString(addr);
QString finalText;
if(bHasLabel && bHasModule) //<module.label>
if(bHasLabel && bHasModule) //<module.label>
finalText = QString("<%1%2>").arg(moduleText).arg(labelText);
else if(bHasModule) //module.addr
else if(bHasModule) //module.addr
finalText = QString("%1%2").arg(moduleText).arg(addrText);
else if(bHasLabel) //<label>
else if(bHasLabel) //<label>
finalText = QString("<%1>").arg(labelText);
else
finalText = addrText;
@ -554,7 +554,7 @@ bool CapstoneTokenizer::tokenizeMemOperand(const cs_x86_op & op)
addToken(bracketsType, "[");
//stuff inside the brackets
if(mem.base == X86_REG_RIP) //rip-relative (#replacement)
if(mem.base == X86_REG_RIP) //rip-relative (#replacement)
{
duint addr = _cp.Address() + duint(mem.disp) + _cp.Size();
TokenValue value = TokenValue(op.size, addr);
@ -564,12 +564,12 @@ bool CapstoneTokenizer::tokenizeMemOperand(const cs_x86_op & op)
else //#base + #index * #scale + #displacement
{
bool prependPlus = false;
if(mem.base != X86_REG_INVALID) //base register
if(mem.base != X86_REG_INVALID) //base register
{
addToken(TokenType::MemoryBaseRegister, _cp.RegName(mem.base));
prependPlus = true;
}
if(mem.index != X86_REG_INVALID) //index register
if(mem.index != X86_REG_INVALID) //index register
{
if(prependPlus)
addMemoryOperator('+');

View File

@ -41,7 +41,7 @@ QString BreakpointsViewTable::paintContent(QPainter* painter, dsint rowBase, int
{
painter->fillRect(QRect(x, y, w, h), QBrush(mCipBackgroundColor));
painter->setPen(QPen(mCipColor));
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, bpAddrStr);
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, bpAddrStr);
ret = "";
}
}

View File

@ -117,9 +117,9 @@ void CPUDisassembly::mouseDoubleClickEvent(QMouseEvent* event)
void CPUDisassembly::addFollowReferenceMenuItem(QString name, dsint value, QMenu* menu, bool isReferences, bool isFollowInCPU)
{
foreach(QAction * action, menu->actions()) //check for duplicate action
if(action->text() == name)
return;
foreach(QAction* action, menu->actions()) //check for duplicate action
if(action->text() == name)
return;
QAction* newAction = new QAction(name, this);
newAction->setFont(QFont("Courier New", 8));
menu->addAction(newAction);
@ -488,7 +488,7 @@ void CPUDisassembly::setupRightClickContextMenu()
};
ENCODETYPE enctypeTable[] = {enc_code, enc_byte, enc_word, enc_dword, enc_fword, enc_qword, enc_tbyte, enc_oword, enc_middle,
enc_real4, enc_real8, enc_real10 , enc_middle,
enc_real4, enc_real8, enc_real10, enc_middle,
enc_ascii, enc_unicode, enc_middle,
enc_mmword, enc_xmmword, enc_ymmword
};

View File

@ -329,7 +329,7 @@ QString CPUDump::paintContent(QPainter* painter, dsint rowBase, int rowOffset, i
}
if(background.alpha())
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background color
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(cur_addr));
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(cur_addr));
return "";
}
return HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);

View File

@ -324,9 +324,9 @@ void CPUInfoBox::followActionSlot()
*/
void CPUInfoBox::addFollowMenuItem(QMenu* menu, QString name, duint value)
{
foreach(QAction * action, menu->actions()) //check for duplicate action
if(action->text() == name)
return;
foreach(QAction* action, menu->actions()) //check for duplicate action
if(action->text() == name)
return;
QAction* newAction = new QAction(name, menu);
newAction->setFont(QFont("Courier New", 8));
menu->addAction(newAction);
@ -389,9 +389,9 @@ void CPUInfoBox::setupFollowMenu(QMenu* menu, duint wVA)
*/
void CPUInfoBox::addWatchMenuItem(QMenu* menu, QString name, duint value)
{
foreach(QAction * action, menu->actions()) //check for duplicate action
if(action->text() == name)
return;
foreach(QAction* action, menu->actions()) //check for duplicate action
if(action->text() == name)
return;
QAction* newAction = new QAction(name, menu);
newAction->setFont(QFont("Courier New", 8));
menu->addAction(newAction);

View File

@ -432,7 +432,7 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
}
if(background.alpha())
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background when defined
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(wVa));
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(wVa));
return QString();
}
else if(col == 1) // paint stack data

View File

@ -89,7 +89,7 @@ void CalculatorDialog::expressionChanged(bool validExpression, bool validPointer
else
ui->txtAscii->setText("???");
ui->txtAscii->setCursorPosition(1);
if((value == (value & 0xFFF))) //UNICODE?
if((value == (value & 0xFFF))) //UNICODE?
{
QChar c = QChar((ushort)value);
if(c.isPrint())

View File

@ -186,7 +186,7 @@ void DisassemblerGraphView::paintNormal(QPainter & p, QRect & viewportRect, int
}
//Ignore blocks that are not in view
if(viewportRect.intersects(QRect(block.x + this->charWidth , block.y + this->charWidth,
if(viewportRect.intersects(QRect(block.x + this->charWidth, block.y + this->charWidth,
block.width - (2 * this->charWidth), block.height - (2 * this->charWidth))))
{
//Render shadow
@ -1405,7 +1405,7 @@ void DisassemblerGraphView::show_cur_instr(bool force)
QRect viewportRect = this->viewport()->rect();
QPoint translation(this->renderXOfs - xofs, this->renderYOfs - yofs);
viewportRect.translate(-translation.x(), -translation.y());
if(force || !viewportRect.contains(QRect(block.x + this->charWidth , block.y + this->charWidth,
if(force || !viewportRect.contains(QRect(block.x + this->charWidth, block.y + this->charWidth,
block.width - (2 * this->charWidth), block.height - (2 * this->charWidth))))
{
auto x = block.x + int(block.width / 2);

View File

@ -57,9 +57,9 @@ void RegistersView::InitMappings()
offset++;
mRegisterMapping.insert(R8, "R8");
mRegisterPlaces.insert(R8 , Register_Position(offset++, 0, 6, sizeof(duint) * 2));
mRegisterPlaces.insert(R8, Register_Position(offset++, 0, 6, sizeof(duint) * 2));
mRegisterMapping.insert(R9, "R9");
mRegisterPlaces.insert(R9 , Register_Position(offset++, 0, 6, sizeof(duint) * 2));
mRegisterPlaces.insert(R9, Register_Position(offset++, 0, 6, sizeof(duint) * 2));
mRegisterMapping.insert(R10, "R10");
mRegisterPlaces.insert(R10, Register_Position(offset++, 0, 6, sizeof(duint) * 2));
mRegisterMapping.insert(R11, "R11");
@ -1702,7 +1702,7 @@ void RegistersView::mouseDoubleClickEvent(QMouseEvent* event)
// is current register general purposes register or FPU register?
else if(mMODIFYDISPLAY.contains(mSelected))
wCM_Modify->trigger();
else if(mBOOLDISPLAY.contains(mSelected)) // is flag ?
else if(mBOOLDISPLAY.contains(mSelected)) // is flag ?
wCM_ToggleValue->trigger();
else if(mCANSTOREADDRESS.contains(mSelected))
wCM_FollowInDisassembly->trigger();
@ -1746,7 +1746,7 @@ void RegistersView::keyPressEvent(QKeyEvent* event)
QSize RegistersView::sizeHint() const
{
// 32 character width
return QSize(32 * mCharWidth , this->viewport()->height());
return QSize(32 * mCharWidth, this->viewport()->height());
}
void* RegistersView::operator new(size_t size)
@ -1806,7 +1806,7 @@ QString RegistersView::getRegisterLabel(REGISTER_NAME register_selected)
isCharacter = IsCharacterRegister(register_selected);
}
}
else if(register_value == (register_value & 0xFFF)) //UNICODE?
else if(register_value == (register_value & 0xFFF)) //UNICODE?
{
QChar c = QChar((wchar_t)register_value);
if(c.isPrint())
@ -2681,7 +2681,7 @@ void RegistersView::onPushAction()
duint regVal = 0;
regVal = * ((duint*) registerValue(&wRegDumpStruct, mSelected));
setRegister(CSP, csp);
DbgMemWrite(csp, (const unsigned char*)&regVal , sizeof(void*));
DbgMemWrite(csp, (const unsigned char*)&regVal, sizeof(void*));
}
void RegistersView::onPopAction()

View File

@ -191,7 +191,7 @@ protected slots:
QString getRegisterLabel(REGISTER_NAME);
int CompareRegisters(const REGISTER_NAME reg_name, REGDUMP* regdump1, REGDUMP* regdump2);
SIZE_T GetSizeRegister(const REGISTER_NAME reg_name);
QString GetRegStringValueFromValue(REGISTER_NAME reg , const char* value);
QString GetRegStringValueFromValue(REGISTER_NAME reg, const char* value);
QString GetTagWordStateString(unsigned short);
//unsigned int GetTagWordValueFromString(const char* string);
QString GetControlWordPCStateString(unsigned short);

View File

@ -109,7 +109,7 @@ QString ScriptView::paintContent(QPainter* painter, dsint rowBase, int rowOffset
if(background.alpha())
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background
}
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, returnString);
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, returnString);
returnString = "";
}
break;

View File

@ -50,7 +50,7 @@ void ThreadView::setupContextMenu()
QAction* mSetPriorityNormal = makeCommandAction(new QAction(tr("Normal"), this), "setprioritythread $, Normal");
QAction* mSetPriorityTimeCritical = makeCommandAction(new QAction(tr("Time Critical"), this), "setprioritythread $, TimeCritical");
MenuBuilder* mSetPriority = new MenuBuilder(this, [this, mSetPriorityIdle, mSetPriorityAboveNormal, mSetPriorityBelowNormal,
mSetPriorityHighest, mSetPriorityLowest, mSetPriorityNormal, mSetPriorityTimeCritical](QMenu*)
mSetPriorityHighest, mSetPriorityLowest, mSetPriorityNormal, mSetPriorityTimeCritical](QMenu*)
{
QString priority = getCellContent(getInitialSelection(), 6);
QAction* selectedaction = nullptr;
@ -366,7 +366,7 @@ QString ThreadView::paintContent(QPainter* painter, dsint rowBase, int rowOffset
{
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("ThreadCurrentBackgroundColor")));
painter->setPen(QPen(ConfigColor("ThreadCurrentColor"))); //white text
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, ret);
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, ret);
ret = "";
}
return ret;

View File

@ -178,7 +178,7 @@ QString WatchView::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
{
painter->fillRect(QRect(x, y, w, h), mWatchTriggeredBackgroundColor);
painter->setPen(mWatchTriggeredColor); //white text
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, ret);
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, ret);
return "";
}
else

View File

@ -126,7 +126,7 @@ namespace
dd_real("0.0263157894736842105263157894736842105"), // 1/38
dd_real("0.0256410256410256410256410256410256410"), // 1/39
dd_real("0.025"), // 1/40
dd_real("0.0243902439024390243902439024390243902") // 1/41
dd_real("0.0243902439024390243902439024390243902") // 1/41
};
dd_real const inv_fact[] =
@ -872,11 +872,11 @@ recompute:
int ilog = std::ilogb(a) + 1; // 0.5 <= frac < 1.0
if(ilog < -std::numeric_limits<dd_real>::digits / 2) // |a| <= 2^-54 - error O( 2^-108)
if(ilog < -std::numeric_limits<dd_real>::digits / 2) // |a| <= 2^-54 - error O( 2^-108)
return a;
if(ilog < -std::numeric_limits<dd_real>::digits / 3) // |a| <= 2^-36 - error O( 2^-108)
if(ilog < -std::numeric_limits<dd_real>::digits / 3) // |a| <= 2^-36 - error O( 2^-108)
return a * std::Fma(a, -0.5, 1.0);
if(ilog < -std::numeric_limits<dd_real>::digits / 4) // |a| <= 2^-27 - error O( 2^-108)
if(ilog < -std::numeric_limits<dd_real>::digits / 4) // |a| <= 2^-27 - error O( 2^-108)
return a * std::Fma(a, -std::Fma(a, -_third, 0.5), 1.0);
dd_real f_minus = a;
@ -1324,7 +1324,7 @@ std::string dd_real::to_string(std::streamsize precision, std::streamsize width,
{
// fix the string if it's been computed incorrectly
// round here in the decimal string if required
round_string(t, d + 1 , &off);
round_string(t, d + 1, &off);
if(off > 0)
{
@ -2155,7 +2155,7 @@ namespace std
// align exponents of x, y and subtract
//
auto ys = scalbn(y, ix - iy);
if(x < ys) // if mantissa( y ) > mantissa( x ),
if(x < ys) // if mantissa( y ) > mantissa( x ),
scalbn(ys, -1); // divide by 2
double z[3];
@ -2748,7 +2748,7 @@ namespace std
return signbit(a) ? -1.0 : a;
// exp( a ) > 2.0; no destructive cancelation is possible
if(std::abs(a) > _ln2) // exp( a ) < 0.5; no destructive cancellation is possible
if(std::abs(a) > _ln2) // exp( a ) < 0.5; no destructive cancellation is possible
{
return exp(a) - 1.0;
}
@ -2809,7 +2809,7 @@ namespace std
return a;
if((a >= 2.0) || (a <= -0.5)) // a >= 2.0 - no loss of significant bits - use log()
if((a >= 2.0) || (a <= -0.5)) // a >= 2.0 - no loss of significant bits - use log()
return _log(1.0 + a);
// at this point, -1.0 < a < 2.0

View File

@ -408,7 +408,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
defaultShortcuts.insert("OptionsAppearance", Shortcut(tr("Options -> Appearance"), "", true));
defaultShortcuts.insert("OptionsShortcuts", Shortcut(tr("Options -> Shortcuts"), "", true));
defaultShortcuts.insert("OptionsTopmost", Shortcut(tr("Options -> Topmost"), "Ctrl+F5", true));
defaultShortcuts.insert("OptionsReloadStylesheet", Shortcut(tr("Options -> Reload style.css") , "", true));
defaultShortcuts.insert("OptionsReloadStylesheet", Shortcut(tr("Options -> Reload style.css"), "", true));
defaultShortcuts.insert("HelpAbout", Shortcut(tr("Help -> About"), "", true));
defaultShortcuts.insert("HelpBlog", Shortcut(tr("Help -> Blog"), "", true));

View File

@ -404,7 +404,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
//Handle command line
auto argc = 0;
auto argv = CommandLineToArgvW(GetCommandLineW(), &argc);
if(argc <= 1) //no arguments -> set configuration
if(argc <= 1) //no arguments -> set configuration
{
if(!FileExists(sz32Path) && BrowseFileOpen(nullptr, TEXT("x32dbg.exe\0x32dbg.exe\0\0"), nullptr, sz32Path, MAX_PATH, szCurrentDir))
{
@ -439,7 +439,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
if(bDoneSomething)
MessageBox(nullptr, LoadResString(IDS_NEWCFGWRITTEN), LoadResString(IDS_DONE), MB_ICONINFORMATION);
}
else if(argc >= 2) //one or more arguments -> execute debugger
else if(argc >= 2) //one or more arguments -> execute debugger
{
BOOL canDisableRedirect = FALSE;
RedirectWow rWow;
@ -453,19 +453,19 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
}
TCHAR szPath[MAX_PATH] = TEXT("");
if(PathIsRelative(argv[1])) //resolve the full path if a relative path is specified
if(PathIsRelative(argv[1])) //resolve the full path if a relative path is specified
{
GetCurrentDirectory(_countof(szPath), szPath);
PathAppend(szPath, argv[1]);
}
else if(!ResolveShortcut(nullptr, argv[1], szPath, _countof(szPath))) //attempt to resolve the shortcut path
else if(!ResolveShortcut(nullptr, argv[1], szPath, _countof(szPath))) //attempt to resolve the shortcut path
_tcscpy_s(szPath, argv[1]); //fall back to the origin full path
std::wstring cmdLine;
cmdLine.push_back(L'\"');
cmdLine += szPath;
cmdLine.push_back(L'\"');
if(argc > 2) //forward any commandline parameters
if(argc > 2) //forward any commandline parameters
{
cmdLine += L" \"";
for(auto i = 2; i < argc; i++)