Skip to content

Commit

Permalink
Fix for newer x64dbg versions
Browse files Browse the repository at this point in the history
[*] Detection of function names in newer versions of x64dbg fixed
  • Loading branch information
ThunderCls committed Sep 20, 2018
1 parent 8e20cd5 commit 175b014
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions xAnalyzer/xanalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,10 @@ string StripFunctionNamePointer(char *lpszCallText, int *index_caller)
index++; // sub_undefined
}

++index; // jump over the "." or the "&"
// jump over the "." and/or the "&"
while (lpszCallText[index] == '.' || lpszCallText[index] == '&')
index++;

if (!isalpha(lpszCallText[index]) && !isdigit(lpszCallText[index])) // if not function name
{
while (lpszCallText[index] != '_' && lpszCallText[index] != '?' && lpszCallText[index] != '(' && lpszCallText[index] != '[') // get the initial bracket
Expand Down Expand Up @@ -1062,6 +1065,36 @@ bool GetDynamicUndefinedCall(LPSTR lpszCallText, LPSTR dest)
return false;
}

/*string GetMemoryString(INSTRUCTIONSTACK *inst)
{
string memString = "";
string addrString = "";
if (strncmp(inst->Instruction, "push", 4) == 0)
{
char *strPtr = nullptr;
if ((strPtr = strchr(inst->DestinationRegister, '[')) != nullptr)
{
addrString = strPtr;
if (addrString.back() == ']')
addrString.pop_back();
}
}
duint memAddr = hextoduint(addrString.c_str());
if (Memory::IsValidPtr(memAddr))
{
duint memAddrPtr = Memory::ReadPtr(memAddr);
char byteStr = 0;
while ((byteStr = Memory::ReadByte(memAddrPtr)) != 0 && (Memory::ReadByte(++memAddrPtr) != 0))
{
memString += byteStr;
memAddrPtr++;
}
}
return memString;
}*/

// ------------------------------------------------------------------------------------
// Set Auto Comment only if a comment isn't already set
// ------------------------------------------------------------------------------------
Expand All @@ -1085,8 +1118,12 @@ void SetAutoCommentIfCommentIsEmpty(INSTRUCTIONSTACK *inst, char *CommentString,
if (spaceleft <= 1)
return;

if (DbgGetCommentAt(inst->Address, szComment))
//string memStr = "";
if (DbgGetCommentAt(inst->Address, szComment)/* || (memStr = GetMemoryString(inst)) != ""*/)
{
/*if (!*szComment && memStr != "")
strcpy_s(szComment, memStr.c_str());*/

if (*szComment)
{
StripDbgCommentAddress(szComment); // get rid of the comment address id used by the dbg
Expand Down

0 comments on commit 175b014

Please sign in to comment.