Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
torusrxxx authored Nov 20, 2016
1 parent 76c9d70 commit c21323e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pluginmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,17 @@ void cbPlugin(CBTYPE cbType, LPVOID generic_param)
if(DbgXrefGet(param->VA, &info) && info.refcount > 0)
{
std::string output;
std::qsort(info.references, info.refcount, sizeof(info.references[0]), &compareFunc);
XREF_RECORD* data;
data = new XREF_RECORD[info.refcount];
memcpy(data, info.references, info.refcount * sizeof(XREF_RECORD));
std::qsort(data, info.refcount, sizeof(info.references[0]), &compareFunc);
int t = XREF_NONE;
duint i;
for(i = 0; i < info.refcount && i < 10; i++)
{
if(t != info.references[i].type)
if(t != data[i].type)
{
switch(info.references[i].type)
switch(data[i].type)
{
case XREF_JMP:
output += LoadUTF8String(IDS_JMPFROM);
Expand All @@ -87,27 +90,28 @@ void cbPlugin(CBTYPE cbType, LPVOID generic_param)
output += LoadUTF8String(IDS_REFFROM);
break;
}
t = info.references[i].type;
t = data[i].type;
}
ADDRINFO label;
label.flags = flaglabel;
_dbg_addrinfoget(info.references[i].addr, SEG_DEFAULT, &label);
_dbg_addrinfoget(data[i].addr, SEG_DEFAULT, &label);
if(label.label[0] != '\0')
output += label.label;
else{
char temp[18];
sprintf_s(temp, "%p", info.references[i].addr);
sprintf_s(temp, "%p", data[i].addr);
output += temp;
}
if(i != info.refcount - 1)
output += ",";
}
delete[] data;
if(info.refcount > 10)
output += " ...";
GuiAddInfoLine(output.c_str());
if(info.references)
BridgeFree(info.references);
}
if(info.refcount != 0)
BridgeFree(info.references);
}
}

Expand Down

0 comments on commit c21323e

Please sign in to comment.