3 * Copyright (C) 2002 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 /* $Id: misc.c,v 1.1 2002/05/01 13:15:42 ekohl Exp $
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: services/fs/cdfs/misc.c
24 * PURPOSE: CDROM (ISO 9660) filesystem driver
25 * PROGRAMMER: Eric Kohl
29 /* INCLUDES *****************************************************************/
31 #include <ddk/ntddk.h>
39 /* FUNCTIONS ****************************************************************/
46 * FUNCTION: Compare two wide character strings, s2 with jokers (* or ?)
47 * return TRUE if s1 like s2
50 while ((*s2
=='*')||(*s2
=='?')||(towlower(*s1
)==towlower(*s2
)))
52 if ((*s1
)==0 && (*s2
)==0)
59 if (wstrcmpjoki(s1
,s2
))
73 for (;((*s2
)=='.')||((*s2
)=='*')||((*s2
)=='?');s2
++)
77 if ((*s1
)==0 && (*s2
)==0)
85 CdfsSwapString(PWCHAR Out
,
89 PUCHAR t
= (PUCHAR
)Out
;
92 for (i
= 0; i
< Count
; i
+= 2)
103 CdfsDateTimeToFileTime(PFCB Fcb
,
106 TIME_FIELDS TimeFields
;
108 TimeFields
.Milliseconds
= 0;
109 TimeFields
.Second
= Fcb
->Entry
.Second
;
110 TimeFields
.Minute
= Fcb
->Entry
.Minute
;
111 TimeFields
.Hour
= Fcb
->Entry
.Hour
;
113 TimeFields
.Day
= Fcb
->Entry
.Day
;
114 TimeFields
.Month
= Fcb
->Entry
.Month
;
115 TimeFields
.Year
= Fcb
->Entry
.Year
+ 1900;
117 RtlTimeFieldsToTime(&TimeFields
,
118 (PLARGE_INTEGER
)FileTime
);
123 CdfsFileFlagsToAttributes(PFCB Fcb
,
124 PULONG FileAttributes
)
126 /* FIXME: Fix attributes */
128 *FileAttributes
= // FILE_ATTRIBUTE_READONLY |
129 (Fcb
->Entry
.FileFlags
& 0x01) ? FILE_ATTRIBUTE_HIDDEN
: 0 |
130 (Fcb
->Entry
.FileFlags
& 0x02) ? FILE_ATTRIBUTE_DIRECTORY
: 0 |
131 (Fcb
->Entry
.FileFlags
& 0x04) ? FILE_ATTRIBUTE_SYSTEM
: 0 |
132 (Fcb
->Entry
.FileFlags
& 0x10) ? FILE_ATTRIBUTE_READONLY
: 0;