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.

  1. open project main program (your web project or exe project ) in visual studio.

  2. locate "solution explorer" pane

  3. right click on "references" node , choose "add reference"

  4. click "browse"

  5. select dll wish "import" , click ok

congratulations, have "imported" non-internal, non-private classes , methods in dll.

just instantiate , use.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -