libPeConv
A library to load, manipulate, dump PE files.
buffer_util.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <windows.h>
9
10namespace peconv {
11
22 bool validate_ptr(
23 IN const void* buffer_bgn,
24 IN SIZE_T buffer_size,
25 IN const void* field_bgn,
26 IN SIZE_T field_size
27 );
28
29//-----------------------------------------------------------------------------------
30//
31// supported buffers:
32//
36 typedef PBYTE UNALIGNED_BUF;
37
41 typedef PBYTE ALIGNED_BUF;
42
43//
44// alloc/free unaligned buffers:
45//
49 UNALIGNED_BUF alloc_unaligned(size_t buf_size);
50
51 //
55 void free_unaligned(UNALIGNED_BUF section_buffer);
56
57//
58// alloc/free aligned buffers:
59//
60
64 ALIGNED_BUF alloc_aligned(size_t buffer_size, DWORD protect, ULONGLONG desired_base=NULL);
65
69 bool free_aligned(ALIGNED_BUF buffer, size_t buffer_size=0);
70
71 //PE buffers (wrappers)
72
76 ALIGNED_BUF alloc_pe_buffer(size_t buffer_size, DWORD protect, ULONGLONG desired_base=NULL);
77
81 bool free_pe_buffer(ALIGNED_BUF buffer, size_t buffer_size=0);
82
83}; //namespace peconv
bool validate_ptr(IN const void *buffer_bgn, IN SIZE_T buffer_size, IN const void *field_bgn, IN SIZE_T field_size)
Definition: buffer_util.cpp:9
bool free_aligned(ALIGNED_BUF buffer, size_t buffer_size=0)
Definition: buffer_util.cpp:60
ALIGNED_BUF alloc_aligned(size_t buffer_size, DWORD protect, ULONGLONG desired_base=NULL)
Definition: buffer_util.cpp:52
PBYTE ALIGNED_BUF
Definition: buffer_util.h:41
UNALIGNED_BUF alloc_unaligned(size_t buf_size)
Definition: buffer_util.cpp:35
bool free_pe_buffer(ALIGNED_BUF buffer, size_t buffer_size=0)
Definition: buffer_util.cpp:84
ALIGNED_BUF alloc_pe_buffer(size_t buffer_size, DWORD protect, ULONGLONG desired_base=NULL)
Definition: buffer_util.cpp:78
PBYTE UNALIGNED_BUF
Definition: buffer_util.h:36
void free_unaligned(UNALIGNED_BUF section_buffer)
Definition: buffer_util.cpp:43