zoukankan
html css js c++ java
C#引入Win32API:常用Win32API
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; //这个肯定要的 namespace WindowsApplication1 { class win32API { public const int OPEN_PROCESS_ALL = 2035711; public const int PAGE_READWRITE = 4; public const int PROCESS_CREATE_THREAD = 2; public const int PROCESS_HEAP_ENTRY_BUSY = 4; public const int PROCESS_VM_OPERATION = 8; public const int PROCESS_VM_READ = 256; public const int PROCESS_VM_WRITE = 32; private const int PAGE_EXECUTE_READWRITE = 0x4; private const int MEM_COMMIT = 4096; private const int MEM_RELEASE = 0x8000; private const int MEM_DECOMMIT = 0x4000; private const int PROCESS_ALL_ACCESS = 0x1F0FFF; //查找窗体 [DllImport("User32.dll", EntryPoint = "FindWindow")] public extern static IntPtr FindWindow( string lpClassName, string lpWindowName ); //得到目标进程句柄的函数 [DllImport("USER32.DLL")] public extern static int GetWindowThreadProcessId( int hwnd, ref int lpdwProcessId ); [DllImport("USER32.DLL")] public extern static int GetWindowThreadProcessId( IntPtr hwnd, ref int lpdwProcessId ); //打开进程 [DllImport("kernel32.dll")] public extern static int OpenProcess( int dwDesiredAccess, int bInheritHandle, int dwProcessId ); [DllImport("kernel32.dll")] public extern static IntPtr OpenProcess( uint dwDesiredAccess, int bInheritHandle, uint dwProcessId ); //关闭句柄的函数 [DllImport("kernel32.dll", EntryPoint = "CloseHandle")] public static extern int CloseHandle( int hObject ); //读内存 [DllImport("Kernel32.dll ")] public static extern Int32 ReadProcessMemory( IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesWritten ); [DllImport("Kernel32.dll ")] public static extern Int32 ReadProcessMemory( int hProcess, int lpBaseAddress, ref int buffer, //byte[] buffer, int size, int lpNumberOfBytesWritten ); [DllImport("Kernel32.dll ")] public static extern Int32 ReadProcessMemory( int hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesWritten ); //写内存 [DllImport("kernel32.dll")] public static extern Int32 WriteProcessMemory( IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesWritten ); [DllImport("kernel32.dll")] public static extern Int32 WriteProcessMemory( int hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesWritten ); //创建线程 [DllImport("kernel32", EntryPoint = "CreateRemoteThread")] public static extern int CreateRemoteThread( int hProcess, int lpThreadAttributes, int dwStackSize, int lpStartAddress, int lpParameter, int dwCreationFlags, ref int lpThreadId ); //开辟指定进程的内存空间 [DllImport("Kernel32.dll")] public static extern System.Int32 VirtualAllocEx( System.IntPtr hProcess, System.Int32 lpAddress, System.Int32 dwSize, System.Int16 flAllocationType, System.Int16 flProtect ); [DllImport("Kernel32.dll")] public static extern System.Int32 VirtualAllocEx( int hProcess, int lpAddress, int dwSize, int flAllocationType, int flProtect ); //释放内存空间 [DllImport("Kernel32.dll")] public static extern System.Int32 VirtualFreeEx( int hProcess, int lpAddress, int dwSize, int flAllocationType ); } }
查看全文
相关阅读:
学习素材、网站
用 Python脚本生成 Android SALT 扰码
H面试程序(29):求最大递增数
常用数据库查询判断表和字段是否存在
《火球——UML大战需求分析》(第3章 分析业务模型-类图)——3.7 关于对象图
N个数依次入栈,出栈顺序有多少种
WIN ERROR:C:WindowsSystem32<LANG_NAME>mstsc.exe.MUI
大端法和小端法
freopen()重定向的打开和关闭
Linux 的 Spinlock 在 MIPS 多核处理器中的设计与实现
原文地址:https://www.cnblogs.com/bdstjk/p/2519866.html
最新文章
How to get the MouseEvent coordinates for an element that has CSS3 Transform?
Android Volley 具体解释 Google公布的一套用于网络通信的工具库
MFC的执行过程分析
Thumb指令集与ARM指令集的差别
最大不重叠区间
Tensorflow MNIST 数据集測试代码入门
OpenCV图像处理篇之腐蚀与膨胀
域控制器情况分析
BZOJ4872: [Shoi2017]分手是祝愿
洛谷P3746 [六省联考2017]组合数问题
热门文章
洛谷P3704 [SDOI2017]数字表格
浅谈线段树中加与乘标记的下放
浅谈ST表
复习计划
洛谷P3356 火星探险问题(费用流)
洛谷P3357 最长k可重线段集问题(费用流)
洛谷P3358 最长k可重区间集问题(费用流)
【Itext】7步制作Itext5页眉页脚pdf实现第几页共几页
DNS解析服务使用的系统对网站的安全起着很重要的作用
W5300E01-ARM 交叉编译器(Cross Compiler)用户手册
Copyright © 2011-2022 走看看