This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef _WIN32 // inet_pton is available from Vista only (based on inet_pton.c from wireshark) | |
#define NS_INADDRSZ_ 4 | |
#define NS_IN6ADDRSZ_ 16 | |
#define NS_INT16SZ_ 2 | |
static int inet_pton4(const char *src, unsigned char *dst) | |
{ | |
char saw_digit = 0, octets = 0, ch; | |
unsigned char tmp[NS_INADDRSZ_], *tp = tmp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <tlhelp32.h> | |
// Pass 0 as the targetProcessId to suspend threads in the current process | |
void DoSuspendThread(DWORD targetProcessId, DWORD targetThreadId) | |
{ | |
HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); | |
if (h != INVALID_HANDLE_VALUE) | |
{ | |
THREADENTRY32 te; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <stdio.h> | |
// fullDump enables MiniDumpWithFullMemory, and results in dmp files to be over 100MB in size (as opposed to default which is only 100KB). | |
// With fullDump Visual Studio is able to display proper backtrace for unhandled c++ exception. Without fullDump WinDBG has to be used. | |
static int WriteMinidumpForException(EXCEPTION_POINTERS* e, bool fullDump) | |
{ | |
HMODULE dbghelp = LoadLibraryA("DbgHelp.dll"); // Note: no matching FreeLibrary | |
if (!dbghelp) | |
return EXCEPTION_CONTINUE_SEARCH; |
NewerOlder