Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
833 B
1
Indexable
Never
#include <iostream>
#include <Windows.h>

using namespace std;
int main() {


#pragma region CallingFunction
    DWORD processId = 1456;

    // Target function address
    uintptr_t functionAddress = 0x7FF864824F35;

    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
    if (hProcess == NULL) {
        std::cerr << "Process failed." << std::endl;
        return 1;
    }

    HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(functionAddress), NULL, 0, NULL);
    if (hThread == NULL) {
        std::cerr << "Thread failed." << std::endl;
        CloseHandle(hProcess);
        return 1;
    }

    WaitForSingleObject(hThread, INFINITE);

    CloseHandle(hThread);

    CloseHandle(hProcess);

    return 0;
#pragma endregion
}
Leave a Comment