Commit e7afddd2 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

ntdll: Rename THREAD_DESCRIPTION_INFORMATION to THREAD_NAME_INFORMATION.

parent 4071f6c6
...@@ -2353,7 +2353,7 @@ todo_wine ...@@ -2353,7 +2353,7 @@ todo_wine
static void test_thread_description(void) static void test_thread_description(void)
{ {
THREAD_DESCRIPTION_INFORMATION *thread_desc; THREAD_NAME_INFORMATION *thread_desc;
static const WCHAR *desc = L"thread_desc"; static const WCHAR *desc = L"thread_desc";
ULONG len, len2, desc_len; ULONG len, len2, desc_len;
NTSTATUS status; NTSTATUS status;
...@@ -2368,7 +2368,7 @@ static void test_thread_description(void) ...@@ -2368,7 +2368,7 @@ static void test_thread_description(void)
} }
desc_len = lstrlenW(desc) * sizeof(*desc); desc_len = lstrlenW(desc) * sizeof(*desc);
thread_desc = (THREAD_DESCRIPTION_INFORMATION *)buff; thread_desc = (THREAD_NAME_INFORMATION *)buff;
/* Initial description. */ /* Initial description. */
ptr = NULL; ptr = NULL;
...@@ -2383,15 +2383,15 @@ static void test_thread_description(void) ...@@ -2383,15 +2383,15 @@ static void test_thread_description(void)
ok(len == sizeof(*thread_desc), "Unexpected structure length %u.\n", len); ok(len == sizeof(*thread_desc), "Unexpected structure length %u.\n", len);
len2 = 0; len2 = 0;
thread_desc->Description.Length = 1; thread_desc->ThreadName.Length = 1;
thread_desc->Description.MaximumLength = 0; thread_desc->ThreadName.MaximumLength = 0;
thread_desc->Description.Buffer = (WCHAR *)thread_desc; thread_desc->ThreadName.Buffer = (WCHAR *)thread_desc;
status = pNtQueryInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, len, &len2); status = pNtQueryInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, len, &len2);
ok(!status, "Failed to get thread info, status %#x.\n", status); ok(!status, "Failed to get thread info, status %#x.\n", status);
ok(len2 == sizeof(*thread_desc), "Unexpected structure length %u.\n", len); ok(len2 == sizeof(*thread_desc), "Unexpected structure length %u.\n", len);
ok(!thread_desc->Description.Length, "Unexpected description length %#x.\n", thread_desc->Description.Length); ok(!thread_desc->ThreadName.Length, "Unexpected description length %#x.\n", thread_desc->ThreadName.Length);
ok(thread_desc->Description.Buffer == (WCHAR *)(thread_desc + 1), ok(thread_desc->ThreadName.Buffer == (WCHAR *)(thread_desc + 1),
"Unexpected description string pointer %p, %p.\n", thread_desc->Description.Buffer, thread_desc); "Unexpected description string pointer %p, %p.\n", thread_desc->ThreadName.Buffer, thread_desc);
hr = pSetThreadDescription(GetCurrentThread(), NULL); hr = pSetThreadDescription(GetCurrentThread(), NULL);
ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#x.\n", hr); ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#x.\n", hr);
...@@ -2415,11 +2415,11 @@ static void test_thread_description(void) ...@@ -2415,11 +2415,11 @@ static void test_thread_description(void)
ok(!status, "Failed to get thread info.\n"); ok(!status, "Failed to get thread info.\n");
ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len); ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
ok(thread_desc->Description.Length == desc_len && thread_desc->Description.MaximumLength == desc_len, ok(thread_desc->ThreadName.Length == desc_len && thread_desc->ThreadName.MaximumLength == desc_len,
"Unexpected description length %u.\n", thread_desc->Description.Length); "Unexpected description length %u.\n", thread_desc->ThreadName.Length);
ok(thread_desc->Description.Buffer == (WCHAR *)(thread_desc + 1), ok(thread_desc->ThreadName.Buffer == (WCHAR *)(thread_desc + 1),
"Unexpected description string pointer %p, %p.\n", thread_desc->Description.Buffer, thread_desc); "Unexpected description string pointer %p, %p.\n", thread_desc->ThreadName.Buffer, thread_desc);
ok(!memcmp(thread_desc->Description.Buffer, desc, desc_len), "Unexpected description string.\n"); ok(!memcmp(thread_desc->ThreadName.Buffer, desc, desc_len), "Unexpected description string.\n");
/* Partial results. */ /* Partial results. */
len = 0; len = 0;
...@@ -2432,7 +2432,7 @@ static void test_thread_description(void) ...@@ -2432,7 +2432,7 @@ static void test_thread_description(void)
ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len); ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
/* Change description. */ /* Change description. */
thread_desc->Description.Length = thread_desc->Description.MaximumLength = 8; thread_desc->ThreadName.Length = thread_desc->ThreadName.MaximumLength = 8;
lstrcpyW((WCHAR *)(thread_desc + 1), L"desc"); lstrcpyW((WCHAR *)(thread_desc + 1), L"desc");
status = pNtSetInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, sizeof(*thread_desc)); status = pNtSetInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, sizeof(*thread_desc));
...@@ -2450,7 +2450,7 @@ static void test_thread_description(void) ...@@ -2450,7 +2450,7 @@ static void test_thread_description(void)
status = NtSetInformationThread(GetCurrentThread(), ThreadNameInformation, NULL, sizeof(*thread_desc)); status = NtSetInformationThread(GetCurrentThread(), ThreadNameInformation, NULL, sizeof(*thread_desc));
ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status); ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status);
thread_desc->Description.Buffer = NULL; thread_desc->ThreadName.Buffer = NULL;
status = pNtSetInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, sizeof(*thread_desc)); status = pNtSetInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, sizeof(*thread_desc));
ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status); ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status);
......
...@@ -417,7 +417,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadContext( HANDLE thread, const CONTEXT *co ...@@ -417,7 +417,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadContext( HANDLE thread, const CONTEXT *co
*/ */
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR description ) HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR description )
{ {
THREAD_DESCRIPTION_INFORMATION info; THREAD_NAME_INFORMATION info;
int length; int length;
TRACE( "(%p, %s)\n", thread, debugstr_w( description )); TRACE( "(%p, %s)\n", thread, debugstr_w( description ));
...@@ -427,8 +427,8 @@ HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR des ...@@ -427,8 +427,8 @@ HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR des
if (length > USHRT_MAX) if (length > USHRT_MAX)
return HRESULT_FROM_NT(STATUS_INVALID_PARAMETER); return HRESULT_FROM_NT(STATUS_INVALID_PARAMETER);
info.Description.Length = info.Description.MaximumLength = length; info.ThreadName.Length = info.ThreadName.MaximumLength = length;
info.Description.Buffer = (WCHAR *)description; info.ThreadName.Buffer = (WCHAR *)description;
return HRESULT_FROM_NT(NtSetInformationThread( thread, ThreadNameInformation, &info, sizeof(info) )); return HRESULT_FROM_NT(NtSetInformationThread( thread, ThreadNameInformation, &info, sizeof(info) ));
} }
...@@ -438,7 +438,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR des ...@@ -438,7 +438,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR des
*/ */
HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **description ) HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **description )
{ {
THREAD_DESCRIPTION_INFORMATION *info; THREAD_NAME_INFORMATION *info;
NTSTATUS status; NTSTATUS status;
ULONG length; ULONG length;
...@@ -457,13 +457,13 @@ HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **de ...@@ -457,13 +457,13 @@ HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **de
status = NtQueryInformationThread( thread, ThreadNameInformation, info, length, &length ); status = NtQueryInformationThread( thread, ThreadNameInformation, info, length, &length );
if (!status) if (!status)
{ {
if (!(*description = LocalAlloc( 0, info->Description.Length + sizeof(WCHAR)))) if (!(*description = LocalAlloc( 0, info->ThreadName.Length + sizeof(WCHAR))))
status = STATUS_NO_MEMORY; status = STATUS_NO_MEMORY;
else else
{ {
if (info->Description.Length) if (info->ThreadName.Length)
memcpy(*description, info->Description.Buffer, info->Description.Length); memcpy(*description, info->ThreadName.Buffer, info->ThreadName.Length);
(*description)[info->Description.Length / sizeof(WCHAR)] = 0; (*description)[info->ThreadName.Length / sizeof(WCHAR)] = 0;
} }
} }
......
...@@ -2037,7 +2037,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class, ...@@ -2037,7 +2037,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadNameInformation: case ThreadNameInformation:
{ {
THREAD_DESCRIPTION_INFORMATION *info = data; THREAD_NAME_INFORMATION *info = data;
data_size_t len, desc_len = 0; data_size_t len, desc_len = 0;
WCHAR *ptr; WCHAR *ptr;
...@@ -2056,8 +2056,8 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class, ...@@ -2056,8 +2056,8 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
if (!info) status = STATUS_BUFFER_TOO_SMALL; if (!info) status = STATUS_BUFFER_TOO_SMALL;
else if (status == STATUS_SUCCESS) else if (status == STATUS_SUCCESS)
{ {
info->Description.Length = info->Description.MaximumLength = desc_len; info->ThreadName.Length = info->ThreadName.MaximumLength = desc_len;
info->Description.Buffer = ptr; info->ThreadName.Buffer = ptr;
} }
if (ret_len && (status == STATUS_SUCCESS || status == STATUS_BUFFER_TOO_SMALL)) if (ret_len && (status == STATUS_SUCCESS || status == STATUS_BUFFER_TOO_SMALL))
...@@ -2230,18 +2230,18 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, ...@@ -2230,18 +2230,18 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadNameInformation: case ThreadNameInformation:
{ {
const THREAD_DESCRIPTION_INFORMATION *info = data; const THREAD_NAME_INFORMATION *info = data;
if (length != sizeof(*info)) return STATUS_INFO_LENGTH_MISMATCH; if (length != sizeof(*info)) return STATUS_INFO_LENGTH_MISMATCH;
if (!info) return STATUS_ACCESS_VIOLATION; if (!info) return STATUS_ACCESS_VIOLATION;
if (info->Description.Length != info->Description.MaximumLength) return STATUS_INVALID_PARAMETER; if (info->ThreadName.Length != info->ThreadName.MaximumLength) return STATUS_INVALID_PARAMETER;
if (info->Description.Length && !info->Description.Buffer) return STATUS_ACCESS_VIOLATION; if (info->ThreadName.Length && !info->ThreadName.Buffer) return STATUS_ACCESS_VIOLATION;
SERVER_START_REQ( set_thread_info ) SERVER_START_REQ( set_thread_info )
{ {
req->handle = wine_server_obj_handle( handle ); req->handle = wine_server_obj_handle( handle );
req->mask = SET_THREAD_INFO_DESCRIPTION; req->mask = SET_THREAD_INFO_DESCRIPTION;
wine_server_add_data( req, info->Description.Buffer, info->Description.Length ); wine_server_add_data( req, info->ThreadName.Buffer, info->ThreadName.Length );
status = wine_server_call( req ); status = wine_server_call( req );
} }
SERVER_END_REQ; SERVER_END_REQ;
......
...@@ -934,10 +934,10 @@ NTSTATUS WINAPI wow64_NtQueryInformationThread( UINT *args ) ...@@ -934,10 +934,10 @@ NTSTATUS WINAPI wow64_NtQueryInformationThread( UINT *args )
return status; return status;
} }
case ThreadNameInformation: /* THREAD_DESCRIPTION_INFORMATION */ case ThreadNameInformation: /* THREAD_NAME_INFORMATION */
{ {
THREAD_DESCRIPTION_INFORMATION *info; THREAD_NAME_INFORMATION *info;
THREAD_DESCRIPTION_INFORMATION32 *info32 = ptr; THREAD_NAME_INFORMATION32 *info32 = ptr;
ULONG size, ret_size; ULONG size, ret_size;
if (len >= sizeof(*info32)) if (len >= sizeof(*info32))
...@@ -947,10 +947,10 @@ NTSTATUS WINAPI wow64_NtQueryInformationThread( UINT *args ) ...@@ -947,10 +947,10 @@ NTSTATUS WINAPI wow64_NtQueryInformationThread( UINT *args )
status = NtQueryInformationThread( handle, class, info, size, &ret_size ); status = NtQueryInformationThread( handle, class, info, size, &ret_size );
if (!status) if (!status)
{ {
info32->Description.Length = info->Description.Length; info32->ThreadName.Length = info->ThreadName.Length;
info32->Description.MaximumLength = info->Description.MaximumLength; info32->ThreadName.MaximumLength = info->ThreadName.MaximumLength;
info32->Description.Buffer = PtrToUlong( info32 + 1 ); info32->ThreadName.Buffer = PtrToUlong( info32 + 1 );
memcpy( info32 + 1, info + 1, min( len, info->Description.MaximumLength )); memcpy( info32 + 1, info + 1, min( len, info->ThreadName.MaximumLength ));
} }
} }
else status = NtQueryInformationThread( handle, class, NULL, 0, &ret_size ); else status = NtQueryInformationThread( handle, class, NULL, 0, &ret_size );
...@@ -1190,13 +1190,13 @@ NTSTATUS WINAPI wow64_NtSetInformationThread( UINT *args ) ...@@ -1190,13 +1190,13 @@ NTSTATUS WINAPI wow64_NtSetInformationThread( UINT *args )
} }
else return STATUS_INVALID_PARAMETER; else return STATUS_INVALID_PARAMETER;
case ThreadNameInformation: /* THREAD_DESCRIPTION_INFORMATION */ case ThreadNameInformation: /* THREAD_NAME_INFORMATION */
if (len == sizeof(THREAD_DESCRIPTION_INFORMATION32)) if (len == sizeof(THREAD_NAME_INFORMATION32))
{ {
THREAD_DESCRIPTION_INFORMATION32 *info32 = ptr; THREAD_NAME_INFORMATION32 *info32 = ptr;
THREAD_DESCRIPTION_INFORMATION info; THREAD_NAME_INFORMATION info;
if (!unicode_str_32to64( &info.Description, &info32->Description )) if (!unicode_str_32to64( &info.ThreadName, &info32->ThreadName ))
return STATUS_ACCESS_VIOLATION; return STATUS_ACCESS_VIOLATION;
return NtSetInformationThread( handle, class, &info, sizeof(info) ); return NtSetInformationThread( handle, class, &info, sizeof(info) );
} }
......
...@@ -363,8 +363,8 @@ typedef struct ...@@ -363,8 +363,8 @@ typedef struct
typedef struct typedef struct
{ {
UNICODE_STRING32 Description; UNICODE_STRING32 ThreadName;
} THREAD_DESCRIPTION_INFORMATION32; } THREAD_NAME_INFORMATION32;
typedef struct typedef struct
{ {
......
...@@ -1905,10 +1905,10 @@ typedef struct _THREAD_DESCRIPTOR_INFORMATION ...@@ -1905,10 +1905,10 @@ typedef struct _THREAD_DESCRIPTOR_INFORMATION
LDT_ENTRY Entry; LDT_ENTRY Entry;
} THREAD_DESCRIPTOR_INFORMATION, *PTHREAD_DESCRIPTOR_INFORMATION; } THREAD_DESCRIPTOR_INFORMATION, *PTHREAD_DESCRIPTOR_INFORMATION;
typedef struct _THREAD_DESCRIPTION_INFORMATION typedef struct _THREAD_NAME_INFORMATION
{ {
UNICODE_STRING Description; UNICODE_STRING ThreadName;
} THREAD_DESCRIPTION_INFORMATION, *PTHREAD_DESCRIPTION_INFORMATION; } THREAD_NAME_INFORMATION, *PTHREAD_NAME_INFORMATION;
typedef struct _KERNEL_USER_TIMES { typedef struct _KERNEL_USER_TIMES {
LARGE_INTEGER CreateTime; LARGE_INTEGER CreateTime;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment