diff options
author | midipix <writeonce@midipix.org> | 2015-05-26 22:39:10 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:19 -0500 |
commit | 2b71e842c7f9a7a2130e9516ab0f900d41f1fc48 (patch) | |
tree | b38b8cd9daf6f88099797973680f4267c500a382 | |
parent | ca49435bbfc3d8394cfc10809d2ab8ff706560b8 (diff) | |
download | perk-2b71e842c7f9a7a2130e9516ab0f900d41f1fc48.tar.bz2 perk-2b71e842c7f9a7a2130e9516ab0f900d41f1fc48.tar.xz |
pe_map_raw_image: accept page protection as an argument.
-rw-r--r-- | include/perk/perk.h | 2 | ||||
-rw-r--r-- | src/main/pe_map_raw_image.c | 4 | ||||
-rw-r--r-- | src/main/perk.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h index 11b5f45..c6aeed7 100644 --- a/include/perk/perk.h +++ b/include/perk/perk.h @@ -74,7 +74,7 @@ struct pe_image_meta { perk_api int pe_output_export_symbols (const struct pe_image_meta *, uint32_t flags, FILE *); /* high-level api */ -perk_api int pe_map_raw_image (int fd, const char * name, struct pe_raw_image *); +perk_api int pe_map_raw_image (int fd, const char * name, int prot, struct pe_raw_image *); perk_api int pe_unmap_raw_image (struct pe_raw_image *); perk_api int pe_get_image_meta (const struct pe_raw_image *, struct pe_image_meta **); diff --git a/src/main/pe_map_raw_image.c b/src/main/pe_map_raw_image.c index dc37e35..bf21a9b 100644 --- a/src/main/pe_map_raw_image.c +++ b/src/main/pe_map_raw_image.c @@ -9,7 +9,7 @@ #include <perk/perk.h> -int pe_map_raw_image (int fd, const char * fname, struct pe_raw_image * map) +int pe_map_raw_image (int fd, const char * fname, int prot, struct pe_raw_image * map) { struct stat stat; int nfd, ret; @@ -21,7 +21,7 @@ int pe_map_raw_image (int fd, const char * fname, struct pe_raw_image * map) return errno; map->size = stat.st_size; - map->addr = (char *)mmap(0,map->size,PROT_READ,MAP_PRIVATE,fd,0); + map->addr = (char *)mmap(0,map->size,prot,MAP_PRIVATE,fd,0); if (map->addr == MAP_FAILED) { map->addr = 0; diff --git a/src/main/perk.c b/src/main/perk.c index d66b9ae..94be294 100644 --- a/src/main/perk.c +++ b/src/main/perk.c @@ -65,7 +65,7 @@ static int perk_map_input(struct perk_ctx * ctx) return ctx->status; } - ctx->status = pe_map_raw_image(ctx->fd,0,&ctx->map); + ctx->status = pe_map_raw_image(ctx->fd,0,PROT_READ,&ctx->map); return ctx->status; } |