我正在开发一个微过滤器来检测拖放文件到硬盘。当用户将文件拖放到驱动器时:
- 将文件名更改为指定的文件名。例如:redirect_file_name.txt
- 然后我删除这个文件。
但是文件redirect_file_name.txt 的大小不会改变。
- 如果源文件大小为 1GB,redirect_file_name.txt 为 1GB
- 如果源文件大小为 100MB,redirect_file_name.txt 为 100MB
我通过这篇文章将源名称更改为 redirect_file_name.txt
如何更改文件 redirect_file_name.txt 的大小?
更新:将 FltSetInformationFile 与 FileAllocationInformation 一起使用
FILE_ALLOCATION_INFORMATION fileInformation;
fileInformation.AllocationSize.QuadPart = 1024;
status = FltSetInformationFile( FltObjects->Instance,
FltObjects->FileObject,
&fileInformation,
sizeof(FILE_ALLOCATION_INFORMATION),
FileAllocationInformation);
但状态是 0XC000000D (STATUS_INVALID_PARAMETER)