Thomas Faber thfabba@gmx.de wrote:
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.
Contents of IO_STATUS_BLOCK/OVERLAPPED are tested only in the cases known to not contain STATUS_PENDING of a being executed operation, which means that the operation has already finished and waiting would return immediately and therefore is not necessary and redundant.