3 * Copyright (C) 1998, 1999, 2000, 2001 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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * PROJECT: ReactOS kernel
21 * FILE: drivers/fs/vfat/create.c
22 * PURPOSE: VFAT Filesystem
23 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
26 /* INCLUDES *****************************************************************/
31 /* FUNCTIONS *****************************************************************/
34 vfat8Dot3ToString (PFAT_DIR_ENTRY pEntry
, PUNICODE_STRING NameU
)
40 RtlCopyMemory(cString
, pEntry
->ShortName
, 11);
42 if (cString
[0] == 0x05)
47 StringA
.Buffer
= cString
;
48 for (StringA
.Length
= 0;
49 StringA
.Length
< 8 && StringA
.Buffer
[StringA
.Length
] != ' ';
51 StringA
.MaximumLength
= StringA
.Length
;
53 RtlOemStringToUnicodeString(NameU
, &StringA
, FALSE
);
55 if (pEntry
->lCase
& VFAT_CASE_LOWER_BASE
)
57 RtlDowncaseUnicodeString(NameU
, NameU
, FALSE
);
59 if (cString
[8] != ' ')
61 Length
= NameU
->Length
;
62 NameU
->Buffer
+= Length
/ sizeof(WCHAR
);
63 if (!FAT_ENTRY_VOLUME(pEntry
))
65 Length
+= sizeof(WCHAR
);
66 NameU
->Buffer
[0] = L
'.';
70 NameU
->MaximumLength
-= Length
;
72 StringA
.Buffer
= &cString
[8];
73 for (StringA
.Length
= 0;
74 StringA
.Length
< 3 && StringA
.Buffer
[StringA
.Length
] != ' ';
76 StringA
.MaximumLength
= StringA
.Length
;
77 RtlOemStringToUnicodeString(NameU
, &StringA
, FALSE
);
78 if (pEntry
->lCase
& VFAT_CASE_LOWER_EXT
)
80 RtlDowncaseUnicodeString(NameU
, NameU
, FALSE
);
82 NameU
->Buffer
-= Length
/ sizeof(WCHAR
);
83 NameU
->Length
+= Length
;
84 NameU
->MaximumLength
+= Length
;
86 NameU
->Buffer
[NameU
->Length
/ sizeof(WCHAR
)] = 0;
87 DPRINT("'%wZ'\n", NameU
);
91 ReadVolumeLabel (PDEVICE_EXTENSION DeviceExt
, PVPB Vpb
)
93 * FUNCTION: Read the volume label
100 LARGE_INTEGER FileOffset
;
101 UNICODE_STRING NameU
;
103 ULONG EntriesPerPage
;
106 NameU
.Buffer
= Vpb
->VolumeLabel
;
108 NameU
.MaximumLength
= sizeof(Vpb
->VolumeLabel
);
109 *(Vpb
->VolumeLabel
) = 0;
110 Vpb
->VolumeLabelLength
= 0;
112 if (DeviceExt
->Flags
& VCB_IS_FATX
)
114 SizeDirEntry
= sizeof(FATX_DIR_ENTRY
);
115 EntriesPerPage
= FATX_ENTRIES_PER_PAGE
;
119 SizeDirEntry
= sizeof(FAT_DIR_ENTRY
);
120 EntriesPerPage
= FAT_ENTRIES_PER_PAGE
;
123 ExAcquireResourceExclusiveLite (&DeviceExt
->DirResource
, TRUE
);
124 pFcb
= vfatOpenRootFCB (DeviceExt
);
125 ExReleaseResourceLite (&DeviceExt
->DirResource
);
127 FileOffset
.QuadPart
= 0;
128 if (CcMapData(pFcb
->FileObject
, &FileOffset
, SizeDirEntry
, TRUE
, &Context
, (PVOID
*)&Entry
))
132 if (ENTRY_VOLUME(DeviceExt
, Entry
))
134 /* copy volume label */
135 if (DeviceExt
->Flags
& VCB_IS_FATX
)
137 StringO
.Buffer
= (PCHAR
)Entry
->FatX
.Filename
;
138 StringO
.MaximumLength
= StringO
.Length
= Entry
->FatX
.FilenameLength
;
139 RtlOemStringToUnicodeString(&NameU
, &StringO
, FALSE
);
143 vfat8Dot3ToString (&Entry
->Fat
, &NameU
);
145 Vpb
->VolumeLabelLength
= NameU
.Length
;
148 if (ENTRY_END(DeviceExt
, Entry
))
153 Entry
= (PDIR_ENTRY
)((ULONG_PTR
)Entry
+ SizeDirEntry
);
154 if ((DirIndex
% EntriesPerPage
) == 0)
156 CcUnpinData(Context
);
157 FileOffset
.u
.LowPart
+= PAGE_SIZE
;
158 if (!CcMapData(pFcb
->FileObject
, &FileOffset
, SizeDirEntry
, TRUE
, &Context
, (PVOID
*)&Entry
))
167 CcUnpinData(Context
);
170 ExAcquireResourceExclusiveLite (&DeviceExt
->DirResource
, TRUE
);
171 vfatReleaseFCB (DeviceExt
, pFcb
);
172 ExReleaseResourceLite (&DeviceExt
->DirResource
);
174 return STATUS_SUCCESS
;
179 PDEVICE_EXTENSION DeviceExt
,
181 PUNICODE_STRING FileToFindU
,
182 PVFAT_DIRENTRY_CONTEXT DirContext
,
185 * FUNCTION: Find a file
188 PWCHAR PathNameBuffer
;
189 USHORT PathNameBufferLength
;
191 PVOID Context
= NULL
;
195 UNICODE_STRING PathNameU
;
196 UNICODE_STRING FileToFindUpcase
;
199 DPRINT ("FindFile(Parent %p, FileToFind '%wZ', DirIndex: %u)\n",
200 Parent
, FileToFindU
, DirContext
->DirIndex
);
201 DPRINT ("FindFile: Path %wZ\n",&Parent
->PathNameU
);
203 PathNameBufferLength
= LONGNAME_MAX_LENGTH
* sizeof(WCHAR
);
204 PathNameBuffer
= ExAllocatePoolWithTag(NonPagedPool
, PathNameBufferLength
+ sizeof(WCHAR
), TAG_VFAT
);
207 return STATUS_INSUFFICIENT_RESOURCES
;
210 PathNameU
.Buffer
= PathNameBuffer
;
211 PathNameU
.Length
= 0;
212 PathNameU
.MaximumLength
= PathNameBufferLength
;
214 DirContext
->LongNameU
.Length
= 0;
215 DirContext
->ShortNameU
.Length
= 0;
217 WildCard
= FsRtlDoesNameContainWildCards(FileToFindU
);
219 if (WildCard
== FALSE
)
221 /* if there is no '*?' in the search name, than look first for an existing fcb */
222 RtlCopyUnicodeString(&PathNameU
, &Parent
->PathNameU
);
223 if (!vfatFCBIsRoot(Parent
))
225 PathNameU
.Buffer
[PathNameU
.Length
/ sizeof(WCHAR
)] = L
'\\';
226 PathNameU
.Length
+= sizeof(WCHAR
);
228 RtlAppendUnicodeStringToString(&PathNameU
, FileToFindU
);
229 PathNameU
.Buffer
[PathNameU
.Length
/ sizeof(WCHAR
)] = 0;
230 rcFcb
= vfatGrabFCBFromTable(DeviceExt
, &PathNameU
);
233 ULONG startIndex
= rcFcb
->startIndex
;
234 if ((rcFcb
->Flags
& FCB_IS_FATX_ENTRY
) && !vfatFCBIsRoot(Parent
))
238 if(startIndex
>= DirContext
->DirIndex
)
240 RtlCopyUnicodeString(&DirContext
->LongNameU
, &rcFcb
->LongNameU
);
241 RtlCopyUnicodeString(&DirContext
->ShortNameU
, &rcFcb
->ShortNameU
);
242 RtlCopyMemory(&DirContext
->DirEntry
, &rcFcb
->entry
, sizeof(DIR_ENTRY
));
243 DirContext
->StartIndex
= rcFcb
->startIndex
;
244 DirContext
->DirIndex
= rcFcb
->dirIndex
;
245 DPRINT("FindFile: new Name %wZ, DirIndex %u (%u)\n",
246 &DirContext
->LongNameU
, DirContext
->DirIndex
, DirContext
->StartIndex
);
247 Status
= STATUS_SUCCESS
;
251 DPRINT("FCB not found for %wZ\n", &PathNameU
);
252 Status
= STATUS_UNSUCCESSFUL
;
254 vfatReleaseFCB(DeviceExt
, rcFcb
);
255 ExFreePool(PathNameBuffer
);
260 /* FsRtlIsNameInExpression need the searched string to be upcase,
261 * even if IgnoreCase is specified */
262 Status
= RtlUpcaseUnicodeString(&FileToFindUpcase
, FileToFindU
, TRUE
);
263 if (!NT_SUCCESS(Status
))
265 ExFreePool(PathNameBuffer
);
271 Status
= DeviceExt
->GetNextDirEntry(&Context
, &Page
, Parent
, DirContext
, First
);
273 if (Status
== STATUS_NO_MORE_ENTRIES
)
277 if (ENTRY_VOLUME(DeviceExt
, &DirContext
->DirEntry
))
279 DirContext
->DirIndex
++;
284 Found
= FsRtlIsNameInExpression(&FileToFindUpcase
, &DirContext
->LongNameU
, TRUE
, NULL
) ||
285 FsRtlIsNameInExpression(&FileToFindUpcase
, &DirContext
->ShortNameU
, TRUE
, NULL
);
289 Found
= FsRtlAreNamesEqual(&DirContext
->LongNameU
, FileToFindU
, TRUE
, NULL
) ||
290 FsRtlAreNamesEqual(&DirContext
->ShortNameU
, FileToFindU
, TRUE
, NULL
);
297 RtlCopyUnicodeString(&PathNameU
, &Parent
->PathNameU
);
298 if (!vfatFCBIsRoot(Parent
))
300 PathNameU
.Buffer
[PathNameU
.Length
/ sizeof(WCHAR
)] = L
'\\';
301 PathNameU
.Length
+= sizeof(WCHAR
);
303 RtlAppendUnicodeStringToString(&PathNameU
, &DirContext
->LongNameU
);
304 PathNameU
.Buffer
[PathNameU
.Length
/ sizeof(WCHAR
)] = 0;
305 rcFcb
= vfatGrabFCBFromTable(DeviceExt
, &PathNameU
);
308 RtlCopyMemory(&DirContext
->DirEntry
, &rcFcb
->entry
, sizeof(DIR_ENTRY
));
309 vfatReleaseFCB(DeviceExt
, rcFcb
);
312 DPRINT("%u\n", DirContext
->LongNameU
.Length
);
313 DPRINT("FindFile: new Name %wZ, DirIndex %u\n",
314 &DirContext
->LongNameU
, DirContext
->DirIndex
);
318 CcUnpinData(Context
);
320 RtlFreeUnicodeString(&FileToFindUpcase
);
321 ExFreePool(PathNameBuffer
);
322 return STATUS_SUCCESS
;
324 DirContext
->DirIndex
++;
329 CcUnpinData(Context
);
332 RtlFreeUnicodeString(&FileToFindUpcase
);
333 ExFreePool(PathNameBuffer
);
340 PDEVICE_EXTENSION DeviceExt
,
341 PUNICODE_STRING PathNameU
,
342 PFILE_OBJECT FileObject
,
343 PVFATFCB
* ParentFcb
)
345 * FUNCTION: Opens a file
351 DPRINT ("VfatOpenFile(%p, '%wZ', %p, %p)\n", DeviceExt
, PathNameU
, FileObject
, ParentFcb
);
353 if (FileObject
->RelatedFileObject
)
355 DPRINT ("'%wZ'\n", &FileObject
->RelatedFileObject
->FileName
);
357 *ParentFcb
= FileObject
->RelatedFileObject
->FsContext
;
358 (*ParentFcb
)->RefCount
++;
365 if (!DeviceExt
->FatInfo
.FixedMedia
)
367 Status
= VfatBlockDeviceIoControl (DeviceExt
->StorageDevice
,
368 IOCTL_DISK_CHECK_VERIFY
,
375 if (!NT_SUCCESS(Status
))
377 DPRINT ("Status %lx\n", Status
);
385 (*ParentFcb
)->RefCount
++;
388 /* try first to find an existing FCB in memory */
389 DPRINT ("Checking for existing FCB in memory\n");
391 Status
= vfatGetFCBForFile (DeviceExt
, ParentFcb
, &Fcb
, PathNameU
);
392 if (!NT_SUCCESS (Status
))
394 DPRINT ("Could not make a new FCB, status: %x\n", Status
);
397 if (Fcb
->Flags
& FCB_DELETE_PENDING
)
399 vfatReleaseFCB (DeviceExt
, Fcb
);
400 return STATUS_DELETE_PENDING
;
402 DPRINT ("Attaching FCB to fileObject\n");
403 Status
= vfatAttachFCBToFileObject (DeviceExt
, Fcb
, FileObject
);
404 if (!NT_SUCCESS(Status
))
406 vfatReleaseFCB (DeviceExt
, Fcb
);
412 VfatCreateFile ( PDEVICE_OBJECT DeviceObject
, PIRP Irp
)
414 * FUNCTION: Create or open a file
417 PIO_STACK_LOCATION Stack
;
418 PFILE_OBJECT FileObject
;
419 NTSTATUS Status
= STATUS_SUCCESS
;
420 PDEVICE_EXTENSION DeviceExt
;
421 ULONG RequestedDisposition
, RequestedOptions
;
422 PVFATFCB pFcb
= NULL
;
423 PVFATFCB ParentFcb
= NULL
;
425 BOOLEAN PagingFileCreate
= FALSE
;
427 UNICODE_STRING FileNameU
;
428 UNICODE_STRING PathNameU
;
430 /* Unpack the various parameters. */
431 Stack
= IoGetCurrentIrpStackLocation (Irp
);
432 RequestedDisposition
= ((Stack
->Parameters
.Create
.Options
>> 24) & 0xff);
434 Stack
->Parameters
.Create
.Options
& FILE_VALID_OPTION_FLAGS
;
435 PagingFileCreate
= (Stack
->Flags
& SL_OPEN_PAGING_FILE
) ? TRUE
: FALSE
;
436 FileObject
= Stack
->FileObject
;
437 DeviceExt
= DeviceObject
->DeviceExtension
;
439 /* Check their validity. */
440 if (RequestedOptions
& FILE_DIRECTORY_FILE
&&
441 RequestedDisposition
== FILE_SUPERSEDE
)
443 return(STATUS_INVALID_PARAMETER
);
446 if (RequestedOptions
& FILE_DIRECTORY_FILE
&&
447 RequestedOptions
& FILE_NON_DIRECTORY_FILE
)
449 return(STATUS_INVALID_PARAMETER
);
452 /* This a open operation for the volume itself */
453 if (FileObject
->FileName
.Length
== 0 &&
454 (FileObject
->RelatedFileObject
== NULL
|| FileObject
->RelatedFileObject
->FsContext2
!= NULL
))
456 if (RequestedDisposition
!= FILE_OPEN
&&
457 RequestedDisposition
!= FILE_OPEN_IF
)
459 return(STATUS_ACCESS_DENIED
);
462 /* In spite of what is shown in WDK, it seems that Windows FAT driver doesn't perform that test */
463 if (RequestedOptions
& FILE_DIRECTORY_FILE
)
465 return(STATUS_NOT_A_DIRECTORY
);
469 pFcb
= DeviceExt
->VolumeFcb
;
470 vfatAttachFCBToFileObject(DeviceExt
, pFcb
, FileObject
);
473 Irp
->IoStatus
.Information
= FILE_OPENED
;
474 return(STATUS_SUCCESS
);
478 * Check for illegal characters and illegale dot sequences in the file name
480 PathNameU
= FileObject
->FileName
;
481 c
= PathNameU
.Buffer
+ PathNameU
.Length
/ sizeof(WCHAR
);
484 while (c
-- > PathNameU
.Buffer
)
486 if (*c
== L
'\\' || c
== PathNameU
.Buffer
)
488 if (Dots
&& last
> c
)
490 return(STATUS_OBJECT_NAME_INVALID
);
500 if (*c
!= '\\' && vfatIsLongIllegal(*c
))
502 return(STATUS_OBJECT_NAME_INVALID
);
505 if (FileObject
->RelatedFileObject
&& PathNameU
.Length
>= sizeof(WCHAR
) && PathNameU
.Buffer
[0] == L
'\\')
507 return(STATUS_OBJECT_NAME_INVALID
);
509 if (PathNameU
.Length
> sizeof(WCHAR
) && PathNameU
.Buffer
[PathNameU
.Length
/sizeof(WCHAR
)-1] == L
'\\')
511 PathNameU
.Length
-= sizeof(WCHAR
);
514 /* Try opening the file. */
515 Status
= VfatOpenFile (DeviceExt
, &PathNameU
, FileObject
, &ParentFcb
);
518 * If the directory containing the file to open doesn't exist then
521 if (Status
== STATUS_OBJECT_PATH_NOT_FOUND
||
522 Status
== STATUS_INVALID_PARAMETER
||
523 Status
== STATUS_DELETE_PENDING
)
527 vfatReleaseFCB (DeviceExt
, ParentFcb
);
531 if (!NT_SUCCESS(Status
) && ParentFcb
== NULL
)
533 DPRINT1("VfatOpenFile faild for '%wZ', status %x\n", &PathNameU
, Status
);
538 * If the file open failed then create the required file
540 if (!NT_SUCCESS (Status
))
542 if (RequestedDisposition
== FILE_CREATE
||
543 RequestedDisposition
== FILE_OPEN_IF
||
544 RequestedDisposition
== FILE_OVERWRITE_IF
||
545 RequestedDisposition
== FILE_SUPERSEDE
)
548 Attributes
= Stack
->Parameters
.Create
.FileAttributes
& ~FILE_ATTRIBUTE_NORMAL
;
549 vfatSplitPathName(&PathNameU
, NULL
, &FileNameU
);
550 Status
= VfatAddEntry (DeviceExt
, &FileNameU
, &pFcb
, ParentFcb
, RequestedOptions
,
551 (UCHAR
)(Attributes
& FILE_ATTRIBUTE_VALID_FLAGS
));
552 vfatReleaseFCB (DeviceExt
, ParentFcb
);
553 if (NT_SUCCESS (Status
))
555 Status
= vfatAttachFCBToFileObject (DeviceExt
, pFcb
, FileObject
);
556 if ( !NT_SUCCESS(Status
) )
558 vfatReleaseFCB (DeviceExt
, pFcb
);
562 Irp
->IoStatus
.Information
= FILE_CREATED
;
563 VfatSetAllocationSizeInformation(FileObject
,
566 &Irp
->Overlay
.AllocationSize
);
567 VfatSetExtendedAttributes(FileObject
,
568 Irp
->AssociatedIrp
.SystemBuffer
,
569 Stack
->Parameters
.Create
.EaLength
);
571 if (PagingFileCreate
)
573 pFcb
->Flags
|= FCB_IS_PAGE_FILE
;
585 vfatReleaseFCB (DeviceExt
, ParentFcb
);
594 vfatReleaseFCB (DeviceExt
, ParentFcb
);
596 /* Otherwise fail if the caller wanted to create a new file */
597 if (RequestedDisposition
== FILE_CREATE
)
599 Irp
->IoStatus
.Information
= FILE_EXISTS
;
600 VfatCloseFile (DeviceExt
, FileObject
);
601 return(STATUS_OBJECT_NAME_COLLISION
);
604 pFcb
= FileObject
->FsContext
;
606 if (pFcb
->OpenHandleCount
!= 0)
608 Status
= IoCheckShareAccess(Stack
->Parameters
.Create
.SecurityContext
->DesiredAccess
,
609 Stack
->Parameters
.Create
.ShareAccess
,
611 &pFcb
->FCBShareAccess
,
613 if (!NT_SUCCESS(Status
))
615 VfatCloseFile (DeviceExt
, FileObject
);
621 * Check the file has the requested attributes
623 if (RequestedOptions
& FILE_NON_DIRECTORY_FILE
&&
624 *pFcb
->Attributes
& FILE_ATTRIBUTE_DIRECTORY
)
626 VfatCloseFile (DeviceExt
, FileObject
);
627 return(STATUS_FILE_IS_A_DIRECTORY
);
629 if (RequestedOptions
& FILE_DIRECTORY_FILE
&&
630 !(*pFcb
->Attributes
& FILE_ATTRIBUTE_DIRECTORY
))
632 VfatCloseFile (DeviceExt
, FileObject
);
633 return(STATUS_NOT_A_DIRECTORY
);
635 #ifndef USE_ROS_CC_AND_FS
636 if (!(*pFcb
->Attributes
& FILE_ATTRIBUTE_DIRECTORY
))
638 if (Stack
->Parameters
.Create
.SecurityContext
->DesiredAccess
& FILE_WRITE_DATA
||
639 RequestedDisposition
== FILE_OVERWRITE
||
640 RequestedDisposition
== FILE_OVERWRITE_IF
)
642 if (!MmFlushImageSection(&pFcb
->SectionObjectPointers
, MmFlushForWrite
))
644 DPRINT1("%wZ\n", &pFcb
->PathNameU
);
645 DPRINT1("%d %d %d\n", Stack
->Parameters
.Create
.SecurityContext
->DesiredAccess
& FILE_WRITE_DATA
,
646 RequestedDisposition
== FILE_OVERWRITE
, RequestedDisposition
== FILE_OVERWRITE_IF
);
647 VfatCloseFile (DeviceExt
, FileObject
);
648 return STATUS_SHARING_VIOLATION
;
653 if (PagingFileCreate
)
656 * Do more checking for page files. It is possible,
657 * that the file was opened and closed previously
658 * as a normal cached file. In this case, the cache
659 * manager has referenced the fileobject and the fcb
660 * is held in memory. Try to remove the fileobject
661 * from cache manager and use the fcb.
663 if (pFcb
->RefCount
> 1)
665 if(!(pFcb
->Flags
& FCB_IS_PAGE_FILE
))
667 VfatCloseFile(DeviceExt
, FileObject
);
668 return(STATUS_INVALID_PARAMETER
);
673 pFcb
->Flags
|= FCB_IS_PAGE_FILE
;
678 if (pFcb
->Flags
& FCB_IS_PAGE_FILE
)
680 VfatCloseFile(DeviceExt
, FileObject
);
681 return(STATUS_INVALID_PARAMETER
);
686 if (RequestedDisposition
== FILE_OVERWRITE
||
687 RequestedDisposition
== FILE_OVERWRITE_IF
||
688 RequestedDisposition
== FILE_SUPERSEDE
)
690 ExAcquireResourceExclusiveLite(&(pFcb
->MainResource
), TRUE
);
691 Status
= VfatSetAllocationSizeInformation (FileObject
,
694 &Irp
->Overlay
.AllocationSize
);
695 ExReleaseResourceLite(&(pFcb
->MainResource
));
696 if (!NT_SUCCESS (Status
))
698 VfatCloseFile (DeviceExt
, FileObject
);
703 if (RequestedDisposition
== FILE_SUPERSEDE
)
705 Irp
->IoStatus
.Information
= FILE_SUPERSEDED
;
707 else if (RequestedDisposition
== FILE_OVERWRITE
||
708 RequestedDisposition
== FILE_OVERWRITE_IF
)
710 Irp
->IoStatus
.Information
= FILE_OVERWRITTEN
;
714 Irp
->IoStatus
.Information
= FILE_OPENED
;
718 if (pFcb
->OpenHandleCount
== 0)
720 IoSetShareAccess(Stack
->Parameters
.Create
.SecurityContext
->DesiredAccess
,
721 Stack
->Parameters
.Create
.ShareAccess
,
723 &pFcb
->FCBShareAccess
);
729 &pFcb
->FCBShareAccess
734 pFcb
->OpenHandleCount
++;
736 /* FIXME : test write access if requested */
743 VfatCreate (PVFAT_IRP_CONTEXT IrpContext
)
745 * FUNCTION: Create or open a file
752 if (IrpContext
->DeviceObject
== VfatGlobalData
->DeviceObject
)
754 /* DeviceObject represents FileSystem instead of logical volume */
755 DPRINT ("FsdCreate called with file system\n");
756 IrpContext
->Irp
->IoStatus
.Information
= FILE_OPENED
;
757 IrpContext
->Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
758 IoCompleteRequest (IrpContext
->Irp
, IO_DISK_INCREMENT
);
759 VfatFreeIrpContext(IrpContext
);
760 return(STATUS_SUCCESS
);
763 if (!(IrpContext
->Flags
& IRPCONTEXT_CANWAIT
))
765 return(VfatQueueRequest (IrpContext
));
768 IrpContext
->Irp
->IoStatus
.Information
= 0;
769 ExAcquireResourceExclusiveLite (&IrpContext
->DeviceExt
->DirResource
, TRUE
);
770 Status
= VfatCreateFile (IrpContext
->DeviceObject
, IrpContext
->Irp
);
771 ExReleaseResourceLite (&IrpContext
->DeviceExt
->DirResource
);
773 IrpContext
->Irp
->IoStatus
.Status
= Status
;
774 IoCompleteRequest (IrpContext
->Irp
,
775 (CCHAR
)(NT_SUCCESS(Status
) ? IO_DISK_INCREMENT
: IO_NO_INCREMENT
));
776 VfatFreeIrpContext(IrpContext
);