1
0
Fork 0

CAPSTONE_WRAPPER: better formatting for OperandText

This commit is contained in:
mrexodia 2015-11-20 17:26:06 +01:00
parent dd6d10a4b7
commit bac28590d4
3 changed files with 47 additions and 4 deletions

View File

@ -89,7 +89,7 @@ std::string Capstone::OperandText(int opindex) const
case X86_OP_IMM: case X86_OP_IMM:
{ {
sprintf_s(temp, "%p", op.imm); sprintf_s(temp, "%llX", op.imm);
result = temp; result = temp;
} }
break; break;
@ -99,7 +99,7 @@ std::string Capstone::OperandText(int opindex) const
const auto & mem = op.mem; const auto & mem = op.mem;
if(op.mem.base == X86_REG_RIP) //rip-relative if(op.mem.base == X86_REG_RIP) //rip-relative
{ {
sprintf_s(temp, "%p", Address() + op.mem.disp + Size()); sprintf_s(temp, "%llX", Address() + op.mem.disp + Size());
result += temp; result += temp;
} }
else //normal else //normal
@ -125,10 +125,10 @@ std::string Capstone::OperandText(int opindex) const
if(mem.disp < 0) if(mem.disp < 0)
{ {
operatorText = '-'; operatorText = '-';
sprintf_s(temp, "%p", mem.disp * -1); sprintf_s(temp, "%llX", mem.disp * -1);
} }
else else
sprintf_s(temp, "%p", mem.disp); sprintf_s(temp, "%llX", mem.disp);
if(prependPlus) if(prependPlus)
result += operatorText; result += operatorText;
result += temp; result += temp;

View File

@ -137,6 +137,16 @@
<ClCompile Include="capstone_wrapper.cpp" /> <ClCompile Include="capstone_wrapper.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\dbg\capstone\arm.h" />
<ClInclude Include="..\dbg\capstone\arm64.h" />
<ClInclude Include="..\dbg\capstone\capstone.h" />
<ClInclude Include="..\dbg\capstone\mips.h" />
<ClInclude Include="..\dbg\capstone\platform.h" />
<ClInclude Include="..\dbg\capstone\ppc.h" />
<ClInclude Include="..\dbg\capstone\sparc.h" />
<ClInclude Include="..\dbg\capstone\systemz.h" />
<ClInclude Include="..\dbg\capstone\x86.h" />
<ClInclude Include="..\dbg\capstone\xcore.h" />
<ClInclude Include="capstone_wrapper.h" /> <ClInclude Include="capstone_wrapper.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -13,6 +13,9 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
<Filter Include="Header Files\capstone">
<UniqueIdentifier>{4ccbf4c1-9486-4a56-ae45-53ffa1bdea25}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="capstone_wrapper.cpp"> <ClCompile Include="capstone_wrapper.cpp">
@ -23,5 +26,35 @@
<ClInclude Include="capstone_wrapper.h"> <ClInclude Include="capstone_wrapper.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\dbg\capstone\arm.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\arm64.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\capstone.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\mips.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\platform.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\ppc.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\sparc.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\systemz.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\x86.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
<ClInclude Include="..\dbg\capstone\xcore.h">
<Filter>Header Files\capstone</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>