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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
/*!
# The Reloaded Buffers Library
**Allocate Memory, & Knuckles**
- 
- 
- 
## About
`Reloaded.Memory.Buffers` is a library for allocating memory between a given minimum and maximum memory address, for C# and Rust.
With the following properties:
- ***Memory Efficient***: No wasted memory.
- ***Shared***: Can be found and read/written to by multiple users.
- ***Static***: Allocated data never moves, or is overwritten.
- ***Permanent***: Allocated data lasts the lifetime of the process.
- ***Concurrent***: Multiple users can access at the same time.
- ***Large Address Aware:*** On Windows, the library can correctly leverage all 4GB in 32-bit processes.
- ***Cross Platform***: Supports Windows, OSX and Linux.
## Wiki & Documentation
This is a cross-platform library, with shared documentation.
[For basic usage, see wiki](https://reloaded-project.github.io/Reloaded.Memory.Buffers/)
## Example Use Cases
These are just examples:
- ***Hooks***: Hooking libraries like [Reloaded.Hooks](https://github.com/Reloaded-Project/Reloaded.Hooks) can reduce amount of bytes stolen from functions.
- ***Libraries***: Libraries like [Reloaded.Assembler](https://github.com/Reloaded-Project/Reloaded.Assembler) require memory be allocated in first 2GB for x64 FASM.
## Usage
The library provides a simple high level API to use.
See [Wiki](https://reloaded-project.github.io/Reloaded.Memory.Buffers/) for Rust usage
### Community Feedback
If you have questions/bug reports/etc. feel free to [Open an Issue](https://github.com/Reloaded-Project/Reloaded.Memory.Buffers/issues/new).
Contributions are welcome and encouraged. Feel free to implement new features, make bug fixes or suggestions so long as
they meet the quality standards set by the existing code in the repository.
For an idea as to how things are set up, [see Reloaded Project Configurations.](https://github.com/Reloaded-Project/Reloaded.Project.Configurations)
Happy Hacking 💜
*/
pub mod structs {
pub mod params {
pub mod buffer_allocator_settings;
pub use buffer_allocator_settings::BufferAllocatorSettings;
pub mod buffer_search_settings;
pub use buffer_search_settings::BufferSearchSettings;
}
pub mod errors {
pub mod buffer_allocation_error;
pub use buffer_allocation_error::BufferAllocationError;
pub mod buffer_search_error;
pub use buffer_search_error::BufferSearchError;
pub mod item_allocation_error;
pub use item_allocation_error::ItemAllocationError;
}
pub mod safe_locator_item;
pub use safe_locator_item::SafeLocatorItem;
pub mod private_allocation;
pub use private_allocation::PrivateAllocation;
/// Provides access to underlying internal structures.
/// i.e. The Raw structures used in the backend.
///
/// Unsafe and for advanced users only, not recommended for general use.
pub mod internal {
pub mod locator_item;
pub use locator_item::LocatorItem;
pub mod locator_header;
pub use locator_header::LocatorHeader;
}
}
pub(crate) mod internal {
pub mod buffer_allocator;
pub mod locator_header_finder;
#[cfg(target_os = "linux")]
pub mod buffer_allocator_linux;
#[cfg(target_os = "macos")]
pub mod buffer_allocator_osx;
#[cfg(target_os = "windows")]
pub mod buffer_allocator_windows;
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
pub mod buffer_allocator_mmap_rs;
pub mod memory_mapped_file;
#[cfg(unix)]
pub mod memory_mapped_file_unix;
#[cfg(target_os = "windows")]
pub mod memory_mapped_file_windows;
}
pub(crate) mod utilities {
pub mod address_range;
pub mod cached;
pub mod icache_clear;
pub mod map_parser_utilities;
pub mod mathematics;
pub mod wrappers;
#[cfg(target_os = "linux")]
pub mod linux_map_parser;
// Internal, disables W^X for internal buffers.
pub(crate) mod disable_write_xor_execute;
}
/// Provides a C interface to the library.
pub mod c {
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub mod buffers_c_buffers;
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub mod buffers_c_locatoritem;
pub mod buffers_fnptr;
}
pub mod buffers;