ReactOS  0.4.13-dev-464-g6b95727
xboxvmp.h File Reference
#include "ntdef.h"
#include "dderror.h"
#include "devioctl.h"
#include "miniport.h"
#include "video.h"
Include dependency graph for xboxvmp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _SYSTEM_BASIC_INFORMATION
 
struct  XBOXVMP_DEVICE_EXTENSION
 

Macros

#define PAGE_SIZE   4096
 
#define SystemBasicInformation   0
 

Typedefs

typedef struct _SYSTEM_BASIC_INFORMATION SYSTEM_BASIC_INFORMATION
 
typedef struct _SYSTEM_BASIC_INFORMATIONPSYSTEM_BASIC_INFORMATION
 
typedef struct XBOXVMP_DEVICE_EXTENSIONPXBOXVMP_DEVICE_EXTENSION
 

Functions

LONG __stdcall ZwQuerySystemInformation (IN ULONG SystemInformationClass, OUT PVOID SystemInformation, IN ULONG Length, OUT PULONG ResultLength)
 
VP_STATUS NTAPI XboxVmpFindAdapter (IN PVOID HwDeviceExtension, IN PVOID HwContext, IN PWSTR ArgumentString, IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, OUT PUCHAR Again)
 
BOOLEAN NTAPI XboxVmpInitialize (PVOID HwDeviceExtension)
 
BOOLEAN NTAPI XboxVmpStartIO (PVOID HwDeviceExtension, PVIDEO_REQUEST_PACKET RequestPacket)
 
BOOLEAN NTAPI XboxVmpResetHw (PVOID DeviceExtension, ULONG Columns, ULONG Rows)
 
VP_STATUS NTAPI XboxVmpGetPowerState (PVOID HwDeviceExtension, ULONG HwId, PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
VP_STATUS NTAPI XboxVmpSetPowerState (PVOID HwDeviceExtension, ULONG HwId, PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
BOOLEAN FASTCALL XboxVmpSetCurrentMode (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpResetDevice (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpMapVideoMemory (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY RequestedAddress, PVIDEO_MEMORY_INFORMATION MapInformation, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpUnmapVideoMemory (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpQueryNumAvailModes (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_NUM_MODES Modes, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpQueryAvailModes (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION ReturnedModes, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpQueryCurrentMode (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoModeInfo, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpSetColorRegisters (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_CLUT ColorLookUpTable, PSTATUS_BLOCK StatusBlock)
 

Macro Definition Documentation

◆ PAGE_SIZE

#define PAGE_SIZE   4096

Definition at line 28 of file xboxvmp.h.

◆ SystemBasicInformation

#define SystemBasicInformation   0

Definition at line 35 of file xboxvmp.h.

Typedef Documentation

◆ PSYSTEM_BASIC_INFORMATION

◆ PXBOXVMP_DEVICE_EXTENSION

◆ SYSTEM_BASIC_INFORMATION

Function Documentation

◆ XboxVmpFindAdapter()

VP_STATUS NTAPI XboxVmpFindAdapter ( IN PVOID  HwDeviceExtension,
IN PVOID  HwContext,
IN PWSTR  ArgumentString,
IN OUT PVIDEO_PORT_CONFIG_INFO  ConfigInfo,
OUT PUCHAR  Again 
)

Definition at line 64 of file xboxvmp.c.

70 {
71  PXBOXVMP_DEVICE_EXTENSION XboxVmpDeviceExtension;
72  VIDEO_ACCESS_RANGE AccessRanges[3];
74 
75  VideoPortDebugPrint(Trace, "XboxVmpFindAdapter\n");
76 
77  XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension;
78  Status = VideoPortGetAccessRanges(HwDeviceExtension, 0, NULL, 3, AccessRanges,
79  NULL, NULL, NULL);
80 
81  if (NO_ERROR == Status)
82  {
83  XboxVmpDeviceExtension->PhysControlStart = AccessRanges[0].RangeStart;
84  XboxVmpDeviceExtension->ControlLength = AccessRanges[0].RangeLength;
85  XboxVmpDeviceExtension->PhysFrameBufferStart = AccessRanges[1].RangeStart;
86  }
87 
88  return Status;
89 }
PHYSICAL_ADDRESS PhysControlStart
Definition: xboxvmp.h:62
#define NO_ERROR
Definition: dderror.h:5
smooth NULL
Definition: ftsmooth.c:416
PHYSICAL_ADDRESS PhysFrameBufferStart
Definition: xboxvmp.h:65
#define Trace(x)
Definition: zutil.h:197
Status
Definition: gdiplustypes.h:24
VPAPI VP_STATUS NTAPI VideoPortGetAccessRanges(IN PVOID HwDeviceExtension, IN ULONG NumRequestedResources, IN PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL, IN ULONG NumAccessRanges, OUT PVIDEO_ACCESS_RANGE AccessRanges, IN PVOID VendorId, IN PVOID DeviceId, OUT PULONG Slot)
struct XBOXVMP_DEVICE_EXTENSION * PXBOXVMP_DEVICE_EXTENSION
LONG VP_STATUS
Definition: video.h:153
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)
ULONG RangeLength
Definition: video.h:216
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215

Referenced by DriverEntry().

◆ XboxVmpGetPowerState()

VP_STATUS NTAPI XboxVmpGetPowerState ( PVOID  HwDeviceExtension,
ULONG  HwId,
PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 274 of file xboxvmp.c.

278 {
279  VideoPortDebugPrint(Error, "XboxVmpGetPowerState is not supported\n");
280 
281  return ERROR_INVALID_FUNCTION;
282 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
BOOL Error
Definition: chkdsk.c:66
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)

Referenced by DriverEntry().

◆ XboxVmpInitialize()

BOOLEAN NTAPI XboxVmpInitialize ( PVOID  HwDeviceExtension)

Definition at line 99 of file xboxvmp.c.

100 {
101  PXBOXVMP_DEVICE_EXTENSION XboxVmpDeviceExtension;
102  ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
103  ULONG Length;
104 
105  VideoPortDebugPrint(Trace, "XboxVmpInitialize\n");
106 
107  XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension;
108 
109  Length = XboxVmpDeviceExtension->ControlLength;
110  XboxVmpDeviceExtension->VirtControlStart = NULL;
111  if (NO_ERROR != VideoPortMapMemory(HwDeviceExtension,
112  XboxVmpDeviceExtension->PhysControlStart,
113  &Length, &inIoSpace,
114  &XboxVmpDeviceExtension->VirtControlStart))
115  {
116  VideoPortDebugPrint(Error, "Failed to map control memory\n");
117  return FALSE;
118  }
119  VideoPortDebugPrint(Info, "Mapped 0x%x bytes of control mem at 0x%x to virt addr 0x%x\n",
120  XboxVmpDeviceExtension->ControlLength,
121  XboxVmpDeviceExtension->PhysControlStart.u.LowPart,
122  XboxVmpDeviceExtension->VirtControlStart);
123 
124  return TRUE;
125 }
#define TRUE
Definition: types.h:120
PHYSICAL_ADDRESS PhysControlStart
Definition: xboxvmp.h:62
#define NO_ERROR
Definition: dderror.h:5
struct TraceInfo Info
smooth NULL
Definition: ftsmooth.c:416
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
BOOL Error
Definition: chkdsk.c:66
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define Trace(x)
Definition: zutil.h:197
struct _LARGE_INTEGER::@2196 u
struct XBOXVMP_DEVICE_EXTENSION * PXBOXVMP_DEVICE_EXTENSION
unsigned int ULONG
Definition: retypes.h:1
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)

Referenced by DriverEntry().

◆ XboxVmpMapVideoMemory()

BOOLEAN FASTCALL XboxVmpMapVideoMemory ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MEMORY  RequestedAddress,
PVIDEO_MEMORY_INFORMATION  MapInformation,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 348 of file xboxvmp.c.

353 {
355  ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
356  SYSTEM_BASIC_INFORMATION BasicInfo;
357  ULONG Length;
358 
359  /* FIXME: this should probably be done differently, without native API */
360  StatusBlock->Information = sizeof(VIDEO_MEMORY_INFORMATION);
361 
362  FrameBuffer.u.HighPart = 0;
364  (PVOID) &BasicInfo,
365  sizeof(SYSTEM_BASIC_INFORMATION),
366  &Length) == NO_ERROR)
367  {
368  FrameBuffer.u.LowPart = BasicInfo.HighestPhysicalPageNumber * PAGE_SIZE;
369  }
370  else
371  {
372  VideoPortDebugPrint(Error, "ZwQueryBasicInformation failed, assuming 64MB total memory\n");
373  FrameBuffer.u.LowPart = 60 * 1024 * 1024;
374  }
375 
376  FrameBuffer.QuadPart += DeviceExtension->PhysFrameBufferStart.QuadPart;
377  MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress;
378  MapInformation->VideoRamLength = 4 * 1024 * 1024;
379  VideoPortMapMemory(DeviceExtension, FrameBuffer,
380  &MapInformation->VideoRamLength, &inIoSpace,
381  &MapInformation->VideoRamBase);
382 
383  MapInformation->FrameBufferBase = MapInformation->VideoRamBase;
384  MapInformation->FrameBufferLength = MapInformation->VideoRamLength;
385 
386  /* Tell the nVidia controller about the framebuffer */
387  *((PULONG)((char *) DeviceExtension->VirtControlStart + CONTROL_FRAMEBUFFER_ADDRESS_OFFSET)) = FrameBuffer.u.LowPart;
388 
389  VideoPortDebugPrint(Info, "Mapped 0x%x bytes of phys mem at 0x%lx to virt addr 0x%p\n",
390  MapInformation->VideoRamLength, FrameBuffer.u.LowPart, MapInformation->VideoRamBase);
391 
392  return TRUE;
393 }
#define TRUE
Definition: types.h:120
#define CONTROL_FRAMEBUFFER_ADDRESS_OFFSET
Definition: xboxvmp.c:34
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:274
#define NO_ERROR
Definition: dderror.h:5
struct TraceInfo Info
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
PHYSICAL_ADDRESS PhysFrameBufferStart
Definition: xboxvmp.h:65
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
struct _VIDEO_MEMORY_INFORMATION VIDEO_MEMORY_INFORMATION
BOOL Error
Definition: chkdsk.c:66
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
static PVOID FrameBuffer
Definition: xboxvideo.c:24
#define SystemBasicInformation
Definition: xboxvmp.h:35
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)
ULONG_PTR Information
Definition: video.h:326
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by XboxVmpStartIO().

◆ XboxVmpQueryAvailModes()

BOOLEAN FASTCALL XboxVmpQueryAvailModes ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE_INFORMATION  ReturnedModes,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 525 of file xboxvmp.c.

529 {
530  return XboxVmpQueryCurrentMode(DeviceExtension, VideoMode, StatusBlock);
531 }
BOOLEAN FASTCALL XboxVmpQueryCurrentMode(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:540

Referenced by XboxVmpStartIO().

◆ XboxVmpQueryCurrentMode()

BOOLEAN FASTCALL XboxVmpQueryCurrentMode ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE_INFORMATION  VideoModeInfo,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 540 of file xboxvmp.c.

544 {
545  ULONG AvMode = 0;
546 
547  VideoMode->Length = sizeof(VIDEO_MODE_INFORMATION);
548  VideoMode->ModeIndex = 0;
549  if (I2CTransmitByteGetReturn(0x10, 0x04, &AvMode))
550  {
551  if (1 == AvMode) /* HDTV */
552  {
553  VideoMode->VisScreenWidth = 720;
554  }
555  else
556  {
557  /* FIXME Other possible values of AvMode:
558  * 0 - AV_SCART_RGB
559  * 2 - AV_VGA_SOG
560  * 4 - AV_SVIDEO
561  * 6 - AV_COMPOSITE
562  * 7 - AV_VGA
563  * other AV_COMPOSITE
564  */
565  VideoMode->VisScreenWidth = 640;
566  }
567  }
568  else
569  {
570  VideoMode->VisScreenWidth = 640;
571  }
572  VideoMode->VisScreenHeight = 480;
573  VideoMode->ScreenStride = VideoMode->VisScreenWidth * 4;
574  VideoMode->NumberOfPlanes = 1;
575  VideoMode->BitsPerPlane = 32;
576  VideoMode->Frequency = 1;
577  VideoMode->XMillimeter = 0; /* FIXME */
578  VideoMode->YMillimeter = 0; /* FIXME */
579  VideoMode->NumberRedBits = 8;
580  VideoMode->NumberGreenBits = 8;
581  VideoMode->NumberBlueBits = 8;
582  VideoMode->RedMask = 0xff0000;
583  VideoMode->GreenMask = 0x00ff00;
584  VideoMode->BlueMask = 0x0000ff;
585  VideoMode->VideoMemoryBitmapWidth = VideoMode->VisScreenWidth;
586  VideoMode->VideoMemoryBitmapHeight = VideoMode->VisScreenHeight;
587  VideoMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR |
589  VideoMode->DriverSpecificAttributeFlags = 0;
590 
591  StatusBlock->Information = sizeof(VIDEO_MODE_INFORMATION);
592 
593  return TRUE;
594 }
#define TRUE
Definition: types.h:120
#define VIDEO_MODE_NO_OFF_SCREEN
Definition: ntddvdeo.h:298
static BOOLEAN I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return)
Definition: xboxvmp.c:513
#define VIDEO_MODE_COLOR
Definition: ntddvdeo.h:293
unsigned int ULONG
Definition: retypes.h:1
struct _VIDEO_MODE_INFORMATION VIDEO_MODE_INFORMATION
ULONG_PTR Information
Definition: video.h:326
#define VIDEO_MODE_GRAPHICS
Definition: ntddvdeo.h:294

Referenced by XboxVmpQueryAvailModes(), and XboxVmpStartIO().

◆ XboxVmpQueryNumAvailModes()

BOOLEAN FASTCALL XboxVmpQueryNumAvailModes ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_NUM_MODES  Modes,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 423 of file xboxvmp.c.

427 {
428  Modes->NumModes = 1;
429  Modes->ModeInformationLength = sizeof(VIDEO_MODE_INFORMATION);
430  StatusBlock->Information = sizeof(VIDEO_NUM_MODES);
431  return TRUE;
432 }
#define TRUE
Definition: types.h:120
struct _VIDEO_NUM_MODES VIDEO_NUM_MODES
static const VBE_MODE Modes[VBE_MODE_COUNT]
Definition: vbe.c:189
struct _VIDEO_MODE_INFORMATION VIDEO_MODE_INFORMATION
ULONG_PTR Information
Definition: video.h:326

Referenced by XboxVmpStartIO().

◆ XboxVmpResetDevice()

BOOLEAN FASTCALL XboxVmpResetDevice ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 331 of file xboxvmp.c.

334 {
335  /* There is nothing to be done here */
336 
337  return TRUE;
338 }
#define TRUE
Definition: types.h:120

Referenced by XboxVmpResetHw(), and XboxVmpStartIO().

◆ XboxVmpResetHw()

BOOLEAN NTAPI XboxVmpResetHw ( PVOID  DeviceExtension,
ULONG  Columns,
ULONG  Rows 
)

Definition at line 252 of file xboxvmp.c.

256 {
257  VideoPortDebugPrint(Trace, "XboxVmpResetHw\n");
258 
259  if (! XboxVmpResetDevice((PXBOXVMP_DEVICE_EXTENSION) DeviceExtension, NULL))
260  {
261  return FALSE;
262  }
263 
264  return TRUE;
265 }
#define TRUE
Definition: types.h:120
BOOLEAN FASTCALL XboxVmpResetDevice(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:331
smooth NULL
Definition: ftsmooth.c:416
#define Trace(x)
Definition: zutil.h:197
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)

Referenced by DriverEntry().

◆ XboxVmpSetColorRegisters()

BOOLEAN FASTCALL XboxVmpSetColorRegisters ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_CLUT  ColorLookUpTable,
PSTATUS_BLOCK  StatusBlock 
)

◆ XboxVmpSetCurrentMode()

BOOLEAN FASTCALL XboxVmpSetCurrentMode ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE  RequestedMode,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 308 of file xboxvmp.c.

312 {
313  if (0 != RequestedMode->RequestedMode)
314  {
315  return FALSE;
316  }
317 
318  /* Nothing to do, really. We only support a single mode and we're already
319  in that mode */
320  return TRUE;
321 }
#define TRUE
Definition: types.h:120
ULONG RequestedMode
Definition: ntddvdeo.h:289

Referenced by XboxVmpStartIO().

◆ XboxVmpSetPowerState()

VP_STATUS NTAPI XboxVmpSetPowerState ( PVOID  HwDeviceExtension,
ULONG  HwId,
PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 291 of file xboxvmp.c.

295 {
296  VideoPortDebugPrint(Error, "XboxVmpSetPowerState not supported\n");
297 
298  return ERROR_INVALID_FUNCTION;
299 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
BOOL Error
Definition: chkdsk.c:66
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)

Referenced by DriverEntry().

◆ XboxVmpStartIO()

BOOLEAN NTAPI XboxVmpStartIO ( PVOID  HwDeviceExtension,
PVIDEO_REQUEST_PACKET  RequestPacket 
)

Definition at line 134 of file xboxvmp.c.

137 {
138  BOOLEAN Result;
139 
140  RequestPacket->StatusBlock->Status = ERROR_INVALID_PARAMETER;
141 
142  switch (RequestPacket->IoControlCode)
143  {
145  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_SET_CURRENT_MODE\n");
146  if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE))
147  {
148  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
149  return TRUE;
150  }
152  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
153  (PVIDEO_MODE)RequestPacket->InputBuffer,
154  RequestPacket->StatusBlock);
155  break;
156 
158  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_RESET_DEVICE\n");
160  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
161  RequestPacket->StatusBlock);
162  break;
163 
165  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_MAP_VIDEO_MEMORY\n");
166  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) ||
167  RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
168  {
169  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
170  return TRUE;
171  }
173  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
174  (PVIDEO_MEMORY)RequestPacket->InputBuffer,
175  (PVIDEO_MEMORY_INFORMATION)RequestPacket->OutputBuffer,
176  RequestPacket->StatusBlock);
177  break;
178 
180  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_UNMAP_VIDEO_MEMORY\n");
181  if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
182  {
183  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
184  return TRUE;
185  }
187  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
188  (PVIDEO_MEMORY)RequestPacket->InputBuffer,
189  RequestPacket->StatusBlock);
190  break;
191 
193  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES\n");
194  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES))
195  {
196  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
197  return TRUE;
198  }
200  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
201  (PVIDEO_NUM_MODES)RequestPacket->OutputBuffer,
202  RequestPacket->StatusBlock);
203  break;
204 
206  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_QUERY_AVAIL_MODES\n");
207  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
208  {
209  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
210  return TRUE;
211  }
213  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
214  (PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer,
215  RequestPacket->StatusBlock);
216  break;
217 
219  VideoPortDebugPrint(Trace, "XboxVmpStartIO IOCTL_VIDEO_QUERY_CURRENT_MODE\n");
220  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
221  {
222  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
223  return TRUE;
224  }
226  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
227  (PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer,
228  RequestPacket->StatusBlock);
229  break;
230 
231  default:
232  VideoPortDebugPrint(Warn, "XboxVmpStartIO 0x%x not implemented\n");
233  RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
234  return FALSE;
235  }
236 
237  if (Result)
238  {
239  RequestPacket->StatusBlock->Status = NO_ERROR;
240  }
241 
242  return TRUE;
243 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
BOOLEAN FASTCALL XboxVmpQueryCurrentMode(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:540
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define IOCTL_VIDEO_RESET_DEVICE
Definition: ntddvdeo.h:137
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:104
BOOLEAN FASTCALL XboxVmpSetCurrentMode(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:308
ULONG InputBufferLength
Definition: video.h:333
#define NO_ERROR
Definition: dderror.h:5
BOOLEAN FASTCALL XboxVmpResetDevice(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:331
#define IOCTL_VIDEO_QUERY_CURRENT_MODE
Definition: ntddvdeo.h:113
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:152
BOOLEAN FASTCALL XboxVmpQueryAvailModes(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:525
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
ULONG OutputBufferLength
Definition: video.h:335
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:179
Definition: video.h:581
VP_STATUS Status
Definition: video.h:323
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:122
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:107
#define Trace(x)
Definition: zutil.h:197
BOOLEAN FASTCALL XboxVmpQueryNumAvailModes(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_NUM_MODES Modes, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:423
PSTATUS_BLOCK StatusBlock
Definition: video.h:331
BOOLEAN FASTCALL XboxVmpMapVideoMemory(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY RequestedAddress, PVIDEO_MEMORY_INFORMATION MapInformation, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:348
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)
BOOLEAN FASTCALL XboxVmpUnmapVideoMemory(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:403
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by DriverEntry().

◆ XboxVmpUnmapVideoMemory()

BOOLEAN FASTCALL XboxVmpUnmapVideoMemory ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MEMORY  VideoMemory,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 403 of file xboxvmp.c.

407 {
408  VideoPortUnmapMemory(DeviceExtension, VideoMemory->RequestedVirtualAddress,
409  NULL);
410 
411  return TRUE;
412 }
#define TRUE
Definition: types.h:120
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:274
smooth NULL
Definition: ftsmooth.c:416
VPAPI VP_STATUS NTAPI VideoPortUnmapMemory(IN PVOID HwDeviceExtension, IN OUT PVOID VirtualAddress, IN HANDLE ProcessHandle)

Referenced by XboxVmpStartIO().

◆ ZwQuerySystemInformation()

LONG __stdcall ZwQuerySystemInformation ( IN ULONG  SystemInformationClass,
OUT PVOID  SystemInformation,
IN ULONG  Length,
OUT PULONG  ResultLength 
)