https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ef2c4515ef7aa44b3d9c…
commit 5ef2c4515ef7aa44b3d9c2eb7360e79f30cffe3f
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sun Dec 24 00:04:15 2017 +0100
[NTVDM] Move the def file out of the source files list. Rename some variables and
functions. #179
---
subsystems/mvdm/ntvdm/CMakeLists.txt | 10 +-
subsystems/mvdm/ntvdm/dos/dem.c | 2 +-
subsystems/mvdm/ntvdm/dos/dem.h | 4 +-
subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c | 136 +++++++++++++--------------
subsystems/mvdm/ntvdm/dos/dos32krnl/himem.c | 32 +++----
subsystems/mvdm/ntvdm/hardware/keyboard.c | 58 ++++++------
subsystems/mvdm/ntvdm/hardware/mouse.c | 86 ++++++++---------
7 files changed, 166 insertions(+), 162 deletions(-)
diff --git a/subsystems/mvdm/ntvdm/CMakeLists.txt b/subsystems/mvdm/ntvdm/CMakeLists.txt
index 6cdaf7e449..30a4398702 100644
--- a/subsystems/mvdm/ntvdm/CMakeLists.txt
+++ b/subsystems/mvdm/ntvdm/CMakeLists.txt
@@ -67,12 +67,16 @@ list(APPEND SOURCE
utils.c
vddsup.c
ntvdm.c
- ntvdm.h
- ${CMAKE_CURRENT_BINARY_DIR}/ntvdm.def)
+ ntvdm.h)
file(GLOB ntvdm_rc_deps res/*.*)
add_rc_deps(ntvdm.rc ${ntvdm_rc_deps})
-add_executable(ntvdm ${SOURCE} ntvdm.rc)
+
+add_executable(ntvdm
+ ${SOURCE}
+ ntvdm.rc
+ ${CMAKE_CURRENT_BINARY_DIR}/ntvdm.def)
+
add_pch(ntvdm ntvdm.h SOURCE)
set_module_type(ntvdm win32cui UNICODE IMAGEBASE 0x0F000000)
target_link_libraries(ntvdm fast486 ${PSEH_LIB})
diff --git a/subsystems/mvdm/ntvdm/dos/dem.c b/subsystems/mvdm/ntvdm/dos/dem.c
index 0848d456bf..1c81eacc1c 100644
--- a/subsystems/mvdm/ntvdm/dos/dem.c
+++ b/subsystems/mvdm/ntvdm/dos/dem.c
@@ -54,7 +54,7 @@
\******************************************************************************/
-VOID BiosCharPrint(CHAR Character)
+VOID Dem_BiosCharPrint(CHAR Character)
{
/* Save AX and BX */
USHORT AX = getAX();
diff --git a/subsystems/mvdm/ntvdm/dos/dem.h b/subsystems/mvdm/ntvdm/dos/dem.h
index befbe80dc6..8760e0468f 100644
--- a/subsystems/mvdm/ntvdm/dos/dem.h
+++ b/subsystems/mvdm/ntvdm/dos/dem.h
@@ -29,9 +29,9 @@
/* FUNCTIONS ******************************************************************/
-VOID BiosCharPrint(CHAR Character);
+VOID Dem_BiosCharPrint(CHAR Character);
#define BiosDisplayMessage(Format, ...) \
- PrintMessageAnsi(BiosCharPrint, (Format), ##__VA_ARGS__)
+ PrintMessageAnsi(Dem_BiosCharPrint, (Format), ##__VA_ARGS__)
VOID DosCharPrint(CHAR Character);
#define DosDisplayMessage(Format, ...) \
diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
b/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
index 38da36c23e..8ba74891c9 100644
--- a/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
+++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
@@ -35,9 +35,9 @@
static PDOS_DEVICE_NODE Node;
static RTL_BITMAP AllocBitmap;
-static PULONG BitmapBuffer = NULL;
-static PEMS_PAGE PageTable = NULL;
-static EMS_HANDLE HandleTable[EMS_MAX_HANDLES];
+static PULONG EmsBitmapBuffer = NULL;
+static PEMS_PAGE EmsPageTable = NULL;
+static EMS_HANDLE EmsHandleTable[EMS_MAX_HANDLES];
static PVOID Mapping[EMS_PHYSICAL_PAGES] = { NULL };
static PVOID MappingBackup[EMS_PHYSICAL_PAGES] = { NULL };
static ULONG EmsTotalPages = 0;
@@ -50,12 +50,12 @@ static VOID InitHandlesTable(VOID)
{
USHORT i;
- for (i = 0; i < ARRAYSIZE(HandleTable); i++)
+ for (i = 0; i < ARRAYSIZE(EmsHandleTable); i++)
{
- HandleTable[i].Allocated = FALSE;
- HandleTable[i].PageCount = 0;
- RtlZeroMemory(HandleTable[i].Name, sizeof(HandleTable[i].Name));
- InitializeListHead(&HandleTable[i].PageList);
+ EmsHandleTable[i].Allocated = FALSE;
+ EmsHandleTable[i].PageCount = 0;
+ RtlZeroMemory(EmsHandleTable[i].Name, sizeof(EmsHandleTable[i].Name));
+ InitializeListHead(&EmsHandleTable[i].PageList);
}
}
@@ -65,9 +65,9 @@ static PEMS_HANDLE CreateHandle(PUSHORT Handle)
USHORT i;
/* Handle 0 is reserved (system handle) */
- for (i = 1; i < ARRAYSIZE(HandleTable); i++)
+ for (i = 1; i < ARRAYSIZE(EmsHandleTable); i++)
{
- HandleEntry = &HandleTable[i];
+ HandleEntry = &EmsHandleTable[i];
if (!HandleEntry->Allocated)
{
*Handle = i;
@@ -87,10 +87,10 @@ static VOID FreeHandle(PEMS_HANDLE HandleEntry)
// InitializeListHead(&HandleEntry->PageList);
}
-static inline PEMS_HANDLE GetHandleRecord(USHORT Handle)
+static inline PEMS_HANDLE GetEmsHandleRecord(USHORT Handle)
{
- if (Handle >= ARRAYSIZE(HandleTable)) return NULL;
- return &HandleTable[Handle];
+ if (Handle >= ARRAYSIZE(EmsHandleTable)) return NULL;
+ return &EmsHandleTable[Handle];
}
static inline BOOLEAN ValidateHandle(PEMS_HANDLE HandleEntry)
@@ -101,7 +101,7 @@ static inline BOOLEAN ValidateHandle(PEMS_HANDLE HandleEntry)
static UCHAR EmsFree(USHORT Handle)
{
PLIST_ENTRY Entry;
- PEMS_HANDLE HandleEntry = GetHandleRecord(Handle);
+ PEMS_HANDLE HandleEntry = GetEmsHandleRecord(Handle);
if (!ValidateHandle(HandleEntry))
return EMS_STATUS_INVALID_HANDLE;
@@ -111,7 +111,7 @@ static UCHAR EmsFree(USHORT Handle)
Entry = Entry->Flink)
{
PEMS_PAGE PageEntry = (PEMS_PAGE)CONTAINING_RECORD(Entry, EMS_PAGE, Entry);
- ULONG PageNumber = ARRAY_INDEX(PageEntry, PageTable);
+ ULONG PageNumber = ARRAY_INDEX(PageEntry, EmsPageTable);
/* Free the page */
RtlClearBits(&AllocBitmap, PageNumber, 1);
@@ -158,8 +158,8 @@ static UCHAR EmsAlloc(USHORT NumPages, PUSHORT Handle)
for (i = 0; i < RunSize; i++)
{
- PageTable[RunStart + i].Handle = *Handle;
- InsertTailList(&HandleEntry->PageList, &PageTable[RunStart +
i].Entry);
+ EmsPageTable[RunStart + i].Handle = *Handle;
+ InsertTailList(&HandleEntry->PageList, &EmsPageTable[RunStart +
i].Entry);
}
}
@@ -173,7 +173,7 @@ static UCHAR InitSystemHandle(USHORT NumPages)
//
ULONG i, CurrentIndex = 0;
- PEMS_HANDLE HandleEntry = &HandleTable[EMS_SYSTEM_HANDLE];
+ PEMS_HANDLE HandleEntry = &EmsHandleTable[EMS_SYSTEM_HANDLE];
/* The system handle must never have been initialized before */
ASSERT(!HandleEntry->Allocated);
@@ -209,8 +209,8 @@ static UCHAR InitSystemHandle(USHORT NumPages)
for (i = 0; i < RunSize; i++)
{
- PageTable[RunStart + i].Handle = EMS_SYSTEM_HANDLE;
- InsertTailList(&HandleEntry->PageList, &PageTable[RunStart +
i].Entry);
+ EmsPageTable[RunStart + i].Handle = EMS_SYSTEM_HANDLE;
+ InsertTailList(&HandleEntry->PageList, &EmsPageTable[RunStart +
i].Entry);
}
}
@@ -234,7 +234,7 @@ static PEMS_PAGE GetLogicalPage(PEMS_HANDLE HandleEntry, USHORT
LogicalPage)
static UCHAR EmsMap(USHORT Handle, UCHAR PhysicalPage, USHORT LogicalPage)
{
PEMS_PAGE PageEntry;
- PEMS_HANDLE HandleEntry = GetHandleRecord(Handle);
+ PEMS_HANDLE HandleEntry = GetEmsHandleRecord(Handle);
if (!ValidateHandle(HandleEntry))
return EMS_STATUS_INVALID_HANDLE;
@@ -253,7 +253,7 @@ static UCHAR EmsMap(USHORT Handle, UCHAR PhysicalPage, USHORT
LogicalPage)
if (!PageEntry) return EMS_STATUS_INV_LOGICAL_PAGE;
Mapping[PhysicalPage] = (PVOID)((ULONG_PTR)EmsMemory
- + ARRAY_INDEX(PageEntry, PageTable) * EMS_PAGE_SIZE);
+ + ARRAY_INDEX(PageEntry, EmsPageTable) * EMS_PAGE_SIZE);
return EMS_STATUS_SUCCESS;
}
@@ -344,9 +344,9 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
USHORT NumOpenHandles = 0;
USHORT i;
- for (i = 0; i < ARRAYSIZE(HandleTable); i++)
+ for (i = 0; i < ARRAYSIZE(EmsHandleTable); i++)
{
- if (HandleTable[i].Allocated)
+ if (EmsHandleTable[i].Allocated)
++NumOpenHandles;
}
@@ -358,7 +358,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
/* Get Handle Number of Pages */
case 0x4C:
{
- PEMS_HANDLE HandleEntry = GetHandleRecord(getDX());
+ PEMS_HANDLE HandleEntry = GetEmsHandleRecord(getDX());
if (!ValidateHandle(HandleEntry))
{
@@ -378,12 +378,12 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
USHORT NumOpenHandles = 0;
USHORT i;
- for (i = 0; i < ARRAYSIZE(HandleTable); i++)
+ for (i = 0; i < ARRAYSIZE(EmsHandleTable); i++)
{
- if (HandleTable[i].Allocated)
+ if (EmsHandleTable[i].Allocated)
{
HandlePageInfo->Handle = i;
- HandlePageInfo->PageCount = HandleTable[i].PageCount;
+ HandlePageInfo->PageCount = EmsHandleTable[i].PageCount;
++HandlePageInfo;
++NumOpenHandles;
}
@@ -430,7 +430,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
/* Get/Set Handle Name */
case 0x53:
{
- PEMS_HANDLE HandleEntry = GetHandleRecord(getDX());
+ PEMS_HANDLE HandleEntry = GetEmsHandleRecord(getDX());
if (!ValidateHandle(HandleEntry))
{
@@ -474,13 +474,13 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
USHORT NumOpenHandles = 0;
USHORT i;
- for (i = 0; i < ARRAYSIZE(HandleTable); i++)
+ for (i = 0; i < ARRAYSIZE(EmsHandleTable); i++)
{
- if (HandleTable[i].Allocated)
+ if (EmsHandleTable[i].Allocated)
{
HandleDir->Handle = i;
RtlCopyMemory(HandleDir->Name,
- HandleTable[i].Name,
+ EmsHandleTable[i].Name,
sizeof(HandleDir->Name));
++HandleDir;
++NumOpenHandles;
@@ -498,20 +498,20 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
PEMS_HANDLE HandleFound = NULL;
USHORT i;
- for (i = 0; i < ARRAYSIZE(HandleTable); i++)
+ for (i = 0; i < ARRAYSIZE(EmsHandleTable); i++)
{
- if (HandleTable[i].Allocated &&
+ if (EmsHandleTable[i].Allocated &&
RtlCompareMemory(HandleName,
- HandleTable[i].Name,
- sizeof(HandleTable[i].Name)) ==
sizeof(HandleTable[i].Name))
+ EmsHandleTable[i].Name,
+ sizeof(EmsHandleTable[i].Name)) ==
sizeof(EmsHandleTable[i].Name))
{
- HandleFound = &HandleTable[i];
+ HandleFound = &EmsHandleTable[i];
break;
}
}
/* Bail out if no handle was found */
- if (i >= ARRAYSIZE(HandleTable)) // HandleFound == NULL
+ if (i >= ARRAYSIZE(EmsHandleTable)) // HandleFound == NULL
{
setAH(EMS_STATUS_HANDLE_NOT_FOUND);
break;
@@ -544,7 +544,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
* a program may request.
*/
setAH(EMS_STATUS_SUCCESS);
- setBX(ARRAYSIZE(HandleTable));
+ setBX(ARRAYSIZE(EmsHandleTable));
}
else
{
@@ -567,7 +567,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
if (Data->SourceType)
{
/* Expanded memory */
- HandleEntry = GetHandleRecord(Data->SourceHandle);
+ HandleEntry = GetEmsHandleRecord(Data->SourceHandle);
if (!ValidateHandle(HandleEntry))
{
setAH(EMS_STATUS_INVALID_HANDLE);
@@ -582,7 +582,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
}
SourcePtr = (PUCHAR)((ULONG_PTR)EmsMemory
- + ARRAY_INDEX(PageEntry, PageTable) * EMS_PAGE_SIZE
+ + ARRAY_INDEX(PageEntry, EmsPageTable) *
EMS_PAGE_SIZE
+ Data->SourceOffset);
}
else
@@ -594,7 +594,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
if (Data->DestType)
{
/* Expanded memory */
- HandleEntry = GetHandleRecord(Data->DestHandle);
+ HandleEntry = GetEmsHandleRecord(Data->DestHandle);
if (!ValidateHandle(HandleEntry))
{
setAH(EMS_STATUS_INVALID_HANDLE);
@@ -609,7 +609,7 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack)
}
DestPtr = (PUCHAR)((ULONG_PTR)EmsMemory
- + ARRAY_INDEX(PageEntry, PageTable) * EMS_PAGE_SIZE
+ + ARRAY_INDEX(PageEntry, EmsPageTable) *
EMS_PAGE_SIZE
+ Data->DestOffset);
}
else
@@ -774,24 +774,24 @@ BOOLEAN EmsDrvInitialize(USHORT Segment, ULONG TotalPages)
if (!UmaDescReserve(&EmsSegment, &Size)) return FALSE;
EmsTotalPages = TotalPages;
- BitmapBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
- HEAP_ZERO_MEMORY,
- ((TotalPages + 31) / 32) * sizeof(ULONG));
- if (BitmapBuffer == NULL)
+ EmsBitmapBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ ((TotalPages + 31) / 32) * sizeof(ULONG));
+ if (EmsBitmapBuffer == NULL)
{
UmaDescRelease(EmsSegment);
return FALSE;
}
- RtlInitializeBitMap(&AllocBitmap, BitmapBuffer, TotalPages);
+ RtlInitializeBitMap(&AllocBitmap, EmsBitmapBuffer, TotalPages);
- PageTable = (PEMS_PAGE)RtlAllocateHeap(RtlGetProcessHeap(),
- HEAP_ZERO_MEMORY,
- TotalPages * sizeof(EMS_PAGE));
- if (PageTable == NULL)
+ EmsPageTable = (PEMS_PAGE)RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ TotalPages * sizeof(EMS_PAGE));
+ if (EmsPageTable == NULL)
{
- RtlFreeHeap(RtlGetProcessHeap(), 0, BitmapBuffer);
- BitmapBuffer = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsBitmapBuffer);
+ EmsBitmapBuffer = NULL;
UmaDescRelease(EmsSegment);
return FALSE;
@@ -800,10 +800,10 @@ BOOLEAN EmsDrvInitialize(USHORT Segment, ULONG TotalPages)
EmsMemory = (PVOID)RtlAllocateHeap(RtlGetProcessHeap(), 0, TotalPages *
EMS_PAGE_SIZE);
if (EmsMemory == NULL)
{
- RtlFreeHeap(RtlGetProcessHeap(), 0, PageTable);
- PageTable = NULL;
- RtlFreeHeap(RtlGetProcessHeap(), 0, BitmapBuffer);
- BitmapBuffer = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsPageTable);
+ EmsPageTable = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsBitmapBuffer);
+ EmsBitmapBuffer = NULL;
UmaDescRelease(EmsSegment);
return FALSE;
@@ -821,10 +821,10 @@ BOOLEAN EmsDrvInitialize(USHORT Segment, ULONG TotalPages)
RtlFreeHeap(RtlGetProcessHeap(), 0, EmsMemory);
EmsMemory = NULL;
- RtlFreeHeap(RtlGetProcessHeap(), 0, PageTable);
- PageTable = NULL;
- RtlFreeHeap(RtlGetProcessHeap(), 0, BitmapBuffer);
- BitmapBuffer = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsPageTable);
+ EmsPageTable = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsBitmapBuffer);
+ EmsBitmapBuffer = NULL;
UmaDescRelease(EmsSegment);
return FALSE;
@@ -861,16 +861,16 @@ VOID EmsDrvCleanup(VOID)
EmsMemory = NULL;
}
- if (PageTable)
+ if (EmsPageTable)
{
- RtlFreeHeap(RtlGetProcessHeap(), 0, PageTable);
- PageTable = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsPageTable);
+ EmsPageTable = NULL;
}
- if (BitmapBuffer)
+ if (EmsBitmapBuffer)
{
- RtlFreeHeap(RtlGetProcessHeap(), 0, BitmapBuffer);
- BitmapBuffer = NULL;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EmsBitmapBuffer);
+ EmsBitmapBuffer = NULL;
}
UmaDescRelease(EmsSegment);
diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/himem.c
b/subsystems/mvdm/ntvdm/dos/dos32krnl/himem.c
index 19216eda0c..09f6a29b11 100644
--- a/subsystems/mvdm/ntvdm/dos/dos32krnl/himem.c
+++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/himem.c
@@ -169,7 +169,7 @@ Fail:
/* PRIVATE FUNCTIONS **********************************************************/
-static inline PXMS_HANDLE GetHandleRecord(WORD Handle)
+static inline PXMS_HANDLE GetXmsHandleRecord(WORD Handle)
{
PXMS_HANDLE Entry;
if (Handle == 0 || Handle >= XMS_MAX_HANDLES) return NULL;
@@ -178,7 +178,7 @@ static inline PXMS_HANDLE GetHandleRecord(WORD Handle)
return Entry->Size ? Entry : NULL;
}
-static inline BOOLEAN ValidateHandle(PXMS_HANDLE HandleEntry)
+static inline BOOLEAN ValidateXmsHandle(PXMS_HANDLE HandleEntry)
{
return (HandleEntry != NULL && HandleEntry->Handle != 0);
}
@@ -277,12 +277,12 @@ static UCHAR XmsAlloc(WORD Size, PWORD Handle)
static UCHAR XmsRealloc(WORD Handle, WORD NewSize)
{
DWORD BlockNumber;
- PXMS_HANDLE HandleEntry = GetHandleRecord(Handle);
+ PXMS_HANDLE HandleEntry = GetXmsHandleRecord(Handle);
DWORD CurrentIndex = 0;
ULONG RunStart;
ULONG RunSize;
- if (!ValidateHandle(HandleEntry))
+ if (!ValidateXmsHandle(HandleEntry))
return XMS_STATUS_INVALID_HANDLE;
if (HandleEntry->LockCount)
@@ -360,9 +360,9 @@ static UCHAR XmsRealloc(WORD Handle, WORD NewSize)
static UCHAR XmsFree(WORD Handle)
{
DWORD BlockNumber;
- PXMS_HANDLE HandleEntry = GetHandleRecord(Handle);
+ PXMS_HANDLE HandleEntry = GetXmsHandleRecord(Handle);
- if (!ValidateHandle(HandleEntry))
+ if (!ValidateXmsHandle(HandleEntry))
return XMS_STATUS_INVALID_HANDLE;
if (HandleEntry->LockCount)
@@ -379,9 +379,9 @@ static UCHAR XmsFree(WORD Handle)
static UCHAR XmsLock(WORD Handle, PDWORD Address)
{
- PXMS_HANDLE HandleEntry = GetHandleRecord(Handle);
+ PXMS_HANDLE HandleEntry = GetXmsHandleRecord(Handle);
- if (!ValidateHandle(HandleEntry))
+ if (!ValidateXmsHandle(HandleEntry))
return XMS_STATUS_INVALID_HANDLE;
if (HandleEntry->LockCount == 0xFF)
@@ -396,9 +396,9 @@ static UCHAR XmsLock(WORD Handle, PDWORD Address)
static UCHAR XmsUnlock(WORD Handle)
{
- PXMS_HANDLE HandleEntry = GetHandleRecord(Handle);
+ PXMS_HANDLE HandleEntry = GetXmsHandleRecord(Handle);
- if (!ValidateHandle(HandleEntry))
+ if (!ValidateXmsHandle(HandleEntry))
return XMS_STATUS_INVALID_HANDLE;
if (!HandleEntry->LockCount)
@@ -596,8 +596,8 @@ static VOID WINAPI XmsBopProcedure(LPWORD Stack)
if (CopyData->SourceHandle)
{
- HandleEntry = GetHandleRecord(CopyData->SourceHandle);
- if (!ValidateHandle(HandleEntry))
+ HandleEntry = GetXmsHandleRecord(CopyData->SourceHandle);
+ if (!ValidateXmsHandle(HandleEntry))
{
setAX(0);
setBL(XMS_STATUS_BAD_SRC_HANDLE);
@@ -620,8 +620,8 @@ static VOID WINAPI XmsBopProcedure(LPWORD Stack)
if (CopyData->DestHandle)
{
- HandleEntry = GetHandleRecord(CopyData->DestHandle);
- if (!ValidateHandle(HandleEntry))
+ HandleEntry = GetXmsHandleRecord(CopyData->DestHandle);
+ if (!ValidateXmsHandle(HandleEntry))
{
setAX(0);
setBL(XMS_STATUS_BAD_DEST_HANDLE);
@@ -686,11 +686,11 @@ static VOID WINAPI XmsBopProcedure(LPWORD Stack)
/* Get Handle Information */
case 0x0E:
{
- PXMS_HANDLE HandleEntry = GetHandleRecord(getDX());
+ PXMS_HANDLE HandleEntry = GetXmsHandleRecord(getDX());
UINT i;
UCHAR Handles = 0;
- if (!ValidateHandle(HandleEntry))
+ if (!ValidateXmsHandle(HandleEntry))
{
setAX(0);
setBL(XMS_STATUS_INVALID_HANDLE);
diff --git a/subsystems/mvdm/ntvdm/hardware/keyboard.c
b/subsystems/mvdm/ntvdm/hardware/keyboard.c
index 6d18b9da89..e1c167e9b9 100644
--- a/subsystems/mvdm/ntvdm/hardware/keyboard.c
+++ b/subsystems/mvdm/ntvdm/hardware/keyboard.c
@@ -18,22 +18,22 @@
/* PRIVATE VARIABLES **********************************************************/
-static BOOLEAN Reporting = FALSE;
+static BOOLEAN KeyboardReporting = FALSE;
static BYTE KeyboardId = 0; // We only support basic old-type keyboard
-static BYTE DataByteWait = 0;
+static BYTE KbdDataByteWait = 0;
-static BYTE PS2Port = 0;
+static BYTE KbdPS2Port = 0;
/* PRIVATE FUNCTIONS **********************************************************/
static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
{
/* Check if we were waiting for a data byte */
- if (DataByteWait)
+ if (KbdDataByteWait)
{
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
- switch (DataByteWait)
+ switch (KbdDataByteWait)
{
/* Set/Reset Mode Indicators */
case 0xED:
@@ -52,7 +52,7 @@ static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
// the keyboard by sending keyboard commands and then
// performing polling on the port until "valid" data
// comes out.
- DPRINT1("KeyboardCommand(0x%02X) NOT IMPLEMENTED\n",
DataByteWait);
+ DPRINT1("KeyboardCommand(0x%02X) NOT IMPLEMENTED\n",
KbdDataByteWait);
break;
}
@@ -63,7 +63,7 @@ static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
}
}
- DataByteWait = 0;
+ KbdDataByteWait = 0;
return;
}
@@ -76,39 +76,39 @@ static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
/* Set Typematic Rate/Delay */
case 0xF3:
{
- DataByteWait = Command;
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ KbdDataByteWait = Command;
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
break;
}
/* Echo test command */
case 0xEE:
{
- PS2QueuePush(PS2Port, 0xEE);
+ PS2QueuePush(KbdPS2Port, 0xEE);
break;
}
/* Get Keyboard ID */
case 0xF2:
{
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
- PS2QueuePush(PS2Port, KeyboardId);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
+ PS2QueuePush(KbdPS2Port, KeyboardId);
break;
}
/* Enable Reporting */
case 0xF4:
{
- Reporting = TRUE;
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ KeyboardReporting = TRUE;
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
break;
}
/* Disable Reporting */
case 0xF5:
{
- Reporting = FALSE;
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ KeyboardReporting = FALSE;
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
break;
}
@@ -116,7 +116,7 @@ static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
case 0xF6:
{
// So far, nothing to reset
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
break;
}
@@ -129,13 +129,13 @@ static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
* and acknowledged as discussed in:
*
http://stanislavs.org/helppc/keyboard_commands.html
*/
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
}
/* Resend */
case 0xFE:
{
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
UNIMPLEMENTED;
break;
}
@@ -144,20 +144,20 @@ static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
case 0xFF:
{
/* Send ACKnowledge */
- PS2QueuePush(PS2Port, KEYBOARD_ACK);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ACK);
// So far, nothing to reset
/* Send the Basic Assurance Test success code and the device ID */
- PS2QueuePush(PS2Port, KEYBOARD_BAT_SUCCESS);
- PS2QueuePush(PS2Port, KeyboardId);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_BAT_SUCCESS);
+ PS2QueuePush(KbdPS2Port, KeyboardId);
break;
}
/* Unknown command */
default:
{
- PS2QueuePush(PS2Port, KEYBOARD_ERROR);
+ PS2QueuePush(KbdPS2Port, KEYBOARD_ERROR);
}
}
}
@@ -170,7 +170,7 @@ VOID KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent)
BYTE ScanCode = (BYTE)KeyEvent->wVirtualScanCode;
/* Check if we're not reporting */
- if (!Reporting) return;
+ if (!KeyboardReporting) return;
/* If this is a key release, set the highest bit in the scan code */
if (!KeyEvent->bKeyDown) ScanCode |= 0x80;
@@ -178,8 +178,8 @@ VOID KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent)
/* Push the scan code into the PS/2 queue */
for (i = 0; i < KeyEvent->wRepeatCount; i++)
{
- if (KeyEvent->dwControlKeyState & ENHANCED_KEY) PS2QueuePush(PS2Port,
0xE0);
- PS2QueuePush(PS2Port, ScanCode);
+ if (KeyEvent->dwControlKeyState & ENHANCED_KEY) PS2QueuePush(KbdPS2Port,
0xE0);
+ PS2QueuePush(KbdPS2Port, ScanCode);
}
DPRINT("Press 0x%X\n", ScanCode);
@@ -188,7 +188,7 @@ VOID KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent)
BOOLEAN KeyboardInit(BYTE PS2Connector)
{
/* Finish to plug the keyboard to the specified PS/2 port */
- PS2Port = PS2Connector;
- PS2SetDeviceCmdProc(PS2Port, NULL, KeyboardCommand);
+ KbdPS2Port = PS2Connector;
+ PS2SetDeviceCmdProc(KbdPS2Port, NULL, KeyboardCommand);
return TRUE;
}
diff --git a/subsystems/mvdm/ntvdm/hardware/mouse.c
b/subsystems/mvdm/ntvdm/hardware/mouse.c
index 493b2bbe93..4b48c0dc54 100644
--- a/subsystems/mvdm/ntvdm/hardware/mouse.c
+++ b/subsystems/mvdm/ntvdm/hardware/mouse.c
@@ -34,19 +34,19 @@ static MOUSE_MODE Mode, PreviousMode;
static COORD Position;
static BYTE Resolution; /* Completely ignored */
static BOOLEAN Scaling; /* Completely ignored */
-static BOOLEAN Reporting = FALSE;
+static BOOLEAN MouseReporting = FALSE;
static BYTE MouseId;
static ULONG ButtonState;
static SHORT HorzCounter;
static SHORT VertCounter;
static CHAR ScrollCounter;
static BOOLEAN EventsOccurred = FALSE;
-static BYTE DataByteWait = 0;
+static BYTE MouseDataByteWait = 0;
static BYTE ScrollMagicCounter = 0, ExtraButtonMagicCounter = 0;
static UINT MouseCycles = 10;
-static BYTE PS2Port = 1;
+static BYTE MousePS2Port = 1;
/* PUBLIC VARIABLES ***********************************************************/
@@ -58,7 +58,7 @@ static VOID MouseResetConfig(VOID)
MouseCycles = 10;
Resolution = 4;
Scaling = FALSE;
- Reporting = FALSE;
+ MouseReporting = FALSE;
}
static VOID MouseResetCounters(VOID)
@@ -146,20 +146,20 @@ static VOID MouseGetPacket(PMOUSE_PACKET Packet)
static VOID MouseDispatchPacket(PMOUSE_PACKET Packet)
{
- PS2QueuePush(PS2Port, Packet->Flags);
- PS2QueuePush(PS2Port, Packet->HorzCounter);
- PS2QueuePush(PS2Port, Packet->VertCounter);
- if (MouseId >= 3) PS2QueuePush(PS2Port, Packet->Extra);
+ PS2QueuePush(MousePS2Port, Packet->Flags);
+ PS2QueuePush(MousePS2Port, Packet->HorzCounter);
+ PS2QueuePush(MousePS2Port, Packet->VertCounter);
+ if (MouseId >= 3) PS2QueuePush(MousePS2Port, Packet->Extra);
}
static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
{
/* Check if we were waiting for a data byte */
- if (DataByteWait)
+ if (MouseDataByteWait)
{
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
- switch (DataByteWait)
+ switch (MouseDataByteWait)
{
/* Set Resolution */
case 0xE8:
@@ -210,7 +210,7 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
}
}
- DataByteWait = 0;
+ MouseDataByteWait = 0;
return;
}
@@ -223,7 +223,7 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
*/
if (Command != 0xEC && Command != 0xFF)
{
- PS2QueuePush(PS2Port, Command);
+ PS2QueuePush(MousePS2Port, Command);
return;
}
}
@@ -234,7 +234,7 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
case 0xE6:
{
Scaling = FALSE;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
@@ -242,7 +242,7 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
case 0xE7:
{
Scaling = TRUE;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
@@ -251,8 +251,8 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
/* Set Sample Rate */
case 0xF3:
{
- DataByteWait = Command;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ MouseDataByteWait = Command;
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
@@ -262,13 +262,13 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
BYTE Status = ButtonState & 7;
if (Scaling) Status |= 1 << 4;
- if (Reporting) Status |= 1 << 5;
+ if (MouseReporting) Status |= 1 << 5;
if (Mode == MOUSE_REMOTE_MODE) Status |= 1 << 6;
- PS2QueuePush(PS2Port, MOUSE_ACK);
- PS2QueuePush(PS2Port, Status);
- PS2QueuePush(PS2Port, Resolution);
- PS2QueuePush(PS2Port, (BYTE)(1000 / MouseCycles));
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, Status);
+ PS2QueuePush(MousePS2Port, Resolution);
+ PS2QueuePush(MousePS2Port, (BYTE)(1000 / MouseCycles));
break;
}
@@ -278,14 +278,14 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
MouseResetCounters();
Mode = MOUSE_STREAMING_MODE;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
/* Read Packet */
case 0xEB:
{
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
MouseGetPacket(&LastPacket);
MouseDispatchPacket(&LastPacket);
break;
@@ -299,11 +299,11 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
/* Restore the previous mode */
MouseResetCounters();
Mode = PreviousMode;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
}
else
{
- PS2QueuePush(PS2Port, MOUSE_ERROR);
+ PS2QueuePush(MousePS2Port, MOUSE_ERROR);
}
break;
@@ -321,7 +321,7 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
MouseResetCounters();
Mode = MOUSE_WRAP_MODE;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
@@ -331,33 +331,33 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
MouseResetCounters();
Mode = MOUSE_REMOTE_MODE;
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
/* Get Mouse ID */
case 0xF2:
{
- PS2QueuePush(PS2Port, MOUSE_ACK);
- PS2QueuePush(PS2Port, MouseId);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MouseId);
break;
}
/* Enable Reporting */
case 0xF4:
{
- Reporting = TRUE;
+ MouseReporting = TRUE;
MouseResetCounters();
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
/* Disable Reporting */
case 0xF5:
{
- Reporting = FALSE;
+ MouseReporting = FALSE;
MouseResetCounters();
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
@@ -367,14 +367,14 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
/* Reset the configuration and counters */
MouseResetConfig();
MouseResetCounters();
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
break;
}
/* Resend */
case 0xFE:
{
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
MouseDispatchPacket(&LastPacket);
break;
}
@@ -383,20 +383,20 @@ static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
case 0xFF:
{
/* Send ACKnowledge */
- PS2QueuePush(PS2Port, MOUSE_ACK);
+ PS2QueuePush(MousePS2Port, MOUSE_ACK);
MouseReset();
/* Send the Basic Assurance Test success code and the device ID */
- PS2QueuePush(PS2Port, MOUSE_BAT_SUCCESS);
- PS2QueuePush(PS2Port, MouseId);
+ PS2QueuePush(MousePS2Port, MOUSE_BAT_SUCCESS);
+ PS2QueuePush(MousePS2Port, MouseId);
break;
}
/* Unknown command */
default:
{
- PS2QueuePush(PS2Port, MOUSE_ERROR);
+ PS2QueuePush(MousePS2Port, MOUSE_ERROR);
}
}
}
@@ -406,7 +406,7 @@ static VOID FASTCALL MouseStreamingCallback(ULONGLONG ElapsedTime)
UNREFERENCED_PARAMETER(ElapsedTime);
/* Check if we're not in streaming mode, not reporting, or there's nothing to
report */
- if (Mode != MOUSE_STREAMING_MODE || !Reporting || !EventsOccurred) return;
+ if (Mode != MOUSE_STREAMING_MODE || !MouseReporting || !EventsOccurred) return;
MouseGetPacket(&LastPacket);
MouseDispatchPacket(&LastPacket);
@@ -464,8 +464,8 @@ VOID MouseEventHandler(PMOUSE_EVENT_RECORD MouseEvent)
BOOLEAN MouseInit(BYTE PS2Connector)
{
/* Finish to plug the mouse to the specified PS/2 port */
- PS2Port = PS2Connector;
- PS2SetDeviceCmdProc(PS2Port, NULL, MouseCommand);
+ MousePS2Port = PS2Connector;
+ PS2SetDeviceCmdProc(MousePS2Port, NULL, MouseCommand);
MouseMutex = CreateMutex(NULL, FALSE, NULL);
if (MouseMutex == NULL) return FALSE;