CVS: winex/files dos_fs.c,1.37,1.38

[email protected] 31 Jul 2007 20:00:58 -0000
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/files dos_fs.c,1.37,1.38Update of /var/lib/cvsd/cvsroot/winex/files
In directory agravaine:/tmp/cvs-serv2420/files

Modified Files:
	dos_fs.c 
Log Message:
Support locating DOS devices via FindFirstFile() API



Index: dos_fs.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/files/dos_fs.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- dos_fs.c	31 Jul 2007 19:46:16 -0000	1.37
+++ dos_fs.c	31 Jul 2007 20:00:56 -0000	1.38
@@ -1841,6 +1841,8 @@
       case FindExInfoStandard:
         {
           WIN32_FIND_DATAA * data = (WIN32_FIND_DATAA *) lpFindFileData;
+          const DOS_DEVICE *pDev;
+
           data->dwReserved0 = data->dwReserved1 = 0x0;
           if (!lpFileName) return 0;
           if (!strncmp(lpFileName, "\\\\?\\", 4)) lpFileName += 4;
@@ -1858,19 +1860,34 @@
               info->drive = FILE_toupper(*lpFileName) - 'A';
           else info->drive = DRIVE_GetCurrentDrive();
           info->cur_pos = 0;
+
+          if ((pDev = DOSFS_GetDevice (lpFileName)))
+          {
+             info->dir = NULL;
+             info->cur_dir_entry = 0;
+
+             /* Values taken from XP SP 2 */
+             memset (data, 0, sizeof (*data));
+             data->dwFileAttributes = FILE_ATTRIBUTE_ARCHIVE;
+             strcpy (data->cFileName, pDev->name);
+             GlobalUnlock (handle);
+          }
+          else
+          {
 #ifdef CACHE_DIR_ENTRY
-	  info->dir = NULL;
-          info->cur_dir_entry = 0;
+             info->dir = NULL;
+             info->cur_dir_entry = 0;
 #else
-          info->dir = DOSFS_OpenDir (info->path);
+             info->dir = DOSFS_OpenDir (info->path);
 #endif
 
-          GlobalUnlock( handle );
-          if (!FindNextFileA( handle, data ))
-          {
-              FindClose( handle );
-              SetLastError( ERROR_NO_MORE_FILES );
-              break;
+             GlobalUnlock( handle );
+             if (!FindNextFileA( handle, data ))
+             {
+                FindClose( handle );
+                SetLastError( ERROR_NO_MORE_FILES );
+                break;
+             }
           }
           return handle;
         }