Moved support for opening named pipes to ntdll.

This commit is contained in:
Alexandre Julliard 2004-04-30 19:04:19 +00:00
parent 58447bcd09
commit ff07c20446
2 changed files with 22 additions and 31 deletions

View File

@ -130,6 +130,7 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
ULONG attributes, ULONG sharing, ULONG disposition,
ULONG options, PVOID ea_buffer, ULONG ea_length )
{
static const WCHAR pipeW[] = {'\\','?','?','\\','p','i','p','e','\\'};
ANSI_STRING unix_name;
int created = FALSE;
@ -146,6 +147,24 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
}
if (alloc_size) FIXME( "alloc_size not supported\n" );
/* check for named pipe */
if (attr->ObjectName->Length > sizeof(pipeW) &&
!memicmpW( attr->ObjectName->Buffer, pipeW, sizeof(pipeW)/sizeof(WCHAR) ))
{
SERVER_START_REQ( open_named_pipe )
{
req->access = access;
req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
wine_server_add_data( req, attr->ObjectName->Buffer + sizeof(pipeW)/sizeof(WCHAR),
attr->ObjectName->Length - sizeof(pipeW) );
io->u.Status = wine_server_call( req );
*handle = reply->handle;
}
SERVER_END_REQ;
return io->u.Status;
}
io->u.Status = wine_nt_to_unix_file_name( attr->ObjectName, &unix_name, disposition,
!(attr->Attributes & OBJ_CASE_INSENSITIVE) );

View File

@ -174,30 +174,6 @@ void FILE_SetDosError(void)
}
static HANDLE FILE_OpenPipe(LPCWSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa )
{
HANDLE ret;
DWORD len = 0;
if (name && (len = strlenW(name)) > MAX_PATH)
{
SetLastError( ERROR_FILENAME_EXCED_RANGE );
return 0;
}
SERVER_START_REQ( open_named_pipe )
{
req->access = access;
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
SetLastError(0);
wine_server_add_data( req, name, len * sizeof(WCHAR) );
wine_server_call_err( req );
ret = reply->handle;
}
SERVER_END_REQ;
TRACE("Returned %p\n",ret);
return ret;
}
/*************************************************************************
* CreateFileW [KERNEL32.@] Creates or opens a file or other object
*
@ -288,13 +264,9 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
if (!strncmpW(filename, bkslashes_with_dotW, 4))
{
static const WCHAR pipeW[] = {'P','I','P','E','\\',0};
if(!strncmpiW(filename + 4, pipeW, 5))
{
TRACE("Opening a pipe: %s\n", debugstr_w(filename));
ret = FILE_OpenPipe( filename, access, sa );
goto done;
}
else if (isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0')
if ((isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0') ||
!strncmpiW( filename + 4, pipeW, 5 ))
{
dosdev = 0;
}