18 va_start(argptr, format);
23 int printed = vsnprintf(line,
MAX_LINE, format, argptr);
27 if (printed <= 0)
return false;
29 const char *prefixes[
D_LVL_COUNT] = {
"ERROR",
"WARNING",
"INFO" };
30 if (
static_cast<unsigned>(lvl) >
static_cast<unsigned>(
D_LVL_COUNT)) {
34 fprintf(stderr,
"[%s] %s\n", prefixes[lvl], line);
40 for (
size_t i = 0; i < maxLen; i++ ) {
41 if (inp[i] ==
'\0')
return false;
49 for (; i < maxInp; i++) {
50 const char c = inp[i];
51 if (c ==
'\0')
return i;
54 if (acceptNotTerminated)
return i;
61 for (; i < maxInp; i++) {
62 const WORD w = inp[i];
66 if (acceptNotTerminated)
return i;
73 for ( i = 0; i < maxInp; i++) {
83 if ((c >=
'a' && c <=
'z')
84 || (c >=
'A' && c <=
'Z')
85 || (c >=
'0' && c <=
'9')
104 if (!fPtr || !bufSize)
return false;
106 for (
char i = 0; i < bufSize; i++) {
107 const char c = fPtr[i];
118 if (!fPtr || bufSize == 0)
return 0;
121 bool has_dot =
false;
125 if (*fPtr ==
'.') has_dot =
true;
127 if ((--bufSize) == 0)
break;
142 for (i = 0; i < bufSize; i++) {
151 size_t bufSize = s.length();
154 for (i = 0; i < bufSize; i++) {
163 BYTE* testblock = (BYTE*) calloc(size,
sizeof(BYTE));
165 if (memcmp (testblock, ptr, size)) {
174 if (isdigit(c))
return true;
175 if (c >=
'A' && c <=
'F')
return true;
176 if (c >=
'a' && c <=
'f')
return true;
182 if (buf == NULL)
return;
184 for (
size_t i = 0; i < bufSize; i++) {
185 if (i % pad == 0) printf(
"\n");
186 printf(
"0x%02X ", buf[i]);
193 if (str.length() < endStr.length()) {
196 size_t pos = str.length() - endStr.length();
197 std::string str3 = str.substr(pos);
198 if ( str3 == endStr ) {
bool _isFuncChar(const char c)
bool append(dbg_level lvl, const char *format,...)
bool hasNonPrintable(const char *ptr, size_t maxInp)
size_t forwarderNameLen(const char *ptr, size_t max_len)
size_t getAsciiLen(const char *ptr, size_t maxCount, bool acceptNotTerminated=false)
bool isStrLonger(const char *inp, size_t maxLen)
size_t noWhiteCount(char *buf, size_t bufSize)
bool validateFuncName(const char *fPtr, size_t bufSize)
void hexdump(BYTE *buf, size_t bufSize, size_t pad)
bool isSpaceClear(void *ptr, uint64_t size)
size_t getAsciiLenW(const WORD *ptr, size_t maxCount, bool acceptNotTerminated=false)
bool endsWith(std::string string, std::string endStr)