| 332 | } |
| 333 | |
| 334 | HRESULT |
| 335 | WINAPI |
| 336 | GetCurrentThreadDescription (_Out_ PWSTR *threadDescription) |
| 337 | { |
| 338 | SK_TLS* pTLS = //= ReadAcquire (&__SK_DLL_Attached) ? |
| 339 | SK_TLS_Bottom (); //: nullptr; |
| 340 | |
| 341 | // Always use the TLS value if there is one |
| 342 | if ( pTLS != nullptr && |
| 343 | *pTLS->debug.name != L'\0' ) |
| 344 | { |
| 345 | // This is not freed here; the caller is expected to free it! |
| 346 | *threadDescription = |
| 347 | (wchar_t *)SK_LocalAlloc (LPTR, sizeof (wchar_t) * SK_MAX_THREAD_NAME_LEN); |
| 348 | |
| 349 | wcsncpy_s ( |
| 350 | *threadDescription, SK_MAX_THREAD_NAME_LEN-1, |
| 351 | pTLS->debug.name, _TRUNCATE |
| 352 | ); |
| 353 | |
| 354 | return S_OK; |
| 355 | } |
| 356 | |
| 357 | return |
| 358 | SK_GetThreadDescription ( GetCurrentThread (), |
| 359 | threadDescription ); |
| 360 | } |
| 361 | |
| 362 | using RtlEnterCriticalSection_pfn = NTSTATUS (WINAPI *)(PRTL_CRITICAL_SECTION); |
| 363 | RtlEnterCriticalSection_pfn |
no test coverage detected