diff --git a/commander/Commander.cpp b/commander/Commander.cpp index 0b92365df..8bedb92aa 100644 --- a/commander/Commander.cpp +++ b/commander/Commander.cpp @@ -59,7 +59,6 @@ bool Commander::addCommand(const std::string& name, Command *cmd, bool overwrite void Commander::parseCommands() { const std::string PROMPT = "$ "; - Command *cmd = NULL; while (true) { if (this->context == NULL) throw CmdException("Uninitialized commander context!"); diff --git a/commander/Commander.h b/commander/Commander.h index d0a44b742..faa88100a 100644 --- a/commander/Commander.h +++ b/commander/Commander.h @@ -39,6 +39,7 @@ friend class Commander; class Command { public: + Command() {} Command(const std::string& v_desc) : desc(v_desc) {} virtual ~Command() {} diff --git a/commander/ExeCommander.h b/commander/ExeCommander.h index 9cf255735..1dd31f12c 100644 --- a/commander/ExeCommander.h +++ b/commander/ExeCommander.h @@ -174,7 +174,7 @@ class DumpWrapperEntriesCommand : public WrapperCommand { public: DumpWrapperEntriesCommand(const std::string& desc, size_t v_wrapperId = INVALID_WRAPPER) - : WrapperCommand(desc), wrapperId(v_wrapperId) {} + : WrapperCommand(desc, v_wrapperId) {} virtual void wrapperAction(ExeElementWrapper *wrapper) { @@ -196,9 +196,6 @@ class DumpWrapperEntriesCommand : public WrapperCommand cmd_util::dumpEntryInfo(lib); cmd_util::dumpNodeInfo(lib); } - -protected: - size_t wrapperId; //TODO: fetch it from params! }; diff --git a/commander/PECommander.cpp b/commander/PECommander.cpp index 3185ea9d2..842e4a76c 100644 --- a/commander/PECommander.cpp +++ b/commander/PECommander.cpp @@ -74,10 +74,10 @@ void cmd_util::printStrings(PEFile *pe, size_t limit) } size_t count = wrapper->getResStringsCount(); - for (size_t i = 0; i < count; i++) { + for (size_t j = 0; j < count; j++) { if (limit != 0 && limCount >= limit) return; - ResString *resStr = wrapper->getResStringAt(i); + ResString *resStr = wrapper->getResStringAt(j); if (resStr != NULL) { OUT_PADDED_OFFSET(std::cout, resStr->offset); std::cout << " [" << std::dec << resStr->getSize() << "]" << std::endl; diff --git a/commander/PECommander.h b/commander/PECommander.h index 7f872ef12..df22f662c 100644 --- a/commander/PECommander.h +++ b/commander/PECommander.h @@ -101,8 +101,6 @@ class PrintStringsCommand : public Command cmd_util::printStrings(pe, limit); } -protected: - int wrapperId; //TODO: fetch it from params! }; class PrintWrapperTypesCommand : public Command @@ -210,7 +208,6 @@ class SectionDumpCommand : public Command PEFile *pe = cmd_util::getPEFromContext(context); if (!pe) return; - size_t sectHdrCount = pe->getSectionsCount(false); size_t sectCount = pe->getSectionsCount(true); std:: cout << "Sections count = " << std::dec << sectCount << "\n"; if (sectCount == 0) { diff --git a/parser/pe/ExportDirWrapper.cpp b/parser/pe/ExportDirWrapper.cpp index b4f43a47b..0bb879514 100644 --- a/parser/pe/ExportDirWrapper.cpp +++ b/parser/pe/ExportDirWrapper.cpp @@ -63,7 +63,6 @@ size_t ExportDirWrapper::mapNames() bool ExportDirWrapper::wrap() { clear(); - size_t mapNum = mapNames(); IMAGE_EXPORT_DIRECTORY* exp = exportDir(); if (exp == NULL) return 0; diff --git a/parser/pe/ImportBaseDirWrapper.cpp b/parser/pe/ImportBaseDirWrapper.cpp index b1d776d08..e6e8a6945 100644 --- a/parser/pe/ImportBaseDirWrapper.cpp +++ b/parser/pe/ImportBaseDirWrapper.cpp @@ -64,7 +64,6 @@ void ImportBaseDirWrapper::reloadMapping() for (size_t i = 0; i < entriesCount; i++) { ImportBaseEntryWrapper* lib = dynamic_cast (this->getEntryAt(i)); if (lib == NULL) continue; - size_t libId = lib->entryNum; size_t funcCount = lib->getEntriesCount(); for (size_t fI = 0; fI < funcCount; fI++) { @@ -254,7 +253,7 @@ bool ImportBaseFuncWrapper::isValid() if (!isByOrdinal()) { char *fName = this->getFunctionName(); - if (!imports_util::isNameValid(m_Exe, libName)) return false; + if (!imports_util::isNameValid(m_Exe, fName)) return false; } return true; } diff --git a/parser/pe/ImportDirWrapper.cpp b/parser/pe/ImportDirWrapper.cpp index 25b055192..057cd9d2a 100644 --- a/parser/pe/ImportDirWrapper.cpp +++ b/parser/pe/ImportDirWrapper.cpp @@ -87,8 +87,6 @@ uint64_t ImportedFuncWrapper::getThunkValue() bool ImportedFuncWrapper::isByOrdinal() { - bool isOk = false; - void *p = getValuePtr(ImportEntryWrapper::ORIG_FIRST_THUNK); if (!p) p = getValuePtr(ImportEntryWrapper::FIRST_THUNK); if (!p) return false; @@ -122,13 +120,9 @@ bufsize_t ImportedFuncWrapper::getSize() void* ImportedFuncWrapper::getFieldPtr(size_t fId, size_t subField) { - bool is64 = isBit64(); void *entryPtr = this->getPtr(); if (entryPtr == NULL) return NULL; - IMAGE_THUNK_DATA32* en32 = is64 ? NULL : (IMAGE_THUNK_DATA32*) entryPtr; - IMAGE_THUNK_DATA64* en64 = is64 ? (IMAGE_THUNK_DATA64*) entryPtr : NULL; - switch (fId) { case ORIG_THUNK: return (void*) getValuePtr(ImportEntryWrapper::ORIG_FIRST_THUNK); case THUNK: return (void*) getValuePtr(ImportEntryWrapper::FIRST_THUNK); diff --git a/parser/pe/SectHdrsWrapper.cpp b/parser/pe/SectHdrsWrapper.cpp index c8681fa1a..ad4bc9ba2 100644 --- a/parser/pe/SectHdrsWrapper.cpp +++ b/parser/pe/SectHdrsWrapper.cpp @@ -283,7 +283,7 @@ bufsize_t SectionHdrWrapper::getMappedRawSize() if (secEnd > peSize) { const bufsize_t trimmedSize = peSize - secOffset; // trim to the file size if (virtualSize) { - bufsize_t unit = m_PE->getAlignment(Executable::RVA); + unit = m_PE->getAlignment(Executable::RVA); if (unit != 0) { virtualSize = roundupToUnit(virtualSize, unit); } @@ -534,7 +534,6 @@ QString SectHdrsWrapper::getFieldName(size_t fieldId) SectionHdrWrapper* SectHdrsWrapper::getSecHdrAtOffset(offset_t offset, Executable::addr_type addrType, bool recalculate, bool verbose) { - size_t size = this->entries.size(); std::map *secMap = NULL; if (addrType == Executable::RAW) {