HollowsHunter
Scans all running processes. Recognizes and dumps a variety of potentially malicious implants (replaced/implanted PEs, shellcodes, hooks, in-memory patches).
Loading...
Searching...
No Matches
custom_buffer.h
Go to the documentation of this file.
1#pragma once
2#include <windows.h>
3
4namespace util {
5
6 struct AutoBuffer
7 {
8 AutoBuffer() : buf(nullptr), max_size(0), buf_size(0) { }
9
11 if (buf) {
12 ::free(buf);
13 buf = nullptr;
14 }
15 max_size = 0;
16 buf_size = 0;
17 }
18
19 BYTE* alloc(size_t _buf_size)
20 {
21 if (_buf_size > max_size) {
22 BYTE* allocated = (BYTE*)::realloc((void*)buf, _buf_size);
23 if (!allocated) {
24 return nullptr;
25 }
26 buf = allocated;
27 max_size = _buf_size;
28 }
29 buf_size = _buf_size;
30 ::memset(buf, 0, max_size);
31 return buf;
32 }
33
34 BYTE* buf;
35 size_t max_size;
36 size_t buf_size;
37 };
38
39}; //namespace util
40
BYTE * alloc(size_t _buf_size)