summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/perk/perk.h32
-rw-r--r--src/internal/perk_output_impl.h5
-rw-r--r--src/logic/pe_get_image_meta.c10
-rw-r--r--src/logic/pe_map_raw_image.c8
-rw-r--r--src/output/pe_output_export_symbols.c5
5 files changed, 35 insertions, 25 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h
index a7720e7..fa23754 100644
--- a/include/perk/perk.h
+++ b/include/perk/perk.h
@@ -150,33 +150,33 @@ struct pe_unit_ctx {
};
/* driver api */
-perk_api int pe_get_driver_ctx (const char ** argv, const char ** envp, uint32_t flags, struct pe_driver_ctx **);
+perk_api int pe_get_driver_ctx (const char ** argv, const char ** envp, uint32_t flags, struct pe_driver_ctx **);
perk_api void pe_free_driver_ctx (struct pe_driver_ctx *);
-perk_api int pe_get_unit_ctx (struct pe_driver_ctx *, const char * path, struct pe_unit_ctx **);
+perk_api int pe_get_unit_ctx (struct pe_driver_ctx *, const char * path, struct pe_unit_ctx **);
perk_api void pe_free_unit_ctx (struct pe_unit_ctx *);
/* utility api */
-perk_api int pe_output_export_symbols (const struct pe_image_meta *, const struct pe_common_ctx *, FILE *);
+perk_api int pe_output_export_symbols (const struct pe_image_meta *, const struct pe_common_ctx *, FILE *);
/* high-level api */
-perk_api int pe_map_raw_image (int fd, const char * path, int prot, struct pe_raw_image *);
-perk_api int pe_unmap_raw_image (struct pe_raw_image *);
+perk_api int pe_map_raw_image (int fd, const char * path, 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 **);
-perk_api void pe_free_image_meta (struct pe_image_meta *);
+perk_api int pe_get_image_meta (const struct pe_raw_image *, struct pe_image_meta **);
+perk_api void pe_free_image_meta (struct pe_image_meta *);
-perk_api int pe_get_named_section_index (const struct pe_image_meta *, const char * name);
-perk_api int pe_get_block_section_index (const struct pe_image_meta *, const struct pe_block *);
+perk_api int pe_get_named_section_index(const struct pe_image_meta *, const char * name);
+perk_api int pe_get_block_section_index(const struct pe_image_meta *, const struct pe_block *);
/* low-level api */
-perk_api int pe_read_dos_header (const struct pe_image_dos_hdr *, struct pe_meta_image_dos_hdr *);
-perk_api int pe_read_coff_header (const struct pe_coff_file_hdr *, struct pe_meta_coff_file_hdr *);
-perk_api int pe_read_optional_header (const union pe_opt_hdr *, struct pe_meta_opt_hdr *);
-perk_api int pe_read_section_header (const struct pe_sec_hdr *, struct pe_meta_sec_hdr *);
-perk_api int pe_read_export_header (const struct pe_export_hdr *, struct pe_meta_export_hdr *);
-perk_api int pe_read_import_header (const struct pe_import_hdr *, struct pe_meta_import_hdr *);
-perk_api int pe_read_import_lookup_item (const struct pe_import_lookup_item *, struct pe_meta_import_lookup_item *, uint32_t magic);
+perk_api int pe_read_dos_header (const struct pe_image_dos_hdr *, struct pe_meta_image_dos_hdr *);
+perk_api int pe_read_coff_header (const struct pe_coff_file_hdr *, struct pe_meta_coff_file_hdr *);
+perk_api int pe_read_optional_header (const union pe_opt_hdr *, struct pe_meta_opt_hdr *);
+perk_api int pe_read_section_header (const struct pe_sec_hdr *, struct pe_meta_sec_hdr *);
+perk_api int pe_read_export_header (const struct pe_export_hdr *, struct pe_meta_export_hdr *);
+perk_api int pe_read_import_header (const struct pe_import_hdr *, struct pe_meta_import_hdr *);
+perk_api int pe_read_import_lookup_item(const struct pe_import_lookup_item *, struct pe_meta_import_lookup_item *, uint32_t magic);
#ifdef __cplusplus
}
diff --git a/src/internal/perk_output_impl.h b/src/internal/perk_output_impl.h
index d60d78d..7540015 100644
--- a/src/internal/perk_output_impl.h
+++ b/src/internal/perk_output_impl.h
@@ -1,6 +1,9 @@
#include <perk/perk.h>
-static inline FILE * pe_output_prolog(const struct pe_common_ctx * cctx, FILE * fout, FILE ** ftmp)
+static inline FILE * pe_output_prolog(
+ const struct pe_common_ctx * cctx,
+ FILE * fout,
+ FILE ** ftmp)
{
int fdout;
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index 540ac87..ea76a92 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -6,7 +6,7 @@
#include <perk/perk.h>
#include "perk_impl.h"
-static int pe_free_image_meta_impl (struct pe_image_meta * meta, int status)
+static int pe_free_image_meta_impl(struct pe_image_meta * meta, int status)
{
unsigned i;
@@ -20,12 +20,12 @@ static int pe_free_image_meta_impl (struct pe_image_meta * meta, int status)
}
}
-void pe_free_image_meta (struct pe_image_meta * meta)
+void pe_free_image_meta(struct pe_image_meta * meta)
{
pe_free_image_meta_impl(meta,0);
}
-int pe_get_named_section_index (const struct pe_image_meta * m, const char * name)
+int pe_get_named_section_index(const struct pe_image_meta * m, const char * name)
{
int i; for (i=0; i<m->coff.num_of_sections; i++)
if (!(strcmp(name,m->sectbl[i].name)))
@@ -34,7 +34,7 @@ int pe_get_named_section_index (const struct pe_image_meta * m, const char * nam
return -1;
}
-int pe_get_block_section_index (const struct pe_image_meta * m, const struct pe_block * block)
+int pe_get_block_section_index(const struct pe_image_meta * m, const struct pe_block * block)
{
int i;
uint32_t low,high;
@@ -50,7 +50,7 @@ int pe_get_block_section_index (const struct pe_image_meta * m, const struct pe_
return -1;
}
-int pe_get_image_meta (const struct pe_raw_image * image, struct pe_image_meta ** meta)
+int pe_get_image_meta(const struct pe_raw_image * image, struct pe_image_meta ** meta)
{
int i,j,s,status;
struct pe_image_meta * m;
diff --git a/src/logic/pe_map_raw_image.c b/src/logic/pe_map_raw_image.c
index 58f914b..d93e605 100644
--- a/src/logic/pe_map_raw_image.c
+++ b/src/logic/pe_map_raw_image.c
@@ -8,7 +8,11 @@
#include <perk/perk.h>
-int pe_map_raw_image (int fd, const char * path, int prot, struct pe_raw_image * map)
+int pe_map_raw_image(
+ int fd,
+ const char * path,
+ int prot,
+ struct pe_raw_image * map)
{
struct stat stat;
bool fnew;
@@ -35,7 +39,7 @@ int pe_map_raw_image (int fd, const char * path, int prot, struct pe_raw_image *
return (map->addr == MAP_FAILED) ? -1 : 0;
}
-int pe_unmap_raw_image (struct pe_raw_image * map)
+int pe_unmap_raw_image(struct pe_raw_image * map)
{
return munmap(map->addr,map->size);
}
diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c
index 420cf31..d52bfe4 100644
--- a/src/output/pe_output_export_symbols.c
+++ b/src/output/pe_output_export_symbols.c
@@ -7,7 +7,10 @@
#include <perk/perk.h>
#include "perk_output_impl.h"
-int pe_output_export_symbols (const struct pe_image_meta * m, const struct pe_common_ctx * cctx, FILE * fout)
+int pe_output_export_symbols(
+ const struct pe_image_meta * m,
+ const struct pe_common_ctx * cctx,
+ FILE * fout)
{
FILE * ftmp;
uint32_t offset;