Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat example.c
- #include <stdio.h>
- #include <stdlib.h>
- #include "pe.h"
- int main(int argc, char *argv[])
- {
- pe_ctx_t ctx;
- pe_err_e err = pe_load_file(&ctx, argv[argc-1]);
- if (err != LIBPE_E_OK) {
- pe_error_print(stderr, err);
- return EXIT_FAILURE;
- }
- err = pe_parse(&ctx);
- if (err != LIBPE_E_OK) {
- pe_error_print(stderr, err);
- return EXIT_FAILURE;
- }
- if (!pe_is_pe(&ctx))
- return EXIT_FAILURE;
- IMAGE_COFF_HEADER *coff = pe_coff(&ctx);
- printf("Machine: %x\n", coff->Machine);
- return 0;
- }
- $ gcc -o example example.c -L. -lpe
- $ ./example ~/winapp/wrar530.exe
- Machine: 14c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement