|
发表于 2025-4-6 14:34:48
|
显示全部楼层
江西省景德镇市

.版本 2
.程序集 窗口程序集_启动窗口
.子程序 __启动窗口_创建完毕
.子程序 DLL注入
.局部变量 hProcess, 整数型
.局部变量 pID, 整数型
.局部变量 dllPath, 文本型
.局部变量 allocatedMem, 整数型
.局部变量 writeResult, 整数型
.局部变量 threadHandle, 整数型
pID = 进程_取同名ID (“notepad.exe”)
hProcess = OpenProcess (2035711, 0, pID)
.如果真 (hProcess = 0)
信息框 (“打开进程失败!”, 0, , )
返回 ()
.如果真结束
dllPath = “C:\MyDll.dll” ' 需注入的DLL绝对路径?:ml-citation{ref="3,5" data="citationList"}
allocatedMem = VirtualAllocEx (hProcess, 0, 取文本长度 (dllPath) + 1, 4096, 4) ' MEM_COMMIT + PAGE_READWRITE?:ml-citation{ref="2,4" data="citationList"}
.如果真 (allocatedMem = 0)
信息框 (“内存分配失败!”, 0, , )
进程_关闭 (hProcess)
返回 ()
.如果真结束
WriteProcessMemory (hProcess, allocatedMem, dllPath, 取文本长度 (dllPath) + 1, writeResult)
.如果真 (writeResult ≠ 取文本长度 (dllPath) + 1)
信息框 (“写入内存失败!”, 0, , )
VirtualFreeEx (hProcess, allocatedMem, 0, 32768) ' MEM_RELEASE?:ml-citation{ref="4" data="citationList"}
进程_关闭 (hProcess)
返回 ()
.如果真结束
threadHandle = CreateRemoteThread (hProcess, 0, 0, GetProcAddress (GetModuleHandleA (“kernel32.dll”), “LoadLibraryA”), allocatedMem, 0, 0) ' 核心注入点?:ml-citation{ref="1,2" data="citationList"}
.如果真 (threadHandle = 0)
信息框 (“线程创建失败!”, 0, , )
VirtualFreeEx (hProcess, allocatedMem, 0, 32768)
进程_关闭 (hProcess)
返回 ()
.如果真结束
线程_等待 (threadHandle, -1)
VirtualFreeEx (hProcess, allocatedMem, 0, 32768)
进程_关闭 (threadHandle)
进程_关闭 (hProcess)
信息框 (“DLL注入成功!”, 0, , )
|
|