Skip to content

Commit

Permalink
Merge branch 'support-android-and-bsd'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Nov 25, 2023
2 parents 84610ce + 852e26d commit c7be711
Show file tree
Hide file tree
Showing 26 changed files with 919 additions and 214 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: C# Build, Test and Publish
on:
push:
branches: [ master, refactor-reloaded3-compliance ]
branches: [ master, refactor-reloaded3-compliance, support-android-and-bsd ]
tags:
- '*'
pull_request:
branches: [ master, refactor-reloaded3-compliance ]
branches: [ master, refactor-reloaded3-compliance, support-android-and-bsd ]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Rust Build, Test & Publish

on:
push:
branches: [ main, master, crab ]
branches: [ main, master, crab, support-android-and-bsd ]
tags:
- '*'
pull_request:
branches: [ main, master, crab ]
branches: [ main, master, crab, support-android-and-bsd ]
workflow_dispatch:

jobs:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ With the following properties:
- ***Large Address Aware:*** On Windows, the library can correctly leverage all 4GB in 32-bit processes.
- ***Cross Platform***: Supports Windows, OSX and Linux.

Note: Rust/C port also work with FreeBSD (untested), and has partial [(limited) Android support](https://github.com/Reloaded-Project/Reloaded.Memory.Buffers/issues/3).

## Wiki & Documentation

[For full documentation, please see the Wiki](https://reloaded-project.github.io/Reloaded.Memory.Buffers/).
Expand Down
31 changes: 30 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ With the following properties:
- ***Large Address Aware:*** On Windows, the library can correctly leverage all 4GB in 32-bit processes.
- ***Cross Platform***: Supports Windows, OSX and Linux.

Note: Rust/C port also works with FreeBSD (untested), and has partial [(limited) Android support](https://github.com/Reloaded-Project/Reloaded.Memory.Buffers/issues/3).

## Example Use Cases

!!! tip "These are just examples."
Expand Down Expand Up @@ -161,11 +163,12 @@ With the following properties:
free_get_buffer_result(result);
```

!!! note "Use `append_code` instead of `append_bytes` if you need to add executable code. (Currently unavailable in C# port)"

### Allocate Memory

!!! info "Allows you to temporarily allocate memory within a specific address range and size constraints."


=== "C#"

```csharp
Expand Down Expand Up @@ -215,6 +218,32 @@ With the following properties:

!!! note "You can specify another process with `TargetProcess = someProcess` in `BufferAllocatorSettings`, but this is only supported on Windows."

### Overwriting Allocated Instructions

!!! info "On non-x86 architectures, some extra actions may be needed when overwriting executable code allocated with `append_code`."

!!! note "This involves clearing instruction cache, and abiding by Write XOR Execute restrictions."

=== "Rust"

```rust
Self::overwrite_allocated_code(address, size, |addr, size| {
// Do stuff with executable code
});
```

=== "C/C++"

```cpp
void do_stuff_with_executable_code(char* addr, size_t size) {
// Modify executable code in buffer
}

overwrite_allocated_code(address, size, do_stuff_with_executable_code);
```

!!! warning "Not currently available in C# version. Submit an issue request or PR if you need this."

## 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).
Expand Down
145 changes: 132 additions & 13 deletions src-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c7be711

Please sign in to comment.