* cygpath.cc (get_device_name): Prefer the \\.\X: DOS device for

harddisks, if available.
This commit is contained in:
Corinna Vinschen 2010-08-26 12:06:27 +00:00
parent 46059af75c
commit 708bbfd08e
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2010-08-26 Corinna Vinschen <corinna@vinschen.de>
* cygpath.cc (get_device_name): Prefer the \\.\X: DOS device for
harddisks, if available.
2010-08-21 Corinna Vinschen <corinna@vinschen.de> 2010-08-21 Corinna Vinschen <corinna@vinschen.de>
* ldd.cc (report): Drop long pathname considerations which result in * ldd.cc (report): Drop long pathname considerations which result in

View File

@ -233,8 +233,18 @@ get_device_name (char *path)
ans.MaximumLength = len; ans.MaximumLength = len;
ans.Buffer = ret + 4; ans.Buffer = ret + 4;
RtlUnicodeStringToAnsiString (&ans, &odi->ObjectName, FALSE); RtlUnicodeStringToAnsiString (&ans, &odi->ObjectName, FALSE);
ZwClose (dir); /* Special case for local disks: It's most feasible if the
goto out; DOS device name reflects the DOS drive, so we check for this
explicitly and only return prematurely if so. */
#define HARDDISK_PREFIX L"\\Device\\Harddisk"
if (ntdev.Length < wcslen (HARDDISK_PREFIX)
|| wcsncasecmp (ntdev.Buffer, HARDDISK_PREFIX, 8) != 0
|| (odi->ObjectName.Length == 2 * sizeof (WCHAR)
&& odi->ObjectName.Buffer[1] == L':'))
{
ZwClose (dir);
goto out;
}
} }
} }
ZwClose (dir); ZwClose (dir);