From 4f7f0cdfd29e5c831a4732210bc203fe7dc6ebe2 Mon Sep 17 00:00:00 2001 From: Lightczx <1686188646@qq.com> Date: Mon, 30 Oct 2023 13:51:01 +0800 Subject: [PATCH] disable marshalling --- src/Injector.cs | 2 +- src/NativeMethods.json | 2 +- src/NativeMethods.txt | 32 ++++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Injector.cs b/src/Injector.cs index 4714786..3c3a627 100644 --- a/src/Injector.cs +++ b/src/Injector.cs @@ -45,7 +45,7 @@ public static class Injector { return new Win32Exception().PrintMsgAndReturnErrCode("WriteProcessMemory fail"); } } - var lpStartAddress = pLoadLibrary.CreateDelegate(); + var lpStartAddress = (delegate* unmanaged[Stdcall])pLoadLibrary.Value; //THREAD_START_ROUTINE var hThread = Native.CreateRemoteThread(hProc, default, 0, lpStartAddress, pBase, 0); if (hThread.IsNull) { var e = new Win32Exception(); diff --git a/src/NativeMethods.json b/src/NativeMethods.json index 1372a02..2fc0fd4 100644 --- a/src/NativeMethods.json +++ b/src/NativeMethods.json @@ -1,6 +1,6 @@ { "$schema": "https://aka.ms/CsWin32.schema.json", "className": "Native", - "allowMarshaling": true, + "allowMarshaling": false, "public": true } \ No newline at end of file diff --git a/src/NativeMethods.txt b/src/NativeMethods.txt index d3adb67..941cb92 100644 --- a/src/NativeMethods.txt +++ b/src/NativeMethods.txt @@ -1,21 +1,21 @@ -CreateProcess +CloseClipboard +CreateProcess +CreateRemoteThread +EmptyClipboard +GetConsoleMode +GetDC +GetDeviceCaps GetModuleHandle GetProcAddress -VirtualAllocEx -WriteProcessMemory -CreateRemoteThread -VirtualFreeEx -WaitForSingleObject -OpenClipboard -EmptyClipboard -GlobalLock -SetClipboardData -GlobalUnlock -CloseClipboard GetStdHandle -GetConsoleMode +GlobalLock +GlobalUnlock +OpenClipboard +ResumeThread +SetClipboardData SetConsoleMode TerminateProcess -ResumeThread -GetDeviceCaps -GetDC \ No newline at end of file +VirtualAllocEx +VirtualFreeEx +WaitForSingleObject +WriteProcessMemory \ No newline at end of file