server: Support ObjectTypeInformation in pipe objects.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45743
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-09-03 14:54:15 +02:00 committed by Alexandre Julliard
parent 061b0c459b
commit 8c9c2fca08
2 changed files with 37 additions and 3 deletions

View File

@ -1279,7 +1279,7 @@ static void test_query_object(void)
static const WCHAR type_iocompletion[] = {'I','o','C','o','m','p','l','e','t','i','o','n'};
static const WCHAR type_directory[] = {'D','i','r','e','c','t','o','r','y'};
static const WCHAR type_section[] = {'S','e','c','t','i','o','n'};
HANDLE handle;
HANDLE handle, client;
char buffer[1024];
NTSTATUS status;
ULONG len, expected_len;
@ -1498,6 +1498,32 @@ static void test_query_object(void)
ok( len > sizeof(UNICODE_STRING) + sizeof("\\test_pipe") * sizeof(WCHAR),
"name too short %s\n", wine_dbgstr_w(str->Buffer) );
trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len );
len = 0;
memset( buffer, 0, sizeof(buffer) );
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(buffer), &len );
ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
ok( len > sizeof(OBJECT_TYPE_INFORMATION), "unexpected len %u\n", len );
str = (UNICODE_STRING *)buffer;
ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + str->Length + sizeof(WCHAR), "unexpected len %u\n", len );
ok( str->Buffer && !memcmp( str->Buffer, type_file, sizeof(type_file) ),
"wrong/bad type name %s (%p)\n", wine_dbgstr_w(str->Buffer), str->Buffer );
client = CreateFileA( "\\\\.\\pipe\\test_pipe", GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, 0 );
ok( client != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
len = 0;
memset( buffer, 0, sizeof(buffer) );
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(buffer), &len );
ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
ok( len > sizeof(OBJECT_TYPE_INFORMATION), "unexpected len %u\n", len );
str = (UNICODE_STRING *)buffer;
ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + str->Length + sizeof(WCHAR), "unexpected len %u\n", len );
ok( str->Buffer && !memcmp( str->Buffer, type_file, sizeof(type_file) ),
"wrong/bad type name %s (%p)\n", wine_dbgstr_w(str->Buffer), str->Buffer );
pNtClose( client );
pNtClose( handle );
pRtlCreateUnicodeStringFromAsciiz( &path, "\\REGISTRY\\Machine\\Software\\Classes" );

View File

@ -134,6 +134,7 @@ static const struct object_ops named_pipe_ops =
/* common server and client pipe end functions */
static void pipe_end_destroy( struct object *obj );
static struct object_type *pipe_end_get_type( struct object *obj );
static enum server_fd_type pipe_end_get_fd_type( struct fd *fd );
static struct fd *pipe_end_get_fd( struct object *obj );
static struct security_descriptor *pipe_end_get_sd( struct object *obj );
@ -155,7 +156,7 @@ static const struct object_ops pipe_server_ops =
{
sizeof(struct pipe_server), /* size */
pipe_server_dump, /* dump */
no_get_type, /* get_type */
pipe_end_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -196,7 +197,7 @@ static const struct object_ops pipe_client_ops =
{
sizeof(struct pipe_client), /* size */
pipe_client_dump, /* dump */
no_get_type, /* get_type */
pipe_end_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -315,6 +316,13 @@ static void named_pipe_destroy( struct object *obj)
free_async_queue( &pipe->waiters );
}
static struct object_type *pipe_end_get_type( struct object *obj )
{
static const WCHAR name[] = {'F','i','l','e'};
static const struct unicode_str str = { name, sizeof(name) };
return get_object_type( &str );
}
static struct fd *pipe_end_get_fd( struct object *obj )
{
struct pipe_end *pipe_end = (struct pipe_end *) obj;