diff --git a/Contributors.asciidoc b/Contributors.asciidoc index 0630285c..20c7fd52 100644 --- a/Contributors.asciidoc +++ b/Contributors.asciidoc @@ -54,5 +54,6 @@ This CONTRIBUTOR AGREEMENT applies to any contribution that you make to the WinF CONTRIBUTOR LIST ---------------- |=== -|Bill Zissimopoulos |billziss at navimatics.com +|Bill Zissimopoulos |billziss at navimatics.com +|Sam Kelly (DuroSoft Technologies LLC, https://durosoft.com) |sam at durosoft.com |=== diff --git a/src/dll/fuse/fuse.c b/src/dll/fuse/fuse.c index c7ac85d0..c4583439 100644 --- a/src/dll/fuse/fuse.c +++ b/src/dll/fuse/fuse.c @@ -40,7 +40,12 @@ struct fsp_fuse_core_opt_data rellinks; int set_FileInfoTimeout; FSP_FSCTL_VOLUME_PARAMS VolumeParams; + UINT16 VolumeLabelLength; + WCHAR VolumeLabel[sizeof ((FSP_FSCTL_VOLUME_INFO *)0)->VolumeLabel / sizeof(WCHAR)]; }; +FSP_FSCTL_STATIC_ASSERT( + sizeof ((struct fuse *)0)->VolumeLabel == sizeof ((struct fsp_fuse_core_opt_data *)0)->VolumeLabel, + "fuse::VolumeLabel and fsp_fuse_core_opt_data::VolumeLabel: sizeof must be same."); static struct fuse_opt fsp_fuse_core_opts[] = { @@ -82,6 +87,7 @@ static struct fuse_opt fsp_fuse_core_opts[] = FSP_FUSE_CORE_OPT("norellinks", rellinks, 0), FUSE_OPT_KEY("fstypename=", 'F'), + FUSE_OPT_KEY("volname=", 'v'), FSP_FUSE_CORE_OPT("SectorSize=%hu", VolumeParams.SectorSize, 4096), FSP_FUSE_CORE_OPT("SectorsPerAllocationUnit=%hu", VolumeParams.SectorsPerAllocationUnit, 1), @@ -499,12 +505,20 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key, arg += sizeof "--FileSystemName=" - 1; if (0 == MultiByteToWideChar(CP_UTF8, 0, arg, -1, opt_data->VolumeParams.FileSystemName + 5, - sizeof opt_data->VolumeParams.FileSystemName / sizeof(WCHAR)) - 5) + sizeof opt_data->VolumeParams.FileSystemName / sizeof(WCHAR) - 5)) return -1; opt_data->VolumeParams.FileSystemName [sizeof opt_data->VolumeParams.FileSystemName / sizeof(WCHAR) - 1] = L'\0'; memcpy(opt_data->VolumeParams.FileSystemName, L"FUSE-", 5 * sizeof(WCHAR)); return 0; + case 'v': + arg += sizeof "volname=" - 1; + opt_data->VolumeLabelLength = (UINT16)(sizeof(WCHAR) * + MultiByteToWideChar(CP_UTF8, 0, arg, lstrlenA(arg), + opt_data->VolumeLabel, sizeof opt_data->VolumeLabel / sizeof(WCHAR))); + if (0 == opt_data->VolumeLabelLength) + return -1; + return 0; } } @@ -589,6 +603,8 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env, f->data = data; f->DebugLog = opt_data.debug ? -1 : 0; memcpy(&f->VolumeParams, &opt_data.VolumeParams, sizeof opt_data.VolumeParams); + f->VolumeLabelLength = opt_data.VolumeLabelLength; + memcpy(&f->VolumeLabel, &opt_data.VolumeLabel, opt_data.VolumeLabelLength); Size = (lstrlenW(ch->MountPoint) + 1) * sizeof(WCHAR); f->MountPoint = fsp_fuse_obj_alloc(env, Size); diff --git a/src/dll/fuse/fuse_intf.c b/src/dll/fuse/fuse_intf.c index faa4c0dd..88679dff 100644 --- a/src/dll/fuse/fuse_intf.c +++ b/src/dll/fuse/fuse_intf.c @@ -646,8 +646,8 @@ static NTSTATUS fsp_fuse_intf_GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem, VolumeInfo->TotalSize = (UINT64)stbuf.f_blocks * (UINT64)stbuf.f_frsize; VolumeInfo->FreeSize = (UINT64)stbuf.f_bfree * (UINT64)stbuf.f_frsize; - VolumeInfo->VolumeLabelLength = 0; - VolumeInfo->VolumeLabel[0] = L'\0'; + VolumeInfo->VolumeLabelLength = f->VolumeLabelLength; + memcpy(&VolumeInfo->VolumeLabel, &f->VolumeLabel, f->VolumeLabelLength); return STATUS_SUCCESS; } diff --git a/src/dll/fuse/library.h b/src/dll/fuse/library.h index d538552c..f5b87be9 100644 --- a/src/dll/fuse/library.h +++ b/src/dll/fuse/library.h @@ -45,6 +45,8 @@ struct fuse UINT32 DebugLog; FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY OpGuardStrategy; FSP_FSCTL_VOLUME_PARAMS VolumeParams; + UINT16 VolumeLabelLength; + WCHAR VolumeLabel[sizeof ((FSP_FSCTL_VOLUME_INFO *)0)->VolumeLabel / sizeof(WCHAR)]; PWSTR MountPoint; FSP_FILE_SYSTEM *FileSystem; FSP_SERVICE *Service; /* weak */