Skip to main content

is_write_operation

Function is_write_operation 

Source
pub fn is_write_operation(desired_access: u32, create_disposition: u32) -> bool
Expand description

Determines whether a file open operation intends to write or create.

Strictly follows Windows NT API definitions:

  • Dispositions 0 (SUPERSEDE), 2 (CREATE), 4 (OVERWRITE), 5 (OVERWRITE_IF) unconditionally imply write intent.
  • Dispositions 1 (OPEN) and 3 (OPEN_IF) are only writes if desired_access includes GENERIC_WRITE, FILE_WRITE_DATA, or FILE_APPEND_DATA.

The bitmasks here are plain NT ABI constants, not Windows-crate types, so this has no platform dependency of its own, the proxy DLL calls it with values decoded from a real NtCreateFile call; any other caller (including tests) can call it with the same raw u32s.