[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / io / iomgr / iofunc.c
index 49976c6..2d59c41 100644 (file)
@@ -119,7 +119,7 @@ IopPerformSynchronousRequest(IN PDEVICE_OBJECT DeviceObject,
 {
     NTSTATUS Status;
     PKNORMAL_ROUTINE NormalRoutine;
-    PVOID NormalContext;
+    PVOID NormalContext = NULL;
     KIRQL OldIrql;
     PAGED_CODE();
     IOTRACE(IO_API_DEBUG, "IRP: %p. DO: %p. FO: %p \n",
@@ -163,7 +163,7 @@ IopPerformSynchronousRequest(IN PDEVICE_OBJECT DeviceObject,
                                            Executive,
                                            PreviousMode,
                                            (FileObject->Flags &
-                                            FO_ALERTABLE_IO),
+                                            FO_ALERTABLE_IO) != 0,
                                            NULL);
             if ((Status == STATUS_ALERTED) || (Status == STATUS_USER_APC))
             {
@@ -603,7 +603,8 @@ IopQueryDeviceInformation(IN PFILE_OBJECT FileObject,
             Status = KeWaitForSingleObject(&FileObject->Event,
                                            Executive,
                                            KernelMode,
-                                           FileObject->Flags & FO_ALERTABLE_IO,
+                                           (FileObject->Flags &
+                                            FO_ALERTABLE_IO) != 0,
                                            NULL);
             if (Status == STATUS_ALERTED)
             {
@@ -630,7 +631,7 @@ IopQueryDeviceInformation(IN PFILE_OBJECT FileObject,
     }
 
     /* Return the Length and Status. ReturnedLength is NOT optional */
-    *ReturnedLength = IoStatusBlock.Information;
+    *ReturnedLength = (ULONG)IoStatusBlock.Information;
     return Status;
 }
 
@@ -856,7 +857,8 @@ IoSetInformation(IN PFILE_OBJECT FileObject,
             Status = KeWaitForSingleObject(&FileObject->Event,
                                            Executive,
                                            KernelMode,
-                                           FileObject->Flags & FO_ALERTABLE_IO,
+                                           (FileObject->Flags &
+                                            FO_ALERTABLE_IO) != 0,
                                            NULL);
             if (Status == STATUS_ALERTED)
             {
@@ -1345,7 +1347,7 @@ NtLockFile(IN HANDLE FileHandle,
     {
         /* Allocating failed, clean up and return the exception code */
         IopCleanupAfterException(FileObject, Irp, Event, NULL);
-        if (LocalLength) ExFreePool(LocalLength);
+        if (LocalLength) ExFreePoolWithTag(LocalLength, TAG_LOCK);
 
         /* Return the exception code */
         _SEH2_YIELD(return _SEH2_GetExceptionCode());
@@ -1448,7 +1450,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
             /* Free buffer and return the exception code */
-            if (AuxBuffer) ExFreePool(AuxBuffer);
+            if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
             _SEH2_YIELD(return _SEH2_GetExceptionCode());
         }
         _SEH2_END;
@@ -1464,7 +1466,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
     if (!NT_SUCCESS(Status))
     {
         /* Fail */
-        if (AuxBuffer) ExFreePool(AuxBuffer);
+        if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
         return Status;
     }
 
@@ -1537,7 +1539,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
         {
             /* Allocating failed, clean up and return the exception code */
             IopCleanupAfterException(FileObject, Irp, Event, NULL);
-            if (AuxBuffer) ExFreePool(AuxBuffer);
+            if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
 
             /* Return the exception code */
             _SEH2_YIELD(return _SEH2_GetExceptionCode());
@@ -1861,7 +1863,7 @@ NtQueryInformationFile(IN HANDLE FileHandle,
             _SEH2_END;
 
             /* Free the event */
-            ExFreePool(Event);
+            ExFreePoolWithTag(Event, TAG_IO);
         }
         else
         {
@@ -1869,7 +1871,8 @@ NtQueryInformationFile(IN HANDLE FileHandle,
             Status = KeWaitForSingleObject(&FileObject->Event,
                                            Executive,
                                            PreviousMode,
-                                           FileObject->Flags & FO_ALERTABLE_IO,
+                                           (FileObject->Flags &
+                                            FO_ALERTABLE_IO) != 0,
                                            NULL);
             if ((Status == STATUS_USER_APC) || (Status == STATUS_ALERTED))
             {
@@ -2462,7 +2465,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
                          * Someone else set the completion port in the
                          * meanwhile, so dereference the port and fail.
                          */
-                        ExFreePool(Context);
+                        ExFreePoolWithTag(Context, IOC_TAG);
                         ObDereferenceObject(Queue);
                         Status = STATUS_INVALID_PARAMETER;
                     }
@@ -2521,7 +2524,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
             _SEH2_END;
 
             /* Free the event */
-            ExFreePool(Event);
+            ExFreePoolWithTag(Event, TAG_IO);
         }
         else
         {
@@ -2529,7 +2532,8 @@ NtSetInformationFile(IN HANDLE FileHandle,
             Status = KeWaitForSingleObject(&FileObject->Event,
                                            Executive,
                                            PreviousMode,
-                                           FileObject->Flags & FO_ALERTABLE_IO,
+                                           (FileObject->Flags &
+                                            FO_ALERTABLE_IO) != 0,
                                            NULL);
             if ((Status == STATUS_USER_APC) || (Status == STATUS_ALERTED))
             {
@@ -2551,7 +2555,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
         {
             /* Clear it in the IRP for completion */
             Irp->UserEvent = NULL;
-            ExFreePool(Event);
+            ExFreePoolWithTag(Event, TAG_IO);
         }
 
         /* Set the caller IOSB */
@@ -2718,7 +2722,7 @@ NtUnlockFile(IN HANDLE FileHandle,
         /* Allocate a buffer */
         LocalLength = ExAllocatePoolWithTag(NonPagedPool,
                                             sizeof(LARGE_INTEGER),
-                                        TAG_LOCK);
+                                            TAG_LOCK);
 
         /* Set the length */
         *LocalLength = CapturedLength;
@@ -2729,7 +2733,7 @@ NtUnlockFile(IN HANDLE FileHandle,
     {
         /* Allocating failed, clean up and return the exception code */
         IopCleanupAfterException(FileObject, Irp, NULL, Event);
-        if (LocalLength) ExFreePool(LocalLength);
+        if (LocalLength) ExFreePoolWithTag(LocalLength, TAG_LOCK);
 
         /* Return the exception code */
         _SEH2_YIELD(return _SEH2_GetExceptionCode());