Remove dot at the end of filename without extension
[reactos.git] / reactos / drivers / fs / cdfs / misc.c
index 72b489c..49f2741 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ReactOS kernel
- *  Copyright (C) 2002 ReactOS Team
+ *  Copyright (C) 2002, 2004 ReactOS Team
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: misc.c,v 1.1 2002/05/01 13:15:42 ekohl Exp $
+/* $Id$
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             services/fs/cdfs/misc.c
  * PURPOSE:          CDROM (ISO 9660) filesystem driver
  * PROGRAMMER:       Eric Kohl
- * UPDATE HISTORY: 
+ * UPDATE HISTORY:
  */
 
 /* INCLUDES *****************************************************************/
 
-#include <ddk/ntddk.h>
+#include "cdfs.h"
 
 #define NDEBUG
 #include <debug.h>
 
-#include "cdfs.h"
-
-
 /* FUNCTIONS ****************************************************************/
 
-
-BOOLEAN
-wstrcmpjoki(PWSTR s1,
-           PWSTR s2)
-/*
- * FUNCTION: Compare two wide character strings, s2 with jokers (* or ?)
- * return TRUE if s1 like s2
- */
-{
-  while ((*s2=='*')||(*s2=='?')||(towlower(*s1)==towlower(*s2)))
-    {
-      if ((*s1)==0 && (*s2)==0)
-        return(TRUE);
-
-      if(*s2=='*')
-       {
-         s2++;
-         while (*s1)
-           if (wstrcmpjoki(s1,s2))
-             return(TRUE);
-           else
-             s1++;
-       }
-      else
-       {
-         s1++;
-         s2++;
-       }
-    }
-
-  if ((*s2)=='.')
-    {
-      for (;((*s2)=='.')||((*s2)=='*')||((*s2)=='?');s2++)
-       ;
-    }
-
-  if ((*s1)==0 && (*s2)==0)
-    return(TRUE);
-
-  return(FALSE);
-}
-
-
 VOID
 CdfsSwapString(PWCHAR Out,
               PUCHAR In,
@@ -93,17 +47,25 @@ CdfsSwapString(PWCHAR Out,
     {
       t[i] = In[i+1];
       t[i+1] = In[i];
+      if (t[i+1] == 0 && t[i] == ';')
+       break;
     }
+  if ((i>2)&&(t[i-2] == '.'))
+  {
+    t[i-2] = 0;
+    t[i-1] = 0;
+  }
   t[i] = 0;
   t[i+1] = 0;
 }
 
 
 VOID
-CdfsDateTimeToFileTime(PFCB Fcb,
-                      TIME *FileTime)
+CdfsDateTimeToSystemTime(PFCB Fcb,
+                        PLARGE_INTEGER SystemTime)
 {
   TIME_FIELDS TimeFields;
+  LARGE_INTEGER LocalTime;
 
   TimeFields.Milliseconds = 0;
   TimeFields.Second = Fcb->Entry.Second;
@@ -115,7 +77,8 @@ CdfsDateTimeToFileTime(PFCB Fcb,
   TimeFields.Year = Fcb->Entry.Year + 1900;
 
   RtlTimeFieldsToTime(&TimeFields,
-                     (PLARGE_INTEGER)FileTime);
+                     &LocalTime);
+  ExLocalTimeToSystemTime(&LocalTime, SystemTime);
 }
 
 
@@ -126,10 +89,10 @@ CdfsFileFlagsToAttributes(PFCB Fcb,
   /* FIXME: Fix attributes */
 
   *FileAttributes = // FILE_ATTRIBUTE_READONLY |
-                   (Fcb->Entry.FileFlags & 0x01) ? FILE_ATTRIBUTE_HIDDEN : 0 |
-                   (Fcb->Entry.FileFlags & 0x02) ? FILE_ATTRIBUTE_DIRECTORY : 0 |
-                   (Fcb->Entry.FileFlags & 0x04) ? FILE_ATTRIBUTE_SYSTEM : 0 |
-                   (Fcb->Entry.FileFlags & 0x10) ? FILE_ATTRIBUTE_READONLY : 0;
+                   ((Fcb->Entry.FileFlags & FILE_FLAG_HIDDEN) ? FILE_ATTRIBUTE_HIDDEN : 0) |
+                   ((Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY) ? FILE_ATTRIBUTE_DIRECTORY : 0) |
+                   ((Fcb->Entry.FileFlags & FILE_FLAG_SYSTEM) ? FILE_ATTRIBUTE_SYSTEM : 0) |
+                   ((Fcb->Entry.FileFlags & FILE_FLAG_READONLY) ? FILE_ATTRIBUTE_READONLY : 0);
 }
 
-/* EOF */
\ No newline at end of file
+/* EOF */