mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 04:48:30 +00:00
ntdll/tests: Add tests for calling NtReadFile/NtWriteFile on directory.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b34b65e462
commit
b8315e87f1
|
@ -177,6 +177,7 @@ static void create_file_test(void)
|
|||
static const WCHAR pathInvalidNtW[] = {'\\','\\','?','\\',0};
|
||||
static const WCHAR pathInvalidNt2W[] = {'\\','?','?','\\',0};
|
||||
static const WCHAR pathInvalidDosW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\',0};
|
||||
static const char testdata[] = "Hello World";
|
||||
FILE_NETWORK_OPEN_INFORMATION info;
|
||||
NTSTATUS status;
|
||||
HANDLE dir, file;
|
||||
|
@ -184,6 +185,9 @@ static void create_file_test(void)
|
|||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
UNICODE_STRING nameW;
|
||||
LARGE_INTEGER offset;
|
||||
char buf[32];
|
||||
DWORD ret;
|
||||
|
||||
GetCurrentDirectoryW( MAX_PATH, path );
|
||||
pRtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL );
|
||||
|
@ -195,9 +199,36 @@ static void create_file_test(void)
|
|||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
/* try various open modes and options on directories */
|
||||
status = pNtCreateFile( &dir, GENERIC_READ, &attr, &io, NULL, 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0 );
|
||||
status = pNtCreateFile( &dir, GENERIC_READ|GENERIC_WRITE, &attr, &io, NULL, 0,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0 );
|
||||
ok( !status, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
|
||||
|
||||
U(io).Status = 0xdeadbeef;
|
||||
offset.QuadPart = 0;
|
||||
status = pNtReadFile( dir, NULL, NULL, NULL, &io, buf, sizeof(buf), &offset, NULL );
|
||||
todo_wine
|
||||
ok( status == STATUS_INVALID_DEVICE_REQUEST || status == STATUS_PENDING, "NtReadFile error %08x\n", status );
|
||||
if (status == STATUS_PENDING)
|
||||
{
|
||||
ret = WaitForSingleObject( dir, 1000 );
|
||||
ok( ret == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", ret );
|
||||
ok( U(io).Status == STATUS_INVALID_DEVICE_REQUEST,
|
||||
"expected STATUS_INVALID_DEVICE_REQUEST, got %08x\n", U(io).Status );
|
||||
}
|
||||
|
||||
U(io).Status = 0xdeadbeef;
|
||||
offset.QuadPart = 0;
|
||||
status = pNtWriteFile( dir, NULL, NULL, NULL, &io, testdata, sizeof(testdata), &offset, NULL);
|
||||
todo_wine
|
||||
ok( status == STATUS_INVALID_DEVICE_REQUEST || status == STATUS_PENDING, "NtWriteFile error %08x\n", status );
|
||||
if (status == STATUS_PENDING)
|
||||
{
|
||||
ret = WaitForSingleObject( dir, 1000 );
|
||||
ok( ret == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", ret );
|
||||
ok( U(io).Status == STATUS_INVALID_DEVICE_REQUEST,
|
||||
"expected STATUS_INVALID_DEVICE_REQUEST, got %08x\n", U(io).Status );
|
||||
}
|
||||
|
||||
CloseHandle( dir );
|
||||
|
||||
status = pNtCreateFile( &dir, GENERIC_READ, &attr, &io, NULL, 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
|
|
Loading…
Reference in a new issue