//2015年8月17日
Disabling/enabling File Based Write Filtering
Setting/querying cache memory usage
Setting/querying compression usage
Enable/disable write filtering for an entire volume
Excluding a file ro directory from write filtering.
Committing/restoring cache contents to or from the actual file
Volume Names in the File Based Write Filter
The File Based Write Filter implements volume level write-protection.
Therefore, many of the File Based Write Filter API functions take a volume name as an input parameter.
The volume name can be either a drive letter (e.g., "C:"), or a device name (e.g., "\\device\harddiskvolume").
File Based Write Filter Sessions
Since the File Based Write Filter can't be enabled while the system is running, the FBWF makes a distinction
between the current session (meaning since the last system boot) and the next session (meaning after the next system boot).
Applications call FBWF API functions during the current session to enable and configure the FBWF for the next session.
Some FBWF API functions allow configuration information to be queried for either the current FBWF session,
or the next (following the next system boot).
Applications must call FbwfEnableFilter before calling other FBWF configuration functions.
FBWF API Considerations
The following list shows information that is important to consider before you use the API:
1.Many of the FBWF functions do not take effect until the system restarts.
Review the function documentation to ensure that you understand the expected behavior.
2.Exceeding the cache threshold will cause some disk operations to fail. It is important that applications manage their available cache.
Win32 API calls will generally return ERROR_HANDLE_DISK_FULL in this case.
FbwfIsFilterEnabled(
__out PULONG currentSession,
__out PULONG nextSession
);//NO_ERROR The operation completed successfully.
ERROR_INVALID_PARAMETER If the currentSession or nextSession parameter is NULL.
ULONG WINAPI FbwfEnableFilter(
VOID
);//return value: NO_ERROR The operation completed successfully.
ULONG WINAPI FbwfProtectVolume(
__in LPCWSTR volume
);//NO_ERROR The operation completed successfully.
ERROR_INVALID_DRIVE The specified volume name is valid but does not exist.
ERROR_INVALID_FUNCTION The filter is disabled for the next session.
ERROR_INVALID_PARAMETER The parameter volume is NULL.
ULONG WINAPI FbwfAddExclusion(
__in LPCWSTR volume,
__in LPCWSTR path
);//NO_ERROR The operation completed successfully.
ERROR_INVALID_DRIVE If the specified volume is valid but does not exist or is not protected.
ERROR_INVALID_FUNCTION If the filter is not enabled for the next session.
ERROR_INVALID_PARAMETER If the volume or path parameter is NULL.
ULONG FbwfSetCacheThreshold(
ULONG threshold,
);//NO_ERROR The operation completed successfully.
ERROR_INVALID_FUNCTION If the filter is not enabled for the next session.
ERROR_INVALID_PARAMETER If the parameter threshold is less than the minimum cache threshold or greater than the maximum cache threshold imposed by the FBWF.
ULONG WINAPI FbwfDisableFilter(
VOID
);//return value: NO_ERROR The operation completed successfully.