mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTVDM]
- Rearrange header inclusions. Put almost all NDK stuff in ntvdm.h. - sizeof(array)/sizeof(array[0]) --> ARRAYSIZE(array) : increase code readability. - Use Rtl heap functions (other parts of the code already did use them). svn path=/trunk/; revision=67283
This commit is contained in:
parent
b8d8a11522
commit
9d3bb1fef2
67 changed files with 128 additions and 183 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "memory.h"
|
||||
#include "cpu/callback.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "kbdbios.h"
|
||||
#include "vidbios.h"
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
/* For BIOS Version number */
|
||||
#include <reactos/buildno.h>
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/cpu.h" // for EMULATOR_FLAG_CF
|
||||
#include "cpu/bop.h"
|
||||
|
@ -33,9 +34,6 @@
|
|||
#include "hardware/pic.h"
|
||||
#include "hardware/pit.h"
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/kefuncs.h>
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
CALLBACK16 BiosContext;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
// #include <bios/bios.h>
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include <bios/bios.h>
|
||||
|
||||
/**/ #include "int32.h" /**/
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "bios/bios32/bios32p.h"
|
||||
#include <ndk/rtltypes.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include "ems.h"
|
||||
#include "memory.h"
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "emulator.h"
|
||||
#include "cpu/cpu.h" // for EMULATOR_FLAG_ZF
|
||||
#include "int32.h"
|
||||
#include "ntvdm.h"
|
||||
|
||||
#include "kbdbios32.h"
|
||||
#include <bios/kbdbios.h>
|
||||
#include "bios32p.h"
|
||||
|
||||
#include "int32.h"
|
||||
#include "cpu/cpu.h" // for EMULATOR_FLAG_ZF
|
||||
#include "io.h"
|
||||
#include "hardware/ps2.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _KBDBIOS32_H_
|
||||
#define _KBDBIOS32_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
// #define BIOS_KBD_INTERRUPT 0x16
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include "moubios32.h"
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _MOUBIOS32_H_
|
||||
#define _MOUBIOS32_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#if 0 // This code is for the MOUSE.COM driver
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "emulator.h"
|
||||
#include "ntvdm.h"
|
||||
#include "int32.h"
|
||||
|
||||
#include "vidbios32.h"
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#ifndef _VIDBIOS32_H_
|
||||
#define _VIDBIOS32_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
// #define BIOS_VIDEO_INTERRUPT 0x10
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/bop.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _KBDBIOS_H_
|
||||
#define _KBDBIOS_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define BIOS_KBD_INTERRUPT 0x16
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/callback.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "rom.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
static HANDLE
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _ROM_H_
|
||||
#define _ROM_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define ROM_AREA_START 0xE0000
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/cpu.h"
|
||||
#include "cpu/bop.h"
|
||||
|
@ -2235,13 +2236,13 @@ static VOID VgaChangePalette(BYTE ModeNumber)
|
|||
{
|
||||
/* VGA modes */
|
||||
Palette = VgaPalette;
|
||||
Size = sizeof(VgaPalette)/sizeof(VgaPalette[0]);
|
||||
Size = ARRAYSIZE(VgaPalette);
|
||||
}
|
||||
else if (ModeNumber == 0x10) // || (ModeNumber == 0x0D) || (ModeNumber == 0x0E)
|
||||
{
|
||||
/* EGA HiRes mode */
|
||||
Palette = EgaPalette__HiRes;
|
||||
Size = sizeof(EgaPalette__HiRes)/sizeof(EgaPalette__HiRes[0]);
|
||||
Size = ARRAYSIZE(EgaPalette__HiRes);
|
||||
}
|
||||
#if 0
|
||||
else if ((ModeNumber == 0x04) || (ModeNumber == 0x05))
|
||||
|
@ -2251,14 +2252,14 @@ static VOID VgaChangePalette(BYTE ModeNumber)
|
|||
* bright versions of CGA palettes 0 and 1
|
||||
*/
|
||||
Palette = CgaPalette2;
|
||||
Size = sizeof(CgaPalette2)/sizeof(CgaPalette2[0]);
|
||||
Size = ARRAYSIZE(CgaPalette2);
|
||||
}
|
||||
#endif
|
||||
else // if ((ModeNumber == 0x0D) || (ModeNumber == 0x0E))
|
||||
{
|
||||
/* EGA modes */
|
||||
Palette = EgaPalette__16Colors;
|
||||
Size = sizeof(EgaPalette__16Colors)/sizeof(EgaPalette__16Colors[0]);
|
||||
Size = ARRAYSIZE(EgaPalette__16Colors);
|
||||
}
|
||||
|
||||
VgaSetPalette(Palette, Size);
|
||||
|
@ -2388,7 +2389,7 @@ static BOOLEAN VidBiosSetVideoMode(BYTE ModeNumber)
|
|||
|
||||
/* Retrieve the real mode number and check its validity */
|
||||
ModeNumber &= 0x7F;
|
||||
// if (ModeNumber >= sizeof(VideoModes)/sizeof(VideoModes[0]))
|
||||
// if (ModeNumber >= ARRAYSIZE(VideoModes))
|
||||
if (ModeNumber > BIOS_MAX_VIDEO_MODE)
|
||||
{
|
||||
DPRINT1("VidBiosSetVideoMode -- Mode %02Xh invalid\n", ModeNumber);
|
||||
|
@ -3045,7 +3046,7 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack)
|
|||
// FIXME: Use BL and DL for the number of screen rows
|
||||
|
||||
/* Write the default font to the VGA font plane */
|
||||
VgaWriteFont(0, Font8x8, sizeof(Font8x8)/sizeof(Font8x8[0]) / VGA_FONT_CHARACTERS);
|
||||
VgaWriteFont(0, Font8x8, ARRAYSIZE(Font8x8) / VGA_FONT_CHARACTERS);
|
||||
|
||||
/* Update the BIOS INT 43h vector */
|
||||
// Far pointer to the 8x8 characters 00h-...
|
||||
|
@ -3060,7 +3061,7 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack)
|
|||
// FIXME: Use BL and DL for the number of screen rows
|
||||
|
||||
/* Write the default font to the VGA font plane */
|
||||
VgaWriteFont(0, Font8x16, sizeof(Font8x16)/sizeof(Font8x16[0]) / VGA_FONT_CHARACTERS);
|
||||
VgaWriteFont(0, Font8x16, ARRAYSIZE(Font8x16) / VGA_FONT_CHARACTERS);
|
||||
|
||||
/* Update the BIOS INT 43h vector */
|
||||
// Far pointer to the 8x16 characters 00h-...
|
||||
|
@ -3293,7 +3294,7 @@ BOOLEAN VidBiosInitialize(VOID)
|
|||
Font8x14, sizeof(Font8x14));
|
||||
|
||||
/* Write the default font to the VGA font plane */
|
||||
VgaWriteFont(0, Font8x16, sizeof(Font8x16)/sizeof(Font8x16[0]) / VGA_FONT_CHARACTERS);
|
||||
VgaWriteFont(0, Font8x16, ARRAYSIZE(Font8x16) / VGA_FONT_CHARACTERS);
|
||||
|
||||
//
|
||||
// FIXME: At the moment we always set a VGA mode. In the future,
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#ifndef _VIDBIOS_H_
|
||||
#define _VIDBIOS_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define BIOS_VIDEO_INTERRUPT 0x10
|
||||
|
|
|
@ -11,20 +11,17 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/cpu.h"
|
||||
|
||||
#include "clock.h"
|
||||
|
||||
#include "cpu/cpu.h"
|
||||
#include "hardware/cmos.h"
|
||||
#include "hardware/ps2.h"
|
||||
#include "hardware/pit.h"
|
||||
#include "hardware/video/vga.h"
|
||||
#include "hardware/mouse.h"
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/kefuncs.h>
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -128,7 +125,7 @@ PHARDWARE_TIMER CreateHardwareTimer(ULONG Flags, ULONGLONG Delay, PHARDWARE_TIME
|
|||
{
|
||||
PHARDWARE_TIMER Timer;
|
||||
|
||||
Timer = (PHARDWARE_TIMER)RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(HARDWARE_TIMER));
|
||||
Timer = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(*Timer));
|
||||
if (Timer == NULL) return NULL;
|
||||
|
||||
Timer->Flags = Flags & ~HARDWARE_TIMER_ENABLED;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#ifndef _CLOCK_H_
|
||||
#define _CLOCK_H_
|
||||
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
/* DEFINITIONS ****************************************************************/
|
||||
|
||||
#define HARDWARE_TIMER_ENABLED (1 << 0)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "bop.h"
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "cpu.h"
|
||||
#include "callback.h"
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "callback.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "bop.h"
|
||||
#include <isvbop.h>
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu.h"
|
||||
|
||||
#include "emulator.h"
|
||||
#include "memory.h"
|
||||
#include "callback.h"
|
||||
#include "bop.h"
|
||||
#include <isvbop.h>
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "bios/rom.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include <fast486.h>
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu.h"
|
||||
#include "x86context.h"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -23,9 +24,6 @@
|
|||
#include "bios/bios.h"
|
||||
#include "mouse32.h"
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/obtypes.h>
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
/**/extern BYTE CurrentDrive;/**/
|
||||
|
@ -201,7 +199,7 @@ CommandThreadProc(LPVOID Parameter)
|
|||
CHAR Desktop[MAX_PATH];
|
||||
CHAR Title[MAX_PATH];
|
||||
ULONG EnvSize = 256;
|
||||
PVOID Env = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, EnvSize);
|
||||
PVOID Env = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, EnvSize);
|
||||
|
||||
UNREFERENCED_PARAMETER(Parameter);
|
||||
ASSERT(Env != NULL);
|
||||
|
@ -236,7 +234,7 @@ Command:
|
|||
{
|
||||
/* Expand the environment size */
|
||||
EnvSize = CommandInfo.EnvLen;
|
||||
CommandInfo.Env = Env = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Env, EnvSize);
|
||||
CommandInfo.Env = Env = RtlReAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, Env, EnvSize);
|
||||
|
||||
/* Repeat the request */
|
||||
goto Command;
|
||||
|
@ -259,7 +257,7 @@ Command:
|
|||
}
|
||||
while (AcceptCommands);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, Env);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Env);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "dos32krnl/dos.h"
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "int32.h"
|
||||
|
||||
|
@ -221,7 +222,7 @@ BOOLEAN DosBIOSInitialize(VOID)
|
|||
Stream = _wfopen(DOS_CONFIG_PATH, L"r");
|
||||
if (Stream != NULL)
|
||||
{
|
||||
while (fgetws(Buffer, sizeof(Buffer)/sizeof(Buffer[0]), Stream))
|
||||
while (fgetws(Buffer, ARRAYSIZE(Buffer), Stream))
|
||||
{
|
||||
// TODO: Parse the line
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include "dos.h"
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "device.h"
|
||||
|
||||
#include "dos.h"
|
||||
#include "dos/dem.h"
|
||||
#include "memory.h"
|
||||
#include "device.h"
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
|
@ -212,9 +214,7 @@ PDOS_DEVICE_NODE DosCreateDevice(WORD Attributes, PCHAR DeviceName)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Node = (PDOS_DEVICE_NODE)RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(DOS_DEVICE_NODE));
|
||||
Node = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*Node));
|
||||
if (Node == NULL) return NULL;
|
||||
|
||||
Node->DeviceAttributes = Attributes;
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#ifndef _DEVICE_H_
|
||||
#define _DEVICE_H_
|
||||
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
/* DEFINITIONS ****************************************************************/
|
||||
|
||||
#define MAX_DEVICE_NAME 8
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/cpu.h"
|
||||
#include "int32.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "device.h"
|
||||
|
||||
/**/ #include "int32.h" /**/
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "../../memory.h"
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
#include "dos.h"
|
||||
#include "dos/dem.h"
|
||||
#include "device.h"
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include "dos.h"
|
||||
#include "dos/dem.h"
|
||||
#include "memory.h"
|
||||
|
||||
/* PUBLIC VARIABLES ***********************************************************/
|
||||
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
|
||||
#include "cpu/cpu.h"
|
||||
#include "int32.h"
|
||||
#include "hardware/mouse.h"
|
||||
|
@ -187,7 +189,7 @@ static VOID CallMouseUserHandlers(USHORT CallMask)
|
|||
setDI(DI);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(DriverState.Handlers)/sizeof(DriverState.Handlers[0]); ++i)
|
||||
for (i = 0; i < ARRAYSIZE(DriverState.Handlers); ++i)
|
||||
{
|
||||
/* Call the suitable handlers */
|
||||
if ((DriverState.Handlers[i].CallMask & CallMask) != 0 &&
|
||||
|
@ -654,7 +656,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
|
|||
* Find the handler entry corresponding to the given
|
||||
* callback and undefine it.
|
||||
*/
|
||||
for (i = 0; i < sizeof(DriverState.Handlers)/sizeof(DriverState.Handlers[0]); ++i)
|
||||
for (i = 0; i < ARRAYSIZE(DriverState.Handlers); ++i)
|
||||
{
|
||||
if (DriverState.Handlers[i].Callback == Callback)
|
||||
{
|
||||
|
@ -672,7 +674,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
|
|||
* Find the handler entry corresponding to the given
|
||||
* callmask and undefine it.
|
||||
*/
|
||||
for (i = 0; i < sizeof(DriverState.Handlers)/sizeof(DriverState.Handlers[0]); ++i)
|
||||
for (i = 0; i < ARRAYSIZE(DriverState.Handlers); ++i)
|
||||
{
|
||||
if (DriverState.Handlers[i].CallMask == CallMask)
|
||||
{
|
||||
|
@ -694,7 +696,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
|
|||
|
||||
USHORT EmptyHandler = 0xFFFF; // Invalid handler
|
||||
|
||||
for (i = 0; i < sizeof(DriverState.Handlers)/sizeof(DriverState.Handlers[0]); ++i)
|
||||
for (i = 0; i < ARRAYSIZE(DriverState.Handlers); ++i)
|
||||
{
|
||||
/* Find the first empty handler */
|
||||
if (EmptyHandler == 0xFFFF &&
|
||||
|
@ -719,7 +721,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
|
|||
* an empty handler, set it.
|
||||
*/
|
||||
if (!Success && EmptyHandler != 0xFFFF
|
||||
/* && EmptyHandler < sizeof(DriverState.Handlers)/sizeof(DriverState.Handlers[0]) */)
|
||||
/* && EmptyHandler < ARRAYSIZE(DriverState.Handlers) */)
|
||||
{
|
||||
DriverState.Handlers[EmptyHandler].CallMask = CallMask;
|
||||
DriverState.Handlers[EmptyHandler].Callback = Callback;
|
||||
|
@ -744,7 +746,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
|
|||
/*
|
||||
* Find the handler entry corresponding to the given callmask.
|
||||
*/
|
||||
for (i = 0; i < sizeof(DriverState.Handlers)/sizeof(DriverState.Handlers[0]); ++i)
|
||||
for (i = 0; i < ARRAYSIZE(DriverState.Handlers); ++i)
|
||||
{
|
||||
if (DriverState.Handlers[i].CallMask == CallMask)
|
||||
{
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _MOUSE32_H_
|
||||
#define _MOUSE32_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define DOS_MOUSE_INTERRUPT 0x33
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "memory.h"
|
||||
|
||||
|
@ -35,10 +36,6 @@
|
|||
#include "vddsup.h"
|
||||
#include "io.h"
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/psfuncs.h>
|
||||
#include <ndk/mmfuncs.h>
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
LPVOID BaseAddress = NULL;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include <fast486.h>
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cmos.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _CMOS_H_
|
||||
#define _CMOS_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define RTC_IRQ_NUMBER 8
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "io.h"
|
||||
#include "dma.h"
|
||||
|
||||
#include "io.h"
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#ifndef _DMA_H_
|
||||
#define _DMA_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define DMA_CONTROLLERS 2
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "keyboard.h"
|
||||
#include "ps2.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _KEYBOARD_H_
|
||||
#define _KEYBOARD_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
/* Command responses */
|
||||
|
|
|
@ -10,8 +10,10 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "mouse.h"
|
||||
#include "ps2.h"
|
||||
|
||||
#include "clock.h"
|
||||
#include "video/vga.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _MOUSE_H_
|
||||
#define _MOUSE_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
/* Mouse packet constants */
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
|
||||
#include "io.h"
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
static PIC MasterPic, SlavePic;
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#ifndef _PIC_H_
|
||||
#define _PIC_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define PIC_MASTER_CMD 0x20
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "io.h"
|
||||
#include "pit.h"
|
||||
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
#include "clock.h"
|
||||
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#ifndef _PIT_H_
|
||||
#define _PIT_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define PIT_CHANNELS 3
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "io.h"
|
||||
#include "ps2.h"
|
||||
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
#include "clock.h"
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#ifndef _PS2_H_
|
||||
#define _PS2_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define PS2_DATA_PORT 0x60
|
||||
|
|
|
@ -10,17 +10,12 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "emulator.h"
|
||||
#include "ntvdm.h"
|
||||
#include "speaker.h"
|
||||
#include "hardware/pit.h"
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/iofuncs.h>
|
||||
#include <ndk/obfuncs.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/kefuncs.h>
|
||||
|
||||
/* DDK Driver Headers */
|
||||
#include <ntddbeep.h>
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
#ifndef _SPEAKER_H_
|
||||
#define _SPEAKER_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID SpeakerChange(UCHAR Port61hValue);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "vga.h"
|
||||
#include <bios/vidbios.h>
|
||||
|
@ -356,26 +357,26 @@ __RegisterConsoleVDM(IN DWORD dwRegisterFlags,
|
|||
VDMBufferSize = dwVDMBufferSize;
|
||||
|
||||
/* HACK: Cache -- to be removed in the real implementation */
|
||||
CharBuff = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
VDMBufferSize.X * VDMBufferSize.Y
|
||||
* sizeof(CHAR_INFO));
|
||||
CharBuff = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
VDMBufferSize.X * VDMBufferSize.Y
|
||||
* sizeof(*CharBuff));
|
||||
ASSERT(CharBuff);
|
||||
|
||||
VDMBuffer = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
VDMBufferSize.X * VDMBufferSize.Y
|
||||
* sizeof(CHAR_CELL));
|
||||
VDMBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
VDMBufferSize.X * VDMBufferSize.Y
|
||||
* sizeof(*VDMBuffer));
|
||||
*lpVDMBuffer = VDMBuffer;
|
||||
return (VDMBuffer != NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* HACK: Cache -- to be removed in the real implementation */
|
||||
if (CharBuff) HeapFree(GetProcessHeap(), 0, CharBuff);
|
||||
if (CharBuff) RtlFreeHeap(RtlGetProcessHeap(), 0, CharBuff);
|
||||
CharBuff = NULL;
|
||||
|
||||
if (VDMBuffer) HeapFree(GetProcessHeap(), 0, VDMBuffer);
|
||||
if (VDMBuffer) RtlFreeHeap(RtlGetProcessHeap(), 0, VDMBuffer);
|
||||
VDMBuffer = NULL;
|
||||
|
||||
VDMBufferSize.X = VDMBufferSize.Y = 0;
|
||||
|
@ -500,10 +501,10 @@ static BOOL VgaAttachToConsoleInternal(PCOORD Resolution)
|
|||
}
|
||||
|
||||
#ifdef USE_REAL_REGISTERCONSOLEVDM
|
||||
CharBuff = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
TextResolution.X * TextResolution.Y
|
||||
* sizeof(CHAR_INFO));
|
||||
CharBuff = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
TextResolution.X * TextResolution.Y
|
||||
* sizeof(*CharBuff));
|
||||
ASSERT(CharBuff);
|
||||
#endif
|
||||
|
||||
|
@ -568,7 +569,7 @@ static BOOL VgaAttachToConsoleInternal(PCOORD Resolution)
|
|||
}
|
||||
|
||||
#ifdef USE_REAL_REGISTERCONSOLEVDM
|
||||
if (CharBuff) HeapFree(GetProcessHeap(), 0, CharBuff);
|
||||
if (CharBuff) RtlFreeHeap(RtlGetProcessHeap(), 0, CharBuff);
|
||||
#endif
|
||||
|
||||
VgaUpdateCursorPosition();
|
||||
|
@ -773,14 +774,14 @@ static BOOLEAN VgaInitializePalette(VOID)
|
|||
LPLOGPALETTE Palette, TextPalette;
|
||||
|
||||
/* Allocate storage space for the palettes */
|
||||
Palette = (LPLOGPALETTE)HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(LOGPALETTE) +
|
||||
VGA_MAX_COLORS * sizeof(PALETTEENTRY));
|
||||
TextPalette = (LPLOGPALETTE)HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(LOGPALETTE) +
|
||||
(VGA_AC_PAL_F_REG + 1) * sizeof(PALETTEENTRY));
|
||||
Palette = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(LOGPALETTE) +
|
||||
VGA_MAX_COLORS * sizeof(PALETTEENTRY));
|
||||
TextPalette = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(LOGPALETTE) +
|
||||
(VGA_AC_PAL_F_REG + 1) * sizeof(PALETTEENTRY));
|
||||
if ((Palette == NULL) || (TextPalette == NULL)) goto Cleanup;
|
||||
|
||||
/* Initialize the palettes */
|
||||
|
@ -813,8 +814,8 @@ static BOOLEAN VgaInitializePalette(VOID)
|
|||
|
||||
Cleanup:
|
||||
/* Free the palettes */
|
||||
if (Palette) HeapFree(GetProcessHeap(), 0, Palette);
|
||||
if (TextPalette) HeapFree(GetProcessHeap(), 0, TextPalette);
|
||||
if (Palette) RtlFreeHeap(RtlGetProcessHeap(), 0, Palette);
|
||||
if (TextPalette) RtlFreeHeap(RtlGetProcessHeap(), 0, TextPalette);
|
||||
|
||||
if (!Result)
|
||||
{
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _VGA_H_
|
||||
#define _VGA_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define VGA_NUM_BANKS 4
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "int32.h"
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "io.h"
|
||||
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include <ndk/mmfuncs.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include "memory.h"
|
||||
|
||||
/* Extra PSDK/NDK Headers */
|
||||
#include <ndk/mmfuncs.h>
|
||||
|
||||
/* PRIVATE VARIABLES **********************************************************/
|
||||
|
||||
typedef struct _MEM_HOOK
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "cpu/cpu.h"
|
||||
|
||||
#include "bios/bios.h"
|
||||
#include "cpu/cpu.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
@ -85,7 +85,7 @@ AppendMenuItems(HMENU hMenu,
|
|||
if (LoadStringW(GetModuleHandle(NULL),
|
||||
Items[i].uID,
|
||||
szMenuString,
|
||||
sizeof(szMenuString) / sizeof(szMenuString[0])) > 0)
|
||||
ARRAYSIZE(szMenuString)) > 0)
|
||||
{
|
||||
if (Items[i].SubMenu != NULL)
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ static VOID ShowHideMousePointer(HANDLE ConOutHandle, BOOLEAN ShowPtr)
|
|||
if (LoadStringW(GetModuleHandle(NULL),
|
||||
(!ShowPtr ? IDS_SHOW_MOUSE : IDS_HIDE_MOUSE),
|
||||
szMenuString,
|
||||
sizeof(szMenuString) / sizeof(szMenuString[0])) > 0)
|
||||
ARRAYSIZE(szMenuString)) > 0)
|
||||
{
|
||||
ModifyMenu(hConsoleMenu, ID_SHOWHIDE_MOUSE,
|
||||
MF_BYCOMMAND, ID_SHOWHIDE_MOUSE, szMenuString);
|
||||
|
@ -226,9 +226,9 @@ DisplayMessage(LPCWSTR Format, ...)
|
|||
* an auxiliary buffer; otherwise use the static buffer.
|
||||
*/
|
||||
MsgLen = _vscwprintf(Format, Parameters) + 1; // NULL-terminated
|
||||
if (MsgLen > sizeof(StaticBuffer)/sizeof(StaticBuffer[0]))
|
||||
if (MsgLen > ARRAYSIZE(StaticBuffer))
|
||||
{
|
||||
Buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MsgLen * sizeof(WCHAR));
|
||||
Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, MsgLen * sizeof(WCHAR));
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
/* Allocation failed, use the static buffer and display a suitable error message */
|
||||
|
@ -238,7 +238,7 @@ DisplayMessage(LPCWSTR Format, ...)
|
|||
}
|
||||
}
|
||||
#else
|
||||
MsgLen = sizeof(Buffer)/sizeof(Buffer[0]);
|
||||
MsgLen = ARRAYSIZE(Buffer);
|
||||
#endif
|
||||
|
||||
/* Display the message */
|
||||
|
@ -248,7 +248,7 @@ DisplayMessage(LPCWSTR Format, ...)
|
|||
|
||||
#ifndef WIN2K_COMPLIANT
|
||||
/* Free the buffer if needed */
|
||||
if (Buffer != StaticBuffer) HeapFree(GetProcessHeap(), 0, Buffer);
|
||||
if (Buffer != StaticBuffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
#endif
|
||||
|
||||
va_end(Parameters);
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <conio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/* PSDK/NDK Headers */
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
|
@ -30,6 +30,15 @@
|
|||
|
||||
DWORD WINAPI SetLastConsoleEventActive(VOID);
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/kefuncs.h>
|
||||
#include <ndk/obfuncs.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include <ndk/rtltypes.h>
|
||||
|
||||
/* PSEH for SEH Support */
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "emulator.h"
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#ifndef _UTILS_H_
|
||||
#define _UTILS_H_
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include "ntvdm.h"
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
#include "ntvdm.h"
|
||||
#include "emulator.h"
|
||||
#include "vddsup.h"
|
||||
|
||||
|
@ -41,7 +42,7 @@ static VDD_MODULE VDDList[MAX_VDD_MODULES] = {{NULL}};
|
|||
static USHORT GetNextFreeVDDEntry(VOID)
|
||||
{
|
||||
USHORT Entry = MAX_VDD_MODULES;
|
||||
for (Entry = 0; Entry < sizeof(VDDList)/sizeof(VDDList[0]); ++Entry)
|
||||
for (Entry = 0; Entry < ARRAYSIZE(VDDList); ++Entry)
|
||||
{
|
||||
if (VDDList[Entry].hDll == NULL) break;
|
||||
}
|
||||
|
@ -296,7 +297,7 @@ static BOOL LoadInstallableVDD(VOID)
|
|||
|
||||
/* Allocate the buffer */
|
||||
BufSize = (BufSize < 2*sizeof(WCHAR) ? 2*sizeof(WCHAR) : BufSize);
|
||||
VDDList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufSize);
|
||||
VDDList = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, BufSize);
|
||||
if (VDDList == NULL)
|
||||
{
|
||||
DisplayMessage(ERROR_MEMORYVDD);
|
||||
|
@ -338,7 +339,7 @@ static BOOL LoadInstallableVDD(VOID)
|
|||
VDDList = VDDValueName;
|
||||
|
||||
Quit:
|
||||
if (VDDList) HeapFree(GetProcessHeap(), 0, VDDList);
|
||||
if (VDDList) RtlFreeHeap(RtlGetProcessHeap(), 0, VDDList);
|
||||
RegCloseKey(hVDDKey);
|
||||
return Success;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#ifndef _VDDSUP_H_
|
||||
#define _VDDSUP_H_
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID VDDSupInitialize(VOID);
|
||||
|
|
Loading…
Reference in a new issue