Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-12-15 00:23:27 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-12-15 00:23:27 +0400
commite74758408e50f8980de0d73f5b3721efbd698df9 (patch)
tree31a9ae8cce2a48dbf228c7e73a26b10387546ec8 /winsup
parenta5d1e69e3d9fc57a2829a0982b1e1352300d366d (diff)
Don't leave Windows 2000 behind.
* autoload.cc (GetSystemWow64DirectoryW): Define. (GetVolumePathNamesForVolumeNameW): Define. * fhandler_process.cc (get_volume_path_names_for_volume_name): New static function to workaround missing GetVolumePathNamesForVolumeNameW function in Windows 2000. (dos_drive_mappings::dos_drive_mappings): Call get_volume_path_names_for_volume_name instead of GetVolumePathNamesForVolumeNameW.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/autoload.cc2
-rw-r--r--winsup/cygwin/fhandler_process.cc38
3 files changed, 49 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 154e608e7..a3e3ffc8a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,14 @@
+2011-12-14 Corinna Vinschen <vinschen@redhat.com>
+
+ * autoload.cc (GetSystemWow64DirectoryW): Define.
+ (GetVolumePathNamesForVolumeNameW): Define.
+ * fhandler_process.cc (get_volume_path_names_for_volume_name): New
+ static function to workaround missing GetVolumePathNamesForVolumeNameW
+ function in Windows 2000.
+ (dos_drive_mappings::dos_drive_mappings): Call
+ get_volume_path_names_for_volume_name instead of
+ GetVolumePathNamesForVolumeNameW.
+
2011-12-13 Christopher Faylor <me.cygwin2011@cgf.cx>
* dcrt0.cc (init_windows_system_directory): Record
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index f8a7a0cbb..e4827c22f 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -392,6 +392,8 @@ LoadDLLfunc (GetUdpTable, 12, iphlpapi)
LoadDLLfuncEx (AttachConsole, 4, kernel32, 1)
LoadDLLfuncEx (GetModuleHandleExW, 12, kernel32, 1)
LoadDLLfuncEx (GetNamedPipeClientProcessId, 8, kernel32, 1)
+LoadDLLfuncEx (GetSystemWow64DirectoryW, 8, kernel32, 1)
+LoadDLLfuncEx (GetVolumePathNamesForVolumeNameW, 16, kernel32, 1)
LoadDLLfunc (LocaleNameToLCID, 8, kernel32)
LoadDLLfunc (WNetCloseEnum, 4, mpr)
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 0d269d19e..cefc8f4df 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -544,6 +544,41 @@ format_process_winexename (void *data, char *&destbuf)
return len + 1;
}
+static bool
+get_volume_path_names_for_volume_name (LPCWSTR vol, LPWSTR mounts)
+{
+ DWORD len;
+ if (GetVolumePathNamesForVolumeNameW (vol, mounts, NT_MAX_PATH, &len))
+ return true;
+
+ /* Windows 2000 doesn't have GetVolumePathNamesForVolumeNameW.
+ Just assume that mount points are not longer than MAX_PATH. */
+ WCHAR drives[MAX_PATH], dvol[MAX_PATH], mp[MAX_PATH + 3];
+ if (!GetLogicalDriveStringsW (MAX_PATH, drives))
+ return false;
+ for (PWCHAR drive = drives; *drive; drive = wcschr (drive, '\0') + 1)
+ {
+ if (!GetVolumeNameForVolumeMountPointW (drive, dvol, MAX_PATH))
+ continue;
+ if (!wcscasecmp (vol, dvol))
+ mounts = wcpcpy (mounts, drive) + 1;
+ wcscpy (mp, drive);
+ HANDLE h = FindFirstVolumeMountPointW (dvol, mp + 3, MAX_PATH);
+ if (h == INVALID_HANDLE_VALUE)
+ continue;
+ do
+ {
+ if (GetVolumeNameForVolumeMountPointW (mp, dvol, MAX_PATH))
+ if (!wcscasecmp (vol, dvol))
+ mounts = wcpcpy (mounts, drive) + 1;
+ }
+ while (FindNextVolumeMountPointW (h, mp, MAX_PATH));
+ FindVolumeMountPointClose (h);
+ }
+ *mounts = L'\0';
+ return true;
+}
+
struct dos_drive_mappings
{
struct mapping
@@ -573,9 +608,8 @@ struct dos_drive_mappings
else
do
{
- DWORD len;
/* Skip drives which are not mounted. */
- if (!GetVolumePathNamesForVolumeNameW (vol, mounts, NT_MAX_PATH, &len)
+ if (!get_volume_path_names_for_volume_name (vol, mounts)
|| mounts[0] == L'\0')
continue;
*wcsrchr (vol, L'\\') = L'\0';