| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1037 人关注过本帖
标题:有关API openprocess权限的问题
取消只看楼主 加入收藏
我是菜鸟哦
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:921
专家分:209
注 册:2007-5-4
结帖率:73.33%
收藏
 问题点数:0 回复次数:1 
有关API openprocess权限的问题
我读取游戏CS的内存,可以用最高权限读取。
但是读取另外一款游戏却不行,(可以返回进程句柄的最高权限是1536,但不可以用readmemory函数读取内存),估计是什么被屏蔽掉了(这里我也不怎么懂)

代码如下(代码没有问题,已经试验过了,求达人指点迷津,另外我用CE修改器就可以载入的啊
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As LongPrivate Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function RtlAdjustPrivilege& Lib "ntdll" (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)

Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Const PROCESS_VM_OPERATION = (&H8)
Private Const PROCESS_VM_READ = (&H10)
Private Const PROCESS_VM_WRITE = (&H20)

Private Sub Command1_Click()
Dim s As Integer
Dim ihWnd As Long, iPid As Long, hProcess As Long
Dim i As Long

  
 ihWnd = FindWindow("游戏类名", vbNullString)
 If ihWnd = 0 Then MsgBox "游戏未启动": Exit Sub
 MsgBox "游戏已启动" & vbCrLf
 GetWindowThreadProcessId ihWnd, iPid
 
 For i = 0 To 65535 '我想用程序罗列出所有可以读取内存的权限,但是没有。。。。。。
 hProcess = OpenProcess(i, 0, iPid)
 If hProcess Then
 ReadProcessMemory hProcess, &H90D75F8, s, 2, 0&
 If s <> 0 Then MsgBox s
 CloseHandle hProcess
 End If
 Next i
End Sub

Private Sub Form_Load()
Call RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, 1, 0, 0)
End Sub
搜索更多相关主题的帖子: API openprocess 权限 
2010-04-26 20:39
我是菜鸟哦
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:921
专家分:209
注 册:2007-5-4
收藏
得分:0 
搞定了,SE_DEBUG_PRIVILEGE忘了赋值。(属于强制提升权限)

偶是菜鸟鸟偶惧WHO?!!!!
2010-04-26 20:47
快速回复:有关API openprocess权限的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016258 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved