aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2019-09-26 09:22:09 +0200
committerToni Uhlig <matzeton@googlemail.com>2019-09-26 09:22:09 +0200
commitd18ee31facdf341aa2e79a782e4701d46c57621c (patch)
tree2354d8a1adc7a5939bd6499290422096b83b3e18
parent25bf52435cb7297531bfc3538a9c2c0f06b9f8aa (diff)
added explicit struct constructor
-rw-r--r--MemDriverLib/PatternScanner.cpp13
-rw-r--r--include/PatternScanner.h6
2 files changed, 8 insertions, 11 deletions
diff --git a/MemDriverLib/PatternScanner.cpp b/MemDriverLib/PatternScanner.cpp
index 1b2a493..3e1b8ee 100644
--- a/MemDriverLib/PatternScanner.cpp
+++ b/MemDriverLib/PatternScanner.cpp
@@ -20,13 +20,8 @@ static bool map_file_kmem(MODULE_DATA& module, PVOID * const buffer,
static bool map_file_kmem_cleanup(MODULE_DATA& module, PVOID buffer,
PVOID const user_ptr);
-const struct map_file_data map_loadlib = {
- map_file_loadlib, map_file_loadlib_cleanup, true
-};
-
-const struct map_file_data map_kmem = {
- map_file_kmem, map_file_kmem_cleanup, false
-};
+const struct map_file_data map_loadlib = map_file_data(map_file_loadlib, map_file_loadlib_cleanup, true);
+const struct map_file_data map_kmem = map_file_data(map_file_kmem, map_file_kmem_cleanup, false);
bool map_file_loadlib(MODULE_DATA& module, PVOID * const buffer,
SIZE_T * const size, PVOID const user_ptr)
@@ -161,7 +156,7 @@ bool PatternScanner::Scan(MODULE_DATA& module, const char * const pattern)
return false;
}
- if (!mfd->map_file(module, (PVOID *)&mappedBuffer, &mappedSize, map_file_user_data))
+ if (!mfd->mapfile(module, (PVOID *)&mappedBuffer, &mappedSize, map_file_user_data))
{
return false;
}
@@ -190,7 +185,7 @@ bool PatternScanner::Scan(MODULE_DATA& module, const char * const pattern)
doScan(mappedBuffer, mappedSize, foundOffsets);
}
- if (!mfd->map_file_cleanup(module, mappedBuffer, map_file_user_data))
+ if (!mfd->mapcleanup(module, mappedBuffer, map_file_user_data))
{
return false;
}
diff --git a/include/PatternScanner.h b/include/PatternScanner.h
index 7a661aa..1c53349 100644
--- a/include/PatternScanner.h
+++ b/include/PatternScanner.h
@@ -12,8 +12,10 @@ typedef bool(*map_file_cleanup_cb)(IN MODULE_DATA&,
IN PVOID, IN PVOID const);
struct map_file_data {
- map_file_cb map_file;
- map_file_cleanup_cb map_file_cleanup;
+ explicit map_file_data(map_file_cb _mapfile, map_file_cleanup_cb _mapcleanup, bool _in_memory_module)
+ : mapfile(_mapfile), mapcleanup(_mapcleanup), in_memory_module(_in_memory_module) {}
+ map_file_cb mapfile;
+ map_file_cleanup_cb mapcleanup;
bool in_memory_module;
};