diff --git a/hooks/AStyle.dll b/hooks/AStyle.dll index 6ef20910..9c2f5238 100644 Binary files a/hooks/AStyle.dll and b/hooks/AStyle.dll differ diff --git a/hooks/AStyle.dll.sig b/hooks/AStyle.dll.sig deleted file mode 100644 index 5ea8a5da..00000000 Binary files a/hooks/AStyle.dll.sig and /dev/null differ diff --git a/hooks/AStyleWhore.exe b/hooks/AStyleWhore.exe index 10dd6352..2eddec0c 100644 Binary files a/hooks/AStyleWhore.exe and b/hooks/AStyleWhore.exe differ diff --git a/hooks/AStyleWhore.exe.sig b/hooks/AStyleWhore.exe.sig deleted file mode 100644 index d910d7ff..00000000 Binary files a/hooks/AStyleWhore.exe.sig and /dev/null differ diff --git a/hooks/README.md b/hooks/README.md index 7380d17e..ebf3613d 100644 --- a/hooks/README.md +++ b/hooks/README.md @@ -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 " [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 " [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). \ No newline at end of file +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). \ No newline at end of file diff --git a/src/bridge/bridgelist.h b/src/bridge/bridgelist.h index 2d094ed7..afc74893 100644 --- a/src/bridge/bridgelist.h +++ b/src/bridge/bridgelist.h @@ -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]; } diff --git a/src/bridge/bridgemain.cpp b/src/bridge/bridgemain.cpp index 7d22544c..4cc8bae0 100644 --- a/src/bridge/bridgemain.cpp +++ b/src/bridge/bridgemain.cpp @@ -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; diff --git a/src/capstone_wrapper b/src/capstone_wrapper index c1bf5682..05adc360 160000 --- a/src/capstone_wrapper +++ b/src/capstone_wrapper @@ -1 +1 @@ -Subproject commit c1bf5682a05836e5f54319db92248116a4a9ccc6 +Subproject commit 05adc360018b6810cb0a6bbaa247de6522bdf9c5 diff --git a/src/dbg/_exports.cpp b/src/dbg/_exports.cpp index 05acd8a0..b95f5441 100644 --- a/src/dbg/_exports.cpp +++ b/src/dbg/_exports.cpp @@ -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 + if(!retval) //search for CALL { 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: diff --git a/src/dbg/_plugins.cpp b/src/dbg/_plugins.cpp index 059f6a65..8f4f4b6f 100644 --- a/src/dbg/_plugins.cpp +++ b/src/dbg/_plugins.cpp @@ -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 diff --git a/src/dbg/analysis/advancedanalysis.cpp b/src/dbg/analysis/advancedanalysis.cpp index 7d36bd2e..e10ed1fd 100644 --- a/src/dbg/analysis/advancedanalysis.cpp +++ b/src/dbg/analysis/advancedanalysis.cpp @@ -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); diff --git a/src/dbg/analysis/controlflowanalysis.cpp b/src/dbg/analysis/controlflowanalysis.cpp index 2c75125f..de8e4118 100644 --- a/src/dbg/analysis/controlflowanalysis.cpp +++ b/src/dbg/analysis/controlflowanalysis.cpp @@ -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; diff --git a/src/dbg/analysis/linearanalysis.cpp b/src/dbg/analysis/linearanalysis.cpp index c9542f75..43253de8 100644 --- a/src/dbg/analysis/linearanalysis.cpp +++ b/src/dbg/analysis/linearanalysis.cpp @@ -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)) diff --git a/src/dbg/analysis/recursiveanalysis.cpp b/src/dbg/analysis/recursiveanalysis.cpp index f1679fba..9dcd8ccd 100644 --- a/src/dbg/analysis/recursiveanalysis.cpp +++ b/src/dbg/analysis/recursiveanalysis.cpp @@ -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 diff --git a/src/dbg/breakpoint.cpp b/src/dbg/breakpoint.cpp index d2591c33..f473fed9 100644 --- a/src/dbg/breakpoint.cpp +++ b/src/dbg/breakpoint.cpp @@ -17,7 +17,7 @@ std::map 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); diff --git a/src/dbg/btparser b/src/dbg/btparser index 90eed991..d5034cf6 160000 --- a/src/dbg/btparser +++ b/src/dbg/btparser @@ -1 +1 @@ -Subproject commit 90eed9913a12ef5afec007b4d91f77301b66cc76 +Subproject commit d5034cf6d647e98cb01e9e1fc4efa5086f8fc6a5 diff --git a/src/dbg/commands/cmd-analysis.cpp b/src/dbg/commands/cmd-analysis.cpp index 8325ec22..58b01b69 100644 --- a/src/dbg/commands/cmd-analysis.cpp +++ b/src/dbg/commands/cmd-analysis.cpp @@ -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 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()); diff --git a/src/dbg/commands/cmd-breakpoint-control.cpp b/src/dbg/commands/cmd-breakpoint-control.cpp index 2fd845d4..b441718b 100644 --- a/src/dbg/commands/cmd-breakpoint-control.cpp +++ b/src/dbg/commands/cmd-breakpoint-control.cpp @@ -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(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint + if((!ExceptionNameToCode(argv[1], reinterpret_cast(&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(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint + if((!ExceptionNameToCode(argv[1], reinterpret_cast(&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(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint + if((!ExceptionNameToCode(argv[1], reinterpret_cast(&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; diff --git a/src/dbg/commands/cmd-debug-control.cpp b/src/dbg/commands/cmd-debug-control.cpp index a5498be8..7b79b339 100644 --- a/src/dbg/commands/cmd-debug-control.cpp +++ b/src/dbg/commands/cmd-debug-control.cpp @@ -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); diff --git a/src/dbg/commands/cmd-general-purpose.cpp b/src/dbg/commands/cmd-general-purpose.cpp index d208aecb..c7bc8b0a 100644 --- a/src/dbg/commands/cmd-general-purpose.cpp +++ b/src/dbg/commands/cmd-general-purpose.cpp @@ -26,7 +26,7 @@ static bool ReadWriteVariable(const char* varname, const std::functionname); 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 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) diff --git a/src/dbg/commands/cmd-thread-control.cpp b/src/dbg/commands/cmd-thread-control.cpp index e6768abe..8cb443fa 100644 --- a/src/dbg/commands/cmd-thread-control.cpp +++ b/src/dbg/commands/cmd-thread-control.cpp @@ -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; diff --git a/src/dbg/commands/cmd-undocumented.cpp b/src/dbg/commands/cmd-undocumented.cpp index 8d60138e..2efa4eb3 100644 --- a/src/dbg/commands/cmd-undocumented.cpp +++ b/src/dbg/commands/cmd-undocumented.cpp @@ -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; } diff --git a/src/dbg/debugger.cpp b/src/dbg/debugger.cpp index 4015feb0..c1de87cc 100644 --- a/src/dbg/debugger.cpp +++ b/src/dbg/debugger.cpp @@ -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(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* infoList, std::vector* infoList, std::vector* infoList, std::vector* infoList, std::vectormemory.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; diff --git a/src/dbg/exhandlerinfo.cpp b/src/dbg/exhandlerinfo.cpp index 314e23ff..f57313df 100644 --- a/src/dbg/exhandlerinfo.cpp +++ b/src/dbg/exhandlerinfo.cpp @@ -64,7 +64,7 @@ bool ExHandlerGetSEH(std::vector & 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--; diff --git a/src/dbg/expressionparser.cpp b/src/dbg/expressionparser.cpp index 866a2139..055c1313 100644 --- a/src/dbg/expressionparser.cpp +++ b/src/dbg/expressionparser.cpp @@ -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; diff --git a/src/dbg/memory.cpp b/src/dbg/memory.cpp index 89c188a3..7bfb361f 100644 --- a/src/dbg/memory.cpp +++ b/src/dbg/memory.cpp @@ -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, §ions)) 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; diff --git a/src/dbg/mnemonichelp.cpp b/src/dbg/mnemonichelp.cpp index bacc9b0e..0faacc0b 100644 --- a/src/dbg/mnemonichelp.cpp +++ b/src/dbg/mnemonichelp.cpp @@ -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; } diff --git a/src/dbg/patternfind.cpp b/src/dbg/patternfind.cpp index 51c3638c..f1420f37 100644 --- a/src/dbg/patternfind.cpp +++ b/src/dbg/patternfind.cpp @@ -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 & 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 diff --git a/src/dbg/plugin_loader.cpp b/src/dbg/plugin_loader.cpp index 0ec9f505..760590de 100644 --- a/src/dbg/plugin_loader.cpp +++ b/src/dbg/plugin_loader.cpp @@ -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++) diff --git a/src/dbg/reference.cpp b/src/dbg/reference.cpp index 642c3e4d..aa50c9ec 100644 --- a/src/dbg/reference.cpp +++ b/src/dbg/reference.cpp @@ -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 modList; diff --git a/src/dbg/serializablemap.h b/src/dbg/serializablemap.h index 5d5b1881..2cf062a2 100644 --- a/src/dbg/serializablemap.h +++ b/src/dbg/serializablemap.h @@ -391,7 +391,7 @@ struct AddrInfoHashMap : SerializableModuleHashMap { 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; }); diff --git a/src/dbg/simplescript.cpp b/src/dbg/simplescript.cpp index bb8d3a23..7f822be2 100644 --- a/src/dbg/simplescript.cpp +++ b/src/dbg/simplescript.cpp @@ -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 diff --git a/src/dbg/stringformat.cpp b/src/dbg/stringformat.cpp index a9faab48..eafc88ba 100644 --- a/src/dbg/stringformat.cpp +++ b/src/dbg/stringformat.cpp @@ -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]; diff --git a/src/dbg/stringutils.cpp b/src/dbg/stringutils.cpp index e2dcdad7..ef83a7b8 100644 --- a/src/dbg/stringutils.cpp +++ b/src/dbg/stringutils.cpp @@ -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(); diff --git a/src/dbg/taskthread.h b/src/dbg/taskthread.h index 935c787d..aa7eb277 100644 --- a/src/dbg/taskthread.h +++ b/src/dbg/taskthread.h @@ -64,7 +64,7 @@ template struct concat; template struct concat, seq> -: seq < I1..., (sizeof...(I1) + I2)... > {}; + : seq < I1..., (sizeof...(I1) + I2)... > {}; template using Concat = Invoke>; diff --git a/src/dbg/types.cpp b/src/dbg/types.cpp index 18e5e105..1b6490a6 100644 --- a/src/dbg/types.cpp +++ b/src/dbg/types.cpp @@ -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; diff --git a/src/dbg/value.cpp b/src/dbg/value.cpp index ca7bc9a2..390bd15b 100644 --- a/src/dbg/value.cpp +++ b/src/dbg/value.cpp @@ -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()) { diff --git a/src/dbg/variable.cpp b/src/dbg/variable.cpp index 8efbe382..7e149925 100644 --- a/src/dbg/variable.cpp +++ b/src/dbg/variable.cpp @@ -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); diff --git a/src/dbg/x64dbg.cpp b/src/dbg/x64dbg.cpp index c4cab9f2..dc52c9a1 100644 --- a/src/dbg/x64dbg.cpp +++ b/src/dbg/x64dbg.cpp @@ -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); diff --git a/src/dbg/yara/yara/compiler.h b/src/dbg/yara/yara/compiler.h index 929cdaf5..ac7afa41 100644 --- a/src/dbg/yara/yara/compiler.h +++ b/src/dbg/yara/yara/compiler.h @@ -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( \ diff --git a/src/dbg/yara/yara/modules.h b/src/dbg/yara/yara/modules.h index 35ea7f8a..32b25b84 100644 --- a/src/dbg/yara/yara/modules.h +++ b/src/dbg/yara/yara/modules.h @@ -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) diff --git a/src/gui/Src/BasicView/Disassembly.cpp b/src/gui/Src/BasicView/Disassembly.cpp index 0a880532..bd96df27 100644 --- a/src/gui/Src/BasicView/Disassembly.cpp +++ b/src/gui/Src/BasicView/Disassembly.cpp @@ -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; diff --git a/src/gui/Src/BasicView/SearchListViewTable.cpp b/src/gui/Src/BasicView/SearchListViewTable.cpp index 88f55853..d916e1f1 100644 --- a/src/gui/Src/BasicView/SearchListViewTable.cpp +++ b/src/gui/Src/BasicView/SearchListViewTable.cpp @@ -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)) diff --git a/src/gui/Src/Disassembler/capstone_gui.cpp b/src/gui/Src/Disassembler/capstone_gui.cpp index 193fa57c..f3162f84 100644 --- a/src/gui/Src/Disassembler/capstone_gui.cpp +++ b/src/gui/Src/Disassembler/capstone_gui.cpp @@ -343,11 +343,11 @@ QString CapstoneTokenizer::printValue(const TokenValue & value, bool expandModul moduleText += "."; QString addrText = ToHexString(addr); QString finalText; - if(bHasLabel && bHasModule) // + if(bHasLabel && bHasModule) // 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) //