Reactos
1
2#include "k32_vista.h"
3#define NDEBUG
4#include <debug.h>
5
6#undef TRACE
7#define TRACE DPRINT
8
9/***********************************************************************
10 * SetThreadDescription (kernelbase.@)
11 */
12HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR description )
13{
14 THREAD_NAME_INFORMATION info;
15 int length;
16
17 TRACE( "(%p, %s)\n", thread, debugstr_w( description ));
18
19 length = description ? lstrlenW( description ) * sizeof(WCHAR) : 0;
20
21 if (length > USHRT_MAX)
22 return HRESULT_FROM_NT(STATUS_INVALID_PARAMETER);
23
24 info.ThreadName.Length = info.ThreadName.MaximumLength = length;
25 info.ThreadName.Buffer = (WCHAR *)description;
26
27 return HRESULT_FROM_NT(NtSetInformationThread( thread, ThreadNameInformation, &info, sizeof(info) ));
28}