dll: FspFsctlServiceVersion

During file system volume creation FspFsctlCreateVolume calls FspFsctlServiceVersion
which examines the version of the driver in use and initializes the variables
FspFsctlTransactCode and FspFsctlTransactBatchCode with either the new
FSP_IOCTL_TRANSACT* codes or the old FSP_FSCTL_TRANSACT* codes.
This commit is contained in:
Bill Zissimopoulos
2022-05-27 18:31:36 +01:00
parent c343253718
commit 47aa53c70a
3 changed files with 124 additions and 2 deletions

View File

@ -215,3 +215,36 @@ FSP_API NTSTATUS FspVersion(PUINT32 PVersion)
return STATUS_SUCCESS;
}
NTSTATUS FspGetModuleVersion(PWSTR ModuleFileName, PUINT32 PVersion)
{
/* internal only: get version of any module */
PVOID VersionInfo;
DWORD Size;
VS_FIXEDFILEINFO *FixedFileInfo = 0;
UINT32 Version;
*PVersion = 0;
Size = GetFileVersionInfoSizeW(ModuleFileName, &Size/*dummy*/);
if (0 < Size)
{
VersionInfo = MemAlloc(Size);
if (0 != VersionInfo &&
GetFileVersionInfoW(ModuleFileName, 0, Size, VersionInfo) &&
VerQueryValueW(VersionInfo, L"\\", &FixedFileInfo, &Size))
{
Version = FixedFileInfo->dwFileVersionMS;
}
MemFree(VersionInfo);
}
if (0 == FixedFileInfo)
return STATUS_UNSUCCESSFUL;
*PVersion = Version;
return STATUS_SUCCESS;
}