C# Import from .NET DLL -
how import methods .net dll call c# code? i've tried both [dllimport...]
approach , using reflection assembly. i'm inexperienced @ .net apologies if basic question. goal call lz4decompressor32().decompress(byte[])
.
reflector shows lz4decompressor32
being derived type base type ilz4decompressor
. of resides under exec
guess parent namespace?
screenshot: http://s0.uploads.im/keqxk.jpg
i expect i'm messing namespace or type path i've tried every combination can think of.
fyi old ctf challenge i'm doing learn. full challenge extracts next stage resource section calls lz4decompressor32().decompress()
method on resource data.
resourcemanager manager = new resourcemanager(name, assembly.getexecutingassembly()); byte[] compressed = (byte[]) manager.getobject("data"); return new lz4decompressor32().decompress(compressed);
edit: more info, when debugging , breaking on assembly.loadfrom(...)
following error:
could not load file or assembly 'file:///[dll path]' or 1 of dependencies. module expected contain assembly manifest.
i ran dll through dependency walker , complaint msjava.dll, dependency walker explained (http://dependencywalker.com/faq.html).
follow these steps.
open project main program (your web project or exe project ) in visual studio.
locate "solution explorer" pane
right click on "references" node , choose "add reference"
click "browse"
select dll wish "import" , click ok
congratulations, have "imported" non-internal, non-private classes , methods in dll.
just instantiate , use.
Comments
Post a Comment