kernel32: Add support for security access parameters for named pipes.
This commit is contained in:
parent
83c45eaa3c
commit
ee49a5a273
|
@ -4713,6 +4713,35 @@ static void test_named_pipe_security(HANDLE token)
|
|||
{ 1, GENERIC_EXECUTE, FILE_GENERIC_EXECUTE },
|
||||
{ 1, GENERIC_ALL, STANDARD_RIGHTS_ALL | FILE_ALL_ACCESS }
|
||||
};
|
||||
static const struct
|
||||
{
|
||||
DWORD open_mode;
|
||||
DWORD access;
|
||||
} creation_access[] =
|
||||
{
|
||||
{ PIPE_ACCESS_INBOUND, FILE_GENERIC_READ },
|
||||
{ PIPE_ACCESS_OUTBOUND, FILE_GENERIC_WRITE },
|
||||
{ PIPE_ACCESS_DUPLEX, FILE_GENERIC_READ|FILE_GENERIC_WRITE },
|
||||
{ PIPE_ACCESS_INBOUND|WRITE_DAC, FILE_GENERIC_READ|WRITE_DAC },
|
||||
{ PIPE_ACCESS_INBOUND|WRITE_OWNER, FILE_GENERIC_READ|WRITE_OWNER }
|
||||
/* ACCESS_SYSTEM_SECURITY is also valid, but will fail with ERROR_PRIVILEGE_NOT_HELD */
|
||||
};
|
||||
|
||||
/* Test the different security access options for pipes */
|
||||
for (i = 0; i < sizeof(creation_access)/sizeof(creation_access[0]); i++)
|
||||
{
|
||||
SetLastError(0xdeadbeef);
|
||||
pipe = CreateNamedPipeA(WINE_TEST_PIPE, creation_access[i].open_mode,
|
||||
PIPE_TYPE_BYTE | PIPE_NOWAIT, PIPE_UNLIMITED_INSTANCES, 0, 0,
|
||||
NMPWAIT_USE_DEFAULT_WAIT, NULL);
|
||||
ok(pipe != INVALID_HANDLE_VALUE, "CreateNamedPipe(0x%x) error %d\n",
|
||||
creation_access[i].open_mode, GetLastError());
|
||||
access = get_obj_access(pipe);
|
||||
ok(access == creation_access[i].access,
|
||||
"CreateNamedPipeA(0x%x) pipe expected access 0x%x (got 0x%x)\n",
|
||||
creation_access[i].open_mode, creation_access[i].access, access);
|
||||
CloseHandle(pipe);
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
pipe = CreateNamedPipeA(WINE_TEST_PIPE, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
|
||||
|
|
|
@ -1395,6 +1395,9 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
|
|||
}
|
||||
access |= SYNCHRONIZE;
|
||||
options = 0;
|
||||
if (dwOpenMode & WRITE_DAC) access |= WRITE_DAC;
|
||||
if (dwOpenMode & WRITE_OWNER) access |= WRITE_OWNER;
|
||||
if (dwOpenMode & ACCESS_SYSTEM_SECURITY) access |= ACCESS_SYSTEM_SECURITY;
|
||||
if (dwOpenMode & FILE_FLAG_WRITE_THROUGH) options |= FILE_WRITE_THROUGH;
|
||||
if (!(dwOpenMode & FILE_FLAG_OVERLAPPED)) options |= FILE_SYNCHRONOUS_IO_NONALERT;
|
||||
pipe_type = (dwPipeMode & PIPE_TYPE_MESSAGE) != 0;
|
||||
|
|
Loading…
Reference in New Issue