mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: inject exception handler dll after EasyHook
This commit is contained in:
parent
e2ac9ddd43
commit
2ee990827b
3 changed files with 187 additions and 44 deletions
|
|
@ -5,49 +5,6 @@
|
|||
#include <tchar.h>
|
||||
#include <cstdio>
|
||||
#include <DbgHelp.h>
|
||||
#include <TlHelp32.h>
|
||||
|
||||
BOOL ListProcessThreads(DWORD dwOwnerPID)
|
||||
{
|
||||
HANDLE hThreadSnap = INVALID_HANDLE_VALUE;
|
||||
THREADENTRY32 te32;
|
||||
|
||||
// Take a snapshot of all running threads
|
||||
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||
return(FALSE);
|
||||
|
||||
// Fill in the size of the structure before using it.
|
||||
te32.dwSize = sizeof(THREADENTRY32);
|
||||
|
||||
// Retrieve information about the first thread,
|
||||
// and exit if unsuccessful
|
||||
if (!Thread32First(hThreadSnap, &te32))
|
||||
{
|
||||
CloseHandle(hThreadSnap); // Must clean up the snapshot object!
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
// Now walk the thread list of the system,
|
||||
// and display information about each thread
|
||||
// associated with the specified process
|
||||
do
|
||||
{
|
||||
if (te32.th32OwnerProcessID == dwOwnerPID && te32.th32ThreadID != GetCurrentThreadId())
|
||||
{
|
||||
_tprintf(TEXT("\n THREAD ID = 0x%08X"), te32.th32ThreadID);
|
||||
_tprintf(TEXT("\n base priority = %d"), te32.tpBasePri);
|
||||
_tprintf(TEXT("\n delta priority = %d"), te32.tpDeltaPri);
|
||||
SuspendThread(OpenThread(THREAD_ALL_ACCESS, FALSE, te32.th32ThreadID));
|
||||
}
|
||||
} while (Thread32Next(hThreadSnap, &te32));
|
||||
|
||||
_tprintf(TEXT("\n"));
|
||||
|
||||
// Don't forget to clean up the snapshot object.
|
||||
CloseHandle(hThreadSnap);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
bool isExcept = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue