msvcrt: Throw throw_scheduler_resource_allocation_error on Context tls index allocation error.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-03-23 11:41:36 +01:00 committed by Alexandre Julliard
parent 27185abe63
commit 2458f06380
3 changed files with 14 additions and 1 deletions

View File

@ -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.@)
*

View File

@ -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);

View File

@ -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;
}