win-capture: on mingw-w64 support try and catch

This commit is contained in:
martell
2015-02-05 07:29:24 +00:00
committed by jp9000
parent c5478f52d9
commit 97cc9b610a

View File

@@ -2,13 +2,41 @@
#include <stdint.h>
#ifdef __MINGW32__
#include <excpt.h>
#ifndef TRYLEVEL_NONE
#ifndef __MINGW64__
#define NO_SEH_MINGW
#endif
#ifndef __try
#define __try
#endif
#ifndef __except
#define __except(x) if (0)
#endif
#endif
#endif
static inline int safe_memcmp(const void *p1, const void *p2, size_t size)
{
__try {
#ifdef NO_SEH_MINGW
__try1(EXCEPTION_EXECUTE_HANDLER)
#else
__try
#endif
{
return memcmp(p1, p2, size);
} __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) {
}
#ifdef NO_SEH_MINGW
__except1
#else
__except(EXCEPTION_EXECUTE_HANDLER)
#endif
{
return -1;
}
}
struct patch_info {