考虑这个片段(句柄是用FILE_SYNCHRONOUS_IO_NONALERT
标志打开的):
IO_STATUS_BLOCK io;
NTSTATUS r = NtWriteFile(h, NULL, NULL, NULL, &io, data, data_len, &pos, NULL);
if NT_SUCCESS(r)
assert(io.Information == data_len); // can we succeed with short write?
else
// is IO_STATUS_BLOCK filled?
assert(io.Information == 0); // can we fail and yet write some data?
是否有可能NtWriteFile()
成功但写得比要求的少?
是否有可能NtWriteFile()
失败并写入一些数据?如果是 - 如何确定写入的数据量?