#include "Util.h" using namespace pe_util; bool pe_util::isStrLonger(const char *inp, int maxLen) { for (int i = 0; i < maxLen; i++ ) { if (inp[i] == '\0') return false; } return true; } std::string pe_util::getString(const char *inp, size_t maxInp, size_t maxBuf) { if (maxInp < maxBuf) maxBuf = maxInp; char *buf = new char[maxBuf + 1]; unsigned int i = 0, j = 0; for ( i = 0, j = 0; i = 'A' && c <= 'F') return true; if (c >= 'a' && c <= 'f') return true; return false; } void pe_util::hexdump(BYTE *buf, size_t bufSize, size_t pad) { if (buf == NULL) return; printf("\n---\n"); for (int i = 0; i < bufSize; i++) { if (i % pad == 0) printf("\n"); printf("0x%02X ", buf[i]); } printf("\n---\n"); } bool pe_util::endsWith(std::string str, std::string endStr) { size_t sepPos = str.find_last_of(endStr); if ( sepPos == (str.length() - 1)) { return true; } return false; }