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 <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
}
//
- // Initilize the control device
+ // Initialize the control device
//
RtlInitUnicodeString( &uniDeviceName,
ntStatus = IoCreateDevice( DriverObject,
sizeof( AFSDeviceExt),
&uniDeviceName,
- FILE_DEVICE_DISK_FILE_SYSTEM,
+ FILE_DEVICE_NETWORK_FILE_SYSTEM,
0,
FALSE,
&AFSLibraryDeviceObject);
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;