Author: hbelusca
Date: Sun Oct 13 19:40:34 2013
New Revision: 60642
URL:
http://svn.reactos.org/svn/reactos?rev=60642&view=rev
Log:
[SACDRV]:
- Tabs vs. spaces fix;
- Less hardcoded values;
- Consistency in members names.
No functional changes.
Modified:
trunk/reactos/drivers/sac/driver/chanmgr.c
trunk/reactos/drivers/sac/driver/channel.c
trunk/reactos/drivers/sac/driver/cmdchan.c
trunk/reactos/drivers/sac/driver/concmd.c
trunk/reactos/drivers/sac/driver/conmgr.c
trunk/reactos/drivers/sac/driver/data.c
trunk/reactos/drivers/sac/driver/dispatch.c
trunk/reactos/drivers/sac/driver/init.c
trunk/reactos/drivers/sac/driver/memory.c
trunk/reactos/drivers/sac/driver/rawchan.c
trunk/reactos/drivers/sac/driver/sacdrv.h
trunk/reactos/drivers/sac/driver/util.c
trunk/reactos/drivers/sac/driver/vtutf8chan.c
Modified: trunk/reactos/drivers/sac/driver/chanmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/chanmgr…
==============================================================================
--- trunk/reactos/drivers/sac/driver/chanmgr.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/chanmgr.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 @@
LONG CurrentChannelRefCount;
KMUTEX CurrentChannelLock;
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
#define MAX_REF_COUNT 100
Modified: trunk/reactos/drivers/sac/driver/channel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/channel…
==============================================================================
--- trunk/reactos/drivers/sac/driver/channel.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/channel.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -6,13 +6,13 @@
* PROGRAMMERS: ReactOS Portable Systems Group
*/
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
#include "sacdrv.h"
-/* GLOBALS *******************************************************************/
-
-/* FUNCTIONS *****************************************************************/
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
BOOLEAN
NTAPI
@@ -255,19 +255,19 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
Modified: trunk/reactos/drivers/sac/driver/cmdchan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/cmdchan…
==============================================================================
--- trunk/reactos/drivers/sac/driver/cmdchan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/cmdchan.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 *******************************************************************/
@@ -16,45 +16,45 @@
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;
}
Modified: trunk/reactos/drivers/sac/driver/concmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/concmd.…
==============================================================================
--- trunk/reactos/drivers/sac/driver/concmd.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/concmd.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ VOID
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
DoChannelCloseByNameCommand(
- IN PCHAR Count
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN PCHAR Count
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
DoChannelCloseByIndexCommand(
- IN ULONG ChannelIndex
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN ULONG ChannelIndex
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
DoChannelSwitchByNameCommand(
- IN PCHAR Count
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN PCHAR Count
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
DoChannelSwitchByIndexCommand(
- IN ULONG ChannelIndex
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN ULONG ChannelIndex
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
typedef struct _SAC_SYSTEM_INFORMATION
@@ -324,28 +324,28 @@
BOOLEAN
RetrieveIpAddressFromString(
- IN PWCHAR IpString,
- OUT PULONG IpAddress
- )
-{
- return FALSE;
+ IN PWCHAR IpString,
+ OUT PULONG IpAddress
+ )
+{
+ 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
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ 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;
}
VOID
Modified: trunk/reactos/drivers/sac/driver/conmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/conmgr.…
==============================================================================
--- trunk/reactos/drivers/sac/driver/conmgr.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/conmgr.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 @@
BOOLEAN GlobalPagingNeeded, GlobalDoThreads;
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
VOID
NTAPI
Modified: trunk/reactos/drivers/sac/driver/data.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/data.c?…
==============================================================================
--- trunk/reactos/drivers/sac/driver/data.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/data.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 @@
PKEVENT SACEvent;
HANDLE SACEventHandle;
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
VOID
NTAPI
Modified: trunk/reactos/drivers/sac/driver/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/dispatc…
==============================================================================
--- trunk/reactos/drivers/sac/driver/dispatch.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/dispatch.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -6,15 +6,15 @@
* PROGRAMMERS: ReactOS Portable Systems Group
*/
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
#include "sacdrv.h"
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
LONG TimerDpcCount;
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
NTSTATUS
NTAPI
Modified: trunk/reactos/drivers/sac/driver/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/init.c?…
==============================================================================
--- trunk/reactos/drivers/sac/driver/init.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/init.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -6,13 +6,13 @@
* PROGRAMMERS: ReactOS Portable Systems Group
*/
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
#include "sacdrv.h"
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
NTSTATUS
NTAPI
Modified: trunk/reactos/drivers/sac/driver/memory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/memory.…
==============================================================================
--- trunk/reactos/drivers/sac/driver/memory.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/memory.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 @@
#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 @@
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;
Modified: trunk/reactos/drivers/sac/driver/rawchan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/rawchan…
==============================================================================
--- trunk/reactos/drivers/sac/driver/rawchan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/rawchan.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -6,13 +6,13 @@
* PROGRAMMERS: ReactOS Portable Systems Group
*/
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
#include "sacdrv.h"
-/* GLOBALS *******************************************************************/
-
-/* FUNCTIONS *****************************************************************/
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
NTSTATUS
NTAPI
Modified: trunk/reactos/drivers/sac/driver/sacdrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/sacdrv.…
==============================================================================
--- trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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
@@ -48,12 +48,12 @@
// 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)
@@ -71,63 +71,63 @@
//
// 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; \
+ } \
}
//
@@ -145,7 +145,7 @@
#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
@@ -172,16 +172,16 @@
#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
-//
-#define SAC_CURSOR_FLAG_BLINK 1
-#define SAC_CURSOR_FLAG_BOLD 2
-#define SAC_CURSOR_FLAG_INVERTED 4
+// Cell Flags
+//
+#define SAC_CELL_FLAG_BLINK 1
+#define SAC_CELL_FLAG_BOLD 2
+#define SAC_CELL_FLAG_INVERTED 4
//
// Forward definitions
@@ -312,21 +312,21 @@
//
// Structure of the cell-buffer when in VT-UTF8 Mode
//
-typedef struct _SAC_CURSOR_DATA
-{
- UCHAR CursorBackColor;
- UCHAR CursorColor;
- UCHAR CursorFlags;
- WCHAR CursorValue;
-} SAC_CURSOR_DATA, *PSAC_CURSOR_DATA;
-C_ASSERT(sizeof(SAC_CURSOR_DATA) == 6);
+typedef struct _SAC_CELL_DATA
+{
+ 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 @@
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_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;
Modified: trunk/reactos/drivers/sac/driver/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/util.c?…
==============================================================================
--- trunk/reactos/drivers/sac/driver/util.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/util.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 @@
LONG SerialPortConsumerIndex, SerialPortProducerIndex;
PCHAR SerialPortBuffer;
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
BOOLEAN
NTAPI
@@ -1244,61 +1244,61 @@
ULONG
ConvertAnsiToUnicode(
- IN PWCHAR pwch,
- IN PCHAR pch,
- IN ULONG length
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN PWCHAR pwch,
+ IN PCHAR pch,
+ IN ULONG length
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
BOOLEAN
IsCmdEventRegistrationProcess(
- IN PFILE_OBJECT FileObject
- )
-{
- return FALSE;
+ IN PFILE_OBJECT FileObject
+ )
+{
+ return FALSE;
}
NTSTATUS
InvokeUserModeService(
- VOID
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ VOID
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
TranslateMachineInformationText(
- IN PWCHAR Buffer)
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN PWCHAR Buffer)
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
CopyAndInsertStringAtInterval(
- IN PWCHAR SourceStr,
- IN ULONG Interval,
- IN PWCHAR InsertStr,
- OUT PWCHAR pDestStr
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN PWCHAR SourceStr,
+ IN ULONG Interval,
+ IN PWCHAR InsertStr,
+ OUT PWCHAR pDestStr
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
RegisterSacCmdEvent(
- IN PVOID Object,
- IN PKEVENT SetupCmdEvent[]
- )
-{
- return STATUS_NOT_IMPLEMENTED;
+ IN PVOID Object,
+ IN PKEVENT SetupCmdEvent[]
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
UnregisterSacCmdEvent(
- IN PFILE_OBJECT FileObject
- )
-{
- return STATUS_NOT_IMPLEMENTED;
-}
+ IN PFILE_OBJECT FileObject
+ )
+{
+ return STATUS_NOT_IMPLEMENTED;
+}
Modified: trunk/reactos/drivers/sac/driver/vtutf8chan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/vtutf8c…
==============================================================================
--- trunk/reactos/drivers/sac/driver/vtutf8chan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/vtutf8chan.c [iso-8859-1] Sun Oct 13 19:40:34 2013
@@ -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 @@
{ VT_ANSI_ERASE_ENTIRE_SCREEN, 3, SacEraseScreen },
};
-/* FUNCTIONS *****************************************************************/
+/* FUNCTIONS ******************************************************************/
FORCEINLINE
VOID
@@ -114,7 +114,7 @@
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 @@
/* Set bold if needed */
Status = VTUTF8ChannelAnsiDispatch(Channel,
- Attribute & SAC_CURSOR_FLAG_BOLD ?
+ Attribute & SAC_CELL_FLAG_BOLD ?
SacAnsiSetBoldAttribute :
SacAnsiClearBoldAttribute,
NULL,
@@ -212,7 +212,7 @@
/* Set blink if needed */
Status = VTUTF8ChannelAnsiDispatch(Channel,
- Attribute & SAC_CURSOR_FLAG_BLINK ?
+ Attribute & SAC_CELL_FLAG_BLINK ?
SacAnsiSetBlinkAttribute :
SacAnsiClearBlinkAttribute,
NULL,
@@ -221,7 +221,7 @@
/* Set inverse if needed */
return VTUTF8ChannelAnsiDispatch(Channel,
- Attribute & SAC_CURSOR_FLAG_INVERTED ?
+ Attribute & SAC_CELL_FLAG_INVERTED ?
SacAnsiSetInverseAttribute :
SacAnsiClearInverseAttribute,
NULL,
@@ -244,7 +244,7 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
- {
- x = SAC_VTUTF8_COL_WIDTH;
- do
+ for (R = 0; R < SAC_VTUTF8_ROW_HEIGHT; R++)
+ {
+ 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 @@
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 @@
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 @@
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 @@
/* 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 @@
}
/* 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 @@
}
/* 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 @@
}
/* 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 @@
}
/* 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 @@
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 @@
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 @@
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 @@
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 @@
{
/* 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 @@
/* 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++;