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
static void test_thread_description(void)
{
THREAD_DESCRIPTION_INFORMATION *thread_desc;
THREAD_NAME_INFORMATION *thread_desc;
static const WCHAR *desc = L"thread_desc";
ULONG len, len2, desc_len;
NTSTATUS status;
......@@ -2368,7 +2368,7 @@ static void test_thread_description(void)
}
desc_len = lstrlenW(desc) * sizeof(*desc);
thread_desc = (THREAD_DESCRIPTION_INFORMATION *)buff;
thread_desc = (THREAD_NAME_INFORMATION *)buff;
/* Initial description. */
ptr = NULL;
......@@ -2383,15 +2383,15 @@ static void test_thread_description(void)
ok(len == sizeof(*thread_desc), "Unexpected structure length %u.\n", len);
len2 = 0;
thread_desc->Description.Length = 1;
thread_desc->Description.MaximumLength = 0;
thread_desc->Description.Buffer = (WCHAR *)thread_desc;
thread_desc->ThreadName.Length = 1;
thread_desc->ThreadName.MaximumLength = 0;
thread_desc->ThreadName.Buffer = (WCHAR *)thread_desc;
status = pNtQueryInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, len, &len2);
ok(!status, "Failed to get thread info, status %#x.\n", status);
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->Description.Buffer == (WCHAR *)(thread_desc + 1),
"Unexpected description string pointer %p, %p.\n", thread_desc->Description.Buffer, thread_desc);
ok(!thread_desc->ThreadName.Length, "Unexpected description length %#x.\n", thread_desc->ThreadName.Length);
ok(thread_desc->ThreadName.Buffer == (WCHAR *)(thread_desc + 1),
"Unexpected description string pointer %p, %p.\n", thread_desc->ThreadName.Buffer, thread_desc);
hr = pSetThreadDescription(GetCurrentThread(), NULL);
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)
ok(!status, "Failed to get thread info.\n");
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,
"Unexpected description length %u.\n", thread_desc->Description.Length);
ok(thread_desc->Description.Buffer == (WCHAR *)(thread_desc + 1),
"Unexpected description string pointer %p, %p.\n", thread_desc->Description.Buffer, thread_desc);
ok(!memcmp(thread_desc->Description.Buffer, desc, desc_len), "Unexpected description string.\n");
ok(thread_desc->ThreadName.Length == desc_len && thread_desc->ThreadName.MaximumLength == desc_len,
"Unexpected description length %u.\n", thread_desc->ThreadName.Length);
ok(thread_desc->ThreadName.Buffer == (WCHAR *)(thread_desc + 1),
"Unexpected description string pointer %p, %p.\n", thread_desc->ThreadName.Buffer, thread_desc);
ok(!memcmp(thread_desc->ThreadName.Buffer, desc, desc_len), "Unexpected description string.\n");
/* Partial results. */
len = 0;
......@@ -2432,7 +2432,7 @@ static void test_thread_description(void)
ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
/* 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");
status = pNtSetInformationThread(GetCurrentThread(), ThreadNameInformation, thread_desc, sizeof(*thread_desc));
......@@ -2450,7 +2450,7 @@ static void test_thread_description(void)
status = NtSetInformationThread(GetCurrentThread(), ThreadNameInformation, NULL, sizeof(*thread_desc));
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));
ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status);
......
......@@ -417,7 +417,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadContext( HANDLE thread, const CONTEXT *co
*/
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR description )
{
THREAD_DESCRIPTION_INFORMATION info;
THREAD_NAME_INFORMATION info;
int length;
TRACE( "(%p, %s)\n", thread, debugstr_w( description ));
......@@ -427,8 +427,8 @@ HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR des
if (length > USHRT_MAX)
return HRESULT_FROM_NT(STATUS_INVALID_PARAMETER);
info.Description.Length = info.Description.MaximumLength = length;
info.Description.Buffer = (WCHAR *)description;
info.ThreadName.Length = info.ThreadName.MaximumLength = length;
info.ThreadName.Buffer = (WCHAR *)description;
return HRESULT_FROM_NT(NtSetInformationThread( thread, ThreadNameInformation, &info, sizeof(info) ));
}
......@@ -438,7 +438,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR des
*/
HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **description )
{
THREAD_DESCRIPTION_INFORMATION *info;
THREAD_NAME_INFORMATION *info;
NTSTATUS status;
ULONG length;
......@@ -457,13 +457,13 @@ HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **de
status = NtQueryInformationThread( thread, ThreadNameInformation, info, length, &length );
if (!status)
{
if (!(*description = LocalAlloc( 0, info->Description.Length + sizeof(WCHAR))))
if (!(*description = LocalAlloc( 0, info->ThreadName.Length + sizeof(WCHAR))))
status = STATUS_NO_MEMORY;
else
{
if (info->Description.Length)
memcpy(*description, info->Description.Buffer, info->Description.Length);
(*description)[info->Description.Length / sizeof(WCHAR)] = 0;
if (info->ThreadName.Length)
memcpy(*description, info->ThreadName.Buffer, info->ThreadName.Length);
(*description)[info->ThreadName.Length / sizeof(WCHAR)] = 0;
}
}
......
......@@ -2037,7 +2037,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadNameInformation:
{
THREAD_DESCRIPTION_INFORMATION *info = data;
THREAD_NAME_INFORMATION *info = data;
data_size_t len, desc_len = 0;
WCHAR *ptr;
......@@ -2056,8 +2056,8 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
if (!info) status = STATUS_BUFFER_TOO_SMALL;
else if (status == STATUS_SUCCESS)
{
info->Description.Length = info->Description.MaximumLength = desc_len;
info->Description.Buffer = ptr;
info->ThreadName.Length = info->ThreadName.MaximumLength = desc_len;
info->ThreadName.Buffer = ptr;
}
if (ret_len && (status == STATUS_SUCCESS || status == STATUS_BUFFER_TOO_SMALL))
......@@ -2230,18 +2230,18 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadNameInformation:
{
const THREAD_DESCRIPTION_INFORMATION *info = data;
const THREAD_NAME_INFORMATION *info = data;
if (length != sizeof(*info)) return STATUS_INFO_LENGTH_MISMATCH;
if (!info) return STATUS_ACCESS_VIOLATION;
if (info->Description.Length != info->Description.MaximumLength) return STATUS_INVALID_PARAMETER;
if (info->Description.Length && !info->Description.Buffer) return STATUS_ACCESS_VIOLATION;
if (info->ThreadName.Length != info->ThreadName.MaximumLength) return STATUS_INVALID_PARAMETER;
if (info->ThreadName.Length && !info->ThreadName.Buffer) return STATUS_ACCESS_VIOLATION;
SERVER_START_REQ( set_thread_info )
{
req->handle = wine_server_obj_handle( handle );
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 );
}
SERVER_END_REQ;
......
......@@ -934,10 +934,10 @@ NTSTATUS WINAPI wow64_NtQueryInformationThread( UINT *args )
return status;
}
case ThreadNameInformation: /* THREAD_DESCRIPTION_INFORMATION */
case ThreadNameInformation: /* THREAD_NAME_INFORMATION */
{
THREAD_DESCRIPTION_INFORMATION *info;
THREAD_DESCRIPTION_INFORMATION32 *info32 = ptr;
THREAD_NAME_INFORMATION *info;
THREAD_NAME_INFORMATION32 *info32 = ptr;
ULONG size, ret_size;
if (len >= sizeof(*info32))
......@@ -947,10 +947,10 @@ NTSTATUS WINAPI wow64_NtQueryInformationThread( UINT *args )
status = NtQueryInformationThread( handle, class, info, size, &ret_size );
if (!status)
{
info32->Description.Length = info->Description.Length;
info32->Description.MaximumLength = info->Description.MaximumLength;
info32->Description.Buffer = PtrToUlong( info32 + 1 );
memcpy( info32 + 1, info + 1, min( len, info->Description.MaximumLength ));
info32->ThreadName.Length = info->ThreadName.Length;
info32->ThreadName.MaximumLength = info->ThreadName.MaximumLength;
info32->ThreadName.Buffer = PtrToUlong( info32 + 1 );
memcpy( info32 + 1, info + 1, min( len, info->ThreadName.MaximumLength ));
}
}
else status = NtQueryInformationThread( handle, class, NULL, 0, &ret_size );
......@@ -1190,13 +1190,13 @@ NTSTATUS WINAPI wow64_NtSetInformationThread( UINT *args )
}
else return STATUS_INVALID_PARAMETER;
case ThreadNameInformation: /* THREAD_DESCRIPTION_INFORMATION */
if (len == sizeof(THREAD_DESCRIPTION_INFORMATION32))
case ThreadNameInformation: /* THREAD_NAME_INFORMATION */
if (len == sizeof(THREAD_NAME_INFORMATION32))
{
THREAD_DESCRIPTION_INFORMATION32 *info32 = ptr;
THREAD_DESCRIPTION_INFORMATION info;
THREAD_NAME_INFORMATION32 *info32 = ptr;
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 NtSetInformationThread( handle, class, &info, sizeof(info) );
}
......
......@@ -363,8 +363,8 @@ typedef struct
typedef struct
{
UNICODE_STRING32 Description;
} THREAD_DESCRIPTION_INFORMATION32;
UNICODE_STRING32 ThreadName;
} THREAD_NAME_INFORMATION32;
typedef struct
{
......
......@@ -1905,10 +1905,10 @@ typedef struct _THREAD_DESCRIPTOR_INFORMATION
LDT_ENTRY Entry;
} THREAD_DESCRIPTOR_INFORMATION, *PTHREAD_DESCRIPTOR_INFORMATION;
typedef struct _THREAD_DESCRIPTION_INFORMATION
typedef struct _THREAD_NAME_INFORMATION
{
UNICODE_STRING Description;
} THREAD_DESCRIPTION_INFORMATION, *PTHREAD_DESCRIPTION_INFORMATION;
UNICODE_STRING ThreadName;
} THREAD_NAME_INFORMATION, *PTHREAD_NAME_INFORMATION;
typedef struct _KERNEL_USER_TIMES {
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