aevitas / bluerain Goto Github PK
View Code? Open in Web Editor NEWBlueRain is a fully-featured, managed memory manipulation library written in C#
License: Apache License 2.0
BlueRain is a fully-featured, managed memory manipulation library written in C#
License: Apache License 2.0
As the Injector constructor is internal, theres just ExternalProcessMemory.ctor
to instantiate an Injector. However, there's no way to set _ejectOnDispose
if you want the injected modules to get free'd.
Ideas:
_ejectOnDispose
as a public get/set property
InjectorInitializationParameters
to the ExternalProcessMemory.ctor
createInjector
, which seems like a clean approachExternalProcessMemory.ctor
MCVE:
internal class Program
{
private static void Main(string[] args)
{
var dllPath = @"C:\mydll.dll";
var process = Process.GetProcessesByName("csgo").Single();
var memory = new ExternalProcessMemory(process, true);
var module = memory.Injector.Inject(dllPath);
}
}
The ExternalProcessMemory
constructor throws a NullReferenceException
when being called with createInjector = true
. This is due to the constructor in question calling its base constructor (in which the Injector gets instantiated) before the ProcessHandle gets instantiated, which is required for injection.
See https://github.com/aevitas/bluerain/blob/v2/src/BlueRain/ExternalProcessMemory.cs#L36
My suggestion is to move
ProcessHandle = OpenProcess(access, false, process.Id);
up into its base constructor with sane ProcessAccess
defaults.
Any thoughts?
Currently, the implementation of ExternalProcessMemory
simply calls ReadBytes
to read the length of type T
from memory, and then feeds it to the marshal. Since marshalling is relatively expensive (read: very expensive), we should consider directly dereferencing the buffer ptr, and avoid the marshal entirely.
hi, i tested a method inspirated by yours like ๐
Marshal.SizeOf(typeof(T));
to get the buffer size in generic Read method... i got it work with an integer
is that a correct way to doit?
Mismatch in method call and method definition:
public bool Free(bool isLocalProcessMemory)
vs
if (!InjectedModule.Value.Free(Injector.IsExternal))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.