strip whitespace from end of lines
authorSteven Edwards <winehacker@gmail.com>
Mon, 9 May 2005 01:38:29 +0000 (01:38 +0000)
committerSteven Edwards <winehacker@gmail.com>
Mon, 9 May 2005 01:38:29 +0000 (01:38 +0000)
svn path=/trunk/; revision=15164

260 files changed:
reactos/ntoskrnl/cc/cacheman.c
reactos/ntoskrnl/cc/copy.c
reactos/ntoskrnl/cc/fs.c
reactos/ntoskrnl/cc/mdl.c
reactos/ntoskrnl/cc/pin.c
reactos/ntoskrnl/cc/view.c
reactos/ntoskrnl/cm/cm.h
reactos/ntoskrnl/cm/ntfunc.c
reactos/ntoskrnl/cm/regfile.c
reactos/ntoskrnl/cm/registry.c
reactos/ntoskrnl/cm/regobj.c
reactos/ntoskrnl/dbgk/dbgkutil.c
reactos/ntoskrnl/dbgk/debug.c
reactos/ntoskrnl/ex/callback.c
reactos/ntoskrnl/ex/dbgctrl.c
reactos/ntoskrnl/ex/error.c
reactos/ntoskrnl/ex/event.c
reactos/ntoskrnl/ex/evtpair.c
reactos/ntoskrnl/ex/fmutex.c
reactos/ntoskrnl/ex/handle.c
reactos/ntoskrnl/ex/i386/interlck.c
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ex/interlck.c
reactos/ntoskrnl/ex/list.c
reactos/ntoskrnl/ex/lookas.c
reactos/ntoskrnl/ex/mutant.c
reactos/ntoskrnl/ex/power.c
reactos/ntoskrnl/ex/profile.c
reactos/ntoskrnl/ex/resource.c
reactos/ntoskrnl/ex/rundown.c
reactos/ntoskrnl/ex/sem.c
reactos/ntoskrnl/ex/synch.c
reactos/ntoskrnl/ex/sysinfo.c
reactos/ntoskrnl/ex/time.c
reactos/ntoskrnl/ex/timer.c
reactos/ntoskrnl/ex/util.c
reactos/ntoskrnl/ex/uuid.c
reactos/ntoskrnl/ex/win32k.c
reactos/ntoskrnl/ex/work.c
reactos/ntoskrnl/ex/zone.c
reactos/ntoskrnl/fs/fastio.c
reactos/ntoskrnl/fs/filelock.c
reactos/ntoskrnl/fs/mcb.c
reactos/ntoskrnl/fs/name.c
reactos/ntoskrnl/fs/notify.c
reactos/ntoskrnl/fs/oplock.c
reactos/ntoskrnl/fs/pool.c
reactos/ntoskrnl/fs/tunnel.c
reactos/ntoskrnl/fs/unc.c
reactos/ntoskrnl/fs/util.c
reactos/ntoskrnl/inbv/inbv.c
reactos/ntoskrnl/include/internal/callbacks.h
reactos/ntoskrnl/include/internal/cc.h
reactos/ntoskrnl/include/internal/debug.h
reactos/ntoskrnl/include/internal/ex.h
reactos/ntoskrnl/include/internal/i386/hal.h
reactos/ntoskrnl/include/internal/i386/ke.h
reactos/ntoskrnl/include/internal/i386/mm.h
reactos/ntoskrnl/include/internal/i386/ps.h
reactos/ntoskrnl/include/internal/ifs.h
reactos/ntoskrnl/include/internal/io.h
reactos/ntoskrnl/include/internal/kbd.h
reactos/ntoskrnl/include/internal/kd.h
reactos/ntoskrnl/include/internal/kdb.h
reactos/ntoskrnl/include/internal/kdbochs.h
reactos/ntoskrnl/include/internal/kdgdb.h
reactos/ntoskrnl/include/internal/ke.h
reactos/ntoskrnl/include/internal/ldr.h
reactos/ntoskrnl/include/internal/mm.h
reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/include/internal/ob.h
reactos/ntoskrnl/include/internal/pool.h
reactos/ntoskrnl/include/internal/port.h
reactos/ntoskrnl/include/internal/powerpc/ke.h
reactos/ntoskrnl/include/internal/ps.h
reactos/ntoskrnl/include/internal/se.h
reactos/ntoskrnl/include/internal/trap.h
reactos/ntoskrnl/include/internal/v86m.h
reactos/ntoskrnl/io/adapter.c
reactos/ntoskrnl/io/arcname.c
reactos/ntoskrnl/io/bootlog.c
reactos/ntoskrnl/io/controller.c
reactos/ntoskrnl/io/device.c
reactos/ntoskrnl/io/deviface.c
reactos/ntoskrnl/io/disk.c
reactos/ntoskrnl/io/driver.c
reactos/ntoskrnl/io/efi.c
reactos/ntoskrnl/io/error.c
reactos/ntoskrnl/io/event.c
reactos/ntoskrnl/io/file.c
reactos/ntoskrnl/io/fs.c
reactos/ntoskrnl/io/iocomp.c
reactos/ntoskrnl/io/iomgr.c
reactos/ntoskrnl/io/iowork.c
reactos/ntoskrnl/io/irp.c
reactos/ntoskrnl/io/irq.c
reactos/ntoskrnl/io/plugplay.c
reactos/ntoskrnl/io/pnpdma.c
reactos/ntoskrnl/io/pnpmgr.c
reactos/ntoskrnl/io/pnpnotify.c
reactos/ntoskrnl/io/pnpreport.c
reactos/ntoskrnl/io/pnproot.c
reactos/ntoskrnl/io/rawfs.c
reactos/ntoskrnl/io/remlock.c
reactos/ntoskrnl/io/resource.c
reactos/ntoskrnl/io/share.c
reactos/ntoskrnl/io/timer.c
reactos/ntoskrnl/io/vpb.c
reactos/ntoskrnl/io/wmi.c
reactos/ntoskrnl/kd/kdinit.c
reactos/ntoskrnl/kd/kdio.c
reactos/ntoskrnl/kd/kdmain.c
reactos/ntoskrnl/kd/wrappers/bochs.c
reactos/ntoskrnl/kd/wrappers/gdbstub.c
reactos/ntoskrnl/kdbg/i386/dis-asm.h
reactos/ntoskrnl/kdbg/i386/i386-dis.c
reactos/ntoskrnl/kdbg/kdb.c
reactos/ntoskrnl/kdbg/kdb.h
reactos/ntoskrnl/kdbg/kdb_cli.c
reactos/ntoskrnl/kdbg/kdb_expr.c
reactos/ntoskrnl/kdbg/kdb_keyboard.c
reactos/ntoskrnl/kdbg/kdb_serial.c
reactos/ntoskrnl/kdbg/kdb_symbols.c
reactos/ntoskrnl/ke/apc.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/ke/catch.c
reactos/ntoskrnl/ke/clock.c
reactos/ntoskrnl/ke/device.c
reactos/ntoskrnl/ke/dpc.c
reactos/ntoskrnl/ke/event.c
reactos/ntoskrnl/ke/gate.c
reactos/ntoskrnl/ke/gmutex.c
reactos/ntoskrnl/ke/i386/bios.c
reactos/ntoskrnl/ke/i386/brkpoint.c
reactos/ntoskrnl/ke/i386/exp.c
reactos/ntoskrnl/ke/i386/fpu.c
reactos/ntoskrnl/ke/i386/gdt.c
reactos/ntoskrnl/ke/i386/idt.c
reactos/ntoskrnl/ke/i386/irq.c
reactos/ntoskrnl/ke/i386/kernel.c
reactos/ntoskrnl/ke/i386/ldt.c
reactos/ntoskrnl/ke/i386/thread.c
reactos/ntoskrnl/ke/i386/tss.c
reactos/ntoskrnl/ke/i386/usertrap.c
reactos/ntoskrnl/ke/i386/v86m.c
reactos/ntoskrnl/ke/i386/vdm.c
reactos/ntoskrnl/ke/ipi.c
reactos/ntoskrnl/ke/kqueue.c
reactos/ntoskrnl/ke/kthread.c
reactos/ntoskrnl/ke/main.c
reactos/ntoskrnl/ke/mutex.c
reactos/ntoskrnl/ke/process.c
reactos/ntoskrnl/ke/profile.c
reactos/ntoskrnl/ke/queue.c
reactos/ntoskrnl/ke/sem.c
reactos/ntoskrnl/ke/spinlock.c
reactos/ntoskrnl/ke/timer.c
reactos/ntoskrnl/ke/usercall.c
reactos/ntoskrnl/ke/wait.c
reactos/ntoskrnl/ldr/init.c
reactos/ntoskrnl/ldr/resource.c
reactos/ntoskrnl/ldr/rtl.c
reactos/ntoskrnl/ldr/sysdll.c
reactos/ntoskrnl/ldr/userldr.c
reactos/ntoskrnl/lpc/close.c
reactos/ntoskrnl/lpc/complete.c
reactos/ntoskrnl/lpc/connect.c
reactos/ntoskrnl/lpc/create.c
reactos/ntoskrnl/lpc/listen.c
reactos/ntoskrnl/lpc/port.c
reactos/ntoskrnl/lpc/query.c
reactos/ntoskrnl/lpc/queue.c
reactos/ntoskrnl/lpc/receive.c
reactos/ntoskrnl/lpc/reply.c
reactos/ntoskrnl/lpc/send.c
reactos/ntoskrnl/mkconfig.c
reactos/ntoskrnl/mm/anonmem.c
reactos/ntoskrnl/mm/aspace.c
reactos/ntoskrnl/mm/balance.c
reactos/ntoskrnl/mm/cont.c
reactos/ntoskrnl/mm/drvlck.c
reactos/ntoskrnl/mm/elf32.c
reactos/ntoskrnl/mm/elf64.c
reactos/ntoskrnl/mm/freelist.c
reactos/ntoskrnl/mm/i386/page.c
reactos/ntoskrnl/mm/i386/pfault.c
reactos/ntoskrnl/mm/iospace.c
reactos/ntoskrnl/mm/marea.c
reactos/ntoskrnl/mm/mdl.c
reactos/ntoskrnl/mm/mm.c
reactos/ntoskrnl/mm/mminit.c
reactos/ntoskrnl/mm/mpw.c
reactos/ntoskrnl/mm/ncache.c
reactos/ntoskrnl/mm/npool.c
reactos/ntoskrnl/mm/pagefile.c
reactos/ntoskrnl/mm/pageop.c
reactos/ntoskrnl/mm/pagfault.c
reactos/ntoskrnl/mm/paging.c
reactos/ntoskrnl/mm/pe.c
reactos/ntoskrnl/mm/physical.c
reactos/ntoskrnl/mm/pool.c
reactos/ntoskrnl/mm/process.c
reactos/ntoskrnl/mm/region.c
reactos/ntoskrnl/mm/rmap.c
reactos/ntoskrnl/mm/section.c
reactos/ntoskrnl/mm/verifier.c
reactos/ntoskrnl/mm/virtual.c
reactos/ntoskrnl/mm/wset.c
reactos/ntoskrnl/ob/dirobj.c
reactos/ntoskrnl/ob/handle.c
reactos/ntoskrnl/ob/namespc.c
reactos/ntoskrnl/ob/ntobj.c
reactos/ntoskrnl/ob/object.c
reactos/ntoskrnl/ob/sdcache.c
reactos/ntoskrnl/ob/security.c
reactos/ntoskrnl/ob/symlink.c
reactos/ntoskrnl/ob/wait.c
reactos/ntoskrnl/po/power.c
reactos/ntoskrnl/ps/cid.c
reactos/ntoskrnl/ps/debug.c
reactos/ntoskrnl/ps/i386/continue.c
reactos/ntoskrnl/ps/idle.c
reactos/ntoskrnl/ps/kill.c
reactos/ntoskrnl/ps/locale.c
reactos/ntoskrnl/ps/notify.c
reactos/ntoskrnl/ps/process.c
reactos/ntoskrnl/ps/psmgr.c
reactos/ntoskrnl/ps/query.c
reactos/ntoskrnl/ps/quota.c
reactos/ntoskrnl/ps/security.c
reactos/ntoskrnl/ps/suspend.c
reactos/ntoskrnl/ps/thread.c
reactos/ntoskrnl/ps/win32.c
reactos/ntoskrnl/rtl/atom.c
reactos/ntoskrnl/rtl/capture.c
reactos/ntoskrnl/rtl/ctype.c
reactos/ntoskrnl/rtl/debug.c
reactos/ntoskrnl/rtl/handle.c
reactos/ntoskrnl/rtl/libsupp.c
reactos/ntoskrnl/rtl/misc.c
reactos/ntoskrnl/rtl/nls.c
reactos/ntoskrnl/rtl/purecall.c
reactos/ntoskrnl/rtl/regio.c
reactos/ntoskrnl/rtl/sprintf.c
reactos/ntoskrnl/rtl/stdlib.c
reactos/ntoskrnl/rtl/string.c
reactos/ntoskrnl/rtl/strtok.c
reactos/ntoskrnl/rtl/swprintf.c
reactos/ntoskrnl/rtl/wstring.c
reactos/ntoskrnl/se/acl.c
reactos/ntoskrnl/se/audit.c
reactos/ntoskrnl/se/lsa.c
reactos/ntoskrnl/se/luid.c
reactos/ntoskrnl/se/priv.c
reactos/ntoskrnl/se/sd.c
reactos/ntoskrnl/se/semgr.c
reactos/ntoskrnl/se/sid.c
reactos/ntoskrnl/se/token.c
reactos/ntoskrnl/tests/setup.c
reactos/ntoskrnl/tests/tests/VirtualMemory.c

index 945d0e0..389bf79 100644 (file)
@@ -1,5 +1,5 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/cc/cacheman.c
@@ -31,7 +31,7 @@ CcGetFlushedValidData (
     IN BOOLEAN BcbListHeld
     )
 {
-       LARGE_INTEGER i; 
+       LARGE_INTEGER i;
 
        UNIMPLEMENTED;
 
index 5a6ac44..bedb017 100644 (file)
@@ -40,7 +40,7 @@ ULONG CcFastReadResourceMiss;
 
 /* FUNCTIONS *****************************************************************/
 
-VOID 
+VOID
 CcInitCacheZeroPage(VOID)
 {
    NTSTATUS Status;
@@ -100,7 +100,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
                Buffer = pTemp;
          }
 #endif
-         Length = Length - TempLength; 
+         Length = Length - TempLength;
          previous = current;
          current = current->NextInChain;
          CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
@@ -126,7 +126,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
              current2 = current2->NextInChain;
              current_size += Bcb->CacheSegmentSize;
            }
-         
+
          /*
           * Create an MDL which contains all their pages.
           */
@@ -191,7 +191,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
                        Buffer = pTemp;
                  }
 #endif
-             Length = Length - TempLength; 
+             Length = Length - TempLength;
              CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
              current_size += Bcb->CacheSegmentSize;
            }
@@ -200,7 +200,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
   return(STATUS_SUCCESS);
 }
 
-NTSTATUS 
+NTSTATUS
 ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
 {
   ULONG Size;
@@ -221,7 +221,7 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
   MmBuildMdlForNonPagedPool(Mdl);
   Mdl->MdlFlags |= MDL_IO_PAGE_READ;
   KeInitializeEvent(&Event, NotificationEvent, FALSE);
-  Status = IoPageRead(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, & Event, &IoStatus); 
+  Status = IoPageRead(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, & Event, &IoStatus);
   if (Status == STATUS_PENDING)
   {
      KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
@@ -235,13 +235,13 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
     }
   if (CacheSeg->Bcb->CacheSegmentSize > Size)
     {
-      memset ((char*)CacheSeg->BaseAddress + Size, 0, 
+      memset ((char*)CacheSeg->BaseAddress + Size, 0,
              CacheSeg->Bcb->CacheSegmentSize - Size);
     }
   return STATUS_SUCCESS;
 }
 
-NTSTATUS 
+NTSTATUS
 WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
 {
   ULONG Size;
@@ -316,7 +316,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
   KIRQL oldirql;
   PLIST_ENTRY current_entry;
   PCACHE_SEGMENT current;
-  
+
   DPRINT("CcCopyRead(FileObject %x, FileOffset %x, "
         "Length %d, Wait %d, Buffer %x, IoStatus %x)\n",
         FileObject, (ULONG)FileOffset->QuadPart, Length, Wait,
@@ -324,7 +324,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
 
   Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
   ReadOffset = (ULONG)FileOffset->QuadPart;
-  
+
   DPRINT("AllocationSize %d, FileSize %d\n",
          (ULONG)Bcb->AllocationSize.QuadPart,
          (ULONG)Bcb->FileSize.QuadPart);
@@ -339,7 +339,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
       current_entry = Bcb->BcbSegmentListHead.Flink;
       while (current_entry != &Bcb->BcbSegmentListHead)
        {
-         current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+         current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                      BcbSegmentListEntry);
          if (!current->Valid && current->FileOffset < ReadOffset + Length
              && current->FileOffset + Bcb->CacheSegmentSize > ReadOffset)
@@ -359,7 +359,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
     {
       TempLength = min (Length, Bcb->CacheSegmentSize - TempLength);
       Status = CcRosRequestCacheSegment(Bcb,
-                                       ROUND_DOWN(ReadOffset, 
+                                       ROUND_DOWN(ReadOffset,
                                                   Bcb->CacheSegmentSize),
                                        &BaseAddress, &Valid, &CacheSeg);
       if (!NT_SUCCESS(Status))
@@ -380,14 +380,14 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
              return FALSE;
            }
        }
-      memcpy (Buffer, (char*)BaseAddress + ReadOffset % Bcb->CacheSegmentSize, 
+      memcpy (Buffer, (char*)BaseAddress + ReadOffset % Bcb->CacheSegmentSize,
              TempLength);
       CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
       ReadLength += TempLength;
       Length -= TempLength;
       ReadOffset += TempLength;
       Buffer = (PVOID)((char*)Buffer + TempLength);
-    }  
+    }
   while (Length > 0)
     {
       TempLength = min(max(Bcb->CacheSegmentSize, MAX_RW_LENGTH), Length);
@@ -445,14 +445,14 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
        current_entry = Bcb->BcbSegmentListHead.Flink;
        while (current_entry != &Bcb->BcbSegmentListHead)
         {
-          CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+          CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                        BcbSegmentListEntry);
           if (!CacheSeg->Valid)
             {
-              if ((WriteOffset >= CacheSeg->FileOffset && 
+              if ((WriteOffset >= CacheSeg->FileOffset &&
                    WriteOffset < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
-                  || (WriteOffset + Length > CacheSeg->FileOffset && 
-                      WriteOffset + Length <= CacheSeg->FileOffset + 
+                  || (WriteOffset + Length > CacheSeg->FileOffset &&
+                      WriteOffset + Length <= CacheSeg->FileOffset +
                       Bcb->CacheSegmentSize))
                 {
                   KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
@@ -484,10 +484,10 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
               return(FALSE);
             }
         }
-       memcpy ((char*)BaseAddress + WriteOffset % Bcb->CacheSegmentSize, 
+       memcpy ((char*)BaseAddress + WriteOffset % Bcb->CacheSegmentSize,
               Buffer, TempLength);
        CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, TRUE, FALSE);
-       
+
        Length -= TempLength;
        WriteOffset += TempLength;
 #if defined(__GNUC__)
@@ -500,7 +500,7 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
          }
 #endif
      }
-   
+
    while (Length > 0)
      {
        TempLength = min (Bcb->CacheSegmentSize, Length);
@@ -612,11 +612,11 @@ CcZeroData (IN PFILE_OBJECT     FileObject,
   ULONG i;
   IO_STATUS_BLOCK Iosb;
   KEVENT Event;
-  
+
   DPRINT("CcZeroData(FileObject %x, StartOffset %I64x, EndOffset %I64x, "
-        "Wait %d)\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart, 
+        "Wait %d)\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart,
         Wait);
-  
+
   Length = EndOffset->u.LowPart - StartOffset->u.LowPart;
   WriteOffset.QuadPart = StartOffset->QuadPart;
 
@@ -625,7 +625,7 @@ CcZeroData (IN PFILE_OBJECT     FileObject,
       /* File is not cached */
 
       Mdl = alloca(MmSizeOfMdl(NULL, MAX_ZERO_LENGTH));
+
       while (Length > 0)
        {
          if (Length + WriteOffset.u.LowPart % PAGE_SIZE > MAX_ZERO_LENGTH)
@@ -649,7 +649,7 @@ CcZeroData (IN PFILE_OBJECT     FileObject,
              KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
              Status = Iosb.Status;
          }
-          MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);            
+          MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
          if (!NT_SUCCESS(Status))
            {
              return(FALSE);
@@ -675,14 +675,14 @@ CcZeroData (IN PFILE_OBJECT     FileObject,
          current_entry = Bcb->BcbSegmentListHead.Flink;
          while (current_entry != &Bcb->BcbSegmentListHead)
            {
-             CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+             CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                           BcbSegmentListEntry);
              if (!CacheSeg->Valid)
                {
-                 if ((WriteOffset.u.LowPart >= CacheSeg->FileOffset && 
+                 if ((WriteOffset.u.LowPart >= CacheSeg->FileOffset &&
                       WriteOffset.u.LowPart < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
-                     || (WriteOffset.u.LowPart + Length > CacheSeg->FileOffset && 
-                         WriteOffset.u.LowPart + Length <= 
+                     || (WriteOffset.u.LowPart + Length > CacheSeg->FileOffset &&
+                         WriteOffset.u.LowPart + Length <=
                          CacheSeg->FileOffset + Bcb->CacheSegmentSize))
                    {
                      KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
@@ -726,7 +726,7 @@ CcZeroData (IN PFILE_OBJECT     FileObject,
                      Status = ReadCacheSegment(current);
                      if (!NT_SUCCESS(Status))
                        {
-                         DPRINT1("ReadCacheSegment failed, status %x\n", 
+                         DPRINT1("ReadCacheSegment failed, status %x\n",
                                  Status);
                        }
                    }
@@ -743,7 +743,7 @@ CcZeroData (IN PFILE_OBJECT     FileObject,
              Length -= TempLength;
 
              current = current->NextInChain;
-           } 
+           }
 
           current = CacheSeg;
          while (current != NULL)
index 5a54a25..170f061 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id:$
+/* $Id$
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -17,7 +17,7 @@
 #ifndef VACB_MAPPING_GRANULARITY
 #define VACB_MAPPING_GRANULARITY (256 * 1024)
 #endif
+
 /* GLOBALS   *****************************************************************/
 
 extern FAST_MUTEX ViewLock;
@@ -41,7 +41,7 @@ CcGetDirtyPages (
 {
        UNIMPLEMENTED;
 
-       LARGE_INTEGER i; 
+       LARGE_INTEGER i;
        i.QuadPart = 0;
        return i;
 }
@@ -71,7 +71,7 @@ CcGetLsnForFileObject (
 {
        UNIMPLEMENTED;
 
-       LARGE_INTEGER i; 
+       LARGE_INTEGER i;
        i.QuadPart = 0;
        return i;
 }
@@ -136,7 +136,7 @@ CcSetFileSizes (IN PFILE_OBJECT FileObject,
   LIST_ENTRY FreeListHead;
   NTSTATUS Status;
 
-  DPRINT("CcSetFileSizes(FileObject %x, FileSizes %x)\n", 
+  DPRINT("CcSetFileSizes(FileObject %x, FileSizes %x)\n",
         FileObject, FileSizes);
   DPRINT("AllocationSize %d, FileSize %d, ValidDataLength %d\n",
          (ULONG)FileSizes->AllocationSize.QuadPart,
@@ -151,7 +151,7 @@ CcSetFileSizes (IN PFILE_OBJECT FileObject,
    */
   if (Bcb == NULL)
      return;
+
   if (FileSizes->AllocationSize.QuadPart < Bcb->AllocationSize.QuadPart)
   {
      InitializeListHead(&FreeListHead);
@@ -184,7 +184,7 @@ CcSetFileSizes (IN PFILE_OBJECT FileObject,
           }
        }
      }
-     
+
      Bcb->AllocationSize = FileSizes->AllocationSize;
      Bcb->FileSize = FileSizes->FileSize;
      KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
index 620129d..7e91d70 100644 (file)
@@ -1,5 +1,5 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/cc/fs.c
@@ -49,13 +49,13 @@ CcMdlRead(
  *     Used by CcMdlReadComplete@8 and FsRtl
  *
  */
-VOID 
+VOID
 STDCALL
 CcMdlReadCompleteDev(IN PMDL MdlChain,
                      IN PFILE_OBJECT FileObject)
 {
     PMDL Mdl;
-    
+
     /* Free MDLs */
     while ((Mdl = MdlChain))
     {
@@ -88,11 +88,11 @@ CcMdlReadComplete(IN PFILE_OBJECT FileObject,
 {
     PDEVICE_OBJECT DeviceObject = NULL;
     PFAST_IO_DISPATCH FastDispatch;
-   
+
     /* Get Fast Dispatch Data */
     DeviceObject = IoGetRelatedDeviceObject(FileObject);
     FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
-    
+
     /* Check if we support Fast Calls, and check this one */
     if (FastDispatch && FastDispatch->MdlReadComplete)
     {
@@ -101,7 +101,7 @@ CcMdlReadComplete(IN PFILE_OBJECT FileObject,
                                       MdlChain,
                                       DeviceObject);
     }
-    
+
     /* Use slow path */
     CcMdlReadCompleteDev(MdlChain, FileObject);
 }
@@ -117,11 +117,11 @@ CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
 {
     PDEVICE_OBJECT DeviceObject = NULL;
     PFAST_IO_DISPATCH FastDispatch;
-   
+
     /* Get Fast Dispatch Data */
     DeviceObject = IoGetRelatedDeviceObject(FileObject);
     FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
-    
+
     /* Check if we support Fast Calls, and check this one */
     if (FastDispatch && FastDispatch->MdlWriteComplete)
     {
@@ -131,7 +131,7 @@ CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
                                        MdlChain,
                                        DeviceObject);
     }
-    
+
     /* Use slow path */
     CcMdlWriteCompleteDev(FileOffset, MdlChain, FileObject);
 }
index 1b51b24..f196e1b 100644 (file)
@@ -40,11 +40,11 @@ CcMapData (IN PFILE_OBJECT FileObject,
   NTSTATUS Status;
   PINTERNAL_BCB iBcb;
   ULONG ROffset;
-  
+
   DPRINT("CcMapData(FileObject %x, FileOffset %d, Length %d, Wait %d,"
         " pBcb %x, pBuffer %x)\n", FileObject, (ULONG)FileOffset->QuadPart,
         Length, Wait, pBcb, pBuffer);
-  
+
   ReadOffset = (ULONG)FileOffset->QuadPart;
   Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
   ASSERT(Bcb);
@@ -52,7 +52,7 @@ CcMapData (IN PFILE_OBJECT FileObject,
   DPRINT("AllocationSize %d, FileSize %d\n",
          (ULONG)Bcb->AllocationSize.QuadPart,
          (ULONG)Bcb->FileSize.QuadPart);
-  
+
   if (ReadOffset % Bcb->CacheSegmentSize + Length > Bcb->CacheSegmentSize)
     {
       return(FALSE);
@@ -193,7 +193,7 @@ VOID STDCALL
 CcUnpinData (IN PVOID Bcb)
 {
   PINTERNAL_BCB iBcb = Bcb;
-  CcRosReleaseCacheSegment(iBcb->CacheSegment->Bcb, iBcb->CacheSegment, TRUE, 
+  CcRosReleaseCacheSegment(iBcb->CacheSegment->Bcb, iBcb->CacheSegment, TRUE,
                            iBcb->Dirty, FALSE);
   if (--iBcb->RefCount == 0)
   {
index 9162b84..172f5f4 100644 (file)
 
 /* NOTES **********************************************************************
  *
- * This is not the NT implementation of a file cache nor anything much like 
- * it. 
+ * This is not the NT implementation of a file cache nor anything much like
+ * it.
  *
- * The general procedure for a filesystem to implement a read or write 
+ * The general procedure for a filesystem to implement a read or write
  * dispatch routine is as follows
- * 
+ *
  * (1) If caching for the FCB hasn't been initiated then so do by calling
  * CcInitializeFileCache.
- * 
+ *
  * (2) For each 4k region which is being read or written obtain a cache page
- * by calling CcRequestCachePage. 
+ * by calling CcRequestCachePage.
  *
- * (3) If either the page is being read or not completely written, and it is 
+ * (3) If either the page is being read or not completely written, and it is
  * not up to date then read its data from the underlying medium. If the read
- * fails then call CcReleaseCachePage with VALID as FALSE and return a error.  
- * 
+ * fails then call CcReleaseCachePage with VALID as FALSE and return a error.
+ *
  * (4) Copy the data into or out of the page as necessary.
- * 
+ *
  * (5) Release the cache page
  */
 /* INCLUDES ******************************************************************/
@@ -39,9 +39,9 @@
 /* GLOBALS *******************************************************************/
 
 /*
- * If CACHE_BITMAP is defined, the cache manager uses one large memory region 
- * within the kernel address space and allocate/deallocate space from this block 
- * over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping region 
+ * If CACHE_BITMAP is defined, the cache manager uses one large memory region
+ * within the kernel address space and allocate/deallocate space from this block
+ * over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping region
  * must be reduced (ntoskrnl\mm\mdl.c, MI_MDLMAPPING_REGION_SIZE).
  */
 //#define CACHE_BITMAP
@@ -148,7 +148,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
   }
 
   NewTarget = WriteCount[0];
-  
+
   Target = max(NewTarget, Target);
 
   current_entry = DirtySegmentListHead.Flink;
@@ -158,7 +158,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
   }
   while (current_entry != &DirtySegmentListHead && Target > 0)
     {
-      current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+      current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                  DirtySegmentListEntry);
       current_entry = current_entry->Flink;
       Locked = ExTryToAcquireFastMutex(&current->Lock);
@@ -174,7 +174,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
        }
       ExReleaseFastMutex(&ViewLock);
       PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE;
-      Status = CcRosFlushCacheSegment(current);      
+      Status = CcRosFlushCacheSegment(current);
       ExReleaseFastMutex(&current->Lock);
       if (!NT_SUCCESS(Status) &&  (Status != STATUS_END_OF_FILE))
       {
@@ -205,7 +205,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
  * ARGUMENTS:
  *       Target - The number of pages to be freed.
  *       Priority - The priority of free (currently unused).
- *       NrFreed - Points to a variable where the number of pages 
+ *       NrFreed - Points to a variable where the number of pages
  *                 actually freed is returned.
  */
 {
@@ -219,17 +219,17 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
   DPRINT("CcRosTrimCache(Target %d)\n", Target);
 
   *NrFreed = 0;
-  
+
   InitializeListHead(&FreeList);
-  
+
   ExAcquireFastMutex(&ViewLock);
   current_entry = CacheSegmentLRUListHead.Flink;
   while (current_entry != &CacheSegmentLRUListHead && Target > 0)
     {
-      current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+      current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                  CacheSegmentLRUListEntry);
       current_entry = current_entry->Flink;
-      
+
       KeAcquireSpinLock(&current->Bcb->BcbLock, &oldIrql);
       if (current->ReferenceCount == 0)
       {
@@ -249,7 +249,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
           {
             ULONG i;
             NTSTATUS Status;
-               
+
              current->ReferenceCount++;
             last = current;
             current->PageOut = TRUE;
@@ -281,7 +281,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
   while (!IsListEmpty(&FreeList))
   {
      current_entry = RemoveHeadList(&FreeList);
-     current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+     current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                 BcbSegmentListEntry);
      CcRosInternalFreeCacheSegment(current);
   }
@@ -290,7 +290,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
   return(STATUS_SUCCESS);
 }
 
-NTSTATUS 
+NTSTATUS
 CcRosReleaseCacheSegment(PBCB Bcb,
                         PCACHE_SEGMENT CacheSeg,
                         BOOLEAN Valid,
@@ -334,11 +334,11 @@ CcRosReleaseCacheSegment(PBCB Bcb,
   KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
   ExReleaseFastMutex(&ViewLock);
   ExReleaseFastMutex(&CacheSeg->Lock);
-  
+
   return(STATUS_SUCCESS);
 }
 
-PCACHE_SEGMENT 
+PCACHE_SEGMENT
 CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
 {
   PLIST_ENTRY current_entry;
@@ -353,7 +353,7 @@ CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
   current_entry = Bcb->BcbSegmentListHead.Flink;
   while (current_entry != &Bcb->BcbSegmentListHead)
     {
-      current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+      current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                  BcbSegmentListEntry);
       if (current->FileOffset <= FileOffset &&
          (current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
@@ -499,14 +499,14 @@ CcRosCreateCacheSegment(PBCB Bcb,
   /* There is window between the call to CcRosLookupCacheSegment
    * and CcRosCreateCacheSegment. We must check if a segment on
    * the fileoffset exist. If there exist a segment, we release
-   * our new created segment and return the existing one. 
+   * our new created segment and return the existing one.
    */
   KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
   current_entry = Bcb->BcbSegmentListHead.Flink;
   previous = NULL;
   while (current_entry != &Bcb->BcbSegmentListHead)
   {
-     current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, 
+     current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
                                 BcbSegmentListEntry);
      if (current->FileOffset <= FileOffset &&
        (current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
@@ -554,7 +554,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
   KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
 
   StartingOffset = RtlFindClearBitsAndSet(&CiCacheSegMappingRegionAllocMap, Bcb->CacheSegmentSize / PAGE_SIZE, CiCacheSegMappingRegionHint);
-  
+
   if (StartingOffset == 0xffffffff)
   {
      DPRINT1("Out of CacheSeg mapping space\n");
@@ -565,7 +565,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
 
   if (CiCacheSegMappingRegionHint == StartingOffset)
   {
-     CiCacheSegMappingRegionHint += Bcb->CacheSegmentSize / PAGE_SIZE; 
+     CiCacheSegMappingRegionHint += Bcb->CacheSegmentSize / PAGE_SIZE;
   }
 
   KeReleaseSpinLock(&CiCacheSegMappingRegionLock, oldIrql);
@@ -627,10 +627,10 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
   Length = ROUND_UP(Length, Bcb->CacheSegmentSize);
 
 #if defined(__GNUC__)
-  CacheSegList = alloca(sizeof(PCACHE_SEGMENT) * 
+  CacheSegList = alloca(sizeof(PCACHE_SEGMENT) *
                        (Length / Bcb->CacheSegmentSize));
 #elif defined(_MSC_VER)
-  CacheSegList = _alloca(sizeof(PCACHE_SEGMENT) * 
+  CacheSegList = _alloca(sizeof(PCACHE_SEGMENT) *
                        (Length / Bcb->CacheSegmentSize));
 #else
 #error Unknown compiler for alloca intrinsic stack allocation "function"
@@ -668,7 +668,7 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
        }
     }
   Previous->NextInChain = NULL;
-  
+
   return(STATUS_SUCCESS);
 }
 
@@ -713,7 +713,7 @@ CcRosGetCacheSegment(PBCB Bcb,
    return(STATUS_SUCCESS);
 }
 
-NTSTATUS STDCALL 
+NTSTATUS STDCALL
 CcRosRequestCacheSegment(PBCB Bcb,
                      ULONG FileOffset,
                      PVOID* BaseAddress,
@@ -743,8 +743,8 @@ CcRosRequestCacheSegment(PBCB Bcb,
 }
 #ifdef CACHE_BITMAP
 #else
-STATIC VOID 
-CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, 
+STATIC VOID
+CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
                PFN_TYPE Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
 {
   ASSERT(SwapEntry == 0);
@@ -754,7 +754,7 @@ CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
     }
 }
 #endif
-NTSTATUS 
+NTSTATUS
 CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
 /*
  * FUNCTION: Releases a cache segment associated with a BCB
@@ -774,7 +774,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
   /* Unmap all the pages. */
   for (i = 0; i < RegionSize; i++)
     {
-      MmDeleteVirtualMapping(NULL, 
+      MmDeleteVirtualMapping(NULL,
                             CacheSeg->BaseAddress + (i * PAGE_SIZE),
                             FALSE,
                             NULL,
@@ -785,7 +785,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
   KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
   /* Deallocate all the pages used. */
   Base = (ULONG)(CacheSeg->BaseAddress - CiCacheSegMappingRegionBase) / PAGE_SIZE;
-  
+
   RtlClearBits(&CiCacheSegMappingRegionAllocMap, Base, RegionSize);
 
   CiCacheSegMappingRegionHint = min (CiCacheSegMappingRegionHint, Base);
@@ -858,12 +858,12 @@ CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
       {
         Offset = *FileOffset;
       }
-      else 
+      else
       {
         Offset.QuadPart = (LONGLONG)0;
         Length = Bcb->FileSize.u.LowPart;
       }
-   
+
       if (IoStatus)
       {
         IoStatus->Status = STATUS_SUCCESS;
@@ -909,7 +909,7 @@ CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
    }
 }
 
-NTSTATUS 
+NTSTATUS
 CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
 /*
  * FUNCTION: Releases the BCB associated with a file object
@@ -938,7 +938,7 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
          Bcb->BcbRemoveListEntry.Flink = NULL;
       }
 
-      FileObject->SectionObjectPointer->SharedCacheMap = NULL;  
+      FileObject->SectionObjectPointer->SharedCacheMap = NULL;
 
       /*
        * Release all cache segments.
@@ -960,7 +960,7 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
         }
          InsertHeadList(&FreeList, &current->BcbSegmentListEntry);
       }
-      KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);       
+      KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
 
       ExReleaseFastMutex(&ViewLock);
       ObDereferenceObject (Bcb->FileObject);
@@ -971,7 +971,7 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
          current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
          Status = CcRosInternalFreeCacheSegment(current);
       }
-      ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);   
+      ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);
       ExAcquireFastMutex(&ViewLock);
    }
    return(STATUS_SUCCESS);
@@ -1042,7 +1042,7 @@ VOID CcRosDereferenceCache(PFILE_OBJECT FileObject)
   ExReleaseFastMutex(&ViewLock);
 }
 
-NTSTATUS STDCALL 
+NTSTATUS STDCALL
 CcRosReleaseFileCache(PFILE_OBJECT FileObject)
 /*
  * FUNCTION: Called by the file system when a handle to a file object
@@ -1082,7 +1082,7 @@ CcRosReleaseFileCache(PFILE_OBJECT FileObject)
   return(STATUS_SUCCESS);
 }
 
-NTSTATUS 
+NTSTATUS
 CcTryToInitializeFileCache(PFILE_OBJECT FileObject)
 {
    PBCB Bcb;
@@ -1115,7 +1115,7 @@ CcTryToInitializeFileCache(PFILE_OBJECT FileObject)
 }
 
 
-NTSTATUS STDCALL 
+NTSTATUS STDCALL
 CcRosInitializeFileCache(PFILE_OBJECT FileObject,
                         ULONG CacheSegmentSize)
 /*
@@ -1146,9 +1146,9 @@ CcRosInitializeFileCache(PFILE_OBJECT FileObject,
       Bcb->CacheSegmentSize = CacheSegmentSize;
       if (FileObject->FsContext)
       {
-         Bcb->AllocationSize = 
+         Bcb->AllocationSize =
           ((PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext)->AllocationSize;
-         Bcb->FileSize = 
+         Bcb->FileSize =
           ((PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext)->FileSize;
       }
       KeInitializeSpinLock(&Bcb->BcbLock);
@@ -1219,7 +1219,7 @@ CmLazyCloseThreadMain(PVOID Ignored)
           DbgPrint("LazyCloseThread: Terminating\n");
          break;
       }
-      
+
       ExAcquireFastMutex(&ViewLock);
       CcTimeStamp++;
       if (CcTimeStamp >= 30)
@@ -1250,7 +1250,7 @@ CcInitView(VOID)
 #endif
   NTSTATUS Status;
   KPRIORITY Priority;
-  
+
   DPRINT("CcInitView()\n");
 #ifdef CACHE_BITMAP
   BoundaryAddressMultiple.QuadPart = 0;
@@ -1281,7 +1281,7 @@ CcInitView(VOID)
   RtlClearAllBits(&CiCacheSegMappingRegionAllocMap);
 
   KeInitializeSpinLock(&CiCacheSegMappingRegionLock);
-#endif  
+#endif
   InitializeListHead(&CacheSegmentListHead);
   InitializeListHead(&DirtySegmentListHead);
   InitializeListHead(&CacheSegmentLRUListHead);
@@ -1310,10 +1310,10 @@ CcInitView(VOID)
                                   20);
 
   MmInitializeMemoryConsumer(MC_CACHE, CcRosTrimCache);
-  
+
   CcInitCacheZeroPage();
 
-  CcTimeStamp = 0;  
+  CcTimeStamp = 0;
   LazyCloseThreadShouldTerminate = FALSE;
   KeInitializeEvent (&LazyCloseThreadEvent, SynchronizationEvent, FALSE);
   Status = PsCreateSystemThread(&LazyCloseThreadHandle,
index 952b6c8..ff2f450 100644 (file)
@@ -356,7 +356,7 @@ typedef struct _KEY_OBJECT
 
   /* List entry into the global key object list */
   LIST_ENTRY ListEntry;
-  
+
   /* Time stamp for the last access by the parse routine */
   ULONG TimeStamp;
 } KEY_OBJECT, *PKEY_OBJECT;
index 53388c6..ea3de91 100644 (file)
@@ -1,5 +1,5 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/cm/ntfunc.c
@@ -39,11 +39,11 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
                    IN OUT PLARGE_INTEGER Cookie)
 {
   PREGISTRY_CALLBACK Callback;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(Function && Cookie);
-  
+
   Callback = ExAllocatePoolWithTag(PagedPool,
                                    sizeof(REGISTRY_CALLBACK),
                                    TAG('C', 'M', 'c', 'b'));
@@ -54,7 +54,7 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
     Callback->Function = Function;
     Callback->Context = Context;
     Callback->PendingDelete = FALSE;
-    
+
     /* add it to the callback list and receive a cookie for the callback */
     ExAcquireFastMutex(&CmiCallbackLock);
     /* FIXME - to receive a unique cookie we'll just return the pointer to the
@@ -63,7 +63,7 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
     InsertTailList(&CmiCallbackHead, &Callback->ListEntry);
 
     ExReleaseFastMutex(&CmiCallbackLock);
-    
+
     *Cookie = Callback->Cookie;
     return STATUS_SUCCESS;
   }
@@ -79,7 +79,7 @@ NTSTATUS STDCALL
 CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
 {
   PLIST_ENTRY CurrentEntry;
-  
+
   PAGED_CODE();
 
   ExAcquireFastMutex(&CmiCallbackLock);
@@ -121,7 +121,7 @@ CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
       }
     }
   }
-  
+
   ExReleaseFastMutex(&CmiCallbackLock);
 
   return STATUS_UNSUCCESSFUL;
@@ -133,9 +133,9 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
                            IN PVOID Argument2)
 {
   PLIST_ENTRY CurrentEntry;
-  
+
   PAGED_CODE();
-  
+
   ExAcquireFastMutex(&CmiCallbackLock);
 
   for(CurrentEntry = CmiCallbackHead.Flink;
@@ -149,10 +149,10 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
        ExAcquireRundownProtectionEx(&CurrentCallback->RundownRef, 1))
     {
       NTSTATUS Status;
-      
+
       /* don't hold locks during the callbacks! */
       ExReleaseFastMutex(&CmiCallbackLock);
-      
+
       Status = CurrentCallback->Function(CurrentCallback->Context,
                                          Argument1,
                                          Argument2);
@@ -169,9 +169,9 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
       ExReleaseRundownProtectionEx(&CurrentCallback->RundownRef, 1);
     }
   }
-  
+
   ExReleaseFastMutex(&CmiCallbackLock);
-  
+
   return STATUS_SUCCESS;
 }
 
@@ -191,7 +191,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
   PVOID Object;
   PWSTR Start;
   unsigned i;
-  
+
   PAGED_CODE();
 
   DPRINT("NtCreateKey (Name %wZ  KeyHandle %x  Root %x)\n",
@@ -358,7 +358,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
   ExReleaseResourceLite(&CmiRegistryLock);
   KeLeaveCriticalRegion();
 
-  
+
   ObDereferenceObject(Object);
 
   if (Disposition)
@@ -376,11 +376,11 @@ NtDeleteKey(IN HANDLE KeyHandle)
   KPROCESSOR_MODE PreviousMode;
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
-  
+
   PreviousMode = ExGetPreviousMode();
 
   /* Verify that the handle is valid and is a registry key */
@@ -462,9 +462,9 @@ NtEnumerateKey(IN HANDLE KeyHandle,
   ULONG NameSize, ClassSize;
   KPROCESSOR_MODE PreviousMode;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
-  
+
   PreviousMode = ExGetPreviousMode();
 
   DPRINT("KH %x  I %d  KIC %x KI %x  L %d  RL %x\n",
@@ -687,10 +687,10 @@ NtEnumerateKey(IN HANDLE KeyHandle,
                Status = STATUS_BUFFER_OVERFLOW;
                CHECKPOINT;
              }
-           else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) - 
+           else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
                     NameSize < ClassSize)
              {
-               ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) - 
+               ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
                            NameSize;
                Status = STATUS_BUFFER_OVERFLOW;
                CHECKPOINT;
@@ -812,7 +812,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
   PKEY_VALUE_BASIC_INFORMATION  ValueBasicInformation;
   PKEY_VALUE_PARTIAL_INFORMATION  ValuePartialInformation;
   PKEY_VALUE_FULL_INFORMATION  ValueFullInformation;
-  
+
   PAGED_CODE();
 
   DPRINT("KH %x  I %d  KVIC %x  KVI %x  L %d  RL %x\n",
@@ -879,7 +879,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
             }
           else
             {
-              ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION) 
+              ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION)
                 KeyValueInformation;
               ValueBasicInformation->TitleIndex = 0;
               ValueBasicInformation->Type = ValueCell->DataType;
@@ -911,7 +911,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
         case KeyValuePartialInformation:
           DataSize = ValueCell->DataSize & REG_DATA_SIZE_MASK;
 
-          *ResultLength = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]) + 
+          *ResultLength = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]) +
             DataSize;
 
           if (Length < FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]))
@@ -933,18 +933,18 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
                   Status = STATUS_BUFFER_OVERFLOW;
                   CHECKPOINT;
                 }
-              
+
               if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
               {
                 DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
-                RtlCopyMemory(ValuePartialInformation->Data, 
+                RtlCopyMemory(ValuePartialInformation->Data,
                   DataCell->Data,
                   DataSize);
               }
               else
               {
-                RtlCopyMemory(ValuePartialInformation->Data, 
-                  &ValueCell->DataOffset, 
+                RtlCopyMemory(ValuePartialInformation->Data,
+                  &ValueCell->DataOffset,
                   DataSize);
               }
             }
@@ -967,19 +967,19 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
             }
           else
             {
-              ValueFullInformation = (PKEY_VALUE_FULL_INFORMATION) 
+              ValueFullInformation = (PKEY_VALUE_FULL_INFORMATION)
                 KeyValueInformation;
               ValueFullInformation->TitleIndex = 0;
               ValueFullInformation->Type = ValueCell->DataType;
               ValueFullInformation->NameLength = NameSize;
-              ValueFullInformation->DataOffset = 
+              ValueFullInformation->DataOffset =
                 (ULONG_PTR)ValueFullInformation->Name -
                 (ULONG_PTR)ValueFullInformation +
                 ValueFullInformation->NameLength;
               ValueFullInformation->DataOffset =
                   ROUND_UP(ValueFullInformation->DataOffset, sizeof(PVOID));
               ValueFullInformation->DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
-              
+
              if (Length - FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) <
                  NameSize)
                {
@@ -1050,11 +1050,11 @@ NtFlushKey(IN HANDLE KeyHandle)
   PKEY_OBJECT  KeyObject;
   PREGISTRY_HIVE  RegistryHive;
   KPROCESSOR_MODE  PreviousMode;
-  
+
   PAGED_CODE();
 
   DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle);
-  
+
   PreviousMode = ExGetPreviousMode();
 
   /* Verify that the handle is valid and is a registry key */
@@ -1106,7 +1106,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
   PVOID Object;
   HANDLE hKey;
   NTSTATUS Status = STATUS_SUCCESS;
-  
+
   PAGED_CODE();
 
   DPRINT("NtOpenKey(KH %x  DA %x  OA %x  OA->ON '%wZ'\n",
@@ -1134,7 +1134,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
       Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
-    
+
     if(!NT_SUCCESS(Status))
     {
       return Status;
@@ -1223,7 +1223,7 @@ NtQueryKey(IN HANDLE KeyHandle,
   PKEY_CELL KeyCell;
   ULONG NameSize, ClassSize;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   DPRINT("NtQueryKey(KH %x  KIC %x  KI %x  L %d  RL %x)\n",
@@ -1322,10 +1322,10 @@ NtQueryKey(IN HANDLE KeyHandle,
                Status = STATUS_BUFFER_OVERFLOW;
                CHECKPOINT;
              }
-           else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) - 
+           else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
                     NameSize < ClassSize)
              {
-               ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) - 
+               ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
                            NameSize;
                Status = STATUS_BUFFER_OVERFLOW;
                CHECKPOINT;
@@ -1382,7 +1382,7 @@ NtQueryKey(IN HANDLE KeyHandle,
                Status = STATUS_BUFFER_OVERFLOW;
                CHECKPOINT;
              }
-             
+
            if (ClassSize)
              {
                ClassCell = CmiGetCell (KeyObject->RegistryHive,
@@ -1433,7 +1433,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
   PKEY_VALUE_BASIC_INFORMATION  ValueBasicInformation;
   PKEY_VALUE_PARTIAL_INFORMATION  ValuePartialInformation;
   PKEY_VALUE_FULL_INFORMATION  ValueFullInformation;
-  
+
   PAGED_CODE();
 
   DPRINT("NtQueryValueKey(KeyHandle %x  ValueName %S  Length %x)\n",
@@ -1494,7 +1494,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
          }
        else
          {
-           ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION) 
+           ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION)
              KeyValueInformation;
            ValueBasicInformation->TitleIndex = 0;
            ValueBasicInformation->Type = ValueCell->DataType;
@@ -1587,7 +1587,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
            ValueFullInformation->TitleIndex = 0;
            ValueFullInformation->Type = ValueCell->DataType;
            ValueFullInformation->NameLength = NameSize;
-           ValueFullInformation->DataOffset = 
+           ValueFullInformation->DataOffset =
              (ULONG_PTR)ValueFullInformation->Name -
              (ULONG_PTR)ValueFullInformation +
              ValueFullInformation->NameLength;
@@ -1675,7 +1675,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
   PDATA_CELL NewDataCell;
   PHBIN pBin;
   ULONG DesiredAccess;
-  
+
   PAGED_CODE();
 
   DPRINT("NtSetValueKey(KeyHandle %x  ValueName '%wZ'  Type %d)\n",
@@ -1830,7 +1830,7 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
 {
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   /* Verify that the handle is valid and is a registry key */
@@ -1903,7 +1903,7 @@ NtLoadKey2 (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
   ULONG BufferSize;
   ULONG Length;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   DPRINT ("NtLoadKey2() called\n");
@@ -2038,7 +2038,7 @@ NtNotifyChangeKey (IN HANDLE KeyHandle,
                   IN ULONG Length,
                   IN BOOLEAN Asynchronous)
 {
-     return NtNotifyChangeMultipleKeys(KeyHandle,          
+     return NtNotifyChangeMultipleKeys(KeyHandle,
                                        0,
                                        NULL,
                                        Event,
@@ -2071,7 +2071,7 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
   NTSTATUS Status;
   PUCHAR DataPtr;
   ULONG i;
-  
+
   PAGED_CODE();
 
   /* Verify that the handle is valid and is a registry key */
@@ -2201,7 +2201,7 @@ NtSaveKey (IN HANDLE KeyHandle,
   PREGISTRY_HIVE TempHive;
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   DPRINT ("NtSaveKey() called\n");
@@ -2305,7 +2305,7 @@ NtSetInformationKey (IN HANDLE KeyHandle,
 {
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   if (KeyInformationClass != KeyWriteTimeInformation)
@@ -2363,7 +2363,7 @@ NtUnloadKey (IN POBJECT_ATTRIBUTES KeyObjectAttributes)
 {
   PREGISTRY_HIVE RegistryHive;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   DPRINT ("NtUnloadKey() called\n");
@@ -2411,7 +2411,7 @@ NTSTATUS STDCALL
 NtInitializeRegistry (IN BOOLEAN SetUpBoot)
 {
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   if (CmiRegistryInitialized == TRUE)
index eb34093..5a8c757 100644 (file)
@@ -1,5 +1,5 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/cm/regfile.c
@@ -105,7 +105,7 @@ CmiVerifyBinHeader(PHBIN BinHeader)
 
   //BinHeader->DateModified.dwHighDateTime
 
-  
+
   if (BinHeader->BinSize != REG_BLOCK_SIZE)
     {
       DbgPrint("BinSize is %.08x (should be a multiple of %.08x)\n",
@@ -2873,7 +2873,7 @@ CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
       CmiMarkBlockDirty(RegistryHive, KeyCellOffset);
       CmiMarkBlockDirty(RegistryHive, ValueListCellOffset);
     }
-  else if (KeyCell->NumberOfValues >= 
+  else if (KeyCell->NumberOfValues >=
           (((ULONG)ABS_VALUE(ValueListCell->CellSize) - sizeof(VALUE_LIST_CELL)) / sizeof(BLOCK_OFFSET)))
     {
 #if 0
@@ -3023,7 +3023,7 @@ CmiAllocateHashTableCell (IN PREGISTRY_HIVE RegistryHive,
 
   Status = STATUS_SUCCESS;
   *HashBlock = NULL;
-  NewHashSize = sizeof(HASH_TABLE_CELL) + 
+  NewHashSize = sizeof(HASH_TABLE_CELL) +
                (SubKeyCount * sizeof(HASH_RECORD));
   Status = CmiAllocateCell (RegistryHive,
                            NewHashSize,
index 671afd0..a11f1da 100644 (file)
@@ -255,10 +255,10 @@ CmiWorkerThread(PVOID Param)
 
   while (1)
   {
-    Status = KeWaitForSingleObject(&CmiWorkerTimer, 
-                                  Executive, 
-                                  KernelMode, 
-                                  FALSE, 
+    Status = KeWaitForSingleObject(&CmiWorkerTimer,
+                                  Executive,
+                                  KernelMode,
+                                  FALSE,
                                   NULL);
     if (Status == STATUS_SUCCESS)
     {
@@ -311,25 +311,25 @@ STDCALL
 CmInitHives(BOOLEAN SetupBoot)
 {
     PCHAR BaseAddress;
-    
+
     /* Load Registry Hives. This one can be missing. */
     if (CachedModules[SystemRegistry]) {
         BaseAddress = (PCHAR)CachedModules[SystemRegistry]->ModStart;
         CmImportSystemHive(BaseAddress,
                            CachedModules[SystemRegistry]->ModEnd - (ULONG_PTR)BaseAddress);
     }
-    
+
     BaseAddress = (PCHAR)CachedModules[HardwareRegistry]->ModStart;
     CmImportHardwareHive(BaseAddress,
                          CachedModules[HardwareRegistry]->ModEnd - (ULONG_PTR)BaseAddress);
-    
+
 
     /* Create dummy keys if no hardware hive was found */
     CmImportHardwareHive (NULL, 0);
 
     /* Initialize volatile registry settings */
     if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
-}   
+}
 
 VOID INIT_FUNCTION
 CmInitializeRegistry(VOID)
@@ -397,14 +397,14 @@ CmInitializeRegistry(VOID)
     KEBUGCHECK(0);
   }
 
-  /* Start the timer */  
+  /* Start the timer */
   DueTime.QuadPart = -1;
   KeSetTimerEx(&CmiWorkerTimer, DueTime, 5000, NULL); /* 5sec */
 
   /*  Build volatile registry store  */
   Status = CmiCreateVolatileHive (&CmiVolatileHive);
   ASSERT(NT_SUCCESS(Status));
-  
+
   InitializeListHead(&CmiCallbackHead);
   ExInitializeFastMutex(&CmiCallbackLock);
 
@@ -548,7 +548,7 @@ CmInit2(PCHAR CommandLine)
         MiniNT = TRUE;
       else if (!_strnicmp(CommandLine, "DEBUGPORT=PICE", 14))
         PiceStart = 1;
-      
+
       /* Add a space between the options */
       if (Position != 0)
         SystemStartOptions[Position++] = L' ';
@@ -884,7 +884,7 @@ CmiDisconnectHive (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
     {
       DPRINT1 ("Hive is still in use (hc %d, rc %d)\n", ObGetObjectHandleCount (KeyObject), ObGetObjectPointerCount (KeyObject));
       ObDereferenceObject (KeyObject);
-      
+
       /* Release registry lock */
       ExReleaseResourceLite (&CmiRegistryLock);
       KeLeaveCriticalRegion();
index 4a5ffa8..97d2ec7 100644 (file)
@@ -1,5 +1,5 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/cm/regobj.c
@@ -203,7 +203,7 @@ CmiObjectParse(PVOID ParsedObject,
          if (NT_SUCCESS(Status))
            {
              DPRINT("LinkPath '%wZ'\n", &LinkPath);
-       
+
               ExReleaseResourceLite(&CmiRegistryLock);
               KeLeaveCriticalRegion();
 
@@ -627,7 +627,7 @@ CmiRemoveKeyFromList(PKEY_OBJECT KeyToRemove)
          ParentKey->NumberOfSubKeys--;
 
          DPRINT("Dereference parent key: 0x%x\n", ParentKey);
-       
+
          ObDereferenceObject(ParentKey);
          return STATUS_SUCCESS;
        }
@@ -645,7 +645,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
 {
   PKEY_OBJECT CurKey;
   ULONG Index;
-  
+
   DPRINT("Scanning key list for: %wZ (Parent: %wZ)\n",
         KeyName, &Parent->Name);
 
@@ -670,7 +670,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
            }
        }
     }
-  
+
   if (Index < Parent->NumberOfSubKeys)
   {
      if (CurKey->Flags & KO_MARKED_FOR_DELETE)
index 0d3fc79..d9ed8ab 100644 (file)
@@ -30,17 +30,17 @@ DbgkCreateThread(PVOID StartAddress)
     }
 
   Message.Header.MessageSize = sizeof(LPC_DBG_MESSAGE);
-  Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) - 
+  Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) -
     sizeof(LPC_MESSAGE);
   Message.Type = DBG_EVENT_CREATE_THREAD;
   Message.Status = STATUS_SUCCESS;
   Message.Data.CreateThread.Reserved = 0;
   Message.Data.CreateThread.StartAddress = StartAddress;
-  
+
   /* FIXME: Freeze all threads in process */
 
   /* Send the message to the process's debug port and wait for a reply */
-  Status = 
+  Status =
     LpcSendDebugMessagePort(PsGetCurrentThread()->ThreadsProcess->DebugPort,
                            &Message,
                            &Reply);
index 3a53a96..732535e 100644 (file)
@@ -16,8 +16,8 @@
 POBJECT_TYPE DbgkDebugObjectType;
 /* FUNCTIONS *****************************************************************/
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtCreateDebugObject(OUT PHANDLE DebugHandle,
                     IN ACCESS_MASK DesiredAccess,
                     IN POBJECT_ATTRIBUTES ObjectAttributes,
@@ -27,27 +27,27 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
     PDBGK_DEBUG_OBJECT DebugObject;
     HANDLE hDebug;
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
     DPRINT("NtCreateDebugObject(0x%x, 0x%x, 0x%x)\n", DebugHandle, DesiredAccess, ObjectAttributes);
+
     /* Check Output Safety */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(DebugHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_HANDLE {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Create the Object */
     Status = ObCreateObject(PreviousMode,
                             DbgkDebugObjectType,
@@ -58,22 +58,22 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
                             0,
                             0,
                             (PVOID*)&DebugObject);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Initialize the Debug Object's Fast Mutex */
         ExInitializeFastMutex(&DebugObject->Mutex);
-        
+
         /* Initialize the State Event List */
         InitializeListHead(&DebugObject->StateEventListEntry);
-        
+
         /* Initialize the Debug Object's Wait Event */
         KeInitializeEvent(&DebugObject->Event, NotificationEvent, 0);
-        
+
         /* Set the Flags */
         DebugObject->KillProcessOnExit = KillProcessOnExit;
-        
+
         /* Insert it */
         Status = ObInsertObject((PVOID)DebugObject,
                                  NULL,
@@ -82,18 +82,18 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
                                  NULL,
                                  &hDebug);
         ObDereferenceObject(DebugObject);
+
         /* Check for success and return handle */
         if(NT_SUCCESS(Status)) {
-            
+
             _SEH_TRY {
-                
+
                 *DebugHandle = hDebug;
-            
+
             } _SEH_HANDLE {
-                
+
                 Status = _SEH_GetExceptionCode();
-                
+
             } _SEH_END;
         }
     }
@@ -111,7 +111,7 @@ NtWaitForDebugEvent(IN HANDLE DebugObject, // Debug object handle must grant DEB
 {
 
     UNIMPLEMENTED;
-  
+
     return STATUS_NOT_IMPLEMENTED;
 }
 
@@ -123,7 +123,7 @@ NtDebugContinue(IN HANDLE DebugObject,    // Debug object handle must grant DEBU
 {
 
     UNIMPLEMENTED;
-  
+
     return STATUS_NOT_IMPLEMENTED;
 }
 
@@ -134,7 +134,7 @@ NtDebugActiveProcess(IN HANDLE Process,     // Process handle must grant PROCESS
 {
 
     UNIMPLEMENTED;
-  
+
     return STATUS_NOT_IMPLEMENTED;
 }
 
@@ -145,7 +145,7 @@ NtRemoveProcessDebug(IN HANDLE Process,     // Process handle must grant PROCESS
 {
 
     UNIMPLEMENTED;
-  
+
     return STATUS_NOT_IMPLEMENTED;
 }
 
@@ -158,7 +158,7 @@ NtSetInformationDebugObject(IN HANDLE DebugObject, // Debug object handle need n
                             OUT PULONG ReturnLength OPTIONAL)
 {
     UNIMPLEMENTED;
-  
+
     return STATUS_NOT_IMPLEMENTED;
 }
 /* EOF */
index 918d766..a9eadb9 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/callback.c
  * PURPOSE:         Executive callbacks
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@mcmail.com)
  *                  Alex Ionescu (alex@relsoft.net)
  */
@@ -171,7 +171,7 @@ ExCreateCallback(
    PINT_CALLBACK_OBJECT Callback;
    NTSTATUS    Status;
    HANDLE     Handle;
-   
+
    PAGED_CODE();
 
    /* Open a handle to the callback if it exists */
@@ -323,7 +323,7 @@ ExNotifyCallback(
  * ExRegisterCallback
  *
  * FUNCTION:
- * Allows a function to associate a callback pointer (Function) 
+ * Allows a function to associate a callback pointer (Function)
  *  to a created Callback object
  *
  * ARGUMENTS:
@@ -348,7 +348,7 @@ ExRegisterCallback(
    PINT_CALLBACK_OBJECT CallbackObject = (PINT_CALLBACK_OBJECT)OpaqueCallbackObject;
    PCALLBACK_REGISTRATION  CallbackRegistration = NULL;
    KIRQL     OldIrql;
-   
+
    PAGED_CODE();
 
    /* Create reference to Callback Object */
@@ -415,7 +415,7 @@ ExUnregisterCallback(
    PCALLBACK_REGISTRATION  CallbackRegistration;
    PINT_CALLBACK_OBJECT    CallbackObject;
    KIRQL                   OldIrql;
-   
+
    PAGED_CODE();
 
    /* Convert Handle to valid Structure Pointer */
index 84865b3..c29e65d 100644 (file)
@@ -15,8 +15,8 @@
 
 /* FUNCTIONS *****************************************************************/
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
                      PVOID InputBuffer,
                      ULONG InputBufferLength,
@@ -24,7 +24,7 @@ NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
                      ULONG OutputBufferLength,
                      PULONG ReturnLength)
 {
-    switch (ControlCode) 
+    switch (ControlCode)
     {
         case DebugGetTraceInformation:
         case DebugSetInternalBreakpoint:
@@ -33,14 +33,14 @@ NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
         case DebugQuerySpecialCalls:
         case DebugDbgBreakPoint:
             break;
-              
+
         case DebugDbgLoadSymbols:
             KDB_LOADUSERMODULE_HOOK((PLDR_MODULE) InputBuffer);
             break;
-        
+
         default:
             break;
     }
-    
+
     return STATUS_SUCCESS;
 }
index 7757555..de2b558 100644 (file)
@@ -24,7 +24,7 @@ PEPROCESS ExpDefaultErrorPortProcess = NULL;
 /*
  * @implemented
  */
-VOID 
+VOID
 STDCALL
 ExRaiseAccessViolation(VOID)
 {
@@ -46,7 +46,7 @@ ExRaiseDatatypeMisalignment (VOID)
 /*
  * @implemented
  */
-VOID 
+VOID
 STDCALL
 ExRaiseStatus(IN NTSTATUS Status)
 {
@@ -59,7 +59,7 @@ ExRaiseStatus(IN NTSTATUS Status)
     ExceptionRecord.NumberParameters = 0;
     ExceptionRecord.ExceptionCode = Status;
     ExceptionRecord.ExceptionFlags = 0;
-    
+
     /* Call the Rtl Function */
     RtlRaiseException(&ExceptionRecord);
 }
@@ -91,17 +91,17 @@ ExSystemExceptionFilter(VOID)
 VOID
 STDCALL
 ExRaiseHardError(IN NTSTATUS ErrorStatus,
-                 IN ULONG NumberOfParameters, 
+                 IN ULONG NumberOfParameters,
                  IN PUNICODE_STRING UnicodeStringParameterMask OPTIONAL,
-                 IN PVOID *Parameters, 
-                 IN HARDERROR_RESPONSE_OPTION ResponseOption, 
+                 IN PVOID *Parameters,
+                 IN HARDERROR_RESPONSE_OPTION ResponseOption,
                  OUT PHARDERROR_RESPONSE Response)
 {
     UNIMPLEMENTED;
 }
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtRaiseHardError(IN NTSTATUS ErrorStatus,
                  IN ULONG NumberOfParameters,
                  IN PUNICODE_STRING UnicodeStringParameterMask  OPTIONAL,
@@ -110,7 +110,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
                  OUT PHARDERROR_RESPONSE Response)
 {
     DPRINT1("Hard error %x\n", ErrorStatus);
-  
+
     /* Call the Executive Function (WE SHOULD PUT SEH HERE/CAPTURE!) */
     ExRaiseHardError(ErrorStatus,
                      NumberOfParameters,
@@ -118,45 +118,45 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
                      Parameters,
                      ResponseOption,
                      Response);
-  
+
     /* Return Success */
     return STATUS_SUCCESS;
 }
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
 {
-    
+
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_UNSUCCESSFUL;
-  
+
     /* Check if we have the Privilege */
     if(!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode)) {
-        
+
         DPRINT1("NtSetDefaultHardErrorPort: Caller requires the SeTcbPrivilege privilege!\n");
         return STATUS_PRIVILEGE_NOT_HELD;
     }
-  
+
     /* Only called once during bootup, make sure we weren't called yet */
     if(!ExReadyForErrors) {
-        
+
         Status = ObReferenceObjectByHandle(PortHandle,
                                            0,
                                            LpcPortObjectType,
                                            PreviousMode,
                                            (PVOID*)&ExpDefaultErrorPort,
                                            NULL);
-        
+
         /* Check for Success */
         if(NT_SUCCESS(Status)) {
-            
+
             /* Save the data */
             ExpDefaultErrorPortProcess = PsGetCurrentProcess();
             ExReadyForErrors = TRUE;
         }
     }
-  
+
     return Status;
 }
 
index 5685ee1..b5011bb 100644 (file)
@@ -1,9 +1,9 @@
-/* 
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/nt/event.c
  * PURPOSE:         Named event support
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu(alex@relsoft.net) - Fixed bugs/commented
  *                  Philip Susi and David Welch
  */
@@ -25,14 +25,14 @@ static GENERIC_MAPPING ExpEventMapping = {
     EVENT_ALL_ACCESS};
 
 static const INFORMATION_CLASS_INFO ExEventInfoClass[] = {
-    
+
     /* EventBasicInformation */
     ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY),
 };
 
 /* FUNCTIONS *****************************************************************/
 
-VOID 
+VOID
 INIT_FUNCTION
 ExpInitializeEventImplementation(VOID)
 {
@@ -63,15 +63,15 @@ ExpInitializeEventImplementation(VOID)
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtClearEvent(IN HANDLE EventHandle)
 {
     PKEVENT Event;
     NTSTATUS Status;
-    
+
     PAGED_CODE();
-   
+
     /* Reference the Object */
     Status = ObReferenceObjectByHandle(EventHandle,
                                        EVENT_MODIFY_STATE,
@@ -79,15 +79,15 @@ NtClearEvent(IN HANDLE EventHandle)
                                        ExGetPreviousMode(),
                                        (PVOID*)&Event,
                                        NULL);
-   
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Clear the Event and Dereference */
         KeClearEvent(Event);
         ObDereferenceObject(Event);
     }
-   
+
     /* Return Status */
     return Status;
 }
@@ -96,7 +96,7 @@ NtClearEvent(IN HANDLE EventHandle)
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtCreateEvent(OUT PHANDLE EventHandle,
               IN ACCESS_MASK DesiredAccess,
@@ -108,27 +108,27 @@ NtCreateEvent(OUT PHANDLE EventHandle,
     PKEVENT Event;
     HANDLE hEvent;
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
     DPRINT("NtCreateEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
+
     /* Check Output Safety */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(EventHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Create the Object */
     Status = ObCreateObject(PreviousMode,
                             ExEventObjectType,
@@ -139,15 +139,15 @@ NtCreateEvent(OUT PHANDLE EventHandle,
                             0,
                             0,
                             (PVOID*)&Event);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Initalize the Event */
         KeInitializeEvent(Event,
                           EventType,
                           InitialState);
-        
+
         /* Insert it */
         Status = ObInsertObject((PVOID)Event,
                                  NULL,
@@ -156,18 +156,18 @@ NtCreateEvent(OUT PHANDLE EventHandle,
                                  NULL,
                                  &hEvent);
         ObDereferenceObject(Event);
+
         /* Check for success and return handle */
         if(NT_SUCCESS(Status)) {
-            
+
             _SEH_TRY {
-                
+
                 *EventHandle = hEvent;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-                
+
             } _SEH_END;
         }
     }
@@ -179,7 +179,7 @@ NtCreateEvent(OUT PHANDLE EventHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtOpenEvent(OUT PHANDLE EventHandle,
             IN ACCESS_MASK DesiredAccess,
@@ -188,27 +188,27 @@ NtOpenEvent(OUT PHANDLE EventHandle,
     HANDLE hEvent;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-   
-    PAGED_CODE();    
+
+    PAGED_CODE();
     DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
 
     /* Check Output Safety */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(EventHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Open the Object */
     Status = ObOpenObjectByName(ObjectAttributes,
                                 ExEventObjectType,
@@ -217,21 +217,21 @@ NtOpenEvent(OUT PHANDLE EventHandle,
                                 DesiredAccess,
                                 NULL,
                                 &hEvent);
-             
+
     /* Check for success and return handle */
     if(NT_SUCCESS(Status)) {
-            
+
         _SEH_TRY {
-            
+
             *EventHandle = hEvent;
-                
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
     }
-   
+
     /* Return status */
     return Status;
 }
@@ -239,7 +239,7 @@ NtOpenEvent(OUT PHANDLE EventHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtPulseEvent(IN HANDLE EventHandle,
              OUT PLONG PreviousState OPTIONAL)
@@ -247,28 +247,28 @@ NtPulseEvent(IN HANDLE EventHandle,
     PKEVENT Event;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
     DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
             EventHandle, PreviousState);
 
     /* Check buffer validity */
     if(PreviousState && PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(PreviousState,
                           sizeof(LONG),
                           sizeof(ULONG));
          } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-             
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
 
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventHandle,
                                        EVENT_MODIFY_STATE,
@@ -276,25 +276,25 @@ NtPulseEvent(IN HANDLE EventHandle,
                                        PreviousMode,
                                        (PVOID*)&Event,
                                        NULL);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Pulse the Event */
         LONG Prev = KePulseEvent(Event, EVENT_INCREMENT, FALSE);
         ObDereferenceObject(Event);
-     
-        /* Return it */        
+
+        /* Return it */
         if(PreviousState) {
-            
+
             _SEH_TRY {
-                
+
                 *PreviousState = Prev;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-            
+
             } _SEH_END;
         }
    }
@@ -307,7 +307,7 @@ NtPulseEvent(IN HANDLE EventHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtQueryEvent(IN HANDLE EventHandle,
              IN EVENT_INFORMATION_CLASS EventInformationClass,
@@ -319,10 +319,10 @@ NtQueryEvent(IN HANDLE EventHandle,
     KPROCESSOR_MODE PreviousMode  = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
     PEVENT_BASIC_INFORMATION BasicInfo = (PEVENT_BASIC_INFORMATION)EventInformation;
-    
+
     PAGED_CODE();
     DPRINT("NtQueryEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, EventInformationClass);
-    
+
     /* Check buffers and class validity */
     DefaultQueryInfoBufferCheck(EventInformationClass,
                                 ExEventInfoClass,
@@ -332,12 +332,12 @@ NtQueryEvent(IN HANDLE EventHandle,
                                 PreviousMode,
                                 &Status);
     if(!NT_SUCCESS(Status)) {
-        
+
         /* Invalid buffers */
         DPRINT("NtQuerySemaphore() failed, Status: 0x%x\n", Status);
         return Status;
     }
-   
+
     /* Get the Object */
     Status = ObReferenceObjectByHandle(EventHandle,
                                        EVENT_QUERY_STATE,
@@ -345,23 +345,23 @@ NtQueryEvent(IN HANDLE EventHandle,
                                        PreviousMode,
                                        (PVOID*)&Event,
                                        NULL);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
 
         _SEH_TRY {
-            
+
             /* Return Event Type and State */
             BasicInfo->EventType = Event->Header.Type;
             BasicInfo->EventState = KeReadStateEvent(Event);
 
             /* Return length */
             if(ReturnLength) *ReturnLength = sizeof(EVENT_BASIC_INFORMATION);
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
 
         /* Dereference the Object */
@@ -375,7 +375,7 @@ NtQueryEvent(IN HANDLE EventHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtResetEvent(IN HANDLE EventHandle,
              OUT PLONG PreviousState OPTIONAL)
@@ -383,23 +383,23 @@ NtResetEvent(IN HANDLE EventHandle,
     PKEVENT Event;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
     DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n",
             EventHandle, PreviousState);
 
     /* Check buffer validity */
     if(PreviousState && PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(PreviousState,
                           sizeof(LONG),
                           sizeof(ULONG));
          } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-             
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
 
         if(!NT_SUCCESS(Status)) return Status;
@@ -412,25 +412,25 @@ NtResetEvent(IN HANDLE EventHandle,
                                        PreviousMode,
                                        (PVOID*)&Event,
                                        NULL);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Reset the Event */
         LONG Prev = KeResetEvent(Event);
         ObDereferenceObject(Event);
-     
-        /* Return it */        
+
+        /* Return it */
         if(PreviousState) {
-            
+
             _SEH_TRY {
-                
+
                 *PreviousState = Prev;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-            
+
             } _SEH_END;
         }
    }
@@ -442,7 +442,7 @@ NtResetEvent(IN HANDLE EventHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtSetEvent(IN HANDLE EventHandle,
            OUT PLONG PreviousState  OPTIONAL)
@@ -450,23 +450,23 @@ NtSetEvent(IN HANDLE EventHandle,
     PKEVENT Event;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
     DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n",
            EventHandle, PreviousState);
 
     /* Check buffer validity */
     if(PreviousState != NULL && PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(PreviousState,
                           sizeof(LONG),
                           sizeof(ULONG));
          } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-             
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
 
         if(!NT_SUCCESS(Status)) return Status;
@@ -479,7 +479,7 @@ NtSetEvent(IN HANDLE EventHandle,
                                        PreviousMode,
                                        (PVOID*)&Event,
                                        NULL);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
 
@@ -487,17 +487,17 @@ NtSetEvent(IN HANDLE EventHandle,
         LONG Prev = KeSetEvent(Event, EVENT_INCREMENT, FALSE);
         ObDereferenceObject(Event);
 
-        /* Return it */        
+        /* Return it */
         if(PreviousState) {
-            
+
             _SEH_TRY {
-                
+
                 *PreviousState = Prev;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-            
+
             } _SEH_END;
         }
    }
index 5ce3316..a7af0db 100644 (file)
@@ -67,27 +67,27 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
     HANDLE hEventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
     DPRINT("NtCreateEventPair: %x\n", EventPairHandle);
-   
+
     /* Check Output Safety */
     if(PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(EventPairHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Create the Object */
     DPRINT("Creating EventPair\n");
     Status = ObCreateObject(PreviousMode,
@@ -99,14 +99,14 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
                             0,
                             0,
                             (PVOID*)&EventPair);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Initalize the Event */
         DPRINT("Initializing EventPair\n");
         KeInitializeEventPair(EventPair);
-        
+
         /* Insert it */
         Status = ObInsertObject((PVOID)EventPair,
                                  NULL,
@@ -115,18 +115,18 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
                                  NULL,
                                  &hEventPair);
         ObDereferenceObject(EventPair);
+
         /* Check for success and return handle */
         if(NT_SUCCESS(Status)) {
-            
+
             _SEH_TRY {
-                
+
                 *EventPairHandle = hEventPair;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-                
+
             } _SEH_END;
         }
     }
@@ -135,7 +135,7 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
     return Status;
 }
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtOpenEventPair(OUT PHANDLE EventPairHandle,
                 IN ACCESS_MASK DesiredAccess,
@@ -144,26 +144,26 @@ NtOpenEventPair(OUT PHANDLE EventPairHandle,
     HANDLE hEventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
-   
+
     /* Check Output Safety */
     if(PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(EventPairHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Open the Object */
     Status = ObOpenObjectByName(ObjectAttributes,
                                 ExEventPairObjectType,
@@ -172,21 +172,21 @@ NtOpenEventPair(OUT PHANDLE EventPairHandle,
                                 DesiredAccess,
                                 NULL,
                                 &hEventPair);
-             
+
     /* Check for success and return handle */
     if(NT_SUCCESS(Status)) {
-            
+
         _SEH_TRY {
-            
+
             *EventPairHandle = hEventPair;
-                
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
     }
-   
+
     /* Return status */
     return Status;
 }
@@ -199,10 +199,10 @@ NtSetHighEventPair(IN HANDLE EventPairHandle)
     PKEVENT_PAIR EventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status;
-    
+
     PAGED_CODE();
     DPRINT("NtSetHighEventPair(EventPairHandle %x)\n", EventPairHandle);
-   
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventPairHandle,
                                        SYNCHRONIZE,
@@ -210,17 +210,17 @@ NtSetHighEventPair(IN HANDLE EventPairHandle)
                                        PreviousMode,
                                        (PVOID*)&EventPair,
                                        NULL);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Set the Event */
         KeSetEvent(&EventPair->HighEvent, EVENT_INCREMENT, FALSE);
 
         /* Dereference Object */
         ObDereferenceObject(EventPair);
     }
-   
+
     /* Return status */
     return Status;
 }
@@ -232,10 +232,10 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
     PKEVENT_PAIR EventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status;
-    
+
     PAGED_CODE();
     DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
-    
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventPairHandle,
                                        SYNCHRONIZE,
@@ -243,13 +243,13 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
                                        PreviousMode,
                                        (PVOID*)&EventPair,
                                        NULL);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Set the Event */
         KeSetEvent(&EventPair->HighEvent, EVENT_INCREMENT, FALSE);
-        
+
         /* Wait for the Other one */
         KeWaitForSingleObject(&EventPair->LowEvent,
                               WrEventPair,
@@ -260,25 +260,25 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
         /* Dereference Object */
         ObDereferenceObject(EventPair);
     }
-   
+
     /* Return status */
     return Status;
 }
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtSetLowEventPair(IN HANDLE EventPairHandle)
 {
     PKEVENT_PAIR EventPair;
     KPROCESSOR_MODE PreviousMode;
     NTSTATUS Status;
-    
+
     PAGED_CODE();
-    
+
     PreviousMode = ExGetPreviousMode();
 
     DPRINT1("NtSetHighEventPair(EventPairHandle %x)\n", EventPairHandle);
-   
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventPairHandle,
                                        SYNCHRONIZE,
@@ -286,17 +286,17 @@ NtSetLowEventPair(IN HANDLE EventPairHandle)
                                        PreviousMode,
                                        (PVOID*)&EventPair,
                                        NULL);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Set the Event */
         KeSetEvent(&EventPair->LowEvent, EVENT_INCREMENT, FALSE);
 
         /* Dereference Object */
         ObDereferenceObject(EventPair);
     }
-    
+
     /* Return status */
     return Status;
 }
@@ -308,10 +308,10 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
     PKEVENT_PAIR EventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status;
-    
+
     PAGED_CODE();
     DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
-    
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventPairHandle,
                                        SYNCHRONIZE,
@@ -319,13 +319,13 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
                                        PreviousMode,
                                        (PVOID*)&EventPair,
                                        NULL);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Set the Event */
         KeSetEvent(&EventPair->LowEvent, EVENT_INCREMENT, FALSE);
-        
+
         /* Wait for the Other one */
         KeWaitForSingleObject(&EventPair->HighEvent,
                               WrEventPair,
@@ -336,23 +336,23 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
         /* Dereference Object */
         ObDereferenceObject(EventPair);
     }
-   
+
     /* Return status */
     return Status;
 }
 
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtWaitLowEventPair(IN HANDLE EventPairHandle)
 {
     PKEVENT_PAIR EventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status;
-    
+
     PAGED_CODE();
     DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
-    
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventPairHandle,
                                        SYNCHRONIZE,
@@ -360,10 +360,10 @@ NtWaitLowEventPair(IN HANDLE EventPairHandle)
                                        PreviousMode,
                                        (PVOID*)&EventPair,
                                        NULL);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-               
+
         /* Wait for the Event */
         KeWaitForSingleObject(&EventPair->LowEvent,
                               WrEventPair,
@@ -374,22 +374,22 @@ NtWaitLowEventPair(IN HANDLE EventPairHandle)
         /* Dereference Object */
         ObDereferenceObject(EventPair);
     }
-   
+
     /* Return status */
     return Status;
 }
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtWaitHighEventPair(IN HANDLE EventPairHandle)
 {
     PKEVENT_PAIR EventPair;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status;
-    
+
     PAGED_CODE();
     DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
-    
+
     /* Open the Object */
     Status = ObReferenceObjectByHandle(EventPairHandle,
                                        SYNCHRONIZE,
@@ -400,7 +400,7 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle)
 
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-               
+
         /* Wait for the Event */
         KeWaitForSingleObject(&EventPair->HighEvent,
                               WrEventPair,
@@ -411,7 +411,7 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle)
         /* Dereference Object */
         ObDereferenceObject(EventPair);
     }
-   
+
     /* Return status */
     return Status;
 }
index 8bb01b4..9f905d7 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/fmutex.c
  * PURPOSE:         Implements fast mutexes
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@cwcom.net)
  */
 
index 1c0d9d3..5b29178 100644 (file)
@@ -1,10 +1,10 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/handle.c
  * PURPOSE:         Generic Executive Handle Tables
- * 
+ *
  * PROGRAMMERS:     Thomas Weidenmueller <w3seek@reactos.com>
  *
  *  TODO:
@@ -95,14 +95,14 @@ PHANDLE_TABLE
 ExCreateHandleTable(IN PEPROCESS QuotaProcess  OPTIONAL)
 {
   PHANDLE_TABLE HandleTable;
-  
+
   PAGED_CODE();
-  
+
   if(!ExpInitialized)
   {
     KEBUGCHECK(0);
   }
-  
+
   if(QuotaProcess != NULL)
   {
     /* FIXME - Charge process quota before allocating the handle table! */
@@ -154,7 +154,7 @@ ExCreateHandleTable(IN PEPROCESS QuotaProcess  OPTIONAL)
   {
     /* FIXME - return the quota to the process */
   }
-  
+
   return HandleTable;
 }
 
@@ -215,29 +215,29 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
 {
   PHANDLE_TABLE_ENTRY **tlp, **lasttlp, *mlp, *lastmlp;
   PEPROCESS QuotaProcess;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
-  
+
   KeEnterCriticalRegion();
-  
+
   /* ensure there's no other operations going by acquiring an exclusive lock */
   ExAcquireHandleTableLockExclusive(HandleTable);
-  
+
   ASSERT(!(HandleTable->Flags & EX_HANDLE_TABLE_CLOSING));
-  
+
   HandleTable->Flags |= EX_HANDLE_TABLE_CLOSING;
-  
+
   KePulseEvent(&HandleTable->HandleContentionEvent,
                EVENT_INCREMENT,
                FALSE);
-  
+
   /* remove the handle table from the global handle table list */
   ExAcquireHandleTableListLock();
   RemoveEntryList(&HandleTable->HandleTableList);
   ExReleaseHandleTableListLock();
-  
+
   /* call the callback function to cleanup the objects associated with the
      handle table */
   if(DestroyHandleCallback != NULL)
@@ -255,7 +255,7 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
           if((*mlp) != NULL)
           {
             PHANDLE_TABLE_ENTRY curee, laste;
-            
+
             for(curee = *mlp, laste = *mlp + N_SUBHANDLE_ENTRIES;
                 curee != laste;
                 curee++)
@@ -271,9 +271,9 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
       }
     }
   }
-  
+
   QuotaProcess = HandleTable->QuotaProcess;
-  
+
   /* free the tables */
   for(tlp = HandleTable->Table, lasttlp = HandleTable->Table + N_TOPLEVEL_POINTERS;
       tlp != lasttlp;
@@ -288,7 +288,7 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
         if((*mlp) != NULL)
         {
           ExFreePool(*mlp);
-          
+
           if(QuotaProcess != NULL)
           {
             /* FIXME - return the quota to the process */
@@ -297,22 +297,22 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
       }
 
       ExFreePool(*tlp);
-      
+
       if(QuotaProcess != NULL)
       {
         /* FIXME - return the quota to the process */
       }
     }
   }
-  
+
   ExReleaseHandleTableLock(HandleTable);
-  
+
   KeLeaveCriticalRegion();
-  
+
   /* free the handle table */
   ExDeleteResource(&HandleTable->HandleTableLock);
   ExFreePool(HandleTable);
-  
+
   if(QuotaProcess != NULL)
   {
     /* FIXME - return the quota to the process */
@@ -326,9 +326,9 @@ ExDupHandleTable(IN PEPROCESS QuotaProcess  OPTIONAL,
                  IN PHANDLE_TABLE SourceHandleTable)
 {
   PHANDLE_TABLE HandleTable;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(SourceHandleTable);
 
   HandleTable = ExCreateHandleTable(QuotaProcess);
@@ -336,12 +336,12 @@ ExDupHandleTable(IN PEPROCESS QuotaProcess  OPTIONAL,
   {
     PHANDLE_TABLE_ENTRY **tlp, **srctlp, **etlp, *mlp, *srcmlp, *emlp, stbl, srcstbl, estbl;
     LONG tli, mli, eli;
-    
+
     tli = mli = eli = 0;
-  
+
     /* make sure the other handle table isn't being changed during the duplication */
     ExAcquireHandleTableLockShared(SourceHandleTable);
-    
+
     /* allocate enough tables */
     etlp = SourceHandleTable->Table + N_TOPLEVEL_POINTERS;
     for(srctlp = SourceHandleTable->Table, tlp = HandleTable->Table;
@@ -355,16 +355,16 @@ ExDupHandleTable(IN PEPROCESS QuotaProcess  OPTIONAL,
         {
           /* FIXME - Charge process quota before allocating the handle table! */
         }
-        
+
         *tlp = ExAllocatePoolWithTag(PagedPool,
                                      N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY),
                                      TAG('E', 'x', 'H', 't'));
         if(*tlp != NULL)
         {
           RtlZeroMemory(*tlp, N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY));
-          
+
           KeMemoryBarrier();
-          
+
           emlp = *srctlp + N_MIDDLELEVEL_POINTERS;
           for(srcmlp = *srctlp, mlp = *tlp;
               srcmlp != emlp;
@@ -402,7 +402,7 @@ freehandletable:
           DPRINT1("Failed to duplicate handle table 0x%x\n", SourceHandleTable);
 
           ExReleaseHandleTableLock(SourceHandleTable);
-          
+
           ExDestroyHandleTable(HandleTable,
                                NULL,
                                NULL);
@@ -481,11 +481,11 @@ freehandletable:
         }
       }
     }
-    
+
     /* release the source handle table */
     ExReleaseHandleTableLock(SourceHandleTable);
   }
-  
+
   return HandleTable;
 }
 
@@ -494,39 +494,39 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
                             OUT PLONG Handle)
 {
   PHANDLE_TABLE_ENTRY Entry = NULL;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
   ASSERT(Handle);
   ASSERT(KeGetCurrentThread() != NULL);
-  
+
   DPRINT("HT[0x%x]: HandleCount: %d\n", HandleTable, HandleTable->HandleCount);
-  
+
   if(HandleTable->HandleCount < EX_MAX_HANDLES)
   {
     ULONG tli, mli, eli;
-    
+
     if(HandleTable->FirstFreeTableEntry != -1)
     {
       /* there's a free handle entry we can just grab and use */
       tli = TLI_FROM_HANDLE(HandleTable->FirstFreeTableEntry);
       mli = MLI_FROM_HANDLE(HandleTable->FirstFreeTableEntry);
       eli = ELI_FROM_HANDLE(HandleTable->FirstFreeTableEntry);
-      
+
       /* the pointer should be valid in any way!!! */
       ASSERT(HandleTable->Table[tli]);
       ASSERT(HandleTable->Table[tli][mli]);
-      
+
       Entry = &HandleTable->Table[tli][mli][eli];
-      
+
       *Handle = HandleTable->FirstFreeTableEntry;
-      
+
       /* save the index to the next free handle (if available) */
       HandleTable->FirstFreeTableEntry = Entry->u2.NextFreeTableEntry;
       Entry->u2.NextFreeTableEntry = 0;
       Entry->u1.Object = NULL;
-      
+
       HandleTable->HandleCount++;
     }
     else
@@ -537,7 +537,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
       BOOLEAN AllocatedMtbl;
 
       ASSERT(HandleTable->NextIndexNeedingPool <= N_MAX_HANDLE);
-      
+
       /* the index of the next table to be allocated was saved in
          NextIndexNeedingPool the last time a handle entry was allocated and
          the subhandle entry list was full. the subhandle entry index of
@@ -550,7 +550,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
       ASSERT(ELI_FROM_HANDLE(HandleTable->NextIndexNeedingPool) == 0);
 
       DPRINT("HandleTable->Table[%d] == 0x%x\n", tli, HandleTable->Table[tli]);
-      
+
       /* allocate a middle level entry list if required */
       nmtbl = HandleTable->Table[tli];
       if(nmtbl == NULL)
@@ -559,7 +559,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
         {
           /* FIXME - Charge process quota before allocating the handle table! */
         }
-        
+
         nmtbl = ExAllocatePoolWithTag(PagedPool,
                                       N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY),
                                       TAG('E', 'x', 'H', 't'));
@@ -569,16 +569,16 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
           {
             /* FIXME - return the quota to the process */
           }
-          
+
           return NULL;
         }
-        
+
         /* clear the middle level entry list */
         RtlZeroMemory(nmtbl, N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY));
-        
+
         /* make sure the table was zeroed before we set one item */
         KeMemoryBarrier();
-        
+
         /* note, don't set the the pointer in the top level list yet because we
            might screw up lookups if allocating a subhandle entry table failed
            and this newly allocated table might get freed again */
@@ -587,7 +587,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
       else
       {
         AllocatedMtbl = FALSE;
-        
+
         /* allocate a subhandle entry table in any case! */
         ASSERT(nmtbl[mli] == NULL);
       }
@@ -608,31 +608,31 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
         {
           /* FIXME - Return process quota charged  */
         }
-        
+
         /* free the middle level entry list, if allocated, because it's empty and
            unused */
         if(AllocatedMtbl)
         {
           ExFreePool(nmtbl);
-          
+
           if(HandleTable->QuotaProcess != NULL)
           {
             /* FIXME - Return process quota charged  */
           }
         }
-        
+
         return NULL;
       }
-      
+
       /* let's just use the very first entry */
       Entry = ntbl;
       Entry->u1.ObAttributes = EX_HANDLE_ENTRY_LOCKED;
       Entry->u2.NextFreeTableEntry = 0;
-      
+
       *Handle = HandleTable->NextIndexNeedingPool;
-      
+
       HandleTable->HandleCount++;
-      
+
       /* set the FirstFreeTableEntry member to the second entry and chain the
          free entries */
       HandleTable->FirstFreeTableEntry = HandleTable->NextIndexNeedingPool + 1;
@@ -652,7 +652,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
       {
         InterlockedExchangePointer(&HandleTable->Table[tli], nmtbl);
       }
-      
+
       /* increment the NextIndexNeedingPool to the next index where we need to
          allocate new memory */
       HandleTable->NextIndexNeedingPool += N_SUBHANDLE_ENTRIES;
@@ -662,7 +662,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
   {
     DPRINT1("Can't allocate any more handles in handle table 0x%x!\n", HandleTable);
   }
-  
+
   return Entry;
 }
 
@@ -672,20 +672,20 @@ ExpFreeHandleTableEntry(IN PHANDLE_TABLE HandleTable,
                         IN LONG Handle)
 {
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
   ASSERT(Entry);
   ASSERT(IS_VALID_EX_HANDLE(Handle));
-  
+
   DPRINT("ExpFreeHandleTableEntry HT:0x%x Entry:0x%x\n", HandleTable, Entry);
-  
+
   /* automatically unlock the entry if currently locked. We however don't notify
      anyone who waited on the handle because we're holding an exclusive lock after
      all and these locks will fail then */
   InterlockedExchangePointer(&Entry->u1.Object, NULL);
   Entry->u2.NextFreeTableEntry = HandleTable->FirstFreeTableEntry;
   HandleTable->FirstFreeTableEntry = Handle;
-  
+
   HandleTable->HandleCount--;
 }
 
@@ -694,20 +694,20 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
                           IN LONG Handle)
 {
   PHANDLE_TABLE_ENTRY Entry = NULL;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
-  
+
   if(IS_VALID_EX_HANDLE(Handle))
   {
     ULONG tli, mli, eli;
     PHANDLE_TABLE_ENTRY *mlp;
-    
+
     tli = TLI_FROM_HANDLE(Handle);
     mli = MLI_FROM_HANDLE(Handle);
     eli = ELI_FROM_HANDLE(Handle);
-    
+
     mlp = HandleTable->Table[tli];
     if(Handle < HandleTable->NextIndexNeedingPool &&
        mlp != NULL && mlp[mli] != NULL && mlp[mli][eli].u1.Object != NULL)
@@ -720,7 +720,7 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
   {
     DPRINT("Looking up invalid handle 0x%x\n", Handle);
   }
-  
+
   return Entry;
 }
 
@@ -731,22 +731,22 @@ ExLockHandleTableEntry(IN PHANDLE_TABLE HandleTable,
   ULONG_PTR Current, New;
 
   PAGED_CODE();
-  
+
   DPRINT("Entering handle table entry 0x%x lock...\n", Entry);
-  
+
   ASSERT(HandleTable);
   ASSERT(Entry);
-  
+
   for(;;)
   {
     Current = (volatile ULONG_PTR)Entry->u1.Object;
-    
+
     if(!Current || (HandleTable->Flags & EX_HANDLE_TABLE_CLOSING))
     {
       DPRINT("Attempted to lock empty handle table entry 0x%x or handle table shut down\n", Entry);
       break;
     }
-    
+
     if(!(Current & EX_HANDLE_ENTRY_LOCKED))
     {
       New = Current | EX_HANDLE_ENTRY_LOCKED;
@@ -779,20 +779,20 @@ ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable,
                          IN PHANDLE_TABLE_ENTRY Entry)
 {
   ULONG_PTR Current, New;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
   ASSERT(Entry);
-  
+
   DPRINT("ExUnlockHandleTableEntry HT:0x%x Entry:0x%x\n", HandleTable, Entry);
-  
+
   Current = (volatile ULONG_PTR)Entry->u1.Object;
 
   ASSERT(Current & EX_HANDLE_ENTRY_LOCKED);
-  
+
   New = Current & ~EX_HANDLE_ENTRY_LOCKED;
-  
+
   InterlockedExchangePointer(&Entry->u1.Object,
                              (PVOID)New);
 
@@ -809,26 +809,26 @@ ExCreateHandle(IN PHANDLE_TABLE HandleTable,
 {
   PHANDLE_TABLE_ENTRY NewHandleTableEntry;
   LONG Handle = EX_INVALID_HANDLE;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
   ASSERT(Entry);
-  
+
   /* The highest bit in Entry->u1.Object has to be 1 so we make sure it's a
      pointer to kmode memory. It will cleared though because it also indicates
      the lock */
   ASSERT((ULONG_PTR)Entry->u1.Object & EX_HANDLE_ENTRY_LOCKED);
-  
+
   KeEnterCriticalRegion();
   ExAcquireHandleTableLockExclusive(HandleTable);
-  
+
   NewHandleTableEntry = ExpAllocateHandleTableEntry(HandleTable,
                                                     &Handle);
   if(NewHandleTableEntry != NULL)
   {
     *NewHandleTableEntry = *Entry;
-    
+
     ExUnlockHandleTableEntry(HandleTable,
                              NewHandleTableEntry);
   }
@@ -845,17 +845,17 @@ ExDestroyHandle(IN PHANDLE_TABLE HandleTable,
 {
   PHANDLE_TABLE_ENTRY HandleTableEntry;
   BOOLEAN Ret = FALSE;
-  
+
   PAGED_CODE();
-  
+
   ASSERT(HandleTable);
-  
+
   KeEnterCriticalRegion();
   ExAcquireHandleTableLockExclusive(HandleTable);
-  
+
   HandleTableEntry = ExpLookupHandleTableEntry(HandleTable,
                                                Handle);
-  
+
   if(HandleTableEntry != NULL && ExLockHandleTableEntry(HandleTable, HandleTableEntry))
   {
     /* free and automatically unlock the handle. However we don't need to pulse
@@ -865,10 +865,10 @@ ExDestroyHandle(IN PHANDLE_TABLE HandleTable,
                             Handle);
     Ret = TRUE;
   }
-  
+
   ExReleaseHandleTableLock(HandleTable);
   KeLeaveCriticalRegion();
-  
+
   return Ret;
 }
 
@@ -881,10 +881,10 @@ ExDestroyHandleByEntry(IN PHANDLE_TABLE HandleTable,
 
   ASSERT(HandleTable);
   ASSERT(Entry);
-  
+
   /* This routine requires the entry to be locked */
   ASSERT((ULONG_PTR)Entry->u1.Object & EX_HANDLE_ENTRY_LOCKED);
-  
+
   DPRINT("DestroyHandleByEntry HT:0x%x Entry:0x%x\n", HandleTable, Entry);
 
   KeEnterCriticalRegion();
@@ -909,7 +909,7 @@ ExMapHandleToPointer(IN PHANDLE_TABLE HandleTable,
   PAGED_CODE();
 
   ASSERT(HandleTable);
-  
+
   HandleTableEntry = ExpLookupHandleTableEntry(HandleTable,
                                                Handle);
   if (HandleTableEntry != NULL && ExLockHandleTableEntry(HandleTable, HandleTableEntry))
@@ -917,7 +917,7 @@ ExMapHandleToPointer(IN PHANDLE_TABLE HandleTable,
     DPRINT("ExMapHandleToPointer HT:0x%x Entry:0x%x locked\n", HandleTable, HandleTableEntry);
     return HandleTableEntry;
   }
-  
+
   return NULL;
 }
 
@@ -936,7 +936,7 @@ ExChangeHandle(IN PHANDLE_TABLE HandleTable,
   ASSERT(ChangeHandleCallback);
 
   KeEnterCriticalRegion();
-  
+
   HandleTableEntry = ExpLookupHandleTableEntry(HandleTable,
                                                Handle);
 
@@ -949,7 +949,7 @@ ExChangeHandle(IN PHANDLE_TABLE HandleTable,
     ExUnlockHandleTableEntry(HandleTable,
                              HandleTableEntry);
   }
-  
+
   KeLeaveCriticalRegion();
 
   return Ret;
index 3704c36..8bcf00e 100644 (file)
@@ -1,5 +1,5 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/i386/interlck.c
@@ -27,7 +27,7 @@
 #ifdef CONFIG_SMP
 #define LOCK lock
 #else
-#define LOCK 
+#define LOCK
 #endif
 
 #endif
@@ -248,7 +248,7 @@ Exi386InterlockedExchangeUlong(IN PULONG Target,
 LONG FASTCALL
 InterlockedIncrement(PLONG Addend);
 /*
- * FUNCTION: Increments a caller supplied variable of type LONG as an 
+ * FUNCTION: Increments a caller supplied variable of type LONG as an
  * atomic operation
  * ARGUMENTS:
  *     Addend = Points to a variable whose value is to be increment
index a5bc7ac..11124e1 100644 (file)
@@ -3,7 +3,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/init.c
  * PURPOSE:         Executive initalization
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net) - Added ExpInitializeExecutive
  *                                                    and optimized/cleaned it.
  *                  Eric Kohl (ekohl@abo.rhein-zeitung.de)
@@ -34,8 +34,8 @@ VOID PspPostInitSystemProcess(VOID);
 
 /* FUNCTIONS ****************************************************************/
 
-static 
-VOID 
+static
+VOID
 INIT_FUNCTION
 InitSystemSharedUserPage (PCSZ ParameterLine)
 {
@@ -61,13 +61,13 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
     *   There is NO need to do this again.
     */
     Ki386SetProcessorFeatures();
-    
+
     /* Set the Version Data */
     SharedUserData->NtProductType = NtProductWinNt;
     SharedUserData->ProductTypeIsValid = TRUE;
     SharedUserData->NtMajorVersion = 5;
     SharedUserData->NtMinorVersion = 0;
-   
+
     /*
      * Retrieve the current dos system path
      * (e.g.: C:\reactos) from the given arc path
@@ -88,18 +88,18 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
     /* Extract path */
     p = strchr (ParamBuffer, '\\');
     if (p) {
-        
+
         DPRINT("Boot path: %s\n", p);
         RtlCreateUnicodeStringFromAsciiz (&BootPath, p);
         *p = 0;
-    
+
     } else {
-        
+
         DPRINT("Boot path: %s\n", "\\");
         RtlCreateUnicodeStringFromAsciiz (&BootPath, "\\");
     }
     DPRINT("Arc name: %s\n", ParamBuffer);
-   
+
     /* Only ARC Name left - Build full ARC Name */
     ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
     swprintf (ArcNameBuffer, L"\\ArcName\\%S", ParamBuffer);
@@ -123,29 +123,29 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
     Status = NtOpenSymbolicLinkObject(&Handle,
                                       SYMBOLIC_LINK_ALL_ACCESS,
                                       &ObjectAttributes);
-    
+
     /* Free the String */
     ExFreePool(ArcName.Buffer);
-    
+
     /* Check for Success */
     if (!NT_SUCCESS(Status)) {
-        
+
         /* Free the Strings */
         RtlFreeUnicodeString(&BootPath);
         ExFreePool(ArcDeviceName.Buffer);
         CPRINT("NtOpenSymbolicLinkObject() failed (Status %x)\n", Status);
         KEBUGCHECK(0);
     }
-    
+
     /* Query the Link */
     Status = NtQuerySymbolicLinkObject(Handle,
                                        &ArcDeviceName,
                                        &Length);
     NtClose (Handle);
-    
+
     /* Check for Success */
     if (!NT_SUCCESS(Status)) {
-        
+
         /* Free the Strings */
         RtlFreeUnicodeString(&BootPath);
         ExFreePool(ArcDeviceName.Buffer);
@@ -161,12 +161,12 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
 
     /* Loop Drives */
     for (i = 0; i < 26; i++)  {
-        
+
         /* Setup the String */
         swprintf (DriveNameBuffer, L"\\??\\%C:", 'A' + i);
         RtlInitUnicodeString(&DriveName,
                              DriveNameBuffer);
-        
+
         /* Open the Symbolic Link */
         InitializeObjectAttributes(&ObjectAttributes,
                                    &DriveName,
@@ -176,18 +176,18 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
         Status = NtOpenSymbolicLinkObject(&Handle,
                                           SYMBOLIC_LINK_ALL_ACCESS,
                                           &ObjectAttributes);
-        
+
         /* If it failed, skip to the next drive */
         if (!NT_SUCCESS(Status)) {
             DPRINT("Failed to open link %wZ\n", &DriveName);
             continue;
         }
-        
+
         /* Query it */
         Status = NtQuerySymbolicLinkObject(Handle,
                                            &DriveDeviceName,
                                            &Length);
-        
+
         /* If it failed, skip to the next drive */
         if (!NT_SUCCESS(Status)) {
             DPRINT("Failed to query link %wZ\n", &DriveName);
@@ -197,7 +197,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
 
         /* See if we've found the boot drive */
         if (!RtlCompareUnicodeString (&ArcDeviceName, &DriveDeviceName, FALSE)) {
-            
+
             DPRINT("DOS Boot path: %c:%wZ\n", 'A' + i, &BootPath);
             swprintf(SharedUserData->NtSystemRoot, L"%C:%wZ", 'A' + i, &BootPath);
             BootDriveFound = TRUE;
@@ -206,7 +206,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
         /* Close this Link */
         NtClose (Handle);
     }
-    
+
     /* Free all the Strings we have in memory */
     RtlFreeUnicodeString (&BootPath);
     ExFreePool(DriveDeviceName.Buffer);
@@ -214,7 +214,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
 
     /* Make sure we found the Boot Drive */
     if (BootDriveFound == FALSE) {
-        
+
         DbgPrint("No system drive found!\n");
         KEBUGCHECK (NO_BOOT_DEVICE);
     }
@@ -247,7 +247,7 @@ ExecuteRuntimeAsserts(VOID)
     ASSERT(FIELD_OFFSET(KV86M_TRAP_FRAME, orig_ebp) == TF_ORIG_EBP);
     ASSERT(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
     ASSERT(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
-    ASSERT(FIELD_OFFSET(KPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);  
+    ASSERT(FIELD_OFFSET(KPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);
     ASSERT(FIELD_OFFSET(KPCR, PrcbData) + FIELD_OFFSET(KPRCB, NpxThread) == KPCR_NPX_THREAD);
     ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
     ASSERT(FIELD_OFFSET(KTSS, Eflags) == KTSS_EFLAGS);
@@ -262,115 +262,115 @@ ParseAndCacheLoadedModules(PBOOLEAN SetupBoot)
 {
     ULONG i;
     PCHAR Name;
-    
+
     /* Loop the Module List and get the modules we want */
     for (i = 1; i < KeLoaderBlock.ModsCount; i++) {
-       
+
         /* Get the Name of this Module */
         if (!(Name = strrchr((PCHAR)KeLoaderModules[i].String, '\\'))) {
-      
+
             /* Save the name */
             Name = (PCHAR)KeLoaderModules[i].String;
-          
+
         } else {
-      
+
             /* No name, skip */
             Name++;
         }
-      
+
         /* Now check for any of the modules we will need later */
         if (!_stricmp(Name, "ansi.nls")) {
-          
+
             CachedModules[AnsiCodepage] = &KeLoaderModules[i];
-      
+
         } else if (!_stricmp(Name, "oem.nls")) {
-          
+
             CachedModules[OemCodepage] = &KeLoaderModules[i];
-      
+
         } else if (!_stricmp(Name, "casemap.nls")) {
-      
+
             CachedModules[UnicodeCasemap] = &KeLoaderModules[i];
-      
+
         } else if (!_stricmp(Name, "system") || !_stricmp(Name, "system.hiv")) {
-      
+
             CachedModules[SystemRegistry] = &KeLoaderModules[i];
             *SetupBoot = FALSE;
-      
+
         } else if (!_stricmp(Name, "hardware") || !_stricmp(Name, "hardware.hiv")) {
-      
+
             CachedModules[HardwareRegistry] = &KeLoaderModules[i];
         }
-    }    
+    }
 }
 
 inline
 VOID
 STDCALL
-ParseCommandLine(PULONG MaxMem, 
-                 PBOOLEAN NoGuiBoot, 
-                 PBOOLEAN BootLog, 
+ParseCommandLine(PULONG MaxMem,
+                 PBOOLEAN NoGuiBoot,
+                 PBOOLEAN BootLog,
                  PBOOLEAN ForceAcpiDisable)
 {
-    PCHAR p1, p2; 
-    
+    PCHAR p1, p2;
+
     p1 = (PCHAR)KeLoaderBlock.CommandLine;
     while(*p1 && (p2 = strchr(p1, '/'))) {
-        
+
         p2++;
         if (!_strnicmp(p2, "MAXMEM", 6)) {
-            
+
             p2 += 6;
             while (isspace(*p2)) p2++;
-            
+
             if (*p2 == '=') {
-                
+
                 p2++;
-                
+
                 while(isspace(*p2)) p2++;
-                
+
                 if (isdigit(*p2)) {
                     while (isdigit(*p2)) {
                         *MaxMem = *MaxMem * 10 + *p2 - '0';
                         p2++;
-                    }                
+                    }
                     break;
                 }
             }
         } else if (!_strnicmp(p2, "NOGUIBOOT", 9)) {
-            
+
             p2 += 9;
             *NoGuiBoot = TRUE;
-            
+
         } else if (!_strnicmp(p2, "CRASHDUMP", 9)) {
-            
+
             p2 += 9;
             if (*p2 == ':') {
-                
+
                 p2++;
                 if (!_strnicmp(p2, "FULL", 4)) {
-                    
+
                     MmCoreDumpType = MM_CORE_DUMP_TYPE_FULL;
-                    
+
                 } else {
-                    
+
                     MmCoreDumpType = MM_CORE_DUMP_TYPE_NONE;
                 }
             }
         } else if (!_strnicmp(p2, "BOOTLOG", 7)) {
-            
+
             p2 += 7;
             *BootLog = TRUE;
         } else if (!_strnicmp(p2, "NOACPI", 6)) {
-            
+
             p2 += 6;
             *ForceAcpiDisable = TRUE;
         }
-        
+
         p1 = p2;
     }
 }
 
-VOID 
+VOID
 INIT_FUNCTION
 STDCALL
 ExpInitializeExecutive(VOID)
@@ -391,19 +391,19 @@ ExpInitializeExecutive(VOID)
 
     /* Check if the structures match the ASM offset constants */
     ExecuteRuntimeAsserts();
-    
+
     /* Sets up the Text Sections of the Kernel and HAL for debugging */
     LdrInit1();
-    
+
     /* Lower the IRQL to Dispatch Level */
     KeLowerIrql(DISPATCH_LEVEL);
-    
+
     /* Sets up the VDM Data */
     NtEarlyInitVdm();
 
     /* Parse Command Line Settings */
     ParseCommandLine(&MaxMem, &NoGuiBoot, &BootLog, &ForceAcpiDisable);
-    
+
     /* Initialize Kernel Memory Address Space */
     MmInit1(FirstKrnlPhysAddr,
             LastKrnlPhysAddr,
@@ -414,30 +414,30 @@ ExpInitializeExecutive(VOID)
 
     /* Parse the Loaded Modules (by FreeLoader) and cache the ones we'll need */
     ParseAndCacheLoadedModules(&SetupBoot);
-    
+
     /* Initialize the kernel debugger parameters */
     KdInitSystem(0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
-    
+
     /* Initialize the Dispatcher, Clock and Bug Check Mechanisms. */
     KeInit2();
 
     /* Bring back the IRQL to Passive */
     KeLowerIrql(PASSIVE_LEVEL);
-    
+
     /* Initialize Profiling */
     InitializeListHead(&KiProfileListHead);
     InitializeListHead(&KiProfileSourceListHead);
     KeInitializeSpinLock(&KiProfileLock);
-    
+
     /* Load basic Security for other Managers */
     if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED);
 
     /* Create the Basic Object Manager Types to allow new Object Types */
     ObInit();
-    
+
     /* Initialize Lookaside Lists */
     ExInit2();
-    
+
     /* Set up Region Maps, Sections and the Paging File */
     MmInit2();
 
@@ -446,7 +446,7 @@ ExpInitializeExecutive(VOID)
 
     /* Set 1 CPU for now, we'll increment this later */
     KeNumberProcessors = 1;
-    
+
     /* Initalize the Process Manager */
     PiInitProcessManager();
 
@@ -455,7 +455,7 @@ ExpInitializeExecutive(VOID)
 
     /* Initialize all processors */
     while (!HalAllProcessorsStarted()) {
-        
+
         PVOID ProcessorStack;
 
         /* Set up the Kernel and Process Manager for this CPU */
@@ -472,10 +472,10 @@ ExpInitializeExecutive(VOID)
 
     /* Do Phase 1 HAL Initalization */
     HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
-    
+
     /* Initialize Basic System Objects and Worker Threads */
     ExInit3();
-    
+
     /* Create the system handle table, assign it to the system process, create
        the client id table and assign a PID for the system process. This needs
        to be done before the worker threads are initialized so the system
@@ -484,33 +484,33 @@ ExpInitializeExecutive(VOID)
 
     /* initialize the worker threads */
     ExpInitializeWorkerThreads();
-    
+
     /* initialize callbacks */
     ExpInitializeCallbacks();
-    
+
     /* Call KD Providers at Phase 1 */
     KdInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
-  
+
     /* Initialize I/O Objects, Filesystems, Error Logging and Shutdown */
     IoInit();
-       
+
     /* TBD */
     PoInit((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock, ForceAcpiDisable);
-  
+
     /* Initialize the Registry (Hives are NOT yet loaded!) */
     CmInitializeRegistry();
-  
+
     /* Unmap Low memory, initialize the Page Zeroing and the Balancer Thread */
     MmInit3();
-  
+
     /* Initialize Cache Views */
     CcInit();
-    
+
     /* Initialize File Locking */
     FsRtlpInitFileLockingImplementation();
 
     /* Report all resources used by hal */
-    HalReportResourceUsage();  
+    HalReportResourceUsage();
 
     /* Clear the screen to blue */
     HalInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
@@ -522,7 +522,7 @@ ExpInitializeExecutive(VOID)
     HalDisplayString("\n\nReactOS is free software, covered by the GNU General "
                      "Public License, and you\n");
     HalDisplayString("are welcome to change it and/or distribute copies of it "
-                     "under certain\n"); 
+                     "under certain\n");
     HalDisplayString("conditions. There is absolutely no warranty for "
                       "ReactOS.\n\n");
 
@@ -541,10 +541,10 @@ ExpInitializeExecutive(VOID)
 
     /* Import and Load Registry Hives */
     CmInitHives(SetupBoot);
-    
+
     /* Initialize the time zone information from the registry */
     ExpInitTimeZoneInfo();
-   
+
    /* Enter the kernel debugger before starting up the boot drivers */
     KdbEnter();
 
@@ -553,16 +553,16 @@ ExpInitializeExecutive(VOID)
 
     /* Display the boot screen image if not disabled */
     if (!NoGuiBoot) InbvEnableBootDriver(TRUE);
-    
+
     /* Create ARC Names, SystemRoot SymLink, Load Drivers and Assign Letters */
     IoInit3();
-    
+
     /* Load the System DLL and its Entrypoints */
     LdrpInitializeSystemDll();
-       
+
     /* Initialize the Default Locale */
     PiInitDefaultLocale();
-    
+
     /* Initialize shared user page. Set dos system path, dos device map, etc. */
     InitSystemSharedUserPage ((PCHAR)KeLoaderBlock.CommandLine);
 
@@ -578,10 +578,10 @@ ExpInitializeExecutive(VOID)
                            &ObjectAttributes,
                            SynchronizationEvent,
                            FALSE);
-    
+
     /* Check for Success */
     if (!NT_SUCCESS(Status)) {
-        
+
         DPRINT1("Failed to create 'ReactOSInitDone' event (Status 0x%x)\n", Status);
         InitDoneEventHandle = INVALID_HANDLE_VALUE;
     }
@@ -589,10 +589,10 @@ ExpInitializeExecutive(VOID)
     /* Launch initial process */
     Status = LdrLoadInitialProcess(&ProcessHandle,
                                    &ThreadHandle);
-    
+
     /* Check for success, Bugcheck if we failed */
     if (!NT_SUCCESS(Status)) {
-        
+
         KEBUGCHECKEX(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
     }
 
@@ -613,15 +613,15 @@ ExpInitializeExecutive(VOID)
                                           FALSE,
                                           &Timeout);
         if (!NT_SUCCESS(Status)) {
-            
+
             DPRINT1("NtWaitForMultipleObjects failed with status 0x%x!\n", Status);
-        
+
         } else if (Status == STATUS_TIMEOUT) {
-            
+
             DPRINT1("WARNING: System not initialized after 120 seconds.\n");
-        
+
         } else if (Status == STATUS_WAIT_0 + 1) {
-            
+
             /* Crash the system if the initial process was terminated. */
             KEBUGCHECKEX(SESSION5_INITIALIZATION_FAILED, Status, 0, 0, 0);
         }
@@ -632,9 +632,9 @@ ExpInitializeExecutive(VOID)
         /* Signal the Event and close the handle */
         ZwSetEvent(InitDoneEventHandle, NULL);
         ZwClose(InitDoneEventHandle);
-    
+
     } else {
-        
+
         /* On failure to create 'ReactOSInitDone' event, go to text mode ASAP */
         if (!NoGuiBoot) InbvEnableBootDriver(FALSE);
 
@@ -643,11 +643,11 @@ ExpInitializeExecutive(VOID)
         Status = ZwWaitForSingleObject(ProcessHandle,
                                        FALSE,
                                        &Timeout);
-        
+
         /* Check for timeout, crash if the initial process didn't initalize */
         if (Status != STATUS_TIMEOUT) KEBUGCHECKEX(SESSION5_INITIALIZATION_FAILED, Status, 1, 0, 0);
     }
-    
+
     /* Enable the Clock, close remaining handles */
     KiTimerSystemAuditing = 1;
     ZwClose(ThreadHandle);
index e7863fd..49edcde 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/interlck.c
  * PURPOSE:         Implements interlocked functions
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@mcmail.com)
  */
 
@@ -80,16 +80,16 @@ ExInterlockedAddUlong (PULONG               Addend,
 /*
  * ExInterlockedAddUlong adds an unsigned long value to a given unsigned
  * integer as an atomic operation.
- * 
+ *
  * ADDEND = Points to an unsigned long integer whose value is to be adjusted
  * by the Increment value.
- * 
+ *
  * INCREMENT = Is an unsigned long integer to be added.
- * 
+ *
  * LOCK = Points to a spinlock to be used to synchronize access to ADDEND.
- * 
- * Returns: 
- * 
+ *
+ * Returns:
+ *
  * The original value of the unsigned integer pointed to by ADDEND.
  */
 {
@@ -115,15 +115,15 @@ ExInterlockedAddLargeInteger (PLARGE_INTEGER Addend,
                              PKSPIN_LOCK Lock)
 /*
  * Adds two large integer values as an atomic operation.
- * 
+ *
  * ADDEND = Pointer to a large integer value that will have INCREMENT added.
- * 
+ *
  * INCREMENT = Value to be added.
- * 
+ *
  * LOCK = Spinlock used to synchronize access to ADDEND.
- * 
+ *
  * Returns:
- * 
+ *
  * The original value of the large integer pointed to by ADDEND.
  */
 {
@@ -218,16 +218,16 @@ ExfInterlockedAddUlong(PULONG Addend,
 /*
  * ExInterlockedAddUlong adds an unsigned long value to a given unsigned
  * integer as an atomic operation.
- * 
+ *
  * ADDEND = Points to an unsigned long integer whose value is to be adjusted
  * by the Increment value.
- * 
+ *
  * INCREMENT = Is an unsigned long integer to be added.
- * 
+ *
  * LOCK = Points to a spinlock to be used to synchronize access to ADDEND.
- * 
- * Returns: 
- * 
+ *
+ * Returns:
+ *
  * The original value of the unsigned integer pointed to by ADDEND.
  */
 {
index 24746a0..e77e4a8 100644 (file)
@@ -446,7 +446,7 @@ InterlockedPopEntrySList(IN PSLIST_HEADER ListHead)
 {
   SLIST_HEADER newslh, oldslh;
   PSLIST_ENTRY le;
-  
+
   do
   {
     oldslh = *(volatile SLIST_HEADER *)ListHead;
@@ -476,9 +476,9 @@ InterlockedPushEntrySList(IN PSLIST_HEADER ListHead,
                           IN PSLIST_ENTRY ListEntry)
 {
   SLIST_HEADER newslh, oldslh;
-  
+
   newslh.Next.Next = ListEntry;
-  
+
   do
   {
     oldslh = *(volatile SLIST_HEADER *)ListHead;
index 1bd2a64..a65d99d 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/lookas.c
  * PURPOSE:         Lookaside lists
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@mcmail.com)
  *                  Casper S. Hornstrup (chorns@users.sourceforge.net)
  */
index 700c0c2..5431b11 100644 (file)
@@ -1,9 +1,9 @@
-/* 
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/mutant.c
  * PURPOSE:         Executive Management of Mutants
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu - Fix tab/space mismatching, tiny fixes to query function and
  *                                 add more debug output.
  *                  David Welch (welch@cwcom.net)
@@ -24,14 +24,14 @@ static GENERIC_MAPPING ExpMutantMapping = {
     MUTANT_ALL_ACCESS};
 
 static const INFORMATION_CLASS_INFO ExMutantInfoClass[] = {
-    
+
      /* MutantBasicInformation */
     ICI_SQ_SAME( sizeof(MUTANT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
 };
 
 /* FUNCTIONS *****************************************************************/
 
-VOID 
+VOID
 STDCALL
 ExpDeleteMutant(PVOID ObjectBody)
 {
@@ -45,7 +45,7 @@ ExpDeleteMutant(PVOID ObjectBody)
                     FALSE);
 }
 
-VOID 
+VOID
 INIT_FUNCTION
 ExpInitializeMutantImplementation(VOID)
 {
@@ -79,7 +79,7 @@ ExpInitializeMutantImplementation(VOID)
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtCreateMutant(OUT PHANDLE MutantHandle,
                IN ACCESS_MASK DesiredAccess,
@@ -90,27 +90,27 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
     HANDLE hMutant;
     PKMUTANT Mutant;
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
     DPRINT("NtCreateMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle, DesiredAccess, ObjectAttributes);
-  
+
     /* Check Output Safety */
     if(PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(MutantHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
 
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Create the Mutant Object*/
     Status = ObCreateObject(PreviousMode,
                             ExMutantObjectType,
@@ -121,10 +121,10 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
                             0,
                             0,
                             (PVOID*)&Mutant);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Initalize the Kernel Mutant */
         DPRINT("Initializing the Mutant\n");
         KeInitializeMutant(Mutant, InitialOwner);
@@ -137,18 +137,18 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
                                 NULL,
                                 &hMutant);
         ObDereferenceObject(Mutant);
-    
+
         /* Check for success and return handle */
         if(NT_SUCCESS(Status)) {
-            
+
             _SEH_TRY {
-                
+
                 *MutantHandle = hMutant;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-                
+
             } _SEH_END;
         }
     }
@@ -160,7 +160,7 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtOpenMutant(OUT PHANDLE MutantHandle,
              IN ACCESS_MASK DesiredAccess,
@@ -169,27 +169,27 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
     HANDLE hMutant;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-  
+
     PAGED_CODE();
     DPRINT("NtOpenMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle, DesiredAccess, ObjectAttributes);
 
     /* Check Output Safety */
     if(PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(MutantHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Open the Object */
     Status = ObOpenObjectByName(ObjectAttributes,
                                 ExMutantObjectType,
@@ -201,15 +201,15 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
 
     /* Check for success and return handle */
     if(NT_SUCCESS(Status)) {
-            
+
         _SEH_TRY {
-            
+
             *MutantHandle = hMutant;
-        
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
     }
 
@@ -220,7 +220,7 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtQueryMutant(IN HANDLE MutantHandle,
               IN MUTANT_INFORMATION_CLASS MutantInformationClass,
@@ -232,9 +232,9 @@ NtQueryMutant(IN HANDLE MutantHandle,
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
     PMUTANT_BASIC_INFORMATION BasicInfo = (PMUTANT_BASIC_INFORMATION)MutantInformation;
-    
+
     PAGED_CODE();
-    
+
     /* Check buffers and parameters */
     DefaultQueryInfoBufferCheck(MutantInformationClass,
                                 ExMutantInfoClass,
@@ -244,7 +244,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
                                 PreviousMode,
                                 &Status);
     if(!NT_SUCCESS(Status)) {
-        
+
         DPRINT("NtQueryMutant() failed, Status: 0x%x\n", Status);
         return Status;
     }
@@ -260,7 +260,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
     if(NT_SUCCESS(Status)) {
 
          _SEH_TRY {
-             
+
             /* Fill out the Basic Information Requested */
             DPRINT("Returning Mutant Information\n");
             BasicInfo->CurrentCount = KeReadStateMutant(Mutant);
@@ -269,17 +269,17 @@ NtQueryMutant(IN HANDLE MutantHandle,
 
             /* Return the Result Length if requested */
            if(ResultLength) *ResultLength = sizeof(MUTANT_BASIC_INFORMATION);
-        
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
 
         /* Release the Object */
         ObDereferenceObject(Mutant);
     }
-    
+
     /* Return Status */
     return Status;
 }
@@ -288,7 +288,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtReleaseMutant(IN HANDLE MutantHandle,
                 IN PLONG PreviousCount  OPTIONAL)
@@ -296,31 +296,31 @@ NtReleaseMutant(IN HANDLE MutantHandle,
     PKMUTANT Mutant;
     KPROCESSOR_MODE PreviousMode;
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
-    
+
     PreviousMode = ExGetPreviousMode();
-    
-    DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n", 
-            MutantHandle, 
+
+    DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
+            MutantHandle,
             PreviousCount);
 
     /* Check Output Safety */
     if(PreviousMode != KernelMode && PreviousCount) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(PreviousCount,
                           sizeof(LONG),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
-    } 
+    }
 
     /* Open the Object */
     Status = ObReferenceObjectByHandle(MutantHandle,
@@ -329,12 +329,12 @@ NtReleaseMutant(IN HANDLE MutantHandle,
                                        PreviousMode,
                                        (PVOID*)&Mutant,
                                        NULL);
-    
+
     /* Check for Success and release if such */
     if(NT_SUCCESS(Status)) {
-        
+
         LONG Prev = 0;
-        
+
         /* release the mutant. doing so might raise an exception which we're
            required to catch! */
         _SEH_TRY {
@@ -346,7 +346,7 @@ NtReleaseMutant(IN HANDLE MutantHandle,
             Status = _SEH_GetExceptionCode();
 
         } _SEH_END;
-        
+
         ObDereferenceObject(Mutant);
 
         if(NT_SUCCESS(Status)) {
@@ -359,7 +359,7 @@ NtReleaseMutant(IN HANDLE MutantHandle,
                     *PreviousCount = Prev;
 
                 } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                     Status = _SEH_GetExceptionCode();
 
                 } _SEH_END;
index d68f98e..8e655fa 100644 (file)
@@ -1,10 +1,10 @@
 /* $Id$
- * 
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/power.c
  * PURPOSE:         Power managment
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@cwcom.net)
  */
 
@@ -39,7 +39,7 @@ KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
 VOID STDCALL
 ShutdownThreadMain(PVOID Context)
 {
-   SHUTDOWN_ACTION Action = (SHUTDOWN_ACTION)Context; 
+   SHUTDOWN_ACTION Action = (SHUTDOWN_ACTION)Context;
    LARGE_INTEGER Waittime;
 
    /* Run the thread on the boot processor */
@@ -51,7 +51,7 @@ ShutdownThreadMain(PVOID Context)
 
    PiShutdownProcessManager();
    MiShutdownMemoryManager();
-   
+
    Waittime.QuadPart = (LONGLONG)-10000000; /* 1sec */
    KeDelayExecutionThread(KernelMode, FALSE, &Waittime);
 
@@ -105,7 +105,7 @@ ShutdownThreadMain(PVOID Context)
 }
 
 
-NTSTATUS STDCALL 
+NTSTATUS STDCALL
 NtSetSystemPowerState(IN POWER_ACTION SystemAction,
                      IN SYSTEM_POWER_STATE MinSystemState,
                      IN ULONG Flags)
@@ -117,7 +117,7 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction,
 /*
  * @implemented
  */
-NTSTATUS STDCALL 
+NTSTATUS STDCALL
 NtShutdownSystem(IN SHUTDOWN_ACTION Action)
 {
    NTSTATUS Status;
index 337cb1f..7ef0cb7 100644 (file)
@@ -3,7 +3,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/profile.c
  * PURPOSE:         Support for Executive Profile Objects
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu
  */
 
@@ -41,7 +41,7 @@ static GENERIC_MAPPING ExpProfileMapping = {
     STANDARD_RIGHTS_EXECUTE | PROFILE_CONTROL,
     STANDARD_RIGHTS_ALL};
 
-VOID 
+VOID
 STDCALL
 ExpDeleteProfile(PVOID ObjectBody)
 {
@@ -49,35 +49,35 @@ ExpDeleteProfile(PVOID ObjectBody)
 
     /* Typecast the Object */
     Profile = (PEPROFILE)ObjectBody;
-    
+
     /* Check if there if the Profile was started */
     if (Profile->LockedBuffer) {
-        
+
         /* Stop the Profile */
         KeStopProfile(Profile->KeProfile);
-    
+
         /* Unmap the Locked Buffer */
         MmUnmapLockedPages(Profile->LockedBuffer, Profile->Mdl);
         MmUnlockPages(Profile->Mdl);
         ExFreePool(Profile->Mdl);
     }
-  
+
     /* Check if a Process is associated */
     if (Profile->Process != NULL) {
-        
+
         /* Dereference it */
         ObDereferenceObject(Profile->Process);
         Profile->Process = NULL;
     }
 }
 
-VOID 
+VOID
 INIT_FUNCTION
 ExpInitializeProfileImplementation(VOID)
 {
     /* Initialize the Mutex to lock the States */
     KeInitializeMutex(&ExpProfileMutex, 0x40);
-    
+
     /* Create the Object Type */
     ExProfileObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
     RtlInitUnicodeString(&ExProfileObjectType->TypeName, L"Profile");
@@ -101,12 +101,12 @@ ExpInitializeProfileImplementation(VOID)
     ObpCreateTypeObject(ExProfileObjectType);
 }
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtCreateProfile(OUT PHANDLE ProfileHandle,
                 IN HANDLE Process OPTIONAL,
-                IN PVOID ImageBase, 
-                IN ULONG ImageSize, 
+                IN PVOID ImageBase,
+                IN ULONG ImageSize,
                 IN ULONG BucketSize,
                 IN PVOID Buffer,
                 IN ULONG BufferSize,
@@ -119,7 +119,7 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     OBJECT_ATTRIBUTES ObjectAttributes;
     NTSTATUS Status = STATUS_SUCCESS;
-  
+
     PAGED_CODE();
 
     /* Easy way out */
@@ -127,27 +127,27 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
 
     /* Check the Parameters for validity */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(ProfileHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
-            
+
             ProbeForWrite(Buffer,
                           BufferSize,
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
         } _SEH_END;
-    
+
         if(!NT_SUCCESS(Status)) return Status;
     }
 
     /* Check if a process was specified */
     if (Process) {
-        
+
         /* Reference it */
         Status = ObReferenceObjectByHandle(Process,
                                            PROCESS_QUERY_INFORMATION,
@@ -156,15 +156,15 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
                                            (PVOID*)&pProcess,
                                            NULL);
         if (!NT_SUCCESS(Status)) return(Status);
-        
+
     } else {
-        
+
         /* No process was specified, which means a System-Wide Profile */
         pProcess = NULL;
-        
+
         /* For this, we need to check the Privilege */
         if(!SeSinglePrivilegeCheck(SeSystemProfilePrivilege, PreviousMode)) {
-            
+
             DPRINT1("NtCreateProfile: Caller requires the SeSystemProfilePrivilege privilege!\n");
             return STATUS_PRIVILEGE_NOT_HELD;
         }
@@ -196,7 +196,7 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
     Profile->LockedBuffer = NULL;
     Profile->Affinity = Affinity;
     Profile->Process = pProcess;
-    
+
     /* Insert into the Object Tree */
     Status = ObInsertObject ((PVOID)Profile,
                              NULL,
@@ -205,22 +205,22 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
                              NULL,
                              &hProfile);
     ObDereferenceObject(Profile);
-    
+
     /* Check for Success */
     if (!NT_SUCCESS(Status)) {
-        
+
         /* Dereference Process on failure */
         if (pProcess) ObDereferenceObject(pProcess);
         return Status;
     }
-    
+
     /* Copy the created handle back to the caller*/
     _SEH_TRY {
-        
+
         *ProfileHandle = hProfile;
-        
+
     } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-        
+
         Status = _SEH_GetExceptionCode();
     } _SEH_END;
 
@@ -228,7 +228,7 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
     return Status;
 }
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceCounter,
                           OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL)
@@ -236,48 +236,48 @@ NtQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceCounter,
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     LARGE_INTEGER PerfFrequency;
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     /* Check the Parameters for validity */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(PerformanceCounter,
                           sizeof(LARGE_INTEGER),
                           sizeof(ULONG));
-            
+
             ProbeForWrite(PerformanceFrequency,
                           sizeof(LARGE_INTEGER),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
         } _SEH_END;
-    
+
         if(!NT_SUCCESS(Status)) return Status;
     }
 
     _SEH_TRY {
-        
+
         /* Query the Kernel */
         *PerformanceCounter = KeQueryPerformanceCounter(&PerfFrequency);
-        
+
         /* Return Frequency if requested */
         if(PerformanceFrequency) {
-            
+
             *PerformanceFrequency = PerfFrequency;
         }
     } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-        
+
         Status = _SEH_GetExceptionCode();
-    
+
     } _SEH_END;
 
     return Status;
 }
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtStartProfile(IN HANDLE ProfileHandle)
 {
     PEPROFILE Profile;
@@ -285,7 +285,7 @@ NtStartProfile(IN HANDLE ProfileHandle)
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     PVOID TempLockedBuffer;
     NTSTATUS Status;
-  
+
     PAGED_CODE();
 
     /* Get the Object */
@@ -296,37 +296,37 @@ NtStartProfile(IN HANDLE ProfileHandle)
                                        (PVOID*)&Profile,
                                        NULL);
     if (!NT_SUCCESS(Status)) return(Status);
-    
+
     /* To avoid a Race, wait on the Mutex */
-    KeWaitForSingleObject(&ExpProfileMutex, 
+    KeWaitForSingleObject(&ExpProfileMutex,
                           Executive,
                           KernelMode,
                           FALSE,
                           NULL);
-    
+
     /* The Profile can still be enabled though, so handle that */
     if (Profile->LockedBuffer) {
-    
+
         /* Release our lock, dereference and return */
         KeReleaseMutex(&ExpProfileMutex, FALSE);
         ObDereferenceObject(Profile);
         return STATUS_PROFILING_NOT_STOPPED;
     }
-    
+
     /* Allocate a Kernel Profile Object. */
-    KeProfile = ExAllocatePoolWithTag(NonPagedPool, 
+    KeProfile = ExAllocatePoolWithTag(NonPagedPool,
                                       sizeof(EPROFILE),
                                       TAG('P', 'r', 'o', 'f'));
-   
+
     /* Allocate the Mdl Structure */
     Profile->Mdl = MmCreateMdl(NULL, Profile->Buffer, Profile->BufferSize);
-    
+
     /* Probe and Lock for Write Access */
     MmProbeAndLockPages(Profile->Mdl, PreviousMode, IoWriteAccess);
-    
+
     /* Map the pages */
     TempLockedBuffer = MmMapLockedPages(Profile->Mdl, KernelMode);
-    
+
     /* Initialize the Kernel Profile Object */
     Profile->KeProfile = KeProfile;
     KeInitializeProfile(KeProfile,
@@ -336,13 +336,13 @@ NtStartProfile(IN HANDLE ProfileHandle)
                         Profile->BucketSize,
                         Profile->ProfileSource,
                         Profile->Affinity);
-    
+
     /* Start the Profiling */
     KeStartProfile(KeProfile, TempLockedBuffer);
-    
+
     /* Now it's safe to save this */
     Profile->LockedBuffer = TempLockedBuffer;
-    
+
     /* Release mutex, dereference and return */
     KeReleaseMutex(&ExpProfileMutex, FALSE);
     ObDereferenceObject(Profile);
@@ -350,13 +350,13 @@ NtStartProfile(IN HANDLE ProfileHandle)
 }
 
 NTSTATUS
-STDCALL 
+STDCALL
 NtStopProfile(IN HANDLE ProfileHandle)
 {
     PEPROFILE Profile;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status;
-  
+
     PAGED_CODE();
 
     /* Get the Object */
@@ -367,32 +367,32 @@ NtStopProfile(IN HANDLE ProfileHandle)
                                        (PVOID*)&Profile,
                                        NULL);
     if (!NT_SUCCESS(Status)) return(Status);
-    
+
     /* Get the Mutex */
-    KeWaitForSingleObject(&ExpProfileMutex, 
+    KeWaitForSingleObject(&ExpProfileMutex,
                           Executive,
                           KernelMode,
                           FALSE,
                           NULL);
-    
+
     /* Make sure the Profile Object is really Started */
     if (!Profile->LockedBuffer) {
-    
+
         Status = STATUS_PROFILING_NOT_STARTED;
         goto Exit;
     }
-    
+
     /* Stop the Profile */
     KeStopProfile(Profile->KeProfile);
-    
+
     /* Unlock the Buffer */
     MmUnmapLockedPages(Profile->LockedBuffer, Profile->Mdl);
     MmUnlockPages(Profile->Mdl);
     ExFreePool(Profile->KeProfile);
-    
+
     /* Clear the Locked Buffer pointer, meaning the Object is Stopped */
     Profile->LockedBuffer = NULL;
-    
+
 Exit:
     /* Release Mutex, Dereference and Return */
     KeReleaseMutex(&ExpProfileMutex, FALSE);
@@ -400,60 +400,60 @@ Exit:
     return Status;
 }
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtQueryIntervalProfile(IN  KPROFILE_SOURCE ProfileSource,
                        OUT PULONG Interval)
 {
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     ULONG ReturnInterval;
     NTSTATUS Status = STATUS_SUCCESS;
-  
+
     PAGED_CODE();
-    
+
     /* Check the Parameters for validity */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(Interval,
                           sizeof(ULONG),
                           sizeof(ULONG));
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
         } _SEH_END;
-    
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-  
+
     /* Query the Interval */
     ReturnInterval = KeQueryIntervalProfile(ProfileSource);
 
     /* Return the data */
     _SEH_TRY  {
-        
+
         *Interval = ReturnInterval;
-        
+
     } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-        
+
         Status = _SEH_GetExceptionCode();
-        
+
     } _SEH_END;
-    
-    /* Return Success */  
+
+    /* Return Success */
     return STATUS_SUCCESS;
 }
 
-NTSTATUS 
-STDCALL 
+NTSTATUS
+STDCALL
 NtSetIntervalProfile(IN ULONG Interval,
                      IN KPROFILE_SOURCE Source)
 {
     /* Let the Kernel do the job */
     KeSetIntervalProfile(Interval, Source);
-    
+
     /* Nothing can go wrong */
     return STATUS_SUCCESS;
 }
index 2da0c97..ac33636 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/resource.c
  * PURPOSE:         Resource synchronization construct
- * 
+ *
  * PROGRAMMERS:     No programmer listed.
  */
 
@@ -105,18 +105,18 @@ ExAcquireResourceExclusiveLite (
  */
 {
    KIRQL oldIrql;
-   
+
    DPRINT("ExAcquireResourceExclusiveLite(Resource %x, Wait %d)\n",
          Resource, Wait);
-   
+
    ASSERT_IRQL_LESS(DISPATCH_LEVEL);
-   
+
 /* undefed for now, since cdfs must be fixed first */
-#if 0    
-   /* At least regular kmode APC's must be disabled 
+#if 0
+   /* At least regular kmode APC's must be disabled
     * Note that this requirement is missing in old DDK's */
    ASSERT(KeGetCurrentThread() == NULL || /* <-Early in the boot process the current thread is obseved to be NULL */
-          KeGetCurrentThread()->KernelApcDisable || 
+          KeGetCurrentThread()->KernelApcDisable ||
           KeGetCurrentIrql() == APC_LEVEL);
 #endif
 
@@ -139,17 +139,17 @@ ExAcquireResourceExclusiveLite (
        DPRINT("ExAcquireResourceExclusiveLite() = FALSE\n");
        return(FALSE);
      }
-   
-   /* 
+
+   /*
     * This is slightly better than it looks because other exclusive
     * threads who are waiting won't be woken up but there is a race
     * with new threads trying to grab the resource so we must have
     * the spinlock, still normally this loop will only be executed
     * once
-    * NOTE: We might want to set a timeout to detect deadlock 
+    * NOTE: We might want to set a timeout to detect deadlock
     * (10 minutes?)
     */
-   while (Resource->ActiveCount) 
+   while (Resource->ActiveCount)
      {
        Resource->NumberOfExclusiveWaiters++;
        KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
@@ -181,7 +181,7 @@ static BOOLEAN EiRemoveSharedOwner(PERESOURCE Resource,
  */
 {
    ULONG i;
-   
+
    if (Resource->OwnerThreads[1].OwnerThread == ResourceThreadId)
      {
     Resource->OwnerThreads[1].OwnerCount--;
@@ -192,13 +192,13 @@ static BOOLEAN EiRemoveSharedOwner(PERESOURCE Resource,
          }
        return(TRUE);
      }
-   
-   if (Resource->OwnerThreads[1].OwnerThread) 
+
+   if (Resource->OwnerThreads[1].OwnerThread)
      {
        /* Oh dear, the caller didn't own the resource after all */
-       return(FALSE);;
+       return(FALSE);
      }
-   
+
    for (i=0; i<Resource->OwnerThreads[1].TableSize; i++)
      {
        if (Resource->OwnerTable[i].OwnerThread == ResourceThreadId)
@@ -227,10 +227,10 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
    ERESOURCE_THREAD CurrentThread = ExGetCurrentResourceThread();
    POWNER_ENTRY freeEntry;
    ULONG i = 0;
-   
+
    DPRINT("EiAddSharedOwner(Resource %x)\n", Resource);
-   
-   if (Resource->ActiveCount == 0) 
+
+   if (Resource->ActiveCount == 0)
      {
        /* no owner, it's easy */
        Resource->OwnerThreads[1].OwnerThread = ExGetCurrentResourceThread();
@@ -244,19 +244,19 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
        DPRINT("EiAddSharedOwner() = TRUE\n");
        return(TRUE);
      }
-   
-   /* 
-    * now, we must search if this thread has already acquired this resource 
-    * then increase ownercount if found, else create new entry or reuse free 
+
+   /*
+    * now, we must search if this thread has already acquired this resource
+    * then increase ownercount if found, else create new entry or reuse free
     * entry
     */
    if (Resource->OwnerTable == NULL)
      {
        DPRINT("Creating owner table\n");
-       
+
        /* allocate ownertable,memset to 0, initialize first entry */
-       Resource->OwnerTable = 
-         ExAllocatePoolWithTag(NonPagedPool, sizeof(OWNER_ENTRY)*3, 
+       Resource->OwnerTable =
+         ExAllocatePoolWithTag(NonPagedPool, sizeof(OWNER_ENTRY)*3,
                                TAG_OWNER_TABLE);
        if (Resource->OwnerTable == NULL)
          {
@@ -266,22 +266,22 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
        memset(Resource->OwnerTable,0,sizeof(OWNER_ENTRY)*3);
        memcpy(&Resource->OwnerTable[0], &Resource->OwnerThreads[1],
               sizeof(OWNER_ENTRY));
-       
+
        Resource->OwnerThreads[1].OwnerThread = 0;
     Resource->OwnerThreads[1].TableSize = 3;
-       
+
        Resource->OwnerTable[1].OwnerThread = CurrentThread;
     Resource->OwnerTable[1].OwnerCount = 1;
         Resource->ActiveCount++;
-       
+
        return(TRUE);
      }
-   
+
    DPRINT("Search free entries\n");
-   
-   DPRINT("Number of entries %d\n", 
+
+   DPRINT("Number of entries %d\n",
       Resource->OwnerThreads[1].TableSize);
-   
+
    freeEntry = NULL;
    for (i=0; i<Resource->OwnerThreads[1].TableSize; i++)
      {
@@ -297,15 +297,15 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
             break;
          }
      }
-   
+
    DPRINT("Found free entry %x\n", freeEntry);
-   
+
    if (!freeEntry)
      {
        DPRINT("Allocating new entry\n");
-       
+
        /* reallocate ownertable with one more entry */
-       freeEntry = 
+       freeEntry =
          ExAllocatePoolWithTag(NonPagedPool,
                                sizeof(OWNER_ENTRY)*
                 (Resource->OwnerThreads[1].TableSize+1),
@@ -351,51 +351,51 @@ ExAcquireResourceSharedLite (
  */
 {
    KIRQL oldIrql;
-   
+
    DPRINT("ExAcquireResourceSharedLite(Resource %x, Wait %d)\n",
          Resource, Wait);
 
    ASSERT_IRQL_LESS(DISPATCH_LEVEL);
-   
+
 /* undefed for now, since cdfs must be fixed first */
-#if 0    
-   /* At least regular kmode APC's must be disabled 
-    * Note that this requirement is missing in old DDK's 
+#if 0
+   /* At least regular kmode APC's must be disabled
+    * Note that this requirement is missing in old DDK's
     */
    ASSERT(KeGetCurrentThread() == NULL || /* <-Early in the boot process the current thread is obseved to be NULL */
-          KeGetCurrentThread()->KernelApcDisable || 
+          KeGetCurrentThread()->KernelApcDisable ||
           KeGetCurrentIrql() == APC_LEVEL);
 #endif
 
    KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
-   
+
    /* first, resolve trivial cases */
-   if (Resource->ActiveCount == 0) 
+   if (Resource->ActiveCount == 0)
      {
        EiAddSharedOwner(Resource);
        KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
        DPRINT("ExAcquireResourceSharedLite() = TRUE\n");
        return(TRUE);
      }
-   
+
    if ((Resource->Flag & ResourceOwnedExclusive)
        && Resource->OwnerThreads[0].OwnerThread==ExGetCurrentResourceThread())
      {
        /* exclusive, but by same thread : it's ok */
-       /* 
-        * NOTE: Is this correct? Seems the same as ExConvertExclusiveToShared 
+       /*
+        * NOTE: Is this correct? Seems the same as ExConvertExclusiveToShared
         */
     Resource->OwnerThreads[0].OwnerCount++;
        KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
        DPRINT("ExAcquireResourceSharedLite() = TRUE\n");
        return(TRUE);
      }
-   
+
    if ((Resource->Flag & ResourceOwnedExclusive)
        || Resource->NumberOfExclusiveWaiters)
-     { 
+     {
        /* exclusive by another thread , or thread waiting for exclusive */
-       if (!Wait) 
+       if (!Wait)
          {
             KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
             DPRINT("ExAcquireResourceSharedLite() = FALSE\n");
@@ -417,7 +417,7 @@ ExAcquireResourceSharedLite (
            Resource->NumberOfSharedWaiters--;
          }
      }
-   
+
    EiAddSharedOwner(Resource);
    KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
    DPRINT("ExAcquireResourceSharedLite() = TRUE\n");
@@ -443,13 +443,13 @@ ExConvertExclusiveToSharedLite (
 {
    ULONG oldWaiters;
    KIRQL oldIrql;
-   
+
    DPRINT("ExConvertExclusiveToSharedLite(Resource %x)\n", Resource);
-   
+
    KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
-   
+
    oldWaiters = Resource->NumberOfSharedWaiters;
-   
+
    if (!(Resource->Flag & ResourceOwnedExclusive))
      {
        /* Might not be what the caller expects, better bug check */
@@ -457,7 +457,7 @@ ExConvertExclusiveToSharedLite (
        KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
        return;
      }
-   
+
    //transfer infos from entry 0 to entry 1 and erase entry 0
    Resource->OwnerThreads[1].OwnerThread=Resource->OwnerThreads[0].OwnerThread;
    Resource->OwnerThreads[1].OwnerCount=Resource->OwnerThreads[0].OwnerCount;
@@ -466,7 +466,7 @@ ExConvertExclusiveToSharedLite (
    /* erase exclusive flag */
    Resource->Flag &= (~ResourceOwnedExclusive);
    /* if no shared waiters, that's all */
-   if (!oldWaiters) 
+   if (!oldWaiters)
      {
        KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
        return;
@@ -524,14 +524,14 @@ ExAcquireSharedStarveExclusive (
  */
 {
    KIRQL oldIrql;
-   
+
    DPRINT("ExAcquireSharedStarveExclusive(Resource %x, Wait %d)\n",
          Resource, Wait);
-   
+
    KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
-   
+
    /* no owner, it's easy */
-   if (Resource->ActiveCount == 0) 
+   if (Resource->ActiveCount == 0)
      {
        Resource->OwnerThreads[1].OwnerThread=ExGetCurrentResourceThread();
     Resource->OwnerThreads[1].OwnerCount=1;
@@ -540,21 +540,21 @@ ExAcquireSharedStarveExclusive (
        DPRINT("ExAcquireSharedStarveExclusive() = TRUE\n");
        return(TRUE);
      }
-   
+
    if ((Resource->Flag & ResourceOwnedExclusive)
        &&  Resource->OwnerThreads[0].OwnerThread==ExGetCurrentResourceThread())
-     { 
+     {
        /* exclusive, but by same thread : it's ok */
     Resource->OwnerThreads[0].OwnerCount++;
        KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
        DPRINT("ExAcquireSharedStarveExclusive() = TRUE\n");
        return(TRUE);
      }
-   
+
    if (Resource->Flag & ResourceOwnedExclusive)
-     { 
+     {
        /* exclusive by another thread */
-       if (!Wait) 
+       if (!Wait)
          {
             KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
             DPRINT("ExAcquireSharedStarveExclusive() = FALSE\n");
@@ -620,7 +620,7 @@ ExDeleteResourceLite (
    if (Resource->OwnerTable) ExFreePool(Resource->OwnerTable);
    if (Resource->SharedWaiters) ExFreePool(Resource->SharedWaiters);
    if (Resource->ExclusiveWaiters) ExFreePool(Resource->ExclusiveWaiters);
-   return(STATUS_SUCCESS);;
+   return(STATUS_SUCCESS);
 }
 
 /*
@@ -664,12 +664,12 @@ ExInitializeResourceLite (PERESOURCE      Resource)
    Resource->NumberOfExclusiveWaiters = 0;
    KeInitializeSpinLock(&Resource->SpinLock);
    Resource->Flag = 0;
-   Resource->ExclusiveWaiters = 
+   Resource->ExclusiveWaiters =
      ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_EXCLUSIVE_LOCK);
    KeInitializeEvent(Resource->ExclusiveWaiters,
                     SynchronizationEvent,
                     FALSE);
-   Resource->SharedWaiters = 
+   Resource->SharedWaiters =
      ExAllocatePoolWithTag(NonPagedPool ,sizeof(KSEMAPHORE), TAG_SHARED_SEM);
    KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff);
    Resource->ActiveCount = 0;
@@ -707,8 +707,8 @@ ExIsResourceAcquiredExclusiveLite (
 /*
  * @implemented
  */
+
+
 //NTOSAPI
 //DDKAPI
 USHORT STDCALL
@@ -721,7 +721,7 @@ ExIsResourceAcquiredSharedLite(
  *      Resource = Points to the resource to be queried
  * RETURNS: The number of times the caller has acquired shared access to the
  *          given resource
- */ 
+ */
 {
    ULONG i;
    if (Resource->OwnerThreads[0].OwnerThread == ExGetCurrentResourceThread())
@@ -732,7 +732,7 @@ ExIsResourceAcquiredSharedLite(
      {
     return (USHORT)(Resource->OwnerThreads[1].OwnerCount);
      }
-   if (!Resource->OwnerThreads[1].TableSize) 
+   if (!Resource->OwnerThreads[1].TableSize)
      {
        return(0);
      }
@@ -763,7 +763,7 @@ ExReinitializeResourceLite (
                     FALSE);
    KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff);
    Resource->ActiveCount = 0;
-   if (Resource->OwnerTable) 
+   if (Resource->OwnerTable)
      {
        ExFreePool(Resource->OwnerTable);
      }
@@ -827,18 +827,18 @@ ExReleaseResourceForThreadLite (
  */
 {
    KIRQL oldIrql;
-   
+
    DPRINT("ExReleaseResourceForThreadLite(Resource %x, ResourceThreadId %x)\n",
          Resource, ResourceThreadId);
-   
+
    ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
-   
+
    KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
-   
+
    if (Resource->Flag & ResourceOwnedExclusive)
      {
        DPRINT("Releasing from exclusive access\n");
-       
+
     Resource->OwnerThreads[0].OwnerCount--;
     if (Resource->OwnerThreads[0].OwnerCount > 0)
          {
@@ -846,7 +846,7 @@ ExReleaseResourceForThreadLite (
             DPRINT("ExReleaseResourceForThreadLite() finished\n");
             return;
          }
-       
+
        Resource->OwnerThreads[0].OwnerThread = 0;
        Resource->ActiveCount--;
        Resource->Flag &=(~ResourceOwnedExclusive);
@@ -856,8 +856,8 @@ ExReleaseResourceForThreadLite (
        if (Resource->NumberOfExclusiveWaiters)
          {
             /* get resource to first exclusive waiter */
-            KeSetEvent(Resource->ExclusiveWaiters, 
-                       IO_NO_INCREMENT, 
+            KeSetEvent(Resource->ExclusiveWaiters,
+                       IO_NO_INCREMENT,
                        FALSE);
             KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
             DPRINT("ExReleaseResourceForThreadLite() finished\n");
@@ -877,20 +877,20 @@ ExReleaseResourceForThreadLite (
        DPRINT("ExReleaseResourceForThreadLite() finished\n");
        return;
      }
-  
+
    EiRemoveSharedOwner(Resource, ResourceThreadId);
-   
+
    if (Resource->ActiveCount == 0)
      {
        if (Resource->NumberOfExclusiveWaiters)
-         { 
+         {
             /* get resource to first exclusive waiter */
             KeSetEvent(Resource->ExclusiveWaiters,
                        IO_NO_INCREMENT,
                        FALSE);
          }
      }
-     
+
    KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
    DPRINT("ExReleaseResourceForThreadLite() finished\n");
 }
@@ -909,52 +909,52 @@ ExSetResourceOwnerPointer (
     PKTHREAD CurrentThread;
     KIRQL OldIrql;
     POWNER_ENTRY OwnerEntry;
-    
+
     CurrentThread = KeGetCurrentThread();
-    
+
     /* Lock the resource */
     KeAcquireSpinLock(&Resource->SpinLock, &OldIrql);
-    
+
     /* Check if it's exclusive */
     if (Resource->Flag & ResourceOwnedExclusive) {
-        
+
         /* If it's exclusive, set the first entry no matter what */
         Resource->OwnerThreads[0].OwnerThread = (ULONG_PTR)OwnerPointer;
-        
+
     } else {
-        
+
         /* Check both entries and see which one matches the current thread */
         if (Resource->OwnerThreads[0].OwnerThread == (ULONG_PTR)CurrentThread) {
-            
+
             Resource->OwnerThreads[0].OwnerThread = (ULONG_PTR)OwnerPointer;
-            
+
         } else if (Resource->OwnerThreads[1].OwnerThread == (ULONG_PTR)CurrentThread) {
-            
+
             Resource->OwnerThreads[1].OwnerThread = (ULONG_PTR)OwnerPointer;
-            
+
         } else { /* None of the entries match, so we need to do a lookup */
-            
+
             /* Get the first Entry */
             OwnerEntry = Resource->OwnerTable;
-            
+
             /* Check if the Current Thread is in the Resource Table Entry */
-            if ((CurrentThread->ResourceIndex >= OwnerEntry->TableSize) || 
+            if ((CurrentThread->ResourceIndex >= OwnerEntry->TableSize) ||
                 (OwnerEntry[CurrentThread->ResourceIndex].OwnerThread != (ULONG_PTR)CurrentThread)) {
-                
+
                 /* Loop until we find the current thread in an entry */
                 for (;OwnerEntry->OwnerThread == (ULONG_PTR)CurrentThread;OwnerEntry++);
-                
+
             } else {
-            
+
                 /* It's in the current RTE, so set it */
                 OwnerEntry = &OwnerEntry[CurrentThread->ResourceIndex];
             }
-     
-            /* Now that we went to the right entry, set the Owner Pointer */       
+
+            /* Now that we went to the right entry, set the Owner Pointer */
             OwnerEntry->OwnerThread = (ULONG_PTR)OwnerPointer;
         }
     }
-    
+
     /* Release the resource */
     KeReleaseSpinLock(&Resource->SpinLock, OldIrql);
 }
index 580d9bb..4b5a54e 100644 (file)
@@ -3,7 +3,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/rundown.c
  * PURPOSE:         Rundown Protection Functions
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu & Thomas Weidenmueller - Implementation
  */
 
@@ -39,16 +39,16 @@ ExAcquireRundownProtectionEx (
     )
 {
     ULONG_PTR PrevCount, Current;
-    
+
     PAGED_CODE();
-    
+
     Count <<= EX_RUNDOWN_COUNT_SHIFT;
-    
+
     /* Loop until successfully incremented the counter */
     do
     {
         Current = RunRef->Count;
-        
+
         /* Make sure a rundown is not active */
         if (Current & EX_RUNDOWN_ACTIVE)
         {
@@ -76,7 +76,7 @@ ExInitializeRundownProtection (
     )
 {
     PAGED_CODE();
-    
+
     /* Set the count to zero */
     RunRef->Count = 0;
 }
@@ -91,7 +91,7 @@ ExReInitializeRundownProtection (
     )
 {
     PAGED_CODE();
-    
+
     /* Reset the count */
 #ifdef _WIN64
     InterlockedExchangeAdd64((LONGLONG*)&RunRef->Count, 0LL);
@@ -114,23 +114,23 @@ ExReleaseRundownProtectionEx (
     PAGED_CODE();
 
     Count <<= EX_RUNDOWN_COUNT_SHIFT;
-    
+
     for (;;)
     {
         ULONG_PTR Current = RunRef->Count;
-        
+
         /* Check if Rundown is active */
         if (Current & EX_RUNDOWN_ACTIVE)
         {
             /* Get Pointer */
             PRUNDOWN_DESCRIPTOR RundownDescriptor = (PRUNDOWN_DESCRIPTOR)(Current & ~EX_RUNDOWN_ACTIVE);
-            
+
             if (RundownDescriptor == NULL)
             {
                 /* the rundown was completed and there's no one to notify */
                 break;
             }
-            
+
             Current = RundownDescriptor->References;
 
             /* Decrease RundownDescriptor->References by Count references */
@@ -162,10 +162,10 @@ ExReleaseRundownProtectionEx (
                     /* Successfully decremented the counter, so bail! */
                     break;
                 }
-                
+
                 Current = PrevCount;
             }
-            
+
             break;
         }
         else
@@ -208,7 +208,7 @@ ExRundownCompleted (
     )
 {
     PAGED_CODE();
-    
+
     /* mark the counter as active */
 #ifdef _WIN64
     InterlockedExchange64((LONGLONG*)&RunRef->Count, (LONGLONG)EX_RUNDOWN_ACTIVE);
@@ -228,11 +228,11 @@ ExWaitForRundownProtectionRelease (
 {
     ULONG_PTR PrevCount, NewPtr, PrevPtr;
     RUNDOWN_DESCRIPTOR RundownDescriptor;
-    
+
     PAGED_CODE();
-    
+
     PrevCount = RunRef->Count;
-    
+
     if (PrevCount != 0 && !(PrevCount & EX_RUNDOWN_ACTIVE))
     {
         /* save the reference counter */
@@ -240,11 +240,11 @@ ExWaitForRundownProtectionRelease (
 
         /* Pending references... wait on them to be closed with an event */
         KeInitializeEvent(&RundownDescriptor.RundownEvent, NotificationEvent, FALSE);
-        
+
         ASSERT(!((ULONG_PTR)&RundownDescriptor & EX_RUNDOWN_ACTIVE));
-        
+
         NewPtr = (ULONG_PTR)&RundownDescriptor | EX_RUNDOWN_ACTIVE;
-        
+
         for (;;)
         {
 #ifdef _WIN64
@@ -263,9 +263,9 @@ ExWaitForRundownProtectionRelease (
                 /* some one else was faster, let's just bail */
                 break;
             }
-            
+
             PrevCount = PrevPtr;
-            
+
             /* save the changed reference counter and try again */
             RundownDescriptor.References = PrevCount >> EX_RUNDOWN_COUNT_SHIFT;
         }
index 5486160..c8d5ece 100644 (file)
@@ -3,7 +3,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/sem.c
  * PURPOSE:         Synchronization primitives
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)- Reformatting, bug fixes.
  *                  David Welch (welch@mcmail.com)
  */
@@ -25,16 +25,16 @@ static GENERIC_MAPPING ExSemaphoreMapping = {
     SEMAPHORE_ALL_ACCESS};
 
 static const INFORMATION_CLASS_INFO ExSemaphoreInfoClass[] = {
-    
+
      /* SemaphoreBasicInformation */
     ICI_SQ_SAME( sizeof(SEMAPHORE_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
 };
 
-VOID 
+VOID
 INIT_FUNCTION
 ExpInitializeSemaphoreImplementation(VOID)
 {
-    
+
     /* Create the Semaphore Object */
     ExSemaphoreObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
     RtlInitUnicodeString(&ExSemaphoreObjectType->TypeName, L"Semaphore");
@@ -62,7 +62,7 @@ ExpInitializeSemaphoreImplementation(VOID)
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
                   IN ACCESS_MASK DesiredAccess,
@@ -74,29 +74,29 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
     HANDLE hSemaphore;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
 
     /* Check Output Safety */
     if(PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(SemaphoreHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Make sure the counts make sense */
     if (!MaximumCount || InitialCount < 0 || InitialCount > MaximumCount) {
-    
+
         DPRINT("Invalid Count Data!\n");
         return STATUS_INVALID_PARAMETER;
     }
@@ -111,15 +111,15 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
                             0,
                             0,
                             (PVOID*)&Semaphore);
-    
+
     /* Check for Success */
     if (NT_SUCCESS(Status)) {
-        
+
         /* Initialize it */
         KeInitializeSemaphore(Semaphore,
                               InitialCount,
                               MaximumCount);
-        
+
         /* Insert it into the Object Tree */
         Status = ObInsertObject((PVOID)Semaphore,
                                 NULL,
@@ -131,15 +131,15 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
 
         /* Check for success and return handle */
         if(NT_SUCCESS(Status)) {
-            
+
             _SEH_TRY {
-                
+
                 *SemaphoreHandle = hSemaphore;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-                
+
             } _SEH_END;
         }
     }
@@ -151,7 +151,7 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
                 IN ACCESS_MASK DesiredAccess,
@@ -160,26 +160,26 @@ NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
     HANDLE hSemaphore;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-   
+
     PAGED_CODE();
 
     /* Check Output Safety */
     if(PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(SemaphoreHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-        
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Open the Object */
     Status = ObOpenObjectByName(ObjectAttributes,
                                 ExSemaphoreObjectType,
@@ -188,18 +188,18 @@ NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
                                 DesiredAccess,
                                 NULL,
                                 &hSemaphore);
-    
+
     /* Check for success and return handle */
     if(NT_SUCCESS(Status)) {
-            
+
         _SEH_TRY {
-            
+
             *SemaphoreHandle = hSemaphore;
-        
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
     }
 
@@ -233,12 +233,12 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
                                 PreviousMode,
                                 &Status);
     if(!NT_SUCCESS(Status)) {
-        
+
         /* Invalid buffers */
         DPRINT("NtQuerySemaphore() failed, Status: 0x%x\n", Status);
         return Status;
     }
-   
+
     /* Get the Object */
     Status = ObReferenceObjectByHandle(SemaphoreHandle,
                                        SEMAPHORE_QUERY_STATE,
@@ -246,27 +246,27 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
                                        PreviousMode,
                                        (PVOID*)&Semaphore,
                                        NULL);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
-   
+
         _SEH_TRY {
-            
+
             PSEMAPHORE_BASIC_INFORMATION BasicInfo = (PSEMAPHORE_BASIC_INFORMATION)SemaphoreInformation;
-            
+
             /* Return the basic information */
             BasicInfo->CurrentCount = KeReadStateSemaphore(Semaphore);
             BasicInfo->MaximumCount = Semaphore->Limit;
 
             /* Return length */
             if(ReturnLength) *ReturnLength = sizeof(SEMAPHORE_BASIC_INFORMATION);
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
-     
+
         /* Dereference the Object */
         ObDereferenceObject(Semaphore);
    }
@@ -278,7 +278,7 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
 /*
  * @implemented
  */
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
                    IN LONG ReleaseCount,
@@ -286,34 +286,34 @@ NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
 {
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     PKSEMAPHORE Semaphore;
-    NTSTATUS Status = STATUS_SUCCESS; 
-   
+    NTSTATUS Status = STATUS_SUCCESS;
+
     PAGED_CODE();
-    
+
     /* Check buffer validity */
     if(PreviousCount != NULL && PreviousMode == UserMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(PreviousCount,
                           sizeof(LONG),
                           sizeof(ULONG));
          } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-             
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
 
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
+
     /* Make sure count makes sense */
     if (!ReleaseCount) {
-    
+
         DPRINT("Invalid Release Count\n");
         return STATUS_INVALID_PARAMETER;
     }
-   
+
     /* Get the Object */
     Status = ObReferenceObjectByHandle(SemaphoreHandle,
                                        SEMAPHORE_MODIFY_STATE,
@@ -321,28 +321,28 @@ NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
                                        PreviousMode,
                                        (PVOID*)&Semaphore,
                                        NULL);
-    
+
     /* Check for success */
     if (NT_SUCCESS(Status)) {
-        
+
         /* Release the semaphore */
         LONG PrevCount = KeReleaseSemaphore(Semaphore,
                                             IO_NO_INCREMENT,
                                             ReleaseCount,
                                             FALSE);
         ObDereferenceObject(Semaphore);
-     
-        /* Return it */        
+
+        /* Return it */
         if(PreviousCount) {
-            
+
             _SEH_TRY {
-                
+
                 *PreviousCount = PrevCount;
-            
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-            
+
             } _SEH_END;
         }
     }
index ade25c7..f74d7b1 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id:$
- * 
+/* $Id$
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/synch.c
index 514cff7..6ee4693 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/sysinfo.c
  * PURPOSE:         System information functions
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@mcmail.com)
  *                  Aleksey Bragin (aleksey@studiocerebral.com)
  */
@@ -84,7 +84,7 @@ ExGetCurrentProcessorCounts (
 /*
  * @implemented
  */
-BOOLEAN 
+BOOLEAN
 STDCALL
 ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
 {
@@ -109,11 +109,11 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
   UNICODE_STRING WValue;
   KPROCESSOR_MODE PreviousMode;
   NTSTATUS Status = STATUS_SUCCESS;
-  
+
   PAGED_CODE();
-  
+
   PreviousMode = ExGetPreviousMode();
-  
+
   if(PreviousMode != KernelMode)
   {
     _SEH_TRY
@@ -136,7 +136,7 @@ NtQuerySystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
       Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
-    
+
     if(!NT_SUCCESS(Status))
     {
       return Status;
@@ -165,7 +165,7 @@ NtQuerySystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
       DPRINT1("NtQuerySystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
       return STATUS_PRIVILEGE_NOT_HELD;
     }
-    
+
     /*
      * convert the value name to ansi
      */
@@ -177,7 +177,7 @@ NtQuerySystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
     {
       return Status;
     }
-    
+
   /*
    * Create a temporary buffer for the value
    */
@@ -187,7 +187,7 @@ NtQuerySystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
       RtlFreeAnsiString(&AName);
       return STATUS_INSUFFICIENT_RESOURCES;
     }
-    
+
     /*
      * Get the environment variable
      */
@@ -198,7 +198,7 @@ NtQuerySystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
       ExFreePool(Value);
       return STATUS_UNSUCCESSFUL;
     }
-    
+
     /*
      * Convert the result to UNICODE, protect with SEH in case the value buffer
      * isn't NULL-terminated!
@@ -236,7 +236,7 @@ NtQuerySystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
       }
       _SEH_END;
     }
-    
+
     /*
      * Cleanup allocated resources.
      */
@@ -256,11 +256,11 @@ NtSetSystemEnvironmentValue (IN   PUNICODE_STRING VariableName,
   ANSI_STRING AName, AValue;
   KPROCESSOR_MODE PreviousMode;
   NTSTATUS Status;
-  
+
   PAGED_CODE();
 
   PreviousMode = ExGetPreviousMode();
-  
+
   /*
    * Copy the strings to kernel space if necessary
    */
@@ -309,7 +309,7 @@ NtSetSystemEnvironmentValue (IN     PUNICODE_STRING VariableName,
         DPRINT1("NtSetSystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
         Status = STATUS_PRIVILEGE_NOT_HELD;
       }
-      
+
       RtlReleaseCapturedUnicodeString(&CapturedValue,
                                      PreviousMode,
                                      FALSE);
@@ -319,7 +319,7 @@ NtSetSystemEnvironmentValue (IN     PUNICODE_STRING VariableName,
                                    PreviousMode,
                                    FALSE);
   }
-  
+
   return Status;
 }
 
@@ -342,12 +342,12 @@ static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)
 /* Class 0 - Basic Information */
 QSI_DEF(SystemBasicInformation)
 {
-       PSYSTEM_BASIC_INFORMATION Sbi 
+       PSYSTEM_BASIC_INFORMATION Sbi
                = (PSYSTEM_BASIC_INFORMATION) Buffer;
 
        *ReqSize = sizeof (SYSTEM_BASIC_INFORMATION);
        /*
-        * Check user buffer's size 
+        * Check user buffer's size
         */
        if (Size < sizeof (SYSTEM_BASIC_INFORMATION))
        {
@@ -357,7 +357,7 @@ QSI_DEF(SystemBasicInformation)
        Sbi->MaximumIncrement = KeMaximumIncrement;
        Sbi->PhysicalPageSize = PAGE_SIZE;
        Sbi->NumberOfPhysicalPages = MmStats.NrTotalPages;
-       Sbi->LowestPhysicalPage = 0; /* FIXME */ 
+       Sbi->LowestPhysicalPage = 0; /* FIXME */
        Sbi->HighestPhysicalPage = MmStats.NrTotalPages; /* FIXME */
        Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
        Sbi->LowestUserAddress = 0x10000; /* Top of 64k */
@@ -370,12 +370,12 @@ QSI_DEF(SystemBasicInformation)
 /* Class 1 - Processor Information */
 QSI_DEF(SystemProcessorInformation)
 {
-       PSYSTEM_PROCESSOR_INFORMATION Spi 
+       PSYSTEM_PROCESSOR_INFORMATION Spi
                = (PSYSTEM_PROCESSOR_INFORMATION) Buffer;
        PKPRCB Prcb;
        *ReqSize = sizeof (SYSTEM_PROCESSOR_INFORMATION);
        /*
-        * Check user buffer's size 
+        * Check user buffer's size
         */
        if (Size < sizeof (SYSTEM_PROCESSOR_INFORMATION))
        {
@@ -397,22 +397,22 @@ QSI_DEF(SystemProcessorInformation)
 /* Class 2 - Performance Information */
 QSI_DEF(SystemPerformanceInformation)
 {
-       PSYSTEM_PERFORMANCE_INFORMATION Spi 
+       PSYSTEM_PERFORMANCE_INFORMATION Spi
                = (PSYSTEM_PERFORMANCE_INFORMATION) Buffer;
 
        PEPROCESS TheIdleProcess;
-       
+
        *ReqSize = sizeof (SYSTEM_PERFORMANCE_INFORMATION);
        /*
-        * Check user buffer's size 
+        * Check user buffer's size
         */
        if (Size < sizeof (SYSTEM_PERFORMANCE_INFORMATION))
        {
                return (STATUS_INFO_LENGTH_MISMATCH);
        }
-       
+
        TheIdleProcess = PsIdleProcess;
-       
+
        Spi->IdleTime.QuadPart = TheIdleProcess->Pcb.KernelTime * 100000LL;
 
        Spi->ReadTransferCount.QuadPart = IoReadTransferCount;
@@ -463,9 +463,9 @@ QSI_DEF(SystemPerformanceInformation)
        Spi->NonPagedPoolFrees = 0; /* FIXME */
 
        Spi->TotalFreeSystemPtes = 0; /* FIXME */
-       
+
        Spi->SystemCodePage = MmStats.NrSystemPages; /* FIXME */
-       
+
        Spi->TotalSystemDriverPages = 0; /* FIXME */
        Spi->TotalSystemCodePages = 0; /* FIXME */
        Spi->SmallNonPagedLookasideListAllocateHits = 0; /* FIXME */
@@ -571,7 +571,7 @@ QSI_DEF(SystemProcessInformation)
        {
                return (STATUS_INFO_LENGTH_MISMATCH); // in case buffer size is too small
        }
-       
+
        syspr = PsGetNextProcess(NULL);
        pr = syspr;
        pCur = (unsigned char *)Spi;
@@ -611,7 +611,7 @@ QSI_DEF(SystemProcessInformation)
                SpiCur->NextEntryOffset = curSize+inLen; // relative offset to the beginnnig of the next structure
                SpiCur->NumberOfThreads = nThreads;
                SpiCur->CreateTime = pr->CreateTime;
-               SpiCur->UserTime.QuadPart = pr->Pcb.UserTime * 100000LL; 
+               SpiCur->UserTime.QuadPart = pr->Pcb.UserTime * 100000LL;
                SpiCur->KernelTime.QuadPart = pr->Pcb.KernelTime * 100000LL;
                SpiCur->ImageName.Length = strlen(pr->ImageFileName) * sizeof(WCHAR);
                SpiCur->ImageName.MaximumLength = inLen;
@@ -665,7 +665,7 @@ QSI_DEF(SystemProcessInformation)
                  i++;
                  current_entry = current_entry->Flink;
                }
-               
+
                pr = PsGetNextProcess(pr);
         nThreads = 0;
                if ((pr == syspr) || (pr == NULL))
@@ -676,7 +676,7 @@ QSI_DEF(SystemProcessInformation)
                else
                        pCur = pCur + curSize + inLen;
        }  while ((pr != syspr) && (pr != NULL));
-       
+
        if(pr != NULL)
        {
           ObDereferenceObject(pr);
@@ -697,13 +697,13 @@ QSI_DEF(SystemCallCountInformation)
 /* Class 7 - Device Information */
 QSI_DEF(SystemDeviceInformation)
 {
-       PSYSTEM_DEVICE_INFORMATION Sdi 
+       PSYSTEM_DEVICE_INFORMATION Sdi
                = (PSYSTEM_DEVICE_INFORMATION) Buffer;
        PCONFIGURATION_INFORMATION ConfigInfo;
 
        *ReqSize = sizeof (SYSTEM_DEVICE_INFORMATION);
        /*
-        * Check user buffer's size 
+        * Check user buffer's size
         */
        if (Size < sizeof (SYSTEM_DEVICE_INFORMATION))
        {
@@ -734,7 +734,7 @@ QSI_DEF(SystemProcessorPerformanceInformation)
 
        *ReqSize = KeNumberProcessors * sizeof (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
        /*
-        * Check user buffer's size 
+        * Check user buffer's size
         */
        if (Size < KeNumberProcessors * sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION))
        {
@@ -754,7 +754,7 @@ QSI_DEF(SystemProcessorPerformanceInformation)
           Spi++;
           Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
        }
-     
+
        return (STATUS_SUCCESS);
 }
 
@@ -835,7 +835,7 @@ ObpGetNextHandleByProcessCount(PSYSTEM_HANDLE_TABLE_ENTRY_INFO pshi,
 /* Class 16 - Handle Information */
 QSI_DEF(SystemHandleInformation)
 {
-        PSYSTEM_HANDLE_INFORMATION Shi = 
+        PSYSTEM_HANDLE_INFORMATION Shi =
                (PSYSTEM_HANDLE_INFORMATION) Buffer;
 
         DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
@@ -851,7 +851,7 @@ QSI_DEF(SystemHandleInformation)
        PEPROCESS pr, syspr;
        int curSize, i = 0;
        ULONG hCount = 0;
-               
+
         /* First Calc Size from Count. */
         syspr = PsGetNextProcess(NULL);
        pr = syspr;
@@ -864,7 +864,7 @@ QSI_DEF(SystemHandleInformation)
            if ((pr == syspr) || (pr == NULL))
                break;
         } while ((pr != syspr) && (pr != NULL));
-        
+
        if(pr != NULL)
        {
           ObDereferenceObject(pr);
@@ -873,7 +873,7 @@ QSI_DEF(SystemHandleInformation)
        DPRINT("SystemHandleInformation 2\n");
 
         curSize = sizeof(SYSTEM_HANDLE_INFORMATION)+
-                  (  (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) - 
+                  (  (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) -
                      (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) ));
 
         Shi->NumberOfHandles = hCount;
@@ -921,7 +921,7 @@ QSI_DEF(SystemHandleInformation)
 /*
 SSI_DEF(SystemHandleInformation)
 {
-       
+
        return (STATUS_SUCCESS);
 }
 */
@@ -985,9 +985,9 @@ QSI_DEF(SystemFileCacheInformation)
                return (STATUS_INFO_LENGTH_MISMATCH);
        }
        /* Return the Byte size not the page size. */
-       Sci->CurrentSize = 
+       Sci->CurrentSize =
                MiMemoryConsumers[MC_CACHE].PagesUsed * PAGE_SIZE;
-       Sci->PeakSize = 
+       Sci->PeakSize =
                MiMemoryConsumers[MC_CACHE].PagesUsed * PAGE_SIZE; /* FIXME */
 
        Sci->PageFaultCount = 0; /* FIXME */
@@ -1025,14 +1025,14 @@ QSI_DEF(SystemInterruptInformation)
   UINT i;
   ULONG ti;
   PSYSTEM_INTERRUPT_INFORMATION sii = (PSYSTEM_INTERRUPT_INFORMATION)Buffer;
-  
+
   if(Size < KeNumberProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION))
   {
     return (STATUS_INFO_LENGTH_MISMATCH);
   }
-  
+
   ti = KeQueryTimeIncrement();
-  
+
   Prcb = ((PKPCR)KPCR_BASE)->Prcb;
   for (i = 0; i < KeNumberProcessors; i++)
   {
@@ -1045,7 +1045,7 @@ QSI_DEF(SystemInterruptInformation)
     sii++;
     Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
   }
-  
+
   return STATUS_SUCCESS;
 }
 
@@ -1090,7 +1090,7 @@ QSI_DEF(SystemFullMemoryInformation)
 #ifndef NDEBUG
        MmPrintMemoryStatistic();
 #endif
-       
+
        *Spi = MiMemoryConsumers[MC_USER].PagesUsed;
 
        return (STATUS_SUCCESS);
@@ -1506,7 +1506,7 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
   PVOID SystemInformation;
   NTSTATUS Status;
   NTSTATUS FStatus;
-  
+
   PAGED_CODE();
 
 /*     DPRINT("NtQuerySystemInformation Start. Class:%d\n",
@@ -1524,14 +1524,14 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
          return(STATUS_NO_MEMORY);
        }
     }*/
-  
+
   /* Clear user buffer. */
   RtlZeroMemory(SystemInformation, Length);
 
   /*
    * Check the request is valid.
    */
-  if ((SystemInformationClass >= SystemInformationClassMin) && 
+  if ((SystemInformationClass >= SystemInformationClassMin) &&
       (SystemInformationClass < SystemInformationClassMax))
     {
       if (NULL != CallQS [SystemInformationClass].Query)
@@ -1544,7 +1544,7 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
                                                          &ResultLength);
          /*if (ExGetPreviousMode() != KernelMode)
            {
-             Status = MmCopyToCaller(UnsafeSystemInformation, 
+             Status = MmCopyToCaller(UnsafeSystemInformation,
                                      SystemInformation,
                                      Length);
              ExFreePool(SystemInformation);
@@ -1586,9 +1586,9 @@ NtSetSystemInformation (
        )
 {
         PAGED_CODE();
-        
+
        /*
-        * If called from user mode, check 
+        * If called from user mode, check
         * possible unsafe arguments.
         */
 #if 0
@@ -1636,7 +1636,7 @@ NtFlushInstructionCache (
        )
 {
         PAGED_CODE();
-        
+
        __asm__("wbinvd\n");
        return STATUS_SUCCESS;
 }
index 5adb246..89f5ad9 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/time.c
  * PURPOSE:         Time
- * 
+ *
  * PROGRAMMERS:     David Welch (welch@mcmail.com)
  */
 
@@ -150,11 +150,11 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
   TIME_FIELDS TimeFields;
   KPROCESSOR_MODE PreviousMode;
   NTSTATUS Status = STATUS_SUCCESS;
-  
+
   PAGED_CODE();
-  
+
   PreviousMode = ExGetPreviousMode();
-  
+
   if(PreviousMode != KernelMode)
   {
     _SEH_TRY
@@ -175,7 +175,7 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
       Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
-    
+
     if(!NT_SUCCESS(Status))
     {
       return Status;
@@ -185,14 +185,14 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
   {
     NewSystemTime = *SystemTime;
   }
-  
+
   if(!SeSinglePrivilegeCheck(SeSystemtimePrivilege,
                              PreviousMode))
   {
     DPRINT1("NtSetSystemTime: Caller requires the SeSystemtimePrivilege privilege!\n");
     return STATUS_PRIVILEGE_NOT_HELD;
   }
-  
+
   if(PreviousTime != NULL)
   {
     KeQuerySystemTime(&OldSystemTime);
@@ -235,7 +235,7 @@ NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
 {
   KPROCESSOR_MODE PreviousMode;
   NTSTATUS Status = STATUS_SUCCESS;
-  
+
   PAGED_CODE();
 
   PreviousMode = ExGetPreviousMode();
@@ -263,7 +263,7 @@ NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
   {
     KeQuerySystemTime(SystemTime);
   }
-  
+
   return Status;
 }
 
index 7f2f9af..67cdadb 100644 (file)
@@ -3,7 +3,7 @@
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ex/timer.c
  * PURPOSE:         User-mode timers
- * 
+ *
  * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net) - Reimplemented
  *                  David Welch (welch@mcmail.com)
  */
@@ -47,7 +47,7 @@ static GENERIC_MAPPING ExpTimerMapping = {
 
 /* Timer Information Classes */
 static const INFORMATION_CLASS_INFO ExTimerInfoClass[] = {
-    
+
     /* TimerBasicInformation */
     ICI_SQ_SAME( sizeof(TIMER_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
 };
@@ -62,47 +62,47 @@ ExTimerRundown(VOID)
     KIRQL OldIrql;
     PLIST_ENTRY CurrentEntry;
     PETIMER Timer;
-    
+
     /* Lock the Thread's Active Timer List*/
     KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql);
-    
-    while (!IsListEmpty(&Thread->ActiveTimerListHead)) 
+
+    while (!IsListEmpty(&Thread->ActiveTimerListHead))
     {
-        
+
         /* Remove a Timer */
        CurrentEntry = RemoveTailList(&Thread->ActiveTimerListHead);
 
         /* Get the Timer */
         Timer = CONTAINING_RECORD(CurrentEntry, ETIMER, ActiveTimerListEntry);
-        
+
         ASSERT (Timer->ApcAssociated);
-       Timer->ApcAssociated = FALSE;      
-       
+       Timer->ApcAssociated = FALSE;
+
         DPRINT("Timer, ThreadList: %x, %x\n", Timer, Thread);
-        
+
         /* Unlock the list */
         KeReleaseSpinLockFromDpcLevel(&Thread->ActiveTimerListLock);
-            
+
         /* Lock the Timer */
         KeAcquireSpinLockAtDpcLevel(&Timer->Lock);
-        
+
         ASSERT (&Thread->Tcb == Timer->TimerApc.Thread);
-        
+
         KeCancelTimer(&Timer->KeTimer);
         KeRemoveQueueDpc(&Timer->TimerDpc);
-        KeRemoveQueueApc(&Timer->TimerApc);   
-                       
-        
+        KeRemoveQueueApc(&Timer->TimerApc);
+
+
         /* Unlock the Timer */
         KeReleaseSpinLock(&Timer->Lock, OldIrql);
-        
+
         /* Dereference it, if needed */
         ObDereferenceObject(Timer);
-        
+
         /* Loop again */
         KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql);
-    }       
-    
+    }
+
     KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql);
 }
 
@@ -117,16 +117,16 @@ ExpDeleteTimer(PVOID ObjectBody)
 
     /* Lock the Wake List */
     KeAcquireSpinLock(&ExpWakeListLock, &OldIrql);
-    
+
     /* Check if it has a Wait List */
     if (Timer->WakeTimer) {
-    
+
         /* Remove it from the Wait List */
         DPRINT("Removing wake list\n");
         RemoveEntryList(&Timer->WakeTimerListEntry);
        Timer->WakeTimer = FALSE;
     }
-    
+
     /* Release the Wake List */
     KeReleaseSpinLock(&ExpWakeListLock, OldIrql);
 
@@ -135,7 +135,7 @@ ExpDeleteTimer(PVOID ObjectBody)
     KeCancelTimer(&Timer->KeTimer);
 }
 
-VOID 
+VOID
 STDCALL
 ExpTimerDpcRoutine(PKDPC Dpc,
                    PVOID DeferredContext,
@@ -152,17 +152,17 @@ ExpTimerDpcRoutine(PKDPC Dpc,
 
     /* Lock the Timer */
     KeAcquireSpinLock(&Timer->Lock, &OldIrql);
-    
+
     /* Queue the APC */
     if(Timer->ApcAssociated) {
-        
+
         DPRINT("Queuing APC\n");
         KeInsertQueueApc(&Timer->TimerApc,
                          SystemArgument1,
                          SystemArgument2,
                          IO_NO_INCREMENT);
     }
-    
+
     /* Release the Timer */
     KeReleaseSpinLock(&Timer->Lock, OldIrql);
 }
@@ -183,37 +183,37 @@ ExpTimerApcKernelRoutine(PKAPC Apc,
     /* We need to find out which Timer we are */
     Timer = CONTAINING_RECORD(Apc, ETIMER, TimerApc);
     DPRINT("ExpTimerApcKernelRoutine(Apc: %x. Timer: %x)\n", Apc, Timer);
-    
+
     /* Lock the Timer */
     KeAcquireSpinLock(&Timer->Lock, &OldIrql);
-    
+
     /* Lock the Thread's Active Timer List*/
     KeAcquireSpinLockAtDpcLevel(&CurrentThread->ActiveTimerListLock);
-    
-    /* 
-     * Make sure that the Timer is still valid, and that it belongs to this thread 
+
+    /*
+     * Make sure that the Timer is still valid, and that it belongs to this thread
      * Remove it if it's not periodic
      */
-    if ((Timer->ApcAssociated) && 
-        (&CurrentThread->Tcb == Timer->TimerApc.Thread) && 
+    if ((Timer->ApcAssociated) &&
+        (&CurrentThread->Tcb == Timer->TimerApc.Thread) &&
         (!Timer->KeTimer.Period)) {
 
         /* Remove it from the Active Timers List */
         DPRINT("Removing Timer\n");
         RemoveEntryList(&Timer->ActiveTimerListEntry);
-        
+
         /* Disable it */
         Timer->ApcAssociated = FALSE;
-        
+
         /* Release spinlocks */
         KeReleaseSpinLockFromDpcLevel(&CurrentThread->ActiveTimerListLock);
         KeReleaseSpinLock(&Timer->Lock, OldIrql);
-    
+
         /* Dereference the Timer Object */
         ObDereferenceObject(Timer);
         return;
     }
-    
+
     /* Release spinlocks */
     KeReleaseSpinLockFromDpcLevel(&CurrentThread->ActiveTimerListLock);
     KeReleaseSpinLock(&Timer->Lock, OldIrql);
@@ -224,7 +224,7 @@ INIT_FUNCTION
 ExpInitializeTimerImplementation(VOID)
 {
     DPRINT("ExpInitializeTimerImplementation()\n");
-            
+
     /* Allocate Memory for the Timer */
     ExTimerType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
 
@@ -249,14 +249,14 @@ ExpInitializeTimerImplementation(VOID)
     ExTimerType->Create = NULL;
     ExTimerType->DuplicationNotify = NULL;
     ObpCreateTypeObject(ExTimerType);
-    
+
     /* Initialize the Wait List and Lock */
     KeInitializeSpinLock(&ExpWakeListLock);
     InitializeListHead(&ExpWakeList);
 }
 
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtCancelTimer(IN HANDLE TimerHandle,
               OUT PBOOLEAN CurrentState OPTIONAL)
@@ -268,10 +268,10 @@ NtCancelTimer(IN HANDLE TimerHandle,
     PETHREAD TimerThread;
     BOOLEAN KillTimer = FALSE;
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
     DPRINT("NtCancelTimer(0x%x, 0x%x)\n", TimerHandle, CurrentState);
-   
+
     /* Check Parameter Validity */
     if(CurrentState != NULL && PreviousMode != KernelMode) {
         _SEH_TRY {
@@ -281,7 +281,7 @@ NtCancelTimer(IN HANDLE TimerHandle,
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
             Status = _SEH_GetExceptionCode();
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) {
             return Status;
         }
@@ -294,72 +294,72 @@ NtCancelTimer(IN HANDLE TimerHandle,
                                        PreviousMode,
                                        (PVOID*)&Timer,
                                        NULL);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
-       
+
         DPRINT("Timer Referencced: %x\n", Timer);
-        
+
         /* Lock the Timer */
         KeAcquireSpinLock(&Timer->Lock, &OldIrql);
-        
+
         /* Check if it's enabled */
         if (Timer->ApcAssociated) {
-        
-            /* 
-             * First, remove it from the Thread's Active List 
+
+            /*
+             * First, remove it from the Thread's Active List
              * Get the Thread.
              */
             TimerThread = CONTAINING_RECORD(Timer->TimerApc.Thread, ETHREAD, Tcb);
             DPRINT("Removing from Thread: %x\n", TimerThread);
-            
+
             /* Lock its active list */
             KeAcquireSpinLockAtDpcLevel(&TimerThread->ActiveTimerListLock);
-            
+
             /* Remove it */
             RemoveEntryList(&TimerThread->ActiveTimerListHead);
-            
+
             /* Unlock the list */
             KeReleaseSpinLockFromDpcLevel(&TimerThread->ActiveTimerListLock);
-            
+
             /* Cancel the Timer */
             KeCancelTimer(&Timer->KeTimer);
             KeRemoveQueueDpc(&Timer->TimerDpc);
             KeRemoveQueueApc(&Timer->TimerApc);
             Timer->ApcAssociated = FALSE;
             KillTimer = TRUE;
-            
+
         } else {
-            
+
             /* If timer was disabled, we still need to cancel it */
             DPRINT("APC was not Associated. Cancelling Timer\n");
             KeCancelTimer(&Timer->KeTimer);
         }
-        
+
         /* Read the old State */
         State = KeReadStateTimer(&Timer->KeTimer);
-        
+
         /* Dereference the Object */
         ObDereferenceObject(Timer);
-        
+
         /* Unlock the Timer */
         KeReleaseSpinLock(&Timer->Lock, OldIrql);
-                
+
         /* Dereference if it was previously enabled */
         if (KillTimer) ObDereferenceObject(Timer);
         DPRINT1("Timer disabled\n");
 
         /* Make sure it's safe to write to the handle */
         if(CurrentState != NULL) {
-            
+
             _SEH_TRY {
-                
+
                 *CurrentState = State;
-                
+
             } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-                
+
                 Status = _SEH_GetExceptionCode();
-                
+
             } _SEH_END;
         }
     }
@@ -369,7 +369,7 @@ NtCancelTimer(IN HANDLE TimerHandle,
 }
 
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtCreateTimer(OUT PHANDLE TimerHandle,
               IN ACCESS_MASK DesiredAccess,
@@ -380,28 +380,28 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
     HANDLE hTimer;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
     DPRINT("NtCreateTimer(Handle: %x, Type: %d)\n", TimerHandle, TimerType);
 
     /* Check Parameter Validity */
     if (PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(TimerHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
-    
-    /* Create the Object */   
+
+    /* Create the Object */
     Status = ObCreateObject(PreviousMode,
                            ExTimerType,
                            ObjectAttributes,
@@ -411,24 +411,24 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
                            0,
                            0,
                            (PVOID*)&Timer);
-   
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Initialize the Kernel Timer */
         DPRINT("Initializing Timer: %x\n", Timer);
         KeInitializeTimerEx(&Timer->KeTimer, TimerType);
 
         /* Initialize the Timer Lock */
         KeInitializeSpinLock(&Timer->Lock);
-        
+
         /* Initialize the DPC */
         KeInitializeDpc(&Timer->TimerDpc, ExpTimerDpcRoutine, Timer);
 
         /* Set Initial State */
         Timer->ApcAssociated = FALSE;
         Timer->WakeTimer = FALSE;
-        
+
         /* Insert the Timer */
         Status = ObInsertObject((PVOID)Timer,
                                 NULL,
@@ -438,16 +438,16 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
                                 &hTimer);
         DPRINT("Timer Inserted\n");
 
-  
+
         /* Make sure it's safe to write to the handle */
         _SEH_TRY {
-            
+
             *TimerHandle = hTimer;
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
     }
 
@@ -456,7 +456,7 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
 }
 
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtOpenTimer(OUT PHANDLE TimerHandle,
             IN ACCESS_MASK DesiredAccess,
@@ -465,25 +465,25 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
     HANDLE hTimer;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
     DPRINT("NtOpenTimer(TimerHandle: %x)\n", TimerHandle);
 
     /* Check Parameter Validity */
     if (PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForWrite(TimerHandle,
                           sizeof(HANDLE),
                           sizeof(ULONG));
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
-     
+
         if(!NT_SUCCESS(Status)) return Status;
     }
 
@@ -495,19 +495,19 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
                                 DesiredAccess,
                                 NULL,
                                 &hTimer);
-    
+
     /* Check for success */
     if(NT_SUCCESS(Status)) {
-        
+
         /* Make sure it's safe to write to the handle */
         _SEH_TRY {
-            
+
             *TimerHandle = hTimer;
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
     }
 
@@ -516,7 +516,7 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
 }
 
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtQueryTimer(IN HANDLE TimerHandle,
              IN TIMER_INFORMATION_CLASS TimerInformationClass,
@@ -528,7 +528,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_SUCCESS;
     PTIMER_BASIC_INFORMATION BasicInfo = (PTIMER_BASIC_INFORMATION)TimerInformation;
-    
+
     PAGED_CODE();
     DPRINT("NtQueryTimer(TimerHandle: %x, Class: %d)\n", TimerHandle, TimerInformationClass);
 
@@ -541,7 +541,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
                                 PreviousMode,
                                 &Status);
     if(!NT_SUCCESS(Status)) {
-        
+
         DPRINT1("NtQueryTimer() failed, Status: 0x%x\n", Status);
         return Status;
     }
@@ -550,16 +550,16 @@ NtQueryTimer(IN HANDLE TimerHandle,
     Status = ObReferenceObjectByHandle(TimerHandle,
                                        TIMER_QUERY_STATE,
                                        ExTimerType,
-                                       PreviousMode,    
+                                       PreviousMode,
                                        (PVOID*)&Timer,
                                        NULL);
-    
+
     /* Check for Success */
     if(NT_SUCCESS(Status)) {
 
         /* Return the Basic Information */
         _SEH_TRY {
-           
+
             /* FIXME: Interrupt correction based on Interrupt Time */
             DPRINT("Returning Information for Timer: %x. Time Remaining: %d\n", Timer, Timer->KeTimer.DueTime.QuadPart);
             BasicInfo->TimeRemaining.QuadPart = Timer->KeTimer.DueTime.QuadPart;
@@ -568,20 +568,20 @@ NtQueryTimer(IN HANDLE TimerHandle,
             if(ReturnLength != NULL) *ReturnLength = sizeof(TIMER_BASIC_INFORMATION);
 
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-                  
+
         } _SEH_END;
-        
+
         /* Dereference Object */
         ObDereferenceObject(Timer);
     }
-   
+
     /* Return Status */
     return Status;
 }
 
-NTSTATUS 
+NTSTATUS
 STDCALL
 NtSetTimer(IN HANDLE TimerHandle,
            IN PLARGE_INTEGER DueTime,
@@ -600,84 +600,84 @@ NtSetTimer(IN HANDLE TimerHandle,
     PETHREAD TimerThread;
     BOOLEAN KillTimer = FALSE;
     NTSTATUS Status = STATUS_SUCCESS;
-    
+
     PAGED_CODE();
     DPRINT("NtSetTimer(TimerHandle: %x, DueTime: %d, Apc: %x, Period: %d)\n", TimerHandle, DueTime->QuadPart, TimerApcRoutine, Period);
 
     /* Check Parameter Validity */
     if (PreviousMode != KernelMode) {
-        
+
         _SEH_TRY {
-            
+
             ProbeForRead(DueTime,
                          sizeof(LARGE_INTEGER),
                          sizeof(ULONG));
             TimerDueTime = *DueTime;
-            
+
             if(PreviousState != NULL) {
-                
+
                 ProbeForWrite(PreviousState,
                               sizeof(BOOLEAN),
                               sizeof(BOOLEAN));
             }
-            
+
         } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
-            
+
             Status = _SEH_GetExceptionCode();
-            
+
         } _SEH_END;
-     
-        if(!NT_SUCCESS(Status)) return Status;        
+
+        if(!NT_SUCCESS(Status)) return Status;
     }
-    
-    /* Get the Timer Object */   
+
+    /* Get the Timer Object */
     Status = ObReferenceObjectByHandle(TimerHandle,
                                        TIMER_ALL_ACCESS,
                                        ExTimerType,
                                        PreviousMode,