33#define IsLowV86Mem(_Seg, _Off) ((((_Seg) << 4) + (_Off)) < (0xa0000))
83#if defined(_M_IX86) || defined(_M_AMD64)
96 CHAR IVTAndBda[1024 + 256];
123 DPRINT1(
"Couldn't open \\Device\\PhysicalMemory\n");
128 Offset.QuadPart = 0xa0000;
131 Status = ZwMapViewOfSection(PhysMemHandle,
153 DPRINT1(
"Couldn't map physical memory at the right address (was %x)\n",
171 DPRINT1(
"Failed to allocate virtual memory (Status %x)\n",
Status);
176 DPRINT1(
"Failed to allocate virtual memory at right address (was %x)\n",
223 TRACE_(VIDEOPRT,
"IntInt10AllocateBuffer\n");
228 MemoryAddress = (
PVOID)0x20000;
238 WARN_(VIDEOPRT,
"- ZwAllocateVirtualMemory failed\n");
243 if (MemoryAddress > (
PVOID)(0x100000 -
Size))
249 WARN_(VIDEOPRT,
"- Unacceptable memory allocated\n");
258 INFO_(VIDEOPRT,
"- Segment: %x\n", (
ULONG_PTR)MemoryAddress >> 4);
259 INFO_(VIDEOPRT,
"- Offset: %x\n", (
ULONG_PTR)MemoryAddress & 0xF);
285 TRACE_(VIDEOPRT,
"IntInt10FreeBuffer\n");
286 INFO_(VIDEOPRT,
"- Segment: %x\n", Seg);
287 INFO_(VIDEOPRT,
"- Offset: %x\n", Off);
317 TRACE_(VIDEOPRT,
"IntInt10ReadMemory\n");
318 INFO_(VIDEOPRT,
"- Segment: %x\n", Seg);
319 INFO_(VIDEOPRT,
"- Offset: %x\n", Off);
355 TRACE_(VIDEOPRT,
"IntInt10WriteMemory\n");
356 INFO_(VIDEOPRT,
"- Segment: %x\n", Seg);
357 INFO_(VIDEOPRT,
"- Offset: %x\n", Off);
470 RtlCopyMemory(&Int10BiosArguments, BiosArguments,
sizeof(*BiosArguments));
471 Int10BiosArguments.
SegDs = 0;
472 Int10BiosArguments.
SegEs = 0;
478 RtlCopyMemory(BiosArguments, &Int10BiosArguments,
sizeof(*BiosArguments));
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_NOT_IMPLEMENTED
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
#define IsLowV86Mem(_Seg, _Off)
VP_STATUS NTAPI IntInt10ReadMemory(IN PVOID Context, IN USHORT Seg, IN USHORT Off, OUT PVOID Buffer, IN ULONG Length)
VP_STATUS NTAPI IntInt10WriteMemory(IN PVOID Context, IN USHORT Seg, IN USHORT Off, IN PVOID Buffer, IN ULONG Length)
VP_STATUS NTAPI VideoPortInt10(IN PVOID HwDeviceExtension, IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
VP_STATUS NTAPI IntInt10FreeBuffer(IN PVOID Context, IN USHORT Seg, IN USHORT Off)
VP_STATUS NTAPI IntInt10AllocateBuffer(IN PVOID Context, OUT PUSHORT Seg, OUT PUSHORT Off, IN OUT PULONG Length)
VP_STATUS NTAPI IntInt10CallBios(IN PVOID Context, IN OUT PINT10_BIOS_ARGUMENTS BiosArguments)
NTSTATUS NTAPI IntInitializeVideoAddressSpace(VOID)
static VOID UnprotectLowV86Mem(VOID)
static VOID ProtectLowV86Mem(VOID)
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwOpenSection(_Out_ PHANDLE SectionHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SECTION_ALL_ACCESS
#define NtCurrentProcess()
#define PAGE_EXECUTE_READWRITE
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
_Out_ PKAPC_STATE ApcState
NTSTATUS NTAPI NtVdmControl(IN ULONG ControlCode, IN PVOID ControlData)
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
NTSTATUS NTAPI Ke386CallBios(IN ULONG Int, OUT PCONTEXT Context)
VOID FASTCALL IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
KMUTEX VideoPortInt10Mutex
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
struct _KPROCESS * PKPROCESS
NTSTATUS NTAPI x86BiosFreeBuffer(_In_ USHORT Segment, _In_ USHORT Offset)
NTSTATUS NTAPI x86BiosReadMemory(_In_ USHORT Segment, _In_ USHORT Offset, _Out_writes_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
BOOLEAN NTAPI x86BiosCall(_In_ ULONG InterruptNumber, _Inout_ PX86_BIOS_REGISTERS Registers)
NTSTATUS NTAPI x86BiosWriteMemory(_In_ USHORT Segment, _In_ USHORT Offset, _In_reads_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
NTSTATUS NTAPI x86BiosAllocateBuffer(_In_ ULONG *Size, _In_ USHORT *Segment, _In_ USHORT *Offset)
#define KeWaitForMutexObject
#define PsGetCurrentProcess