report the return value of the command

This commit is contained in:
2020-01-08 15:33:08 -05:00
parent 41df95aaab
commit 7f49731ec6
2 changed files with 6 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ struct dev_cmd_resp
{ {
int ret; int ret;
unsigned long long magic; unsigned long long magic;
unsigned long long retval;
unsigned char *data; unsigned char *data;
int len; int len;
}; };

View File

@@ -136,14 +136,17 @@ struct dev_cmd_resp *command(struct pwned_device *dev,
cmd_resp->ret = CHECKM8_SUCCESS; cmd_resp->ret = CHECKM8_SUCCESS;
memcpy(&cmd_resp->magic, resp_buf, 8); memcpy(&cmd_resp->magic, resp_buf, 8);
memcpy(&cmd_resp->retval, &resp_buf[8], 8);
if(response_len - 16 > 0) if(response_len - 16 > 0)
{ {
checkm8_debug_indent("\tcopying %i bytes of output to response data section\n", response_len - 16); checkm8_debug_indent("\tcopying %i bytes of output to response data section\n", response_len - 16);
cmd_resp->len = response_len - 16;
cmd_resp->data = calloc(1, response_len - 16); cmd_resp->data = calloc(1, response_len - 16);
memcpy(cmd_resp->data, &resp_buf[16], response_len - 16); memcpy(cmd_resp->data, &resp_buf[16], response_len - 16);
} }
else cmd_resp->len = 0;
cmd_resp->len = response_len - 16;
if(close) close_device_session(dev); if(close) close_device_session(dev);
return cmd_resp; return cmd_resp;