From 2458f06380bf2ac6c2d51170b96adc6854d57d23 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 23 Mar 2017 11:41:36 +0100 Subject: [PATCH] msvcrt: Throw throw_scheduler_resource_allocation_error on Context tls index allocation error. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- 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 2cde8b22dea..e86df53f065 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@Z (MSVCRT.@) * diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 659a3dcc427..dd957ef4e20 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 470d141e42f..1ab79064e33 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; } -- 2.11.4.GIT