summaryrefslogtreecommitdiff
path: root/utils/mcpu-object-edit.h
blob: 2e04d9823ea2258ef254f3e84b4841eaa011d4c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _MCPU_OBJECT_EDIT_H_
#define _MCPU_OBJECT_EDIT_H_ 1

#include <stddef.h>


typedef enum mcpu_object_edit_action_type
{
  MCPU_OBJECT_EDIT_REMOVE = 1,
  MCPU_OBJECT_EDIT_RENAME,
  MCPU_OBJECT_EDIT_UPDATE,
  MCPU_OBJECT_EDIT_ADD
} mcpu_object_edit_action_type;


typedef struct mcpu_object_edit_action
{
  mcpu_object_edit_action_type type;
  const char                  *name;
  const char                  *new_name;
  const unsigned char         *data;
  size_t                       size;
} mcpu_object_edit_action;


typedef struct mcpu_object_edit_options
{
  const char *const              *only_sections;
  size_t                          only_count;
  const mcpu_object_edit_action  *actions;
  size_t                          action_count;
} mcpu_object_edit_options;


int mcpu_object_strip_data( const unsigned char *data, size_t size,
                            unsigned char **out, size_t *out_size,
                            int *changed, char *err, size_t errsz );

int mcpu_object_edit_data( const unsigned char *data, size_t size,
                           const mcpu_object_edit_options *options,
                           unsigned char **out, size_t *out_size,
                           int *changed, char *err, size_t errsz );

int mcpu_object_dump_section( const unsigned char *data, size_t size,
                              const char *name,
                              unsigned char **out, size_t *out_size,
                              char *err, size_t errsz );

#endif