mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	winfsp-tests: getvolinfo_test
This commit is contained in:
		| @@ -138,7 +138,56 @@ void getfileinfo_test(void) | ||||
|     } | ||||
| } | ||||
|  | ||||
| void getvolinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout) | ||||
| { | ||||
|     void *memfs = memfs_start_ex(Flags, FileInfoTimeout); | ||||
|  | ||||
|     BOOL Success; | ||||
|     WCHAR FilePath[MAX_PATH]; | ||||
|     WCHAR VolumeLabelBuf[MAX_PATH]; | ||||
|     DWORD VolumeSerialNumber; | ||||
|     DWORD MaxComponentLength; | ||||
|     DWORD FileSystemFlags; | ||||
|     WCHAR FileSystemNameBuf[MAX_PATH]; | ||||
|  | ||||
|     StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\", | ||||
|         Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs)); | ||||
|  | ||||
|     Success = GetVolumeInformationW(FilePath, | ||||
|         VolumeLabelBuf, sizeof VolumeLabelBuf, | ||||
|         &VolumeSerialNumber, &MaxComponentLength, &FileSystemFlags, | ||||
|         FileSystemNameBuf, sizeof FileSystemNameBuf); | ||||
|     ASSERT(Success); | ||||
|     if (-1 != Flags) | ||||
|     { | ||||
|         ASSERT(0 == wcscmp(VolumeLabelBuf, L"MEMFS")); | ||||
|         ASSERT(255 == MaxComponentLength); | ||||
|         ASSERT(0 != (FileSystemFlags & | ||||
|             (FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK | FILE_PERSISTENT_ACLS))); | ||||
|         ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp")); | ||||
|     } | ||||
|  | ||||
|     memfs_stop(memfs); | ||||
| } | ||||
|  | ||||
| void getvolinfo_test(void) | ||||
| { | ||||
|     if (NtfsTests) | ||||
|         getvolinfo_dotest(-1, L"C:", 0); | ||||
|     if (WinFspDiskTests) | ||||
|     { | ||||
|         getvolinfo_dotest(MemfsDisk, 0, 0); | ||||
|         getvolinfo_dotest(MemfsDisk, 0, 1000); | ||||
|     } | ||||
|     if (WinFspNetTests) | ||||
|     { | ||||
|         getvolinfo_dotest(MemfsNet, L"\\\\memfs\\share", 0); | ||||
|         getvolinfo_dotest(MemfsNet, L"\\\\memfs\\share", 1000); | ||||
|     } | ||||
| } | ||||
|  | ||||
| void info_tests(void) | ||||
| { | ||||
|     TEST(getfileinfo_test); | ||||
|     TEST(getvolinfo_test); | ||||
| } | ||||
|   | ||||
| @@ -205,7 +205,7 @@ static NTSTATUS GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem, | ||||
|         (Memfs->MaxFileNodes - MemfsFileNodeMapCount(Memfs->FileNodeMap)) * AllocationUnits; | ||||
|     VolumeInfo->VolumeCreationTime = RootNode->FileInfo.CreationTime; | ||||
|     VolumeInfo->VolumeLabelLength = sizeof L"MEMFS" - sizeof(WCHAR); | ||||
|     memcpy(VolumeInfo->VolumeLabel, L"Memfs", VolumeInfo->VolumeLabelLength); | ||||
|     memcpy(VolumeInfo->VolumeLabel, L"MEMFS", VolumeInfo->VolumeLabelLength); | ||||
|  | ||||
|     return STATUS_SUCCESS; | ||||
| } | ||||
| @@ -218,6 +218,9 @@ static NTSTATUS GetSecurity(FSP_FILE_SYSTEM *FileSystem, | ||||
|     MEMFS_FILE_NODE *FileNode; | ||||
|     NTSTATUS Result; | ||||
|  | ||||
|     if (L'\\' == FileName[0] && L'\0' == FileName[1]) | ||||
|         FileName = L""; | ||||
|  | ||||
|     FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName); | ||||
|     if (0 == FileNode) | ||||
|     { | ||||
| @@ -256,6 +259,9 @@ static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem, | ||||
|     NTSTATUS Result; | ||||
|     BOOLEAN Inserted; | ||||
|  | ||||
|     if (L'\\' == FileName[0] && L'\0' == FileName[1]) | ||||
|         FileName = L""; | ||||
|  | ||||
|     if (CreateOptions & FILE_DIRECTORY_FILE) | ||||
|         AllocationSize = 0; | ||||
|  | ||||
| @@ -326,6 +332,9 @@ static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem, | ||||
|     MEMFS_FILE_NODE *FileNode; | ||||
|     NTSTATUS Result; | ||||
|  | ||||
|     if (L'\\' == FileName[0] && L'\0' == FileName[1]) | ||||
|         FileName = L""; | ||||
|  | ||||
|     FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName); | ||||
|     if (0 == FileNode) | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user