mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Reapply a modified r18883 patch (by Thomas Weidenmueller) that doesn't break named pipes.
svn path=/trunk/; revision=19019
This commit is contained in:
parent
2de23bb008
commit
cb31a202c1
1 changed files with 48 additions and 69 deletions
|
@ -72,7 +72,6 @@ CreateNamedPipeW(LPCWSTR lpName,
|
||||||
HANDLE PipeHandle;
|
HANDLE PipeHandle;
|
||||||
ACCESS_MASK DesiredAccess;
|
ACCESS_MASK DesiredAccess;
|
||||||
ULONG CreateOptions;
|
ULONG CreateOptions;
|
||||||
ULONG CreateDisposition;
|
|
||||||
ULONG WriteModeMessage;
|
ULONG WriteModeMessage;
|
||||||
ULONG ReadModeMessage;
|
ULONG ReadModeMessage;
|
||||||
ULONG NonBlocking;
|
ULONG NonBlocking;
|
||||||
|
@ -81,6 +80,12 @@ CreateNamedPipeW(LPCWSTR lpName,
|
||||||
LARGE_INTEGER DefaultTimeOut;
|
LARGE_INTEGER DefaultTimeOut;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||||
|
|
||||||
|
if (nMaxInstances == 0 || nMaxInstances > PIPE_UNLIMITED_INSTANCES)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
Result = RtlDosPathNameToNtPathName_U((LPWSTR)lpName,
|
Result = RtlDosPathNameToNtPathName_U((LPWSTR)lpName,
|
||||||
&NamedPipeName,
|
&NamedPipeName,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -108,77 +113,51 @@ CreateNamedPipeW(LPCWSTR lpName,
|
||||||
NULL,
|
NULL,
|
||||||
SecurityDescriptor);
|
SecurityDescriptor);
|
||||||
|
|
||||||
DesiredAccess = 0;
|
DesiredAccess = SYNCHRONIZE | (dwOpenMode & (WRITE_DAC | WRITE_OWNER | ACCESS_SYSTEM_SECURITY));
|
||||||
ShareAccess = 0;
|
ShareAccess = 0;
|
||||||
CreateDisposition = FILE_OPEN_IF;
|
|
||||||
CreateOptions = 0;
|
CreateOptions = 0;
|
||||||
|
|
||||||
if (dwOpenMode & FILE_FLAG_WRITE_THROUGH)
|
if (dwOpenMode & FILE_FLAG_WRITE_THROUGH)
|
||||||
{
|
CreateOptions = CreateOptions | FILE_WRITE_THROUGH;
|
||||||
CreateOptions = CreateOptions | FILE_WRITE_THROUGH;
|
|
||||||
}
|
|
||||||
if (!(dwOpenMode & FILE_FLAG_OVERLAPPED))
|
if (!(dwOpenMode & FILE_FLAG_OVERLAPPED))
|
||||||
{
|
CreateOptions = CreateOptions | FILE_SYNCHRONOUS_IO_NONALERT;
|
||||||
CreateOptions = CreateOptions | FILE_SYNCHRONOUS_IO_NONALERT;
|
|
||||||
}
|
|
||||||
if (dwOpenMode & PIPE_ACCESS_DUPLEX)
|
|
||||||
{
|
|
||||||
CreateOptions = CreateOptions | FILE_PIPE_FULL_DUPLEX;
|
|
||||||
DesiredAccess |= (FILE_GENERIC_READ | FILE_GENERIC_WRITE);
|
|
||||||
}
|
|
||||||
else if (dwOpenMode & PIPE_ACCESS_INBOUND)
|
|
||||||
{
|
|
||||||
CreateOptions = CreateOptions | FILE_PIPE_INBOUND;
|
|
||||||
DesiredAccess |= FILE_GENERIC_READ;
|
|
||||||
}
|
|
||||||
else if (dwOpenMode & PIPE_ACCESS_OUTBOUND)
|
|
||||||
{
|
|
||||||
CreateOptions = CreateOptions | FILE_PIPE_OUTBOUND;
|
|
||||||
DesiredAccess |= FILE_GENERIC_WRITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwPipeMode & PIPE_TYPE_BYTE)
|
switch (dwOpenMode & PIPE_ACCESS_DUPLEX)
|
||||||
{
|
{
|
||||||
WriteModeMessage = FILE_PIPE_BYTE_STREAM_MODE;
|
case PIPE_ACCESS_INBOUND:
|
||||||
}
|
CreateOptions |= FILE_PIPE_INBOUND;
|
||||||
else if (dwPipeMode & PIPE_TYPE_MESSAGE)
|
ShareAccess |= FILE_SHARE_WRITE;
|
||||||
{
|
DesiredAccess |= GENERIC_READ;
|
||||||
WriteModeMessage = FILE_PIPE_MESSAGE_MODE;
|
break;
|
||||||
}
|
|
||||||
|
case PIPE_ACCESS_OUTBOUND:
|
||||||
|
CreateOptions |= FILE_PIPE_OUTBOUND;
|
||||||
|
ShareAccess |= FILE_SHARE_READ;
|
||||||
|
DesiredAccess |= GENERIC_WRITE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PIPE_ACCESS_DUPLEX:
|
||||||
|
CreateOptions |= FILE_PIPE_FULL_DUPLEX;
|
||||||
|
ShareAccess |= (FILE_SHARE_READ | FILE_SHARE_WRITE);
|
||||||
|
DesiredAccess |= (GENERIC_READ | GENERIC_WRITE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dwPipeMode & PIPE_TYPE_MESSAGE)
|
||||||
|
WriteModeMessage = FILE_PIPE_MESSAGE_MODE;
|
||||||
else
|
else
|
||||||
{
|
WriteModeMessage = FILE_PIPE_BYTE_STREAM_MODE;
|
||||||
WriteModeMessage = FILE_PIPE_BYTE_STREAM_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwPipeMode & PIPE_READMODE_BYTE)
|
if (dwPipeMode & PIPE_READMODE_MESSAGE)
|
||||||
{
|
ReadModeMessage = FILE_PIPE_MESSAGE_MODE;
|
||||||
ReadModeMessage = FILE_PIPE_BYTE_STREAM_MODE;
|
|
||||||
}
|
|
||||||
else if (dwPipeMode & PIPE_READMODE_MESSAGE)
|
|
||||||
{
|
|
||||||
ReadModeMessage = FILE_PIPE_MESSAGE_MODE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
ReadModeMessage = FILE_PIPE_BYTE_STREAM_MODE;
|
||||||
ReadModeMessage = FILE_PIPE_BYTE_STREAM_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwPipeMode & PIPE_WAIT)
|
if (dwPipeMode & PIPE_NOWAIT)
|
||||||
{
|
NonBlocking = FILE_PIPE_COMPLETE_OPERATION;
|
||||||
NonBlocking = FILE_PIPE_QUEUE_OPERATION;
|
|
||||||
}
|
|
||||||
else if (dwPipeMode & PIPE_NOWAIT)
|
|
||||||
{
|
|
||||||
NonBlocking = FILE_PIPE_COMPLETE_OPERATION;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
NonBlocking = FILE_PIPE_QUEUE_OPERATION;
|
||||||
NonBlocking = FILE_PIPE_QUEUE_OPERATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nMaxInstances >= PIPE_UNLIMITED_INSTANCES)
|
|
||||||
{
|
|
||||||
nMaxInstances = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000LL;
|
DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000LL;
|
||||||
|
|
||||||
|
@ -187,7 +166,7 @@ CreateNamedPipeW(LPCWSTR lpName,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&Iosb,
|
&Iosb,
|
||||||
ShareAccess,
|
ShareAccess,
|
||||||
CreateDisposition,
|
FILE_OPEN_IF,
|
||||||
CreateOptions,
|
CreateOptions,
|
||||||
WriteModeMessage,
|
WriteModeMessage,
|
||||||
ReadModeMessage,
|
ReadModeMessage,
|
||||||
|
|
Loading…
Reference in a new issue