Minor bugfixes

This commit is contained in:
flobernd 2017-07-19 16:56:12 +02:00
parent e76c3d64c3
commit d7a49370fe
1 changed files with 12 additions and 12 deletions

View File

@ -185,7 +185,7 @@ void printOperands(ZydisDecodedInstruction* instruction)
case ZYDIS_OPERAND_TYPE_IMMEDIATE: case ZYDIS_OPERAND_TYPE_IMMEDIATE:
if (instruction->operands[i].imm.isSigned) if (instruction->operands[i].imm.isSigned)
{ {
printf(" (%s %s %2d) 0x%016"PRIX64, printf(" (%s %s %2d) 0x%016" PRIX64,
instruction->operands[i].imm.isSigned ? "S" : "U", instruction->operands[i].imm.isSigned ? "S" : "U",
instruction->operands[i].imm.isRelative ? "R" : "_", instruction->operands[i].imm.isRelative ? "R" : "_",
instruction->raw.imm[immId].size, instruction->raw.imm[immId].size,
@ -197,7 +197,7 @@ void printOperands(ZydisDecodedInstruction* instruction)
"REL ", instruction->operands[i].imm.isRelative ? "Y" : "N"); "REL ", instruction->operands[i].imm.isRelative ? "Y" : "N");
printf(" %84s = %2d\n", printf(" %84s = %2d\n",
"SIZE ", instruction->raw.imm[immId].size); "SIZE ", instruction->raw.imm[immId].size);
printf(" %84s = 0x%016"PRIX64, printf(" %84s = 0x%016" PRIX64,
"VALUE", instruction->operands[i].imm.value.u); "VALUE", instruction->operands[i].imm.value.u);
} }
++immId; ++immId;
@ -267,15 +267,15 @@ void printFlags(ZydisDecodedInstruction* instruction)
ZydisCPUFlagMask flags, temp; ZydisCPUFlagMask flags, temp;
ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_TESTED, &flags); ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_TESTED, &flags);
printf(" READ: 0x%08"PRIX32"\n", flags); printf(" READ: 0x%08" PRIX32 "\n", flags);
ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_MODIFIED, &flags); ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_MODIFIED, &flags);
ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_SET_0, &temp); ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_SET_0, &temp);
flags |= temp; flags |= temp;
ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_SET_1, &temp); ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_SET_1, &temp);
flags |= temp; flags |= temp;
printf(" WRITTEN: 0x%08"PRIX32"\n", flags); printf(" WRITTEN: 0x%08" PRIX32 "\n", flags);
ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_UNDEFINED, &flags); ZydisGetCPUFlagsByAction(instruction, ZYDIS_CPUFLAG_ACTION_UNDEFINED, &flags);
printf(" UNDEFINED: 0x%08"PRIX32"\n", flags); printf(" UNDEFINED: 0x%08" PRIX32 "\n", flags);
} }
void printAVXInfo(ZydisDecodedInstruction* instruction) void printAVXInfo(ZydisDecodedInstruction* instruction)
@ -393,15 +393,15 @@ void printInstruction(ZydisDecodedInstruction* instruction)
fputs("== [ BASIC ] =====================================================", stdout); fputs("== [ BASIC ] =====================================================", stdout);
fputs("=======================================\n", stdout); fputs("=======================================\n", stdout);
printf(" MNEMONIC: %s [ENC: %s, MAP: %s, OPC: %02X]\n", printf(" MNEMONIC: %s [ENC: %s, MAP: %s, OPC: %02X]\n",
ZydisMnemonicGetString(instruction->mnemonic), ZydisMnemonicGetString(instruction->mnemonic),
instructionEncodingStrings[instruction->encoding], instructionEncodingStrings[instruction->encoding],
opcodeMapStrings[instruction->opcodeMap], opcodeMapStrings[instruction->opcodeMap],
instruction->opcode); instruction->opcode);
printf(" LENGTH: %2d\n", instruction->length); printf(" LENGTH: %2d\n", instruction->length);
printf(" SSZ: %2d\n", instruction->stackWidth); printf(" SSZ: %2d\n", instruction->stackWidth);
printf(" EOSZ: %2d\n", instruction->operandSize); printf(" EOSZ: %2d\n", instruction->operandSize);
printf(" EASZ: %2d\n", instruction->addressWidth); printf(" EASZ: %2d\n", instruction->addressWidth);
if (instruction->operandCount > 0) if (instruction->operandCount > 0)
{ {
@ -489,7 +489,7 @@ int main(int argc, char** argv)
fputs("Invalid hex value", stderr); fputs("Invalid hex value", stderr);
return ZYDIS_STATUS_INVALID_PARAMETER; return ZYDIS_STATUS_INVALID_PARAMETER;
} }
data[i + j] = (uint8_t)value; data[length] = (uint8_t)value;
++length; ++length;
} }
} }
@ -501,7 +501,7 @@ int main(int argc, char** argv)
if (status >= ZYDIS_STATUS_USER) if (status >= ZYDIS_STATUS_USER)
{ {
fprintf(stderr, fprintf(stderr,
"Could not decode instruction: User defined status code 0x%"PRIx32, status); "Could not decode instruction: User defined status code 0x%" PRIx32, status);
} else } else
{ {
fprintf(stderr, "Could not decode instruction: %s", ZydisFormatStatus(status)); fprintf(stderr, "Could not decode instruction: %s", ZydisFormatStatus(status));