-
-
Notifications
You must be signed in to change notification settings - Fork 393
Closed
Description
Hi,
I have a problem that I cannot solve on my own.
Basically, my program looks something like this:
fn is_block_cloning_supported(p: &Path) -> std::io::Result<bool> {
let file = std::fs::File::open(p)?;
let flags = 0u32;
let res = unsafe {
GetVolumeInformationByHandleW(file.as_raw_handle() as _, ..., &mut flags as *mut _, ...)
};
if res != 0 {
Err(io::Error::last_os_error())
} else {
if flags & FILE_SUPPORTS_BLOCK_REFCOUNTING > 0 { Ok (true) } else { Ok(false) }
}
}
The problem is, res
is always 1 and get_last_error()
reports that the handle is invalid.
Now, I notice the *mut c_void
type is defined differently in winapi and std, so maybe that is the problem. How can I interop here?
Metadata
Metadata
Assignees
Labels
No labels