vb2008不能用VirtualAllocEx()给外部进程申请内存吗?
在vb6.0都行,搬到vs2008用vb编就不行了。请高手指点!
已经正确得到进程句柄,VirtualAllocEx()有时候有值返回,有时候返回NULL
就算有返回,再用WriteProcessMemory也没效,用任务管理器查过,目标进程的内存没有增加,还有同时申请两个内存时,返回的地址是一样的。
Private Declare Function VirtualAllocEx Lib "kernel32" Alias "VirtualAllocEx" (ByVal hProcess As Integer, ByVal lpAddress As Object, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
Dim lpTextRemote As Int32
lpTextRemote = VirtualAllocEx(hProcess, 0, 1024, MEM_COMMIT, PAGE_READWRITE)