Skip to content

Commit

Permalink
Implement trivial file operations - opening and closing handles. Just…
Browse files Browse the repository at this point in the history
… enough to get file metadata.
  • Loading branch information
CraftSpider committed Dec 2, 2024
1 parent 9b61c05 commit ab0e138
Show file tree
Hide file tree
Showing 4 changed files with 441 additions and 19 deletions.
27 changes: 27 additions & 0 deletions src/shims/windows/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,33 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
};
this.write_scalar(result, dest)?;
}
"CreateFileW" => {
let [
file_name,
desired_access,
share_mode,
security_attributes,
creation_disposition,
flags_and_attributes,
template_file,
] = this.check_shim(abi, ExternAbi::System { unwind: false }, link_name, args)?;
let handle = this.CreateFileW(
file_name,
desired_access,
share_mode,
security_attributes,
creation_disposition,
flags_and_attributes,
template_file,
)?;
this.write_scalar(handle.to_scalar(this), dest)?;
}
"GetFileInformationByHandle" => {
let [handle, info] =
this.check_shim(abi, ExternAbi::System { unwind: false }, link_name, args)?;
let res = this.GetFileInformationByHandle(handle, info)?;
this.write_scalar(res, dest)?;
}

// Allocation
"HeapAlloc" => {
Expand Down
Loading

0 comments on commit ab0e138

Please sign in to comment.