dll: fuse: fsp_fuse_notify: handle case-insensitive file systems

This commit is contained in:
Bill Zissimopoulos 2020-10-21 15:45:07 -07:00
parent cd21d26b93
commit 6340811974
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
2 changed files with 24 additions and 0 deletions

View File

@ -1229,6 +1229,18 @@ FSP_API NTSTATUS FspFileSystemNotifyEnd(FSP_FILE_SYSTEM *FileSystem);
* first issue an FspFileSystemBegin call, followed by 0 or more * first issue an FspFileSystemBegin call, followed by 0 or more
* FspFileSystemNotify calls, followed by an FspFileSystemNotifyEnd call. * FspFileSystemNotify calls, followed by an FspFileSystemNotifyEnd call.
* *
* Note that FspFileSystemNotify requires file names to be normalized. A
* normalized file name is one that contains the correct case of all characters
* in the file name.
*
* For case-sensitive file systems all file names are normalized by definition.
* For case-insensitive file systems that implement file name normalization,
* a normalized file name is the one that the file system specifies in the
* response to Create or Open (see also FspFileSystemGetOpenFileInfo). For
* case-insensitive file systems that do not implement file name normalization
* a normalized file name is the upper case version of the file name used
* to open the file.
*
* @param FileSystem * @param FileSystem
* The file system object. * The file system object.
* @param NotifyInfo * @param NotifyInfo

View File

@ -642,6 +642,18 @@ FSP_FUSE_API int fsp_fuse_notify(struct fsp_fuse_env *env,
NotifyInfo.V.Action = 0; NotifyInfo.V.Action = 0;
memcpy(NotifyInfo.V.FileNameBuf, Path, NotifyInfo.V.Size - sizeof(FSP_FSCTL_NOTIFY_INFO)); memcpy(NotifyInfo.V.FileNameBuf, Path, NotifyInfo.V.Size - sizeof(FSP_FSCTL_NOTIFY_INFO));
if (!f->VolumeParams.CaseSensitiveSearch)
{
/*
* Case-insensitive FUSE file systems do not normalize open file names, which means
* that the FSD automatically normalizes file names internally by uppercasing them.
*
* The FspFileSystemNotify API requires normalized names, so upper case the file name
* here in the case of case-insensitive file systems.
*/
CharUpperBuffW(NotifyInfo.V.FileNameBuf, PathLength);
}
if (action & FSP_FUSE_NOTIFY_MKDIR) if (action & FSP_FUSE_NOTIFY_MKDIR)
{ {
NotifyInfo.V.Filter = FILE_NOTIFY_CHANGE_DIR_NAME; NotifyInfo.V.Filter = FILE_NOTIFY_CHANGE_DIR_NAME;