forked from scanmem/scanmem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanroutines.h
72 lines (60 loc) · 2.55 KB
/
scanroutines.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
scanroutines.h Definition of routines of scanning for different data types
Copyright (C) 2009,2010 WANG Lu <coolwanglu(a)gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCANROUTINES_H__
#define SCANROUTINES_H__
#include <stdbool.h>
#include "value.h"
typedef enum {
ANYNUMBER, /* ANYINTEGER or ANYFLOAT */
ANYINTEGER, /* INTEGER of whatever width */
ANYFLOAT, /* FLOAT of whatever width */
INTEGER8,
INTEGER16,
INTEGER32,
INTEGER64,
FLOAT32,
FLOAT64,
BYTEARRAY,
STRING
} scan_data_type_t;
typedef enum {
MATCHANY, /* to update */
/* following: compare with a given value */
MATCHEQUALTO,
MATCHNOTEQUALTO,
MATCHGREATERTHAN,
MATCHLESSTHAN,
/* following: compare with the old value */
MATCHNOTCHANGED,
MATCHCHANGED,
MATCHINCREASED,
MATCHDECREASED,
/* folowing: compare with both given value and old value */
MATCHINCREASEDBY,
MATCHDECREASEDBY
} scan_match_type_t;
/* match old_value against new_value or user_value (or both, depending on the matching type, store the result into save */
/* NOTE: saveflag must be set to 0, since only useful bits are set, but extra bits are not cleared! */
/* address is pointing to new_value in TARGET PROCESS MEMORY SPACE, used when searching for a byte array */
/* return the number of bytes needed to store old_value, 0 for not matched */
typedef int (*scan_routine_t)(const value_t *new_value, const value_t *old_value, const uservalue_t *user_value, match_flags *saveflag, void *address);
extern scan_routine_t g_scan_routine;
/*
* choose the global scanroutine according to the given parameters, g_scan_routine will be set
* return whether a proper routine has been found
*/
bool choose_scanroutine(scan_data_type_t dt, scan_match_type_t mt);
scan_routine_t get_scanroutine(scan_data_type_t dt, scan_match_type_t mt);
#endif /* SCANROUTINES_H__ */