I'm trying to get the thread context of suspended WordPad. However, no matter what changes I make to the code, it returns 87.
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
CONTEXT ctx;
if (CreateProcess(L"C:\\Windows\\write.exe", NULL, NULL, NULL, false, CREATE_SUSPENDED, NULL, NULL, &si, &pi))
{
cout << "-> Success <-" << endl;
}
else
{
cout << GetLastError();
}
if (GetThreadContext(pi.hThread, &ctx))
{
cout << "-> Success <-" << endl;
}
else
{
cout << GetLastError();
}