How to do pinvoke like stuff in C#

Looking for links to either some tutorials or just code on accessing Windows DLL functions. How to setup return varialbles and map correct types to them, function defs, etc.

thanks all

Have you had a look at the winapi crate? It has a lot of function definitions.

1 Like

Thanks and, yeah, I have. Unfortunately its missing a lot of what I need for forensic work.

Nvm, got winapi confused with another crate, not sure I've looked at this one. I think this will help.

Still hoping for some tutorials or just raw code to learn from if anyone has some. Been a long time since I've done this outside of C#.

Unfortunately I'm not aware of any good tutorials specifically for Windows at the moment. Perhaps someone else is.

If you haven't read it already the Rust book has a very brief introduction to FFI (foreign function interface). The nomicon gives some general advice on how FFI works in Rust, although it's not Windows specific.

Other than that you could try asking a more specific question here as a starting point, e.g. how do I invoke this function or how do I translate this snippet of C# code in to Rust.