From e41d08c9a15a722d0974b763e41d84788f742b6a Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 25 Jan 2013 00:11:41 -0500 Subject: [PATCH] Windows: FILE_FS_DEVICE_INFORMATION Device Type Consistently report our device type as FILE_DEVICE_NETWORK_FILE_SYSTEM instead of FILE_DEVICE_DISK or FILE_DEVICE_DISK_FILE_SYSTEM except when returning FILE_FS_DEVICE_INFORMATION where we must lie and state that the device type is FILE_DEVICE_DISK. Otherwise, the Win32 API GetFileType() returns FILE_TYPE_UNKNOWN instead of FILE_TYPE_DISK. Applications built from msys (but not current cygwin) treat files of type FILE_TYPE_UNKNOWN as special character devices instead of files. This breaks msysGit. Change-Id: I7107ae84ede31abb01481b2e8c3915588d9fd529 Reviewed-on: http://gerrit.openafs.org/8973 Reviewed-by: Rod Widdowson Tested-by: BuildBot Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSInit.cpp | 4 ++-- src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSInit.cpp b/src/WINNT/afsrdr/kernel/lib/AFSInit.cpp index 6a69bfe8d..6bd8756e2 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSInit.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSInit.cpp @@ -165,7 +165,7 @@ DriverEntry( PDRIVER_OBJECT DriverObject, } // - // Initilize the control device + // Initialize the control device // RtlInitUnicodeString( &uniDeviceName, @@ -174,7 +174,7 @@ DriverEntry( PDRIVER_OBJECT DriverObject, ntStatus = IoCreateDevice( DriverObject, sizeof( AFSDeviceExt), &uniDeviceName, - FILE_DEVICE_DISK_FILE_SYSTEM, + FILE_DEVICE_NETWORK_FILE_SYSTEM, 0, FALSE, &AFSLibraryDeviceObject); diff --git a/src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp b/src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp index deeacb464..672e4a68f 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp @@ -397,6 +397,14 @@ AFSQueryFsDeviceInfo( IN AFSVolumeInfoCB *VolumeInfo, if( *Length >= (LONG)sizeof( FILE_FS_DEVICE_INFORMATION)) { + // + // This value is used to determine the return type of + // Win32 GetFileType(). Returning FILE_DEVICE_NETWORK_FILE_SYSTEM + // results in GetFileType returning FILE_TYPE_UNKNOWN which breaks + // msys-based applications. They treat all files as character + // special devices instead of files. + // + Buffer->DeviceType = FILE_DEVICE_DISK; Buffer->Characteristics = VolumeInfo->Characteristics; -- 2.39.5