winpthreads: do not use the XXXExceptionHandler API in winstore builds

Calling RemoveVectoredExceptionHandler()/AddVectoredExceptionHandler() is
forbidden in non-desktop apps.
https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-addvectoredexceptionhandler
https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-removevectoredexceptionhandler

If USE_VEH_FOR_MSC_SETTHREADNAME is set in winstore builds, RaiseException is
only called if there's a debugger attached. In non-winstore builds it can also
be called if the SetThreadName_VEH_handle was set succesfully.

Signed-off-by: Liu Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c
index 1040511..142f65e 100644
--- a/mingw-w64-libraries/winpthreads/src/thread.c
+++ b/mingw-w64-libraries/winpthreads/src/thread.c
@@ -57,6 +57,10 @@
 #if !defined(_MSC_VER)
 #define USE_VEH_FOR_MSC_SETTHREADNAME
 #endif
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+/* forbidden RemoveVectoredExceptionHandler/AddVectoredExceptionHandler APIs */
+#undef USE_VEH_FOR_MSC_SETTHREADNAME
+#endif
 
 #if defined(USE_VEH_FOR_MSC_SETTHREADNAME)
 static void *SetThreadName_VEH_handle = NULL;
@@ -105,7 +109,11 @@
    /* Without a debugger we *must* have an exception handler,
     * otherwise raising an exception will crash the process.
     */
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
    if ((!IsDebuggerPresent ()) && (SetThreadName_VEH_handle == NULL))
+#else
+   if (!IsDebuggerPresent ())
+#endif
      return;
 
    RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (ULONG_PTR *) &info);