[SACDRV]:
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 13 Oct 2013 19:40:34 +0000 (19:40 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 13 Oct 2013 19:40:34 +0000 (19:40 +0000)
- Tabs vs. spaces fix;
- Less hardcoded values;
- Consistency in members names.

No functional changes.

svn path=/trunk/; revision=60642

13 files changed:
reactos/drivers/sac/driver/chanmgr.c
reactos/drivers/sac/driver/channel.c
reactos/drivers/sac/driver/cmdchan.c
reactos/drivers/sac/driver/concmd.c
reactos/drivers/sac/driver/conmgr.c
reactos/drivers/sac/driver/data.c
reactos/drivers/sac/driver/dispatch.c
reactos/drivers/sac/driver/init.c
reactos/drivers/sac/driver/memory.c
reactos/drivers/sac/driver/rawchan.c
reactos/drivers/sac/driver/sacdrv.h
reactos/drivers/sac/driver/util.c
reactos/drivers/sac/driver/vtutf8chan.c

index 9b2878b..42e99dd 100644 (file)
@@ -6,11 +6,11 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 SAC_CHANNEL_LOCK ChannelCreateLock;
 BOOLEAN ChannelCreateEnabled;
@@ -21,7 +21,7 @@ SAC_CHANNEL_LOCK ChannelSlotLock[SAC_MAX_CHANNELS];
 LONG CurrentChannelRefCount;
 KMUTEX CurrentChannelLock;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 #define MAX_REF_COUNT 100
 
index 0476b59..b91f8c1 100644 (file)
@@ -6,13 +6,13 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 BOOLEAN
 NTAPI
@@ -255,19 +255,19 @@ ChannelIsActive(IN PSAC_CHANNEL Channel)
     BOOLEAN IsActive;
 
     /* Get the status */
-       if (!NT_SUCCESS(ChannelGetStatus(Channel, &ChannelStatus)))
-       {
+    if (!NT_SUCCESS(ChannelGetStatus(Channel, &ChannelStatus)))
+    {
         /* We couldn't even do that, assume it's inactive */
         IsActive = FALSE;
-       }
-       else
-       {
+    }
+    else
+    {
         /* Check if the status shows activity */
         IsActive = (ChannelStatus == Active);
     }
 
     /* Return the state */
-       return IsActive;
+    return IsActive;
 }
 
 BOOLEAN
@@ -278,13 +278,13 @@ ChannelIsClosed(IN PSAC_CHANNEL Channel)
     BOOLEAN IsClosed;
 
     /* Get the status */
-       if (!NT_SUCCESS(ChannelGetStatus(Channel, &ChannelStatus)))
-       {
+    if (!NT_SUCCESS(ChannelGetStatus(Channel, &ChannelStatus)))
+    {
         /* We couldn't even do that, assume it's inactive */
         IsClosed = FALSE;
-       }
-       else
-       {
+    }
+    else
+    {
         /* Check if the status shows activity */
         IsClosed = ((ChannelStatus == Inactive) &&
                     (Channel->ChannelHasNewOBufferData));
@@ -310,7 +310,7 @@ ChannelGetName(IN PSAC_CHANNEL Channel,
     ChannelLockAttributes(Channel);
 
     /* Copy the name and null-terminate it */
-    ASSERT(((wcslen(Channel->NameBuffer) + 1) * sizeof(WCHAR)) <= ((64 + 1) * sizeof(WCHAR)));
+    ASSERT(((wcslen(Channel->NameBuffer) + 1) * sizeof(WCHAR)) <= ((SAC_CHANNEL_NAME_SIZE + 1) * sizeof(WCHAR)));
     wcsncpy(*Name, Channel->NameBuffer, RTL_NUMBER_OF(Channel->NameBuffer)); // bug
     (*Name)[SAC_CHANNEL_NAME_SIZE] = UNICODE_NULL;
 
@@ -331,7 +331,7 @@ ChannelSetName(IN PSAC_CHANNEL Channel,
     ChannelLockAttributes(Channel);
 
     /* Copy the name and null-terminate it */
-    ASSERT(((wcslen(Name) + 1) * sizeof(WCHAR)) <= ((64 + 1) * sizeof(WCHAR)));
+    ASSERT(((wcslen(Name) + 1) * sizeof(WCHAR)) <= ((SAC_CHANNEL_NAME_SIZE + 1) * sizeof(WCHAR)));
     wcsncpy(Channel->NameBuffer, Name, RTL_NUMBER_OF(Channel->NameBuffer)); // bug
     Channel->NameBuffer[SAC_CHANNEL_NAME_SIZE] = UNICODE_NULL;
 
@@ -356,7 +356,7 @@ ChannelGetDescription(IN PSAC_CHANNEL Channel,
     ChannelLockAttributes(Channel);
 
     /* Copy the name and null-terminate it */
-    ASSERT(((wcslen(Channel->DescriptionBuffer) + 1) * sizeof(WCHAR)) <= ((256 + 1) * sizeof(WCHAR)));
+    ASSERT(((wcslen(Channel->DescriptionBuffer) + 1) * sizeof(WCHAR)) <= ((SAC_CHANNEL_DESCRIPTION_SIZE + 1) * sizeof(WCHAR)));
     wcsncpy(*Description, Channel->DescriptionBuffer, RTL_NUMBER_OF(Channel->DescriptionBuffer)); // bug
     (*Description)[SAC_CHANNEL_DESCRIPTION_SIZE] = UNICODE_NULL;
 
@@ -377,7 +377,7 @@ ChannelSetDescription(IN PSAC_CHANNEL Channel,
     ChannelLockAttributes(Channel);
 
     /* Copy the name and null-terminate it */
-    ASSERT(((wcslen(Description) + 1) * sizeof(WCHAR)) <= ((64 + 1) * sizeof(WCHAR)));
+    ASSERT(((wcslen(Description) + 1) * sizeof(WCHAR)) <= ((SAC_CHANNEL_NAME_SIZE + 1) * sizeof(WCHAR)));
     wcsncpy(Channel->DescriptionBuffer, Description, RTL_NUMBER_OF(Channel->DescriptionBuffer)); // bug
     Channel->DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE] = UNICODE_NULL;
 
index de6e295..6b8d905 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * PROJECT:             ReactOS Boot Loader
- * LICENSE:             BSD - See COPYING.ARM in the top level directory
- * FILE:                drivers/sac/driver/cmdchan.c
- * PURPOSE:             Driver for the Server Administration Console (SAC) for EMS
- * PROGRAMMERS:         ReactOS Portable Systems Group
+ * PROJECT:     ReactOS Drivers
+ * LICENSE:     BSD - See COPYING.ARM in the top level directory
+ * FILE:        drivers/sac/driver/cmdchan.c
+ * PURPOSE:     Driver for the Server Administration Console (SAC) for EMS
+ * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
 /* INCLUDES *******************************************************************/
 
 NTSTATUS
 CmdChannelCreate(
-       IN PSAC_CHANNEL Channel
-       )
+    IN PSAC_CHANNEL Channel
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 CmdChannelDestroy(
-       IN PSAC_CHANNEL Channel
-       )
+    IN PSAC_CHANNEL Channel
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 CmdChannelOWrite(
-       IN PSAC_CHANNEL Channel,
-       IN PWCHAR String,
-       IN ULONG Size
-       )
+    IN PSAC_CHANNEL Channel,
+    IN PWCHAR String,
+    IN ULONG Size
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 CmdChannelOFlush(
-       IN PSAC_CHANNEL Channel
-       )
+    IN PSAC_CHANNEL Channel
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 CmdChannelORead(
-       IN PSAC_CHANNEL Channel,
-       IN PCHAR Buffer,
-       IN ULONG BufferSize,
-       OUT PULONG ByteCount
-       )
+    IN PSAC_CHANNEL Channel,
+    IN PCHAR Buffer,
+    IN ULONG BufferSize,
+    OUT PULONG ByteCount
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
index 5b7a13f..2c10244 100644 (file)
@@ -6,55 +6,55 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 PVOID GlobalBuffer;
 ULONG GlobalBufferSize;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 NTSTATUS
 DoChannelListCommand(
-       VOID
-       )
+    VOID
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 DoChannelCloseByNameCommand(
-       IN PCHAR Count
-       )
+    IN PCHAR Count
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 DoChannelCloseByIndexCommand(
-       IN ULONG ChannelIndex
-       )
+    IN ULONG ChannelIndex
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 DoChannelSwitchByNameCommand(
-       IN PCHAR Count
-       )
+    IN PCHAR Count
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 DoChannelSwitchByIndexCommand(
-       IN ULONG ChannelIndex
-       )
+    IN ULONG ChannelIndex
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 typedef struct _SAC_SYSTEM_INFORMATION
@@ -324,28 +324,28 @@ PutMore(OUT PBOOLEAN ScreenFull)
 
 BOOLEAN
 RetrieveIpAddressFromString(
-       IN PWCHAR IpString,
-       OUT PULONG IpAddress
-       )
+    IN PWCHAR IpString,
+    OUT PULONG IpAddress
+    )
 {
-       return FALSE;
+    return FALSE;
 }
 
 NTSTATUS
 CallQueryIPIOCTL(
-       IN HANDLE DriverHandle,
-       IN PVOID DriverObject,
-       IN HANDLE WaitEvent,
-       IN PIO_STATUS_BLOCK IoStatusBlock,
-       IN PVOID InputBuffer,
-       IN ULONG InputBufferLength,
-       IN PVOID OutputBuffer,
-       IN ULONG OutputBufferLength, 
-       IN BOOLEAN PrintMessage,
-       OUT PBOOLEAN MessagePrinted
-       )
+    IN HANDLE DriverHandle,
+    IN PVOID DriverObject,
+    IN HANDLE WaitEvent,
+    IN PIO_STATUS_BLOCK IoStatusBlock,
+    IN PVOID InputBuffer,
+    IN ULONG InputBufferLength,
+    IN PVOID OutputBuffer,
+    IN ULONG OutputBufferLength, 
+    IN BOOLEAN PrintMessage,
+    OUT PBOOLEAN MessagePrinted
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 VOID
index b99a103..4031d86 100644 (file)
@@ -6,11 +6,11 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 DEFINE_GUID(PRIMARY_SAC_CHANNEL_APPLICATION_GUID,
             0x63D02270,
@@ -32,7 +32,7 @@ CHAR InputBuffer[80];
 
 BOOLEAN GlobalPagingNeeded, GlobalDoThreads;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 VOID
 NTAPI
index 5d7d293..14a894a 100644 (file)
@@ -6,11 +6,11 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 ULONG SACDebug = 0xFFFFFFFF;
 BOOLEAN CommandConsoleLaunchingEnabled;
@@ -21,7 +21,7 @@ ULONG ProcessingType;
 PKEVENT SACEvent;
 HANDLE SACEventHandle;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 VOID
 NTAPI
index 44ade23..d1cda63 100644 (file)
@@ -6,15 +6,15 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 LONG TimerDpcCount;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 NTSTATUS
 NTAPI
index e0f0a45..d124b32 100644 (file)
@@ -6,13 +6,13 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 NTSTATUS
 NTAPI
index 79e3410..86b2efe 100644 (file)
@@ -6,17 +6,17 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 LONG TotalFrees, TotalBytesFreed, TotalAllocations, TotalBytesAllocated;
 KSPIN_LOCK MemoryLock;
 PSAC_MEMORY_LIST GlobalMemoryList;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 BOOLEAN
 NTAPI
@@ -113,92 +113,91 @@ MyAllocatePool(IN SIZE_T PoolSize,
 
 #if _USE_SAC_HEAP_ALLOCATOR_
     GlobalDescriptor = GlobalMemoryList;
-       KeAcquireSpinLock(&MemoryLock, &OldIrql);
-       while (GlobalDescriptor)
-       {
-               ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE);
-
-               LocalDescriptor = GlobalDescriptor->LocalDescriptor;
-
-               GlobalSize = GlobalDescriptor->Size;
-               while (GlobalSize)
-               {
-                       ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
-
-                       if ((LocalDescriptor->Tag == FREE_POOL_TAG) &&
-                               (LocalDescriptor->Size >= PoolSize))
-                       {
-                               break;
-                       }
-
-                       GlobalSize -= (LocalDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
-
-                       LocalDescriptor =
-                               (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor +
-                               LocalDescriptor->Size +
-                               sizeof(SAC_MEMORY_ENTRY));
-               }
-
-               GlobalDescriptor = GlobalDescriptor->Next;
-       }
-
-       if (!GlobalDescriptor)
-       {
-               KeReleaseSpinLock(&MemoryLock, OldIrql);
-
-               ActualSize = min(
-                       PAGE_SIZE,
-                       PoolSize + sizeof(SAC_MEMORY_ENTRY) + sizeof(SAC_MEMORY_LIST));
-
-               SAC_DBG(SAC_DBG_MM, "Allocating new space.\n");
-
-               NewDescriptor = ExAllocatePoolWithTagPriority(
-                       0,
-                       ActualSize,
-                       ALLOC_BLOCK_TAG,
-                       HighPoolPriority);
-               if (!NewDescriptor)
-               {
-                       SAC_DBG(SAC_DBG_MM, "No more memory, returning NULL.\n");
-                       return NULL;
-               }
-
-               KeAcquireSpinLock(&MemoryLock, &OldIrql);
-
-               NewDescriptor->Signature = GLOBAL_MEMORY_SIGNATURE;
-               NewDescriptor->LocalDescriptor = (PSAC_MEMORY_ENTRY)(NewDescriptor + 1);
-               NewDescriptor->Size = ActualSize - 16;
-               NewDescriptor->Next = GlobalMemoryList;
-
-               GlobalMemoryList = NewDescriptor;
-
-               LocalDescriptor = NewDescriptor->LocalDescriptor;
-               LocalDescriptor->Signature = LOCAL_MEMORY_SIGNATURE;
-               LocalDescriptor->Tag = FREE_POOL_TAG;
-               LocalDescriptor->Size =
-                       GlobalMemoryList->Size - sizeof(SAC_MEMORY_ENTRY);
-       }
-
-       SAC_DBG(SAC_DBG_MM, "Found a good sized block.\n");
-       ASSERT(LocalDescriptor->Tag == FREE_POOL_TAG);
-       ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
-
-       if (LocalDescriptor->Size > (PoolSize + sizeof(SAC_MEMORY_ENTRY)))
-       {
-               NextDescriptor =
-                       (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor +
-                       PoolSize +
-                       sizeof(SAC_MEMORY_ENTRY));
-               if (NextDescriptor->Tag == FREE_POOL_TAG)
-               {
-                       NextDescriptor->Tag = FREE_POOL_TAG;
-                       NextDescriptor->Signature = LOCAL_MEMORY_SIGNATURE;
-                       NextDescriptor->Size =
-                               (LocalDescriptor->Size - PoolSize - sizeof(SAC_MEMORY_ENTRY));
-
-                       LocalDescriptor->Size = PoolSize;
-               }
-       }
+    KeAcquireSpinLock(&MemoryLock, &OldIrql);
+    while (GlobalDescriptor)
+    {
+        ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE);
+
+        LocalDescriptor = GlobalDescriptor->LocalDescriptor;
+
+        GlobalSize = GlobalDescriptor->Size;
+        while (GlobalSize)
+        {
+            ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
+
+            if ((LocalDescriptor->Tag == FREE_POOL_TAG) &&
+                (LocalDescriptor->Size >= PoolSize))
+            {
+                break;
+            }
+
+            GlobalSize -= (LocalDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
+
+            LocalDescriptor =
+                (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor +
+                LocalDescriptor->Size +
+                sizeof(SAC_MEMORY_ENTRY));
+        }
+
+        GlobalDescriptor = GlobalDescriptor->Next;
+    }
+
+    if (!GlobalDescriptor)
+    {
+        KeReleaseSpinLock(&MemoryLock, OldIrql);
+
+        ActualSize = min(
+            PAGE_SIZE,
+            PoolSize + sizeof(SAC_MEMORY_ENTRY) + sizeof(SAC_MEMORY_LIST));
+
+        SAC_DBG(SAC_DBG_MM, "Allocating new space.\n");
+
+        NewDescriptor = ExAllocatePoolWithTagPriority(NonPagedPool,
+                                                      ActualSize,
+                                                      ALLOC_BLOCK_TAG,
+                                                      HighPoolPriority);
+        if (!NewDescriptor)
+        {
+            SAC_DBG(SAC_DBG_MM, "No more memory, returning NULL.\n");
+            return NULL;
+        }
+
+        KeAcquireSpinLock(&MemoryLock, &OldIrql);
+
+        NewDescriptor->Signature = GLOBAL_MEMORY_SIGNATURE;
+        NewDescriptor->LocalDescriptor = (PSAC_MEMORY_ENTRY)(NewDescriptor + 1);
+        NewDescriptor->Size = ActualSize - 16;
+        NewDescriptor->Next = GlobalMemoryList;
+
+        GlobalMemoryList = NewDescriptor;
+
+        LocalDescriptor = NewDescriptor->LocalDescriptor;
+        LocalDescriptor->Signature = LOCAL_MEMORY_SIGNATURE;
+        LocalDescriptor->Tag = FREE_POOL_TAG;
+        LocalDescriptor->Size =
+            GlobalMemoryList->Size - sizeof(SAC_MEMORY_ENTRY);
+    }
+
+    SAC_DBG(SAC_DBG_MM, "Found a good sized block.\n");
+    ASSERT(LocalDescriptor->Tag == FREE_POOL_TAG);
+    ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
+
+    if (LocalDescriptor->Size > (PoolSize + sizeof(SAC_MEMORY_ENTRY)))
+    {
+        NextDescriptor =
+            (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor +
+            PoolSize +
+            sizeof(SAC_MEMORY_ENTRY));
+        if (NextDescriptor->Tag == FREE_POOL_TAG)
+        {
+            NextDescriptor->Tag = FREE_POOL_TAG;
+            NextDescriptor->Signature = LOCAL_MEMORY_SIGNATURE;
+            NextDescriptor->Size =
+                (LocalDescriptor->Size - PoolSize - sizeof(SAC_MEMORY_ENTRY));
+
+            LocalDescriptor->Size = PoolSize;
+        }
+    }
 #else
     /* Shut the compiler up */
     NewDescriptor = GlobalDescriptor = NULL;
@@ -255,77 +254,77 @@ MyFreePool(IN PVOID *Block)
     KeAcquireSpinLock(&MemoryLock, &OldIrql);
 
 #if _USE_SAC_HEAP_ALLOCATOR_
-       while (GlobalDescriptor)
-       {
-               ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE);
-
-               FoundDescriptor = NULL;
-
-               ThisDescriptor = GlobalDescriptor->LocalDescriptor;
-
-               GlobalSize = GlobalDescriptor->Size;
-               while (GlobalSize)
-               {
-                       ASSERT(ThisDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
-
-                       if (ThisDescriptor == LocalDescriptor) break;
-
-                       GlobalSize -= (ThisDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
-
-                       ThisDescriptor =
-                               (PSAC_MEMORY_ENTRY)((ULONG_PTR)ThisDescriptor +
-                               ThisDescriptor->Size +
-                               sizeof(SAC_MEMORY_ENTRY));
-               }
-
-               if (ThisDescriptor == LocalDescriptor) break;
-
-               GlobalDescriptor = GlobalDescriptor->Next;
-       }
-
-       if (!GlobalDescriptor)
-       {
-               KeReleaseSpinLock(&MemoryLock, OldIrql);
-               SAC_DBG(SAC_DBG_MM, "Could not find block.\n");
-               return;
-       }
-
-       ASSERT(ThisDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
-
-       if (LocalDescriptor->Tag == FREE_POOL_TAG)
-       {
-               KeReleaseSpinLock(&MemoryLock, OldIrql);
-               SAC_DBG(SAC_DBG_MM, "Attempted to free something twice.\n");
-               return;
-       }
-
-       LocalSize = LocalDescriptor->Size;
-       LocalDescriptor->Tag = FREE_POOL_TAG;
-
-       if (GlobalSize > (LocalSize + sizeof(SAC_MEMORY_ENTRY)))
-       {
-               NextDescriptor =
-                       (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor +
-                       LocalSize +
-                       sizeof(SAC_MEMORY_ENTRY));
-               if (NextDescriptor->Tag == FREE_POOL_TAG)
-               {
-                       NextDescriptor->Tag = 0;
-                       NextDescriptor->Signature = 0;
-
-                       LocalDescriptor->Size +=
-                               (NextDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
-               }
-       }
-
-       if ((FoundDescriptor) && (FoundDescriptor->Tag == FREE_POOL_TAG))
-       {
-               LocalDescriptor->Signature = 0;
-               LocalDescriptor->Tag = 0;
-
-               FoundDescriptor->Size +=
-                       (LocalDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
-       }
+    while (GlobalDescriptor)
+    {
+        ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE);
+
+        FoundDescriptor = NULL;
+
+        ThisDescriptor = GlobalDescriptor->LocalDescriptor;
+
+        GlobalSize = GlobalDescriptor->Size;
+        while (GlobalSize)
+        {
+            ASSERT(ThisDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
+
+            if (ThisDescriptor == LocalDescriptor) break;
+
+            GlobalSize -= (ThisDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
+
+            ThisDescriptor =
+                (PSAC_MEMORY_ENTRY)((ULONG_PTR)ThisDescriptor +
+                ThisDescriptor->Size +
+                sizeof(SAC_MEMORY_ENTRY));
+        }
+
+        if (ThisDescriptor == LocalDescriptor) break;
+
+        GlobalDescriptor = GlobalDescriptor->Next;
+    }
+
+    if (!GlobalDescriptor)
+    {
+        KeReleaseSpinLock(&MemoryLock, OldIrql);
+        SAC_DBG(SAC_DBG_MM, "Could not find block.\n");
+        return;
+    }
+
+    ASSERT(ThisDescriptor->Signature == LOCAL_MEMORY_SIGNATURE);
+
+    if (LocalDescriptor->Tag == FREE_POOL_TAG)
+    {
+        KeReleaseSpinLock(&MemoryLock, OldIrql);
+        SAC_DBG(SAC_DBG_MM, "Attempted to free something twice.\n");
+        return;
+    }
+
+    LocalSize = LocalDescriptor->Size;
+    LocalDescriptor->Tag = FREE_POOL_TAG;
+
+    if (GlobalSize > (LocalSize + sizeof(SAC_MEMORY_ENTRY)))
+    {
+        NextDescriptor =
+            (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor +
+            LocalSize +
+            sizeof(SAC_MEMORY_ENTRY));
+        if (NextDescriptor->Tag == FREE_POOL_TAG)
+        {
+            NextDescriptor->Tag = 0;
+            NextDescriptor->Signature = 0;
+
+            LocalDescriptor->Size +=
+                (NextDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
+        }
+    }
+
+    if ((FoundDescriptor) && (FoundDescriptor->Tag == FREE_POOL_TAG))
+    {
+        LocalDescriptor->Signature = 0;
+        LocalDescriptor->Tag = 0;
+
+        FoundDescriptor->Size +=
+            (LocalDescriptor->Size + sizeof(SAC_MEMORY_ENTRY));
+    }
 #else
     /* Shut the compiler up */
     LocalSize = GlobalSize = 0;
index fcec668..3aa148f 100644 (file)
@@ -6,13 +6,13 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 NTSTATUS
 NTAPI
index 74d0381..69731ea 100644 (file)
@@ -6,7 +6,7 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include <ntifs.h>
 #include <intrin.h>
@@ -19,7 +19,7 @@
 #include <initguid.h>
 #include <sacmsg.h>
 
-/* DEFINES *******************************************************************/
+/* DEFINES ********************************************************************/
 
 //
 // SAC Heap Allocator Macros
 // SAC Parameter Checking Macros
 //
 #define CHECK_PARAMETER_WITH_STATUS(Parameter, Status)  \
-{   \
-    ASSERT(((PVOID)(Parameter)) != NULL);    \
-    if (((PVOID)(Parameter)) == NULL) \
-    {   \
-       return Status;  \
-    }   \
+{                                                       \
+    ASSERT(((PVOID)(Parameter)) != NULL);               \
+    if (((PVOID)(Parameter)) == NULL)                   \
+    {                                                   \
+        return Status;                                  \
+    }                                                   \
 }
 #define CHECK_PARAMETER(x)      \
     CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER)
 //
 // SAC Channel Event Macros
 //
-#define ChannelInitializeEvent(Channel, Attributes, x)  \
-{   \
-    PVOID Object, WaitObject;   \
-    if (Attributes->x)  \
-    {   \
+#define ChannelInitializeEvent(Channel, Attributes, x)                  \
+{                                                                       \
+    PVOID Object, WaitObject;                                           \
+    if (Attributes->x)                                                  \
+    {                                                                   \
         if (!VerifyEventWaitable(Attributes->x, &Object, &WaitObject))  \
-        {   \
-            goto FailChannel;   \
-        } \
-        Channel->x = Attributes->x; \
-        Channel->x##ObjectBody = Object;    \
-        Channel->x##WaitObjectBody = WaitObject;    \
-    }   \
+        {                                                               \
+            goto FailChannel;                                           \
+        }                                                               \
+        Channel->x = Attributes->x;                                     \
+        Channel->x##ObjectBody = Object;                                \
+        Channel->x##WaitObjectBody = WaitObject;                        \
+    }                                                                   \
 }
-#define ChannelUninitializeEvent(Channel, x, f)                     \
-{                                                                   \
-    ASSERT(ChannelGetFlags(Channel) & (f));                         \
-    ASSERT(Channel->x##ObjectBody);                                 \
-    ASSERT(Channel->x##WaitObjectBody);                             \
-    if (Channel->x##ObjectBody)                                     \
-    {                                                               \
-        ObDereferenceObject(Channel->x##ObjectBody);                \
-        Channel->Flags &= ~(f);                                     \
-        Channel->x = NULL;                                          \
-        Channel->x##ObjectBody = NULL;                              \
-        Channel->x##WaitObjectBody = NULL;                          \
-    }   \
+#define ChannelUninitializeEvent(Channel, x, f)         \
+{                                                       \
+    ASSERT(ChannelGetFlags(Channel) & (f));             \
+    ASSERT(Channel->x##ObjectBody);                     \
+    ASSERT(Channel->x##WaitObjectBody);                 \
+    if (Channel->x##ObjectBody)                         \
+    {                                                   \
+        ObDereferenceObject(Channel->x##ObjectBody);    \
+        Channel->Flags &= ~(f);                         \
+        Channel->x = NULL;                              \
+        Channel->x##ObjectBody = NULL;                  \
+        Channel->x##WaitObjectBody = NULL;              \
+    }                                                   \
 }
-#define ChannelSetEvent(Channel, x) \
-{   \
-    ASSERT(Channel->x); \
-    ASSERT(Channel->x##ObjectBody); \
-    ASSERT(Channel->x##WaitObjectBody); \
-    if (Channel->x##WaitObjectBody) \
-    {   \
+#define ChannelSetEvent(Channel, x)                                     \
+{                                                                       \
+    ASSERT(Channel->x);                                                 \
+    ASSERT(Channel->x##ObjectBody);                                     \
+    ASSERT(Channel->x##WaitObjectBody);                                 \
+    if (Channel->x##WaitObjectBody)                                     \
+    {                                                                   \
         KeSetEvent(Channel->x##WaitObjectBody, EVENT_INCREMENT, FALSE); \
-        Status = STATUS_SUCCESS;    \
-    }   \
-    else    \
-    {   \
-        Status = STATUS_UNSUCCESSFUL;   \
-    }   \
+        Status = STATUS_SUCCESS;                                        \
+    }                                                                   \
+    else                                                                \
+    {                                                                   \
+        Status = STATUS_UNSUCCESSFUL;                                   \
+    }                                                                   \
 }
-#define ChannelClearEvent(Channel, x)   \
-{   \
-    ASSERT(Channel->x); \
-    ASSERT(Channel->x##ObjectBody); \
-    ASSERT(Channel->x##WaitObjectBody); \
-    if (Channel->x##WaitObjectBody) \
-    {   \
-       KeClearEvent(Channel->x##WaitObjectBody);   \
-       Status = STATUS_SUCCESS;    \
-    }   \
-    else    \
-    {   \
-       Status = STATUS_UNSUCCESSFUL;   \
-    }   \
+#define ChannelClearEvent(Channel, x)               \
+{                                                   \
+    ASSERT(Channel->x);                             \
+    ASSERT(Channel->x##ObjectBody);                 \
+    ASSERT(Channel->x##WaitObjectBody);             \
+    if (Channel->x##WaitObjectBody)                 \
+    {                                               \
+        KeClearEvent(Channel->x##WaitObjectBody);   \
+        Status = STATUS_SUCCESS;                    \
+    }                                               \
+    else                                            \
+    {                                               \
+        Status = STATUS_UNSUCCESSFUL;               \
+    }                                               \
 }
 
 //
 #define GLOBAL_BLOCK_TAG                    'GpcR'
 #define CHANNEL_BLOCK_TAG                   'CpcR'
 #define LOCAL_MEMORY_SIGNATURE              'SSEL'
-#define GLOBAL_MEMORY_SIGNATURE                    'DAEH'
+#define GLOBAL_MEMORY_SIGNATURE             'DAEH'
 
 //
 // Size Definitions
 #define SAC_CHANNEL_FLAG_INTERNAL           0x1
 #define SAC_CHANNEL_FLAG_CLOSE_EVENT        0x2
 #define SAC_CHANNEL_FLAG_HAS_NEW_DATA_EVENT 0x4
-#define SAC_CHANNEL_FLAG_LOCK_EVENT            0x8
+#define SAC_CHANNEL_FLAG_LOCK_EVENT         0x8
 #define SAC_CHANNEL_FLAG_REDRAW_EVENT       0x10
 #define SAC_CHANNEL_FLAG_APPLICATION        0x20
 
 //
-// Cursor Flags
+// Cell Flags
 //
-#define SAC_CURSOR_FLAG_BLINK               1
-#define SAC_CURSOR_FLAG_BOLD                2
-#define SAC_CURSOR_FLAG_INVERTED            4
+#define SAC_CELL_FLAG_BLINK                 1
+#define SAC_CELL_FLAG_BOLD                  2
+#define SAC_CELL_FLAG_INVERTED              4
 
 //
 // Forward definitions
@@ -312,21 +312,21 @@ typedef struct _SAC_CHANNEL_LOCK
 //
 // Structure of the cell-buffer when in VT-UTF8 Mode
 //
-typedef struct _SAC_CURSOR_DATA
+typedef struct _SAC_CELL_DATA
 {
-    UCHAR CursorBackColor;
-    UCHAR CursorColor;
-    UCHAR CursorFlags;
-    WCHAR CursorValue;
-} SAC_CURSOR_DATA, *PSAC_CURSOR_DATA;
-C_ASSERT(sizeof(SAC_CURSOR_DATA) == 6);
+    UCHAR CellBackColor;
+    UCHAR CellForeColor;
+    UCHAR CellFlags;
+    WCHAR Char;
+} SAC_CELL_DATA, *PSAC_CELL_DATA;
+C_ASSERT(sizeof(SAC_CELL_DATA) == 6);
 
 //
 // Screen buffer when in VT-UTF8 Mode
 //
 typedef struct _SAC_VTUTF8_SCREEN
 {
-    SAC_CURSOR_DATA Cell[SAC_VTUTF8_ROW_HEIGHT][SAC_VTUTF8_COL_WIDTH];
+    SAC_CELL_DATA Cell[SAC_VTUTF8_ROW_HEIGHT][SAC_VTUTF8_COL_WIDTH];
 } SAC_VTUTF8_SCREEN, *PSAC_VTUTF8_SCREEN;
 
 //
@@ -453,9 +453,9 @@ typedef struct _SAC_CHANNEL
     LONG ChannelHasNewIBufferData;
     UCHAR CursorRow;
     UCHAR CursorCol;
-    UCHAR CursorColor;
-    UCHAR CursorBackColor;
-    UCHAR CursorFlags;
+    UCHAR CellForeColor;
+    UCHAR CellBackColor;
+    UCHAR CellFlags;
     PCHAR OBuffer;
     ULONG OBufferIndex;
     ULONG OBufferFirstGoodIndex;
@@ -479,8 +479,8 @@ typedef struct _SAC_CHANNEL
 typedef struct _SAC_CHANNEL_ATTRIBUTES
 {
     SAC_CHANNEL_TYPE ChannelType;
-    WCHAR NameBuffer[64 + 1];
-    WCHAR DescriptionBuffer[256 + 1];
+    WCHAR NameBuffer[SAC_CHANNEL_NAME_SIZE + 1];
+    WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE + 1];
     ULONG Flag;
     HANDLE CloseEvent;
     HANDLE HasNewDataEvent;
index 29330c0..cc0a62f 100644 (file)
@@ -6,11 +6,11 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 PCHAR Utf8ConversionBuffer;
 ULONG Utf8ConversionBufferSize = PAGE_SIZE;
@@ -32,7 +32,7 @@ ULONG GlobalMessageTableCount;
 LONG SerialPortConsumerIndex, SerialPortProducerIndex;
 PCHAR SerialPortBuffer;
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 BOOLEAN
 NTAPI
@@ -1244,61 +1244,61 @@ GetMessageLineCount(IN ULONG MessageIndex)
 
 ULONG
 ConvertAnsiToUnicode(
-       IN PWCHAR pwch,
-       IN PCHAR pch,
-       IN ULONG length
-       )
+    IN PWCHAR pwch,
+    IN PCHAR pch,
+    IN ULONG length
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 BOOLEAN
 IsCmdEventRegistrationProcess(
-       IN PFILE_OBJECT FileObject
-       )
+    IN PFILE_OBJECT FileObject
+    )
 {
-       return FALSE;
+    return FALSE;
 }
 
 NTSTATUS
 InvokeUserModeService(
-       VOID
-       )
+    VOID
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 TranslateMachineInformationText(
-       IN PWCHAR Buffer)
+    IN PWCHAR Buffer)
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 CopyAndInsertStringAtInterval(
-       IN PWCHAR SourceStr,
-       IN ULONG Interval,
-       IN PWCHAR InsertStr,
-       OUT PWCHAR pDestStr
-       )
+    IN PWCHAR SourceStr,
+    IN ULONG Interval,
+    IN PWCHAR InsertStr,
+    OUT PWCHAR pDestStr
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 RegisterSacCmdEvent(
-       IN PVOID Object,
-       IN PKEVENT SetupCmdEvent[]
-       )
+    IN PVOID Object,
+    IN PKEVENT SetupCmdEvent[]
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
 UnregisterSacCmdEvent(
-       IN PFILE_OBJECT FileObject
-       )
+    IN PFILE_OBJECT FileObject
+    )
 {
-       return STATUS_NOT_IMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
index 69317fb..fe9f7f6 100644 (file)
@@ -6,11 +6,11 @@
  * PROGRAMMERS: ReactOS Portable Systems Group
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include "sacdrv.h"
 
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
 
 CHAR IncomingUtf8ConversionBuffer[4];
 WCHAR IncomingUnicodeValue;
@@ -30,7 +30,7 @@ SAC_STATIC_ESCAPE_STRING SacStaticEscapeStrings [] =
     { VT_ANSI_ERASE_ENTIRE_SCREEN, 3, SacEraseScreen },
 };
 
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
 
 FORCEINLINE
 VOID
@@ -114,7 +114,7 @@ VTUTF8ChannelAnsiDispatch(IN PSAC_CHANNEL Channel,
             Tmp = LocalBuffer;
             break;
 
-        /* Send the [#;#H (Cursor Positio) sequence */
+        /* Send the [#;#H (Cursor Position) sequence */
         case SacAnsiSetPosition:
 
             /* Allocate a small local buffer for it */
@@ -203,7 +203,7 @@ VTUTF8ChannelProcessAttributes(IN PSAC_CHANNEL Channel,
 
     /* Set bold if needed */
     Status = VTUTF8ChannelAnsiDispatch(Channel,
-                                       Attribute & SAC_CURSOR_FLAG_BOLD ?
+                                       Attribute & SAC_CELL_FLAG_BOLD ?
                                        SacAnsiSetBoldAttribute :
                                        SacAnsiClearBoldAttribute,
                                        NULL,
@@ -212,7 +212,7 @@ VTUTF8ChannelProcessAttributes(IN PSAC_CHANNEL Channel,
     
     /* Set blink if needed */
     Status = VTUTF8ChannelAnsiDispatch(Channel,
-                                       Attribute & SAC_CURSOR_FLAG_BLINK ?
+                                       Attribute & SAC_CELL_FLAG_BLINK ?
                                        SacAnsiSetBlinkAttribute :
                                        SacAnsiClearBlinkAttribute,
                                        NULL,
@@ -221,7 +221,7 @@ VTUTF8ChannelProcessAttributes(IN PSAC_CHANNEL Channel,
 
     /* Set inverse if needed */
     return VTUTF8ChannelAnsiDispatch(Channel,
-                                     Attribute & SAC_CURSOR_FLAG_INVERTED ?
+                                     Attribute & SAC_CELL_FLAG_INVERTED ?
                                      SacAnsiSetInverseAttribute :
                                      SacAnsiClearInverseAttribute,
                                      NULL,
@@ -244,7 +244,7 @@ VTUTF8ChannelConsumeEscapeSequence(IN PSAC_CHANNEL Channel,
 {
     ULONG Number, Number2, Number3, i, Action, Result;
     PWCHAR Sequence;
-    PSAC_VTUTF8_SCREEN Cursor;
+    PSAC_VTUTF8_SCREEN Screen;
     ASSERT(String[0] == VT_ANSI_ESCAPE);
 
     /* Microsoft's driver does this after the O(n) check below. Be smarter. */
@@ -441,7 +441,7 @@ ProcessString:
     if (!Result) Result = Sequence - String + 1;
 
     /* Get the current cell buffer */
-    Cursor = (PSAC_VTUTF8_SCREEN)Channel->OBuffer;
+    Screen = (PSAC_VTUTF8_SCREEN)Channel->OBuffer;
     VTUTF8ChannelAssertCursor(Channel);
 
     /* Handle all the supported SAC ANSI commands */
@@ -516,40 +516,40 @@ ProcessString:
             break;
 
         case SacFontNormal:
-            /* Reset the cursor attributes */
-            Channel->CursorFlags = 0;
-            Channel->CursorBackColor = SetBackColorBlack;
-            Channel->CursorColor = SetColorWhite;
+            /* Reset the cell attributes */
+            Channel->CellFlags = 0;
+            Channel->CellBackColor = SetBackColorBlack;
+            Channel->CellForeColor = SetColorWhite;
             break;
 
         case SacFontBlink:
             /* Set the appropriate flag */
-            Channel->CursorFlags |= SAC_CURSOR_FLAG_BLINK;
+            Channel->CellFlags |= SAC_CELL_FLAG_BLINK;
             break;
 
         case SacFontBlinkOff:
             /* Clear the appropriate flag */
-            Channel->CursorFlags &= ~SAC_CURSOR_FLAG_BLINK;
+            Channel->CellFlags &= ~SAC_CELL_FLAG_BLINK;
             break;
 
         case SacFontBold:
             /* Set the appropriate flag */
-            Channel->CursorFlags |= SAC_CURSOR_FLAG_BOLD;
+            Channel->CellFlags |= SAC_CELL_FLAG_BOLD;
             break;
 
         case SacFontBoldOff:
             /* Clear the appropriate flag */
-            Channel->CursorFlags &= ~SAC_CURSOR_FLAG_BOLD;
+            Channel->CellFlags &= ~SAC_CELL_FLAG_BOLD;
             break;
 
         case SacFontInverse:
             /* Set the appropriate flag */
-            Channel->CursorFlags |= SAC_CURSOR_FLAG_INVERTED;
+            Channel->CellFlags |= SAC_CELL_FLAG_INVERTED;
             break;
 
         case SacFontInverseOff:
             /* Clear the appropriate flag */
-            Channel->CursorFlags &= ~SAC_CURSOR_FLAG_INVERTED;
+            Channel->CellFlags &= ~SAC_CELL_FLAG_INVERTED;
             break;
 
         case SacEraseEndOfLine:
@@ -557,10 +557,10 @@ ProcessString:
             for (i = Channel->CursorCol; i < SAC_VTUTF8_COL_WIDTH; i++)
             {
                 /* Replace everything after the current position with blanks */
-                Cursor->Cell[Channel->CursorRow][i].CursorFlags = Channel->CursorFlags;
-                Cursor->Cell[Channel->CursorRow][i].CursorBackColor = Channel->CursorColor;
-                Cursor->Cell[Channel->CursorRow][i].CursorColor = Channel->CursorBackColor;
-                Cursor->Cell[Channel->CursorRow][i].CursorValue = ' ';
+                Screen->Cell[Channel->CursorRow][i].CellFlags = Channel->CellFlags;
+                Screen->Cell[Channel->CursorRow][i].CellBackColor = Channel->CellForeColor;
+                Screen->Cell[Channel->CursorRow][i].CellForeColor = Channel->CellBackColor;
+                Screen->Cell[Channel->CursorRow][i].Char = L' ';
             }
             break;
 
@@ -569,10 +569,10 @@ ProcessString:
             for (i = 0; i < (Channel->CursorCol + 1); i++)
             {
                 /* Replace everything after the current position with blanks */
-                Cursor->Cell[Channel->CursorRow][i].CursorFlags = Channel->CursorFlags;
-                Cursor->Cell[Channel->CursorRow][i].CursorBackColor = Channel->CursorColor;
-                Cursor->Cell[Channel->CursorRow][i].CursorColor = Channel->CursorBackColor;
-                Cursor->Cell[Channel->CursorRow][i].CursorValue = ' ';
+                Screen->Cell[Channel->CursorRow][i].CellFlags = Channel->CellFlags;
+                Screen->Cell[Channel->CursorRow][i].CellBackColor = Channel->CellForeColor;
+                Screen->Cell[Channel->CursorRow][i].CellForeColor = Channel->CellBackColor;
+                Screen->Cell[Channel->CursorRow][i].Char = L' ';
             }
             break;
 
@@ -581,10 +581,10 @@ ProcessString:
             for (i = 0; i < SAC_VTUTF8_COL_WIDTH; i++)
             {
                 /* Replace them all with blanks */
-                Cursor->Cell[Channel->CursorRow][i].CursorFlags = Channel->CursorFlags;
-                Cursor->Cell[Channel->CursorRow][i].CursorBackColor = Channel->CursorColor;
-                Cursor->Cell[Channel->CursorRow][i].CursorColor = Channel->CursorBackColor;
-                Cursor->Cell[Channel->CursorRow][i].CursorValue = ' ';
+                Screen->Cell[Channel->CursorRow][i].CellFlags = Channel->CellFlags;
+                Screen->Cell[Channel->CursorRow][i].CellBackColor = Channel->CellForeColor;
+                Screen->Cell[Channel->CursorRow][i].CellForeColor = Channel->CellBackColor;
+                Screen->Cell[Channel->CursorRow][i].Char = L' ';
             }
             break;
 
@@ -609,26 +609,26 @@ ProcessString:
             break;
 
         case SacSetColors:
-            /* Set the cursor colors */
-            Channel->CursorColor = Number;
-            Channel->CursorBackColor = Number2;
+            /* Set the cell colors */
+            Channel->CellForeColor = Number;
+            Channel->CellBackColor = Number2;
             break;
 
         case SacSetBackgroundColor:
-            /* Set the cursor back color */
-            Channel->CursorBackColor = Number;
+            /* Set the cell back color */
+            Channel->CellBackColor = Number;
             break;
 
         case SacSetFontColor:
-            /* Set the cursor text color */
-            Channel->CursorColor = Number;
+            /* Set the cell text color */
+            Channel->CellForeColor = Number;
             break;
 
         case SacSetColorsAndAttributes:
-            /* Set the cursor flag and colors */
-            Channel->CursorFlags = Number;
-            Channel->CursorColor = Number2;
-            Channel->CursorBackColor = Number3;
+            /* Set the cell flag and colors */
+            Channel->CellFlags = Number;
+            Channel->CellForeColor = Number2;
+            Channel->CellBackColor = Number3;
             break;
 
         default:
@@ -644,32 +644,29 @@ NTSTATUS
 NTAPI
 VTUTF8ChannelOInit(IN PSAC_CHANNEL Channel)
 {
-    PSAC_CURSOR_DATA Cursor;
-    ULONG x, y;
+    PSAC_VTUTF8_SCREEN Screen;
+    ULONG R, C;
     CHECK_PARAMETER(Channel);
 
-    /* Set the current channel cursor parameters */
-    Channel->CursorFlags = 0;
-    Channel->CursorBackColor = SetBackColorBlack;
-    Channel->CursorColor = SetColorWhite;
+    /* Set the current channel cell parameters */
+    Channel->CellFlags = 0;
+    Channel->CellBackColor = SetBackColorBlack;
+    Channel->CellForeColor = SetColorWhite;
+
+    /* Set the cell buffer position */
+    Screen = (PSAC_VTUTF8_SCREEN)Channel->OBuffer;
 
     /* Loop the output buffer height by width */
-    Cursor = (PSAC_CURSOR_DATA)Channel->OBuffer;
-    y = SAC_VTUTF8_ROW_HEIGHT;
-    do
+    for (R = 0; R < SAC_VTUTF8_ROW_HEIGHT; R++)
     {
-        x = SAC_VTUTF8_COL_WIDTH;
-        do
+        for (C = 0; C < SAC_VTUTF8_COL_WIDTH; C++)
         {
             /* For every character, set the defaults */
-            Cursor->CursorValue = ' ';
-            Cursor->CursorBackColor = SetBackColorBlack;
-            Cursor->CursorColor = SetColorWhite;
-
-            /* Move to the next character */
-            Cursor++;
-        } while (--x);
-    } while (--y);
+            Screen->Cell[R][C].Char = L' ';
+            Screen->Cell[R][C].CellBackColor = SetBackColorBlack;
+            Screen->Cell[R][C].CellForeColor = SetColorWhite;
+        }
+    }
 
     /* All done */
     return STATUS_SUCCESS;
@@ -728,7 +725,7 @@ NTAPI
 VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
 {
     NTSTATUS Status;
-    PSAC_VTUTF8_SCREEN Cursor;
+    PSAC_VTUTF8_SCREEN Screen;
     INT Color[2], Position[2];
     ULONG Utf8ProcessedCount, Utf8Count, R, C, ForeColor, BackColor, Attribute;
     PWCHAR TmpBuffer;
@@ -736,7 +733,7 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
     CHECK_PARAMETER(Channel);
 
     /* Set the cell buffer position */
-    Cursor = (PSAC_VTUTF8_SCREEN)Channel->OBuffer;
+    Screen = (PSAC_VTUTF8_SCREEN)Channel->OBuffer;
 
     /* Allocate a temporary buffer */
     TmpBuffer = SacAllocatePool(40, GLOBAL_BLOCK_TAG);
@@ -769,14 +766,14 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
                                        0);
     if (!NT_SUCCESS(Status)) goto Quickie;
 
-    /* Now set the current cursor attributes */
-    Attribute = Channel->CursorFlags;
+    /* Now set the current cell attributes */
+    Attribute = Channel->CellFlags;
     Status = VTUTF8ChannelProcessAttributes(Channel, Attribute);
     if (!NT_SUCCESS(Status)) goto Quickie;
 
-    /* And set the current cursor colors */
-    ForeColor = Channel->CursorColor;
-    BackColor = Channel->CursorBackColor;
+    /* And set the current cell colors */
+    ForeColor = Channel->CellForeColor;
+    BackColor = Channel->CellBackColor;
     Color[1] = BackColor;
     Color[0] = ForeColor;
     Status = VTUTF8ChannelAnsiDispatch(Channel,
@@ -788,12 +785,12 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
     /* Now loop all the characters in the cell buffer */
     for (R = 0; R < SAC_VTUTF8_ROW_HEIGHT; R++)
     {
-        /* Accross every row */
+        /* Across every row */
         for (C = 0; C < SAC_VTUTF8_COL_WIDTH; C++)
         {
             /* Check if there's been a change in colors */
-            if ((Cursor->Cell[R][C].CursorBackColor != BackColor) ||
-                (Cursor->Cell[R][C].CursorColor != ForeColor))
+            if ((Screen->Cell[R][C].CellBackColor != BackColor) ||
+                (Screen->Cell[R][C].CellForeColor != ForeColor))
             {
                 /* New colors are being drawn -- are we also on a new row now? */
                 if (Overflow)
@@ -810,8 +807,8 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
                 }
 
                 /* Cache the new colors */
-                ForeColor = Cursor->Cell[R][C].CursorColor;
-                BackColor = Cursor->Cell[R][C].CursorBackColor;
+                ForeColor = Screen->Cell[R][C].CellForeColor;
+                BackColor = Screen->Cell[R][C].CellBackColor;
 
                 /* Set them on the screen */
                 Color[1] = BackColor;
@@ -824,7 +821,7 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
             }
 
             /* Check if there's been a change in attributes */
-            if (Cursor->Cell[R][C].CursorFlags != Attribute)
+            if (Screen->Cell[R][C].CellFlags != Attribute)
             {
                 /* Yep! Are we also on a new row now? */
                 if (Overflow)
@@ -841,7 +838,7 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
                 }
 
                 /* Set the new attributes on screen */
-                Attribute = Cursor->Cell[R][C].CursorFlags;
+                Attribute = Screen->Cell[R][C].CellFlags;
                 Status = VTUTF8ChannelProcessAttributes(Channel, Attribute);
                 if (!NT_SUCCESS(Status)) goto Quickie;
             }
@@ -861,7 +858,7 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
             }
 
             /* Write the character into our temporary buffer */
-            *TmpBuffer = Cursor->Cell[R][C].CursorValue;
+            *TmpBuffer = Screen->Cell[R][C].Char;
             TmpBuffer[1] = UNICODE_NULL;
 
             /* Convert it to UTF-8 */
@@ -900,12 +897,12 @@ VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
     if (!NT_SUCCESS(Status)) goto Quickie;
 
     /* Set the current attribute one last time */
-    Status = VTUTF8ChannelProcessAttributes(Channel, Channel->CursorFlags);
+    Status = VTUTF8ChannelProcessAttributes(Channel, Channel->CellFlags);
     if (!NT_SUCCESS(Status)) goto Quickie;
 
     /* Set the current colors one last time */
-    Color[1] = Channel->CursorBackColor;
-    Color[0] = Channel->CursorColor;
+    Color[1] = Channel->CellBackColor;
+    Color[0] = Channel->CellForeColor;
     Status = VTUTF8ChannelAnsiDispatch(Channel,
                                        SacAnsiSetColors,
                                        Color,
@@ -935,7 +932,7 @@ VTUTF8ChannelOWrite2(IN PSAC_CHANNEL Channel,
                      IN PWCHAR String,
                      IN ULONG Size)
 {
-    PSAC_VTUTF8_SCREEN Cursor;
+    PSAC_VTUTF8_SCREEN Screen;
     ULONG i, EscapeSize, R, C;
     PWSTR pwch;
     CHECK_PARAMETER1(Channel);
@@ -943,7 +940,7 @@ VTUTF8ChannelOWrite2(IN PSAC_CHANNEL Channel,
     VTUTF8ChannelAssertCursor(Channel);
 
     /* Loop every character */
-    Cursor = (PSAC_VTUTF8_SCREEN) Channel->OBuffer;
+    Screen = (PSAC_VTUTF8_SCREEN)Channel->OBuffer;
     for (i = 0; i < Size; i++)
     {
         /* Check what the character is */
@@ -995,13 +992,13 @@ VTUTF8ChannelOWrite2(IN PSAC_CHANNEL Channel,
                         for (C = 0; C < SAC_VTUTF8_COL_WIDTH; C++)
                         {
                             /* And replace it with one from the row below */
-                            Cursor->Cell[R][C] = Cursor->Cell[R + 1][C];
+                            Screen->Cell[R][C] = Screen->Cell[R + 1][C];
                         }
                     }
 
                     /* Now we're left with the before-last row, zero it out */
                     ASSERT(R == (SAC_VTUTF8_ROW_HEIGHT - 1));
-                    RtlZeroMemory(&Cursor->Cell[R], sizeof(Cursor->Cell[R]));
+                    RtlZeroMemory(&Screen->Cell[R], sizeof(Screen->Cell[R]));
 
                     /* Reset the row back by one */
                     Channel->CursorRow--;
@@ -1018,10 +1015,10 @@ VTUTF8ChannelOWrite2(IN PSAC_CHANNEL Channel,
                 {
                     /* Fill each remaining character with a space */
                     VTUTF8ChannelAssertCursor(Channel);
-                    Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorFlags = Channel->CursorFlags;
-                    Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorBackColor = Channel->CursorBackColor;
-                    Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorColor = Channel->CursorColor;
-                    Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorValue = ' ';
+                    Screen->Cell[Channel->CursorRow][Channel->CursorCol].CellFlags = Channel->CellFlags;
+                    Screen->Cell[Channel->CursorRow][Channel->CursorCol].CellBackColor = Channel->CellBackColor;
+                    Screen->Cell[Channel->CursorRow][Channel->CursorCol].CellForeColor = Channel->CellForeColor;
+                    Screen->Cell[Channel->CursorRow][Channel->CursorCol].Char = L' ';
 
                     /* Move to the next character position, but don't overflow */
                     Channel->CursorCol++;
@@ -1052,10 +1049,10 @@ VTUTF8ChannelOWrite2(IN PSAC_CHANNEL Channel,
 
                 /* Otherwise, print it out with the current attributes */
                 VTUTF8ChannelAssertCursor(Channel);
-                Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorFlags = Channel->CursorFlags;
-                Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorBackColor = Channel->CursorBackColor;
-                Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorColor = Channel->CursorColor;
-                Cursor->Cell[Channel->CursorRow][Channel->CursorCol].CursorValue = *pwch;
+                Screen->Cell[Channel->CursorRow][Channel->CursorCol].CellFlags = Channel->CellFlags;
+                Screen->Cell[Channel->CursorRow][Channel->CursorCol].CellBackColor = Channel->CellBackColor;
+                Screen->Cell[Channel->CursorRow][Channel->CursorCol].CellForeColor = Channel->CellForeColor;
+                Screen->Cell[Channel->CursorRow][Channel->CursorCol].Char = *pwch;
 
                 /* Move forward one character, but make sure not to overflow */
                 Channel->CursorCol++;