Wrapper C# for kernel32.dll API

谁都会走 提交于 2020-01-01 10:00:52

问题


Any helper class anywhere which wrapps kernel32 APIs, with all functions-methods and structures? Or any wrapper generator?

I want ALL methods of kernel32.dll in C# like this:

 [DllImport("kernel32.dll",EntryPoint="RtlMoveMemory")]
        public static extern void RtlMoveMemory(int des, int src, int count);

        [DllImport("kernel32.dll", EntryPoint = "OpenProcess")]
        public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId);

        [DllImport("kernel32", CharSet = CharSet.Ansi)]
        public extern static int GetProcAddress(int hwnd, string procedureName);

        [DllImport("kernel32.dll", EntryPoint = "GetModuleHandle")]
        public static extern int GetModuleHandle(string lpModuleName);

        [DllImport("kernel32.dll", EntryPoint = "VirtualAllocEx")]
        public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);

        [DllImport("kernel32")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseHandle(IntPtr hObject);

        [DllImport("kernel32", EntryPoint = "CreateRemoteThread")]
        public static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, uint lpThreadId);

        [DllImport("kernel32.dll", EntryPoint = "WriteProcessMemory")]
        public static extern IntPtr WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] buffer, uint size, IntPtr lpNumberOfBytesWritten);

回答1:


I doubt it.

Have you seen http://www.pinvoke.net/?



来源:https://stackoverflow.com/questions/1942829/wrapper-c-sharp-for-kernel32-dll-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!