jeudi 23 juillet 2015

C# Import from .NET DLL

How do I import methods from a .NET DLL to call from my C# code? I've tried both the [DllImport...] approach and using reflection with Assembly. I'm very inexperienced at .NET so apologies if this is a very basic question. My goal is to call LZ4Decompressor32().Decompress(byte[]).

Reflector shows LZ4Decompressor32 as being a derived type from the base type ILZ4Decompressor. All of this resides under Exec which I guess is the parent namespace?

Screenshot: http://ift.tt/1Knbbta

I expect I'm just messing up the namespace or type path but I've tried every combination I can think of.

FYI this is an old CTF challenge that I'm doing to learn. The full challenge extracts the next stage from its resource section then calls the LZ4Decompressor32().Decompress() method on the resource data.

ResourceManager manager = new ResourceManager(Name, Assembly.GetExecutingAssembly());
byte[] compressed = (byte[]) manager.GetObject("data");
return new LZ4Decompressor32().Decompress(compressed);





Aucun commentaire:

Enregistrer un commentaire