* Encodes instruction with semantics specified in encoder request structure. * * @param request A pointer to the `ZydisEncoderRequest` struct. Must be validated before * calling this function. * @param buffer A pointer to the output buffer receiving encoded instruction. * @param length A pointer to the variable containing length of the output buffer. U
| 4309 | * @return A zyan status code. |
| 4310 | */ |
| 4311 | static ZyanStatus ZydisEncoderEncodeInstructionInternal(const ZydisEncoderRequest *request, |
| 4312 | void *buffer, ZyanUSize *length, ZydisEncoderInstruction *instruction) |
| 4313 | { |
| 4314 | ZydisEncoderInstructionMatch match; |
| 4315 | ZYAN_CHECK(ZydisFindMatchingDefinition(request, &match)); |
| 4316 | ZydisEncoderBuffer output; |
| 4317 | output.buffer = (ZyanU8 *)buffer; |
| 4318 | output.size = *length; |
| 4319 | output.offset = 0; |
| 4320 | ZYAN_CHECK(ZydisBuildInstruction(&match, instruction)); |
| 4321 | ZYAN_CHECK(ZydisEmitInstruction(instruction, &output)); |
| 4322 | *length = output.offset; |
| 4323 | return ZYAN_STATUS_SUCCESS; |
| 4324 | } |
| 4325 | |
| 4326 | /* ============================================================================================== */ |
| 4327 | /* Exported functions */ |
no test coverage detected