ntdll/tests: Add tests for calling NtReadFile/NtWriteFile on directory.
Sebastian Lackner
sebastian at fds-team.de
Thu Oct 8 00:25:27 CDT 2015
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
Testbot run: https://newtestbot.winehq.org/JobDetails.pl?Key=17156
dlls/ntdll/tests/file.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 1afb9c8..b8f1847 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -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,
--
2.6.0
More information about the wine-patches
mailing list