利用微信Detours不仅可以实现HOOK还能实现注入

Home / C++ MrLee 1天前 13

居然没发现还有注入功能,上代码。

#include <windows.h>
#include <detours.h>
#include <iostream>
int main() {
    STARTUPINFOW si;
    PROCESS_INFORMATION pi;
    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi));
    // 第三方软件的路径
    LPCWSTR applicationPath = L"C:\\Path\\To\\ThirdPartyApp.exe";
    // 我们编译好的 DLL 路径
    LPCSTR dllPath = "HookLogic.dll"; 
    BOOL success = DetourCreateProcessWithDllW(
        applicationPath, NULL, NULL, NULL, FALSE, 
        CREATE_DEFAULT_ERROR_MODE, NULL, NULL, 
        &si, &pi, dllPath, NULL
    );
    if (success) {
        std::cout << "Successfully launched and hooked!" << std::endl;
        ResumeThread(pi.hThread);
        WaitForSingleObject(pi.hProcess, INFINITE);
    } else {
        std::cerr << "Failed to launch. Error code: " << GetLastError() << std::endl;
    }
    return 0;
}


本文链接:https://it72.com/12803.htm

推荐阅读
最新回复 (0)
返回