diff --git a/src/dbg/commands/cmd-plugins.cpp b/src/dbg/commands/cmd-plugins.cpp index b395a1a2..60640e6b 100644 --- a/src/dbg/commands/cmd-plugins.cpp +++ b/src/dbg/commands/cmd-plugins.cpp @@ -49,16 +49,27 @@ bool cbInstrPluginLoad(int argc, char* argv[]) { if(IsArgumentsLessThan(argc, 2)) return false; - if(pluginload(argv[1])) - return true; - return false; + return pluginload(argv[1]); } bool cbInstrPluginUnload(int argc, char* argv[]) { if(IsArgumentsLessThan(argc, 2)) return false; - if(pluginunload(argv[1])) - return true; - return false; + return pluginunload(argv[1]); } + +bool cbInstrPluginReload(int argc, char* argv[]) +{ + if(IsArgumentsLessThan(argc, 2)) + return false; + if(!pluginunload(argv[1])) + return false; + if(argc <= 2) + { + auto text = StringUtils::Utf8ToUtf16(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Press OK to reload the plugin..."))); + auto title = StringUtils::Utf8ToUtf16(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Reload"))); + MessageBoxW(GuiGetWindowHandle(), text.c_str(), title.c_str(), 0); + } + return pluginload(argv[1]); +} \ No newline at end of file diff --git a/src/dbg/commands/cmd-plugins.h b/src/dbg/commands/cmd-plugins.h index d5164b2c..f63acbec 100644 --- a/src/dbg/commands/cmd-plugins.h +++ b/src/dbg/commands/cmd-plugins.h @@ -4,4 +4,5 @@ bool cbDebugStartScylla(int argc, char* argv[]); bool cbInstrPluginLoad(int argc, char* argv[]); -bool cbInstrPluginUnload(int argc, char* argv[]); \ No newline at end of file +bool cbInstrPluginUnload(int argc, char* argv[]); +bool cbInstrPluginReload(int argc, char* argv[]); \ No newline at end of file diff --git a/src/dbg/stringutils.cpp b/src/dbg/stringutils.cpp index 0622da17..22a7fe36 100644 --- a/src/dbg/stringutils.cpp +++ b/src/dbg/stringutils.cpp @@ -451,9 +451,14 @@ String StringUtils::ToLower(const String & s) return result; } -bool StringUtils::StartsWith(const String & h, const String & n) +bool StringUtils::StartsWith(const String & str, const String & prefix) { - return strstr(h.c_str(), n.c_str()) == h.c_str(); + return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); +} + +bool StringUtils::EndsWith(const String & str, const String & suffix) +{ + return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } static int hex2int(char ch) diff --git a/src/dbg/stringutils.h b/src/dbg/stringutils.h index e0e5a79a..85358d9d 100644 --- a/src/dbg/stringutils.h +++ b/src/dbg/stringutils.h @@ -38,7 +38,8 @@ public: static WString vsprintf(_In_z_ _Printf_format_string_ const wchar_t* format, va_list args); static WString sprintf(_In_z_ _Printf_format_string_ const wchar_t* format, ...); static String ToLower(const String & s); - static bool StartsWith(const String & h, const String & n); + static bool StartsWith(const String & str, const String & prefix); + static bool EndsWith(const String & str, const String & suffix); static bool FromHex(const String & text, std::vector & data, bool reverse = false); static String ToHex(unsigned long long value); static String ToHex(unsigned char* buffer, size_t size, bool reverse = false); diff --git a/src/dbg/x64dbg.cpp b/src/dbg/x64dbg.cpp index 3f93ed54..be42573f 100644 --- a/src/dbg/x64dbg.cpp +++ b/src/dbg/x64dbg.cpp @@ -369,6 +369,7 @@ static void registercommands() dbgcmdnew("StartScylla,scylla,imprec", cbDebugStartScylla, false); //start scylla dbgcmdnew("plugload,pluginload,loadplugin", cbInstrPluginLoad, false); //load plugin dbgcmdnew("plugunload,pluginunload,unloadplugin", cbInstrPluginUnload, false); //unload plugin + dbgcmdnew("plugreload,plugunreload,reloadplugin", cbInstrPluginReload, false); //reload plugin //script dbgcmdnew("scriptload", cbScriptLoad, false); diff --git a/src/gui/Src/BasicView/StdTable.cpp b/src/gui/Src/BasicView/StdTable.cpp index cd53665f..6a3296fe 100644 --- a/src/gui/Src/BasicView/StdTable.cpp +++ b/src/gui/Src/BasicView/StdTable.cpp @@ -274,7 +274,7 @@ void StdTable::addColumnAt(int width, QString title, bool isClickable, QString c AbstractTableView::addColumnAt(width, title, isClickable, sortFn); //append empty column to list of rows - for(int i = 0; i < mData.size(); i++) + for(size_t i = 0; i < mData.size(); i++) mData[i].push_back(CellData()); //Append copy title @@ -335,9 +335,9 @@ duint StdTable::getCellUserdata(int r, int c) bool StdTable::isValidIndex(int r, int c) { - if(r < 0 || c < 0 || r >= mData.size()) + if(r < 0 || c < 0 || r >= int(mData.size())) return false; - return c < mData.at(r).size(); + return c < int(mData.at(r).size()); } void StdTable::copyLineSlot()