Piotr Caban : msvcrt: Throw throw_scheduler_resource_allocation_error on Context tls index allocation error.

Alexandre Julliard julliard at winehq.org
Thu Mar 23 15:34:54 CDT 2017


Module: wine
Branch: master
Commit: 2458f06380bf2ac6c2d51170b96adc6854d57d23
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2458f06380bf2ac6c2d51170b96adc6854d57d23

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Mar 23 11:41:36 2017 +0100

msvcrt: Throw throw_scheduler_resource_allocation_error on Context tls index allocation error.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/cpp.c       | 9 +++++++++
 dlls/msvcrt/msvcrt.h    | 3 +++
 dlls/msvcrt/scheduler.c | 3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 2cde8b2..e86df53 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -843,6 +843,15 @@ void throw_bad_alloc(const char *str)
 }
 #endif
 
+#if _MSVCR_VER >= 100
+void throw_scheduler_resource_allocation_error(const char *str, HRESULT hr)
+{
+    scheduler_resource_allocation_error e;
+    scheduler_resource_allocation_error_ctor_name(&e, str, hr);
+    _CxxThrowException(&e.e, &scheduler_resource_allocation_error_exception_type);
+}
+#endif
+
 /******************************************************************
  *		?set_terminate@@YAP6AXXZP6AXXZ at Z (MSVCRT.@)
  *
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 659a3dc..dd957ef 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -285,6 +285,9 @@ void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
 #if _MSVCR_VER >= 80
 void throw_bad_alloc(const char*) DECLSPEC_HIDDEN;
 #endif
+#if _MSVCR_VER >= 100
+void throw_scheduler_resource_allocation_error(const char*, HRESULT) DECLSPEC_HIDDEN;
+#endif
 
 void __cdecl _purecall(void);
 void __cdecl _amsg_exit(int errnum);
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index 470d141..1ab7906 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -87,7 +87,8 @@ static Context* get_current_context(void)
     if (context_tls_index == TLS_OUT_OF_INDEXES) {
         int tls_index = TlsAlloc();
         if (tls_index == TLS_OUT_OF_INDEXES) {
-            /* throw scheduler_resource_allocation_error */
+            throw_scheduler_resource_allocation_error(NULL,
+                    HRESULT_FROM_WIN32(GetLastError()));
             return NULL;
         }
 




More information about the wine-cvs mailing list