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 ); } }
查看全文
相关阅读:
计算机网络 基础 1
JAVA 基础之 多线程
HashMap 多线程处理之 FailFast机制:
Struts2
JAVA 由浅及深之 Servlet
Servlet 会话技术 , Session 及 Cookie 详解
JAVA 设计模式 : 单例模式
JAVA 基础之 序列化 Serializable
代理模式 及 实现AOP 拦截机制
web.xml 文件详解 及 listener、 filter、servlet 加载顺序
原文地址:https://www.cnblogs.com/bdstjk/p/2519866.html
最新文章
*IE动态创建Radio的时候 必须先指定Name属性
*最近培训的一个题目:蚂蚁爬竿
*JS文件操作
*关于Jogl的郁闷事
*关于OpenGL的反馈
获取IP地址
今天在用acegi做系统验证的时候碰到几个问题
极客Style:12款华丽的Admin管理后台模板
重点研究的urls配置
关于用户,用户组,角色和权限
热门文章
扩展RBAC用户角色权限设计方案
MyEclipse6.5安装SVN
[JAVA]定时任务之Quartz使用篇
使用 Spring Data JPA 简化 JPA 开发
基于UML的面向对象分析与设计
一堂如何提高代码质量的培训课
转载: 从B树、B+树、B*树谈到R 树
转:中国互联网十五年的22个创新模式
转载 :js加载与执行顺序
rz 上传到服务器,压缩包解压失败
Copyright © 2011-2022 走看看