See example for more information
One should create a struct MyProjFS
that implements Sync
, ProjFSDirEnum
and ProjFSRead
in order to get a instance.
// create root dir to be projected
std::fs::create_dir("root_dir").ok();
// create a virtualization instance of MyProjFS
// this function returned immediately, and you would like to hold the instance during the projection
let instance = start_proj_virtualization("root_dir", Box::new(MyProjFS::new())).unwrap();
std::thread::sleep(std::time::Duration::from_secs(std::u64::MAX));
// once the instance dropped, the projection stopped
drop(instance)
See also mircosoft guide here Now we could provide callback functions
-
PRJ_CANCEL_COMMAND_CB
-
PRJ_END_DIRECTORY_ENUMERATION_CB
-
PRJ_GET_DIRECTORY_ENUMERATION_CB
-
PRJ_GET_FILE_DATA_CB
(viaProjFSRead::read
) -
PRJ_GET_PLACEHOLDER_INFO_CB
(viaProjFSRead::get_metadata
) -
PRJ_NOTIFICATION_CB
-
PRJ_QUERY_FILE_NAME_CB
-
PRJ_START_DIRECTORY_ENUMERATION_CB
Callback series PRJ_*_DIRECTORY_ENUMERATION_CB
would be generate by ProjFSDirEnum::dir_iter
and ProjFSDirEnum::dir_iter_cache
.
Make sure Projected File System is enabled on your machine
Enable-WindowsOptionalFeature -Online -FeatureName Client-ProjFS -NoRestart