64位系统和32位系统,DLL注入一样吗?
提供测试代码如下:
Public Class Form1
Public Const PROCESS_VM_READ = &H10
Public Const TH32CS_SNAPPROCESS = &H2
Public Const MEM_COMMIT = 4096
Public Const PAGE_READWRITE = 4
Public Const PROCESS_CREATE_THREAD = (&H2)
Public Const PROCESS_VM_OPERATION = (&H8)
Public Const PROCESS_VM_WRITE = (&H20)
Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function GetLastError Lib "kernel32" () As Integer
Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Integer
Public Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
Public Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private TargetProcessHandle As Integer
Private TargetWindowHandle As Integer
Private TargetProcessID As Integer
Private pfnStartAddr As Integer
Private pszLibFileRemote As String
Private TargetBufferSize As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
Public Sub Inject() REM 对记事本插入一个线程
TargetWindowHandle = FindWindow(Nothing, "无标题.txt 记事本") '这个需要改的和标题一样
If TargetWindowHandle = 0 Then MsgBox("NotePad Not Found。Exit") : Me.Close() : Exit Sub
GetWindowThreadProcessId(TargetWindowHandle, TargetProcessID)
TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcessID)
MsgBox(TargetProcessHandle.ToString)
pszLibFileRemote = Application.StartupPath & "\testdll.dll"
pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
MsgBox(pfnStartAddr.ToString)
TargetBufferSize = 1 + Len(pszLibFileRemote)
Dim Rtn As Integer
Dim LoadLibParamAdr As Integer
LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
MsgBox(Rtn.ToString, MsgBoxStyle.OkOnly, "WriteProcessMemory")
CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Inject()
End Sub
End Class
---------------------------------
在64位系统下测试失败,我用win7 64位和vb 2005...高手帮忙测试一下是为什么,我用360扫描的,DLL没有注入进去.
Public Class Form1
Public Const PROCESS_VM_READ = &H10
Public Const TH32CS_SNAPPROCESS = &H2
Public Const MEM_COMMIT = 4096
Public Const PAGE_READWRITE = 4
Public Const PROCESS_CREATE_THREAD = (&H2)
Public Const PROCESS_VM_OPERATION = (&H8)
Public Const PROCESS_VM_WRITE = (&H20)
Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function GetLastError Lib "kernel32" () As Integer
Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Integer
Public Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
Public Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private TargetProcessHandle As Integer
Private TargetWindowHandle As Integer
Private TargetProcessID As Integer
Private pfnStartAddr As Integer
Private pszLibFileRemote As String
Private TargetBufferSize As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
Public Sub Inject() REM 对记事本插入一个线程
TargetWindowHandle = FindWindow(Nothing, "无标题.txt 记事本") '这个需要改的和标题一样
If TargetWindowHandle = 0 Then MsgBox("NotePad Not Found。Exit") : Me.Close() : Exit Sub
GetWindowThreadProcessId(TargetWindowHandle, TargetProcessID)
TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcessID)
MsgBox(TargetProcessHandle.ToString)
pszLibFileRemote = Application.StartupPath & "\testdll.dll"
pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
MsgBox(pfnStartAddr.ToString)
TargetBufferSize = 1 + Len(pszLibFileRemote)
Dim Rtn As Integer
Dim LoadLibParamAdr As Integer
LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
MsgBox(Rtn.ToString, MsgBoxStyle.OkOnly, "WriteProcessMemory")
CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Inject()
End Sub
End Class
---------------------------------
在64位系统下测试失败,我用win7 64位和vb 2005...高手帮忙测试一下是为什么,我用360扫描的,DLL没有注入进去.
...全文
相关推荐
msado15.dll 32位和64位各版本的ADO都有
找了好久终于找到了所有的ADO控件,再也不用为ADO版本不同而发愁了。msado15.dll,32位和64位各版本的ADO都有,从2。0版一直到WIN7的6。XX版
DLL注入与Hook技术在32/64位系统中的应用
在现代软件开发和系统管理中,DLL注入技术是一把双刃剑。它作为一种高级技术手段,主要被用来向一个运行中的进程动态地注入代码或数据。这种技术有着广泛的应用,比如提升软件功能、进行系统监控、或是执行恶意活动。DLL注入通常发生在用户模式下,这也是它区别于直接修改系统内核的系统钩子的一个重要特征。DLL注入技术在游戏开发、安全测试、性能优化等领域有着不可替代的作用。开发者可以利用这一技术为游戏或者应用程序添加额外的模块功能,而安全测试人员则可以通过注入技术来研究软件在特定条件下的行为。
完美的内存中加载DLL支持32位和64位DLL
一位高手写的内存中加载DLL的源代码,支持32位和64位的DLL,支持XE,完美的处理32/64位Windows动态库的加载模,网上很少能下载到了,放到这里备份一下
64位进程调用32位DLL实例
64位进程调用32位DLL实例,参考http://blog.csdn.net/nie2314550441/article/details/49867735
64位和32位下的ucrtbased.dll
vs2015程序提示缺少ucrtbased.dll,本资源提供在x64和x86下的版本。


