Author: ion
Date: Sat Jul 8 22:47:26 2006
New Revision: 22935
URL:
http://svn.reactos.org/svn/reactos?rev=22935&view=rev
Log:
- Implemented NtDeleteFile, also a piece of cake now that we have IopParseDevice done.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/file.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c Sat Jul 8 22:47:26 2006
@@ -2023,14 +2023,70 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
NTAPI
NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes)
{
- UNIMPLEMENTED;
- return(STATUS_NOT_IMPLEMENTED);
+ NTSTATUS Status;
+ DUMMY_FILE_OBJECT DummyFileObject;
+ HANDLE Handle;
+ KPROCESSOR_MODE AccessMode = KeGetPreviousMode();
+ OPEN_PACKET OpenPacket;
+ PAGED_CODE();
+
+ /* Setup the Open Packet */
+ OpenPacket.Type = IO_TYPE_OPEN_PACKET;
+ OpenPacket.Size = sizeof(OPEN_PACKET);
+ OpenPacket.FileObject = NULL;
+ OpenPacket.FinalStatus = STATUS_SUCCESS;
+ OpenPacket.Information = 0;
+ OpenPacket.ParseCheck = 0;
+ OpenPacket.RelatedFileObject = NULL;
+ OpenPacket.AllocationSize.QuadPart = 0;
+ OpenPacket.CreateOptions = FILE_DELETE_ON_CLOSE;
+ OpenPacket.FileAttributes = 0;
+ OpenPacket.ShareAccess = FILE_SHARE_READ |
+ FILE_SHARE_WRITE |
+ FILE_SHARE_DELETE;
+ OpenPacket.EaBuffer = NULL;
+ OpenPacket.EaLength = 0;
+ OpenPacket.Options = 0;
+ OpenPacket.Disposition = FILE_OPEN;
+ OpenPacket.BasicInformation = NULL;
+ OpenPacket.NetworkInformation = NULL;
+ OpenPacket.CreateFileType = 0;
+ OpenPacket.MailslotOrPipeParameters = NULL;
+ OpenPacket.Override = FALSE;
+ OpenPacket.QueryOnly = FALSE;
+ OpenPacket.DeleteOnly = TRUE;
+ OpenPacket.FullAttributes = FALSE;
+ OpenPacket.DummyFileObject = &DummyFileObject;
+ OpenPacket.InternalFlags = 0;
+
+ /* Update the operation counts */
+ IopUpdateOperationCount(IopOtherTransfer);
+
+ /*
+ * Attempt opening the file. This will call the I/O Parse Routine for
+ * the File Object (IopParseDevice) which will use the dummy file obejct
+ * send the IRP to its device object. Note that we have two statuses
+ * to worry about: the Object Manager's status (in Status) and the I/O
+ * status, which is in the Open Packet's Final Status, and determined
+ * by the Parse Check member.
+ */
+ Status = ObOpenObjectByName(ObjectAttributes,
+ NULL,
+ AccessMode,
+ NULL,
+ DELETE,
+ &OpenPacket,
+ &Handle);
+ if (OpenPacket.ParseCheck != TRUE) return Status;
+
+ /* Retrn the Io status */
+ return OpenPacket.FinalStatus;
}
/*
@@ -2044,7 +2100,7 @@
OUT PIO_STATUS_BLOCK IoStatus,
OUT PFILE_NETWORK_OPEN_INFORMATION Buffer)
{
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
DUMMY_FILE_OBJECT DummyFileObject;
HANDLE Handle;
OPEN_PACKET OpenPacket;