ReactOS
0.4.16-dev-1946-g52006dd
SetThreadDescription.c
Go to the documentation of this file.
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
*/
12
HRESULT
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
}
SetThreadDescription
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription(HANDLE thread, PCWSTR description)
Definition:
SetThreadDescription.c:12
TRACE
#define TRACE
Definition:
SetThreadDescription.c:7
DECLSPEC_HOTPATCH
#define DECLSPEC_HOTPATCH
Definition:
_mingw.h:240
thread
static HANDLE thread
Definition:
service.c:33
lstrlenW
#define lstrlenW
Definition:
compat.h:750
length
GLuint GLsizei GLsizei * length
Definition:
glext.h:6040
USHRT_MAX
#define USHRT_MAX
Definition:
limits.h:38
ThreadNameInformation
@ ThreadNameInformation
Definition:
winternl.h:2319
HRESULT
Definition:
mshtmhst.idl:286
void
Definition:
nsiface.idl:2307
k32_vista.h
debugstr_w
#define debugstr_w
Definition:
kernel32.h:32
NtSetInformationThread
NTSTATUS NTAPI NtSetInformationThread(_In_ HANDLE ThreadHandle, _In_ THREADINFOCLASS ThreadInformationClass, _In_reads_bytes_(ThreadInformationLength) PVOID ThreadInformation, _In_ ULONG ThreadInformationLength)
Definition:
query.c:2268
_THREAD_NAME_INFORMATION
Definition:
pstypes.h:1089
info
Definition:
notification.c:61
PCWSTR
const uint16_t * PCWSTR
Definition:
typedefs.h:57
STATUS_INVALID_PARAMETER
#define STATUS_INVALID_PARAMETER
Definition:
udferr_usr.h:135
WINAPI
#define WINAPI
Definition:
msvc.h:6
description
const char * description
Definition:
directx.c:2497
HRESULT_FROM_NT
#define HRESULT_FROM_NT(x)
Definition:
winerror.h:216
WCHAR
__wchar_t WCHAR
Definition:
xmlstorage.h:180
dll
win32
kernel32
kernel32_vista
SetThreadDescription.c
Generated on Thu Dec 4 2025 06:04:30 for ReactOS by
1.9.6