peterhuene edited PR #557 from implement-windows-fdstat-flags to master:
This PR fully implements
__wasi_fd_fdstat_geton Windows so that
the descriptor flags can be determined.It does this by calling into
NtQueryInformationFile(safe to call from
user mode) to get the open mode and access of the underlying OS handle.
NtQueryInformationFileisn't included in thewinapicrate, so it is
manually being linked against.This PR also fixes several bugs on Windows:
Ignore
__WASI_FDFLAG_NONBLOCKby not settingFILE_FLAG_OVERLAPPED
on file handles (the POSIX behavior forO_NONBLOCKon files).Use
FILE_FLAG_WRITE_THROUGHfor the__WASI_FDFLAG_?SYNCflags.
__WASI_FDFLAG_APPENDshould disallowFILE_WRITE_DATAaccess to
force append-only on write operations.Use
GENERIC_READandGENERIC_WRITEaccess flags. The
latter is required when opening a file for truncation.
Last updated: Dec 13 2025 at 19:03 UTC