VC驿站

 找回密码
 加入驿站

QQ登录

只需一步,快速开始

搜索
查看: 1324|回复: 3

關於WriteProcessMemory 部分內存無法寫入

[复制链接]
28_avatar_middle
最佳答案
0 
在线会员 发表于 2023-6-28 01:53:29 | 显示全部楼层 |阅读模式
本帖最后由 FAAW2200 于 2023-6-28 01:58 编辑

關於WriteProcessMemory 部分內存無法寫入
使用CE搜尋 是不可寫入的地址  然後使用CE可以更改數據
但是使用VB ReadProcessMemory WriteProcessMemory  
ReadProcessMemory 可以讀取到數據
WriteProcessMemory  無法寫入 確定 其他可寫入地址可更改數據
為什麼使用CE就可更改  自己用VB寫的 卻無法更改


部分程式碼
  1.     Private Const PROCESS_ALL_ACCESS = &H1F0FFF
  2.     Declare Auto Function WriteMemoryInt Lib "kernel32" Alias "WriteProcessMemory" (ByVal hwnd As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
  3. Private Declare Auto Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As Integer) As IntPtr
  4.     Dim PId As Long
  5. Private Declare Auto Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As IntPtr


  6. Public Enum PROCESS_ACCESS As Integer
  7.         ' Specifies all possible access flags for the process object.
  8.         PROCESS_ALL_ACCESS = &H1F0FFF

  9.         ' Enables using the process handle in the CreateRemoteThread function
  10.         ' to create a thread in the process.
  11.         PROCESS_CREATE_THREAD = &H2

  12.         ' Enables using the process handle as either the source or
  13.         ' target process in the DuplicateHandle function to duplicate a handle.
  14.         PROCESS_DUP_HANDLE = &H40

  15.         ' Enables using the process handle in the GetExitCodeProcess and
  16.         ' GetPriorityClass functions to read information from the process object.
  17.         PROCESS_QUERY_INFORMATION = &H400

  18.         ' Enables using the process handle in the SetPriorityClass function to
  19.         ' set the priority class of the process.
  20.         PROCESS_SET_INFORMATION = &H200

  21.         ' Enables using the process handle in the TerminateProcess function to
  22.         ' terminate the process.
  23.         PROCESS_TERMINATE = &H1

  24.         ' Enables using the process handle in the VirtualProtectEx and
  25.         ' WriteProcessMemory functions to modify the virtual memory of the process.
  26.         PROCESS_VM_OPERATION = &H8

  27.         ' Enables using the process handle in the ReadProcessMemory function to
  28.         ' read from the virtual memory of the process.
  29.         PROCESS_VM_READ = &H10

  30.         ' Enables using the process handle in the WriteProcessMemory function to
  31.         ' write to the virtual memory of the process.
  32.         PROCESS_VM_WRITE = &H20

  33.         ' Enables using the process handle in any of the wait functions to wait
  34.         ' for the process to terminate.
  35.         SYNCHRONIZE = &H100000
  36.     End Enum

  37.   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  38.         Dim hProcess1 As Integer
  39.         GetWindowThreadProcessId(窗口編號.Text, PId)
  40.         hProcess1 = OpenProcess(PROCESS_ALL_ACCESS, False, PId)
  41.         WriteMemoryInt(hProcess1, 地址, "7", 4, 0)

  42.     End Sub
复制代码




上一篇:raw sock关联icop 接收不了数据
下一篇:零基础C++入门教程后面的每一课课后作业答案在哪里呢
02_avatar_middle
最佳答案
0 
在线会员 发表于 2023-6-28 11:50:59 | 显示全部楼层
这是vc,不是vb
04_avatar_middle
最佳答案
22 
online_vip 发表于 2023-7-2 11:22:07 | 显示全部楼层
权限不足吧
59_avatar_middle
最佳答案
1 
在线会员 发表于 2023-7-3 16:39:02 | 显示全部楼层
VirtualProtect 看一下这个API
您需要登录后才可以回帖 登录 | 加入驿站 qq_login

本版积分规则

×【发帖 友情提示】
1、请回复有意义的内容,请勿恶意灌水;
2、纯数字、字母、表情等无意义的内容系统将自动删除;
3、若正常回复后帖子被自动删除,为系统误删的情况,请重新回复其他正常内容或等待管理员审核通过后会自动发布;
4、感谢您对VC驿站一如既往的支持,谢谢合作!

关闭

站长提醒上一条 /2 下一条

QQ|小黑屋|手机版|VC驿站 ( 辽ICP备09019393号-4 )|网站地图wx_jqr

GMT+8, 2023-9-24 21:34

Powered by CcTry.CoM

© 2009-2021 cctry.com

快速回复 返回顶部 返回列表