Commit 8c9c2fca authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Support ObjectTypeInformation in pipe objects.

parent 061b0c45
......@@ -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" );
......
......@@ -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;
......
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