- Implement IoSetFileOrigin
authorStefan Ginsberg <stefanginsberg@gmail.com>
Mon, 15 Sep 2008 17:47:16 +0000 (17:47 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Mon, 15 Sep 2008 17:47:16 +0000 (17:47 +0000)
svn path=/trunk/; revision=36263

reactos/ntoskrnl/io/iomgr/file.c

index 935d031..466b869 100644 (file)
@@ -2418,15 +2418,38 @@ IoQueryFileDosDeviceName(IN PFILE_OBJECT FileObject,
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 NTSTATUS
 NTAPI
 IoSetFileOrigin(IN PFILE_OBJECT FileObject,
                 IN BOOLEAN Remote)
 {
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
+    NTSTATUS Status = STATUS_SUCCESS;
+    BOOLEAN FlagSet;
+
+    /* Get the flag status */
+    FlagSet = FileObject->Flags & FO_REMOTE_ORIGIN ? TRUE : FALSE;
+
+    /* Don't set the flag if it was set already, and don't remove it if it wasn't set */
+    if (Remote && !FlagSet)
+    {
+        /* Set the flag */
+        FileObject->Flags |= FO_REMOTE_ORIGIN;
+    }
+    else if (!Remote && FlagSet)
+    {
+        /* Remove the flag */
+        FileObject->Flags &= ~FO_REMOTE_ORIGIN;
+    }
+    else
+    {
+        /* Fail */
+        Status = STATUS_INVALID_PARAMETER_MIX;
+    }
+
+    /* Return status */
+    return Status;
 }
 
 /*