Example #1
0
NTSTATUS object_dir_impl_t::open( object_t*& obj, open_info_t& info )
{
	ULONG n = 0;
	UNICODE_STRING& path = info.path;

	trace("path = %pus\n", &path );

	while (n < path.Length/2 && path.Buffer[n] != '\\')
		n++;

	if (n == 0)
		return STATUS_OBJECT_NAME_INVALID;

	UNICODE_STRING segment;
	segment.Buffer = path.Buffer;
	segment.Length = n * 2;
	segment.MaximumLength = 0;

	obj = lookup( segment, info.case_insensitive() );

	if (n == path.Length/2)
		return info.on_open( this, obj, info );

	if (!obj)
		return STATUS_OBJECT_PATH_NOT_FOUND;

	path.Buffer += (n + 1);
	path.Length -= (n + 1) * 2;
	path.MaximumLength -= (n + 1) * 2;

	return obj->open( obj, info );
}
Example #2
0
NTSTATUS pipe_device_t::open( object_t *&out, open_info_t& info )
{
	if (info.path.Length == 0)
		return object_dir_impl_t::open( out, info );

	// appears to be a flat namespace under the pipe device
	dprintf("pipe = %pus\n", &info.path );
	out = lookup( info.path, info.case_insensitive() );

	// not the NtCreateNamedPipeFile case?
	if (out && dynamic_cast<pipe_factory*>(&info) == NULL)
		return out->open( out, info );

	return info.on_open( this, out, info );
}
Example #3
0
NTSTATUS open_root( object_t*& obj, open_info_t& info )
{
	// look each directory in the path and make sure it exists
	object_dir_t *dir = 0;

	NTSTATUS r;

	// parse the root directory
	if (info.root)
	{
		// relative path
		if (info.path.Buffer[0] == '\\')
			return STATUS_OBJECT_PATH_SYNTAX_BAD;

		r = object_from_handle( dir, info.root, DIRECTORY_QUERY );
		if (r < STATUS_SUCCESS)
			return r;
	}
	else
	{
		// absolute path
		if (info.path.Buffer[0] != '\\')
			return STATUS_OBJECT_PATH_SYNTAX_BAD;
		dir = root;
		info.path.Buffer++;
		info.path.Length -= 2;
	}

	if (info.path.Length == 0)
	{
		obj = dir;
		return info.on_open( 0, obj, info );
	}

	return dir->open( obj, info );
}