# Unmanaged Code Execution with .NET Dynamic PInvoke

DevFeed: [Unmanaged Code Execution with .NET Dynamic PInvoke](<https://devfeed.tech/articles/unmanaged-code-execution-with-net-dynamic-pinvoke-20504.md>)

Original publisher: [Read original article](<https://bohops.com/2022/04/02/unmanaged-code-execution-with-net-dynamic-pinvoke/>)

Author: bohops

Published: 2022-04-02T16:45:49Z

Content type: tutorial

Language: en

Sources: [Bohops](<https://devfeed.tech/sources/bohops.md>)

Topics: [.NET](<https://devfeed.tech/topics/net.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [Code](<https://devfeed.tech/topics/code.md>), [Endpoint Security & XDR](<https://devfeed.tech/topics/endpoint-security-xdr.md>)

Tags: [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [code](<https://devfeed.tech/tags/code.md>), [endpoint-security](<https://devfeed.tech/tags/endpoint-security.md>), [interop](<https://devfeed.tech/tags/interop.md>), [native](<https://devfeed.tech/tags/native.md>), [net](<https://devfeed.tech/tags/net.md>), [security](<https://devfeed.tech/tags/security.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>)

## AI overview

This developer article explains classic P/Invoke in .NET and introduces Dynamic PInvoke, a technique for calling and executing native code differently from managed code. It discusses limitations, .NET executable structure, and possible defensive-evasion implications.

## Source excerpt

Yes, you read that correctly - "Dynamic Pinvoke" as in "Dynamic Platform Invoke" Background Recently, I was browsing through Microsoft documentation and other blogs to gain a better understanding of .NET dynamic types and objects. I've always found the topic very interesting mainly due to its relative obscurity and the offensive opportunities for defensive evasion. [...]