Hey Dmitry,
I noticed a couple of tests structured like this:
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL); ok(status == STATUS_PENDING || broken(status == STATUS_SUCCESS) /* see below */, "expected STATUS_PENDING, got %#x\n", status); ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status); ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information); ... ret = WaitForSingleObject(hfile, 3000);
Technically, the IO_STATUS_BLOCK (hence also the OVERLAPPED) structure is only filled once the I/O Manager completes the read/write IRP -- meaning its contents should only be read _after_ the wait.
So this aspect essentially tests the question of "are ntfs.sys and the cache manager faster to fill the IOSB than the test can read it". That test can be completely valid, especially if it's known that applications do this, however I'm not sure whether that's actually the intention here. (My preference would obviously -- hence this mail -- be to read the result after waiting unless there's a specific reason to do it otherwise. The specifics are kind of up to the FS driver.)
Thanks! -Thomas