00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef _FSVGA_
00025
#define _FSVGA_
00026
00027
#include "ntddvdeo.h"
00028
#include "fscrnctl.h"
00029
#include "vga.h"
00030
00031
00032
00033
00034
00035 typedef enum _VGA_IO_PORT_TYPE {
00036
CRTCAddressPortColor = 0,
00037
CRTCDataPortColor,
00038
GRAPHAddressPort,
00039
SEQUAddressPort,
00040
MaximumPortCount
00041 }
VGA_IO_PORT_TYPE;
00042
00043
00044
00045
00046
00047
00048 typedef struct _FSVGA_CONFIGURATION_INFORMATION {
00049 USHORT EmulationMode;
00050 #define ENABLE_WORD_WRITE_VRAM 0x01
00051
00052 USHORT HardwareCursor;
00053 #define NO_HARDWARE_CURSOR 0
00054 #define HARDWARE_CURSOR 0x01
00055
00056 USHORT HardwareScroll;
00057 #define NO_HARDWARE_SCROLL 0
00058 #define HARDWARE_SCROLL 0x01
00059 #define USE_LINE_COMPARE 0x02
00060 #define OFFSET_128_TO_NEXT_SLICE 0x04
00061
00062
00063
00064
00065
00066 INTERFACE_TYPE
InterfaceType;
00067
00068
00069
00070
00071
00072 ULONG
BusNumber;
00073
00074
00075
00076
00077
00078 CM_PARTIAL_RESOURCE_DESCRIPTOR
PortList[
MaximumPortCount];
00079 ULONG
PortListCount;
00080
00081 }
FSVGA_CONFIGURATION_INFORMATION, *
PFSVGA_CONFIGURATION_INFORMATION;
00082
00083
00084
00085
00086 typedef struct _EMULATE_BUFFER_INFORMATION {
00087
00088
00089
00090 WORD
StartAddress;
00091 WORD
LineCompare;
00092 WORD
PrevLineCompare;
00093 WORD
BytePerLine;
00094 WORD
MaxScanLine;
00095 DWORD LimitGRAM;
00096 #define LIMIT_64K 0x10000L
00097 WORD
DeltaNextFontRow;
00098
00099
00100
00101 BYTE ColorFg;
00102 BYTE ColorBg;
00103
00104
00105 VIDEO_CURSOR_ATTRIBUTES
CursorAttributes;
00106 FSVIDEO_CURSOR_POSITION
CursorPosition;
00107 BOOL ShowCursor;
00108 }
EMULATE_BUFFER_INFORMATION, *
PEMULATE_BUFFER_INFORMATION;
00109
00110
00111
00112
00113
00114
typedef struct _DEVICE_EXTENSION {
00115
00116
00117
00118
00119
00120 ULONG
HardwarePresent;
00121
00122
00123
00124
00125
00126 PDEVICE_OBJECT DeviceObject;
00127
00128
00129
00130
00131
00132 PVOID
DeviceRegisters[
MaximumPortCount];
00133
00134
00135
00136
00137
00138 FSVGA_CONFIGURATION_INFORMATION Configuration;
00139
00140
00141
00142
00143 FSVIDEO_MODE_INFORMATION
CurrentMode;
00144
00145
00146
00147
00148 FSVIDEO_SCREEN_INFORMATION
ScreenAndFont;
00149
00150
00151
00152
00153 EMULATE_BUFFER_INFORMATION EmulateInfo;
00154
00155
00156
00157
00158
00159
00160 BOOLEAN
UnmapRegistersRequired;
00161
00162 }
DEVICE_EXTENSION, *
PDEVICE_EXTENSION;
00163
00164
00165
00166
00167
00168 #define FSVGA_ERROR_VALUE_BASE 1000
00169
00170
00171
00172
00173
00174 #define FSVGA_HARDWARE_PRESENT 1
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
NTSTATUS
00186
DriverEntry(
00187 IN
PDRIVER_OBJECT DriverObject,
00188 IN PUNICODE_STRING RegistryPath
00189 );
00190
00191
VOID
00192
FsVgaConfiguration(
00193 IN PDEVICE_EXTENSION DeviceExtension,
00194 IN PUNICODE_STRING RegistryPath,
00195 IN PUNICODE_STRING KeyboardDeviceName
00196 );
00197
00198
NTSTATUS
00199
FsVgaPeripheralCallout(
00200 IN PVOID Context,
00201 IN PUNICODE_STRING PathName,
00202 IN INTERFACE_TYPE BusType,
00203 IN ULONG BusNumber,
00204 IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
00205 IN CONFIGURATION_TYPE ControllerType,
00206 IN ULONG ControllerNumber,
00207 IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
00208 IN CONFIGURATION_TYPE PeripheralType,
00209 IN ULONG PeripheralNumber,
00210 IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
00211 );
00212
00213
VOID
00214
FsVgaServiceParameters(
00215 IN PDEVICE_EXTENSION DeviceExtension,
00216 IN PUNICODE_STRING RegistryPath,
00217 IN PUNICODE_STRING FsVgaDeviceName
00218 );
00219
00220
VOID
00221
FsVgaBuildResourceList(
00222 IN PDEVICE_EXTENSION DeviceExtension,
00223 OUT PCM_RESOURCE_LIST *ResourceList,
00224 OUT PULONG ResourceListSize
00225 );
00226
00227
NTSTATUS
00228
FsVgaOpenCloseDispatch(
00229 IN
PDEVICE_OBJECT DeviceObject,
00230 IN
PIRP Irp
00231 );
00232
00233
NTSTATUS
00234
FsVgaDeviceControl(
00235 IN
PDEVICE_OBJECT DeviceObject,
00236 IN
PIRP Irp
00237 );
00238
00239
NTSTATUS
00240
FsVgaCopyFrameBuffer(
00241 PDEVICE_EXTENSION DeviceExtension,
00242 PFSVIDEO_COPY_FRAME_BUFFER CopyFrameBuffer,
00243 ULONG inputBufferLength
00244 );
00245
00246
NTSTATUS
00247
FsVgaWriteToFrameBuffer(
00248 PDEVICE_EXTENSION DeviceExtension,
00249 PFSVIDEO_WRITE_TO_FRAME_BUFFER WriteFrameBuffer,
00250 ULONG inputBufferLength
00251 );
00252
00253
NTSTATUS
00254
FsVgaReverseMousePointer(
00255 PDEVICE_EXTENSION DeviceExtension,
00256 PFSVIDEO_REVERSE_MOUSE_POINTER MouseBuffer,
00257 ULONG inputBufferLength
00258 );
00259
00260
NTSTATUS
00261
FsVgaSetMode(
00262 PDEVICE_EXTENSION DeviceExtension,
00263 PFSVIDEO_MODE_INFORMATION ModeInformation,
00264 ULONG inputBufferLength
00265 );
00266
00267
NTSTATUS
00268
FsVgaSetScreenInformation(
00269 PDEVICE_EXTENSION DeviceExtension,
00270 PFSVIDEO_SCREEN_INFORMATION ScreenInformation,
00271 ULONG inputBufferLength
00272 );
00273
00274
NTSTATUS
00275
FsVgaSetCursorPosition(
00276 PDEVICE_EXTENSION DeviceExtension,
00277 PFSVIDEO_CURSOR_POSITION CursorPosition,
00278 ULONG inputBufferLength
00279 );
00280
00281
NTSTATUS
00282
FsVgaSetCursorAttribute(
00283 PDEVICE_EXTENSION DeviceExtension,
00284 PVIDEO_CURSOR_ATTRIBUTES CursorAttributes,
00285 ULONG inputBufferLength
00286 );
00287
00288
VOID
00289
FsVgaLogError(
00290 IN
PDEVICE_OBJECT DeviceObject,
00291 IN NTSTATUS ErrorCode,
00292 IN ULONG UniqueErrorValue,
00293 IN NTSTATUS FinalStatus,
00294 IN PULONG DumpData,
00295 IN ULONG DumpCount
00296 );
00297
00298
#if DBG
00299
00300
VOID
00301 FsVgaDebugPrint(
00302 ULONG DebugPrintLevel,
00303 PCCHAR DebugMessage,
00304 ...
00305 );
00306
00307
extern ULONG FsVgaDebug;
00308
#define FsVgaPrint(x) FsVgaDebugPrint x
00309
#else
00310 #define FsVgaPrint(x)
00311
#endif
00312
00313
00314
00315
00316 ULONG
00317
CalcGRAMSize(
00318 IN COORD WindowSize,
00319 IN PDEVICE_EXTENSION DeviceExtension
00320 );
00321
00322 PUCHAR
00323
CalcGRAMAddress(
00324 IN COORD WindowSize,
00325 IN PDEVICE_EXTENSION DeviceExtension
00326 );
00327
00328
BOOL
00329
IsGRAMRowOver(
00330 PUCHAR BufPtr,
00331 BOOL fDbcs,
00332 PDEVICE_EXTENSION DeviceExtension
00333 );
00334
00335 PUCHAR
00336
NextGRAMRow(
00337 PUCHAR BufPtr,
00338 PDEVICE_EXTENSION DeviceExtension
00339 );
00340
00341
VOID
00342
memcpyGRAM(
00343 IN PCHAR TargetPtr,
00344 IN PCHAR SourcePtr,
00345 IN ULONG Length
00346 );
00347
00348
VOID
00349
memcpyGRAMOver(
00350 IN PCHAR TargetPtr,
00351 IN PCHAR SourcePtr,
00352 IN ULONG Length,
00353 IN PUCHAR FrameBufPtr,
00354 IN PDEVICE_EXTENSION DeviceExtension
00355 );
00356
00357
VOID
00358
MoveGRAM(
00359 IN PCHAR TargetPtr,
00360 IN PCHAR SourcePtr,
00361 IN ULONG Length,
00362 IN PUCHAR FrameBufPtr,
00363 IN PDEVICE_EXTENSION DeviceExtension
00364 );
00365
00366
NTSTATUS
00367
FsgVgaInitializeHWFlags(
00368 PDEVICE_EXTENSION DeviceExtension
00369 );
00370
00371
NTSTATUS
00372
FsgCopyFrameBuffer(
00373 PDEVICE_EXTENSION DeviceExtension,
00374 PFSVIDEO_COPY_FRAME_BUFFER CopyFrameBuffer,
00375 ULONG inputBufferLength
00376 );
00377
00378
NTSTATUS
00379
FsgWriteToFrameBuffer(
00380 PDEVICE_EXTENSION DeviceExtension,
00381 PFSVIDEO_WRITE_TO_FRAME_BUFFER WriteFrameBuffer,
00382 ULONG inputBufferLength
00383 );
00384
00385
NTSTATUS
00386
FsgReverseMousePointer(
00387 PDEVICE_EXTENSION DeviceExtension,
00388 PFSVIDEO_REVERSE_MOUSE_POINTER MouseBuffer,
00389 ULONG inputBufferLength
00390 );
00391
00392
NTSTATUS
00393
FsgInvertCursor(
00394 PDEVICE_EXTENSION DeviceExtension,
00395 BOOL Invert
00396 );
00397
00398
NTSTATUS
00399
FsgWriteToScreen(
00400 PUCHAR FrameBuffer,
00401 PUCHAR BitmapBuffer,
00402 DWORD cjBytes,
00403 BOOL fDbcs,
00404 WORD Attributes1,
00405 WORD Attributes2,
00406 PDEVICE_EXTENSION DeviceExtension
00407 );
00408
00409
NTSTATUS
00410
FsgWriteToScreenCommonLVB(
00411 PUCHAR FrameBuffer,
00412 WORD Attributes,
00413 PDEVICE_EXTENSION DeviceExtension
00414 );
00415
00416 UCHAR
00417
AccessGRAM_WR(
00418 PUCHAR FrameBuffer,
00419 UCHAR write
00420 );
00421
00422 UCHAR
00423
AccessGRAM_RW(
00424 PUCHAR FrameBuffer,
00425 UCHAR write
00426 );
00427
00428 UCHAR
00429
AccessGRAM_AND(
00430 PUCHAR FrameBuffer,
00431 UCHAR write
00432 );
00433
00434
00435
00436
00437
DWORD
00438
CalcBitmapBufferSize(
00439 IN COORD FontSize,
00440 IN DWORD dwAlign
00441 );
00442
00443
VOID
00444
AlignCopyMemory(
00445 OUT PBYTE pDestBits,
00446 IN DWORD dwDestAlign,
00447 IN PBYTE pSrcBits,
00448 IN DWORD dwSrcAlign,
00449 IN COORD FontSize
00450 );
00451
00452
00453
00454
00455
int
00456
ConvertOutputToOem(
00457 IN LPWSTR Source,
00458 IN
int SourceLength,
00459 OUT LPSTR Target,
00460 IN
int TargetLength
00461 );
00462
00463
NTSTATUS
00464
TranslateOutputToOem(
00465 OUT PCHAR_IMAGE_INFO OutputBuffer,
00466 IN PCHAR_IMAGE_INFO InputBuffer,
00467 IN DWORD Length
00468 );
00469
00470
00471
00472
00473
VOID
00474
GetHardwareScrollReg(
00475 PDEVICE_EXTENSION deviceExtension
00476 );
00477
00478
VOID
00479
SetGRAMWriteMode(
00480 PDEVICE_EXTENSION deviceExtension
00481 );
00482
00483
VOID
00484
SetGRAMCopyMode(
00485 PDEVICE_EXTENSION deviceExtension
00486 );
00487
00488
VOID
00489
SetGRAMInvertMode(
00490 PDEVICE_EXTENSION deviceExtension
00491 );
00492
00493
VOID
00494
set_opaque_bkgnd_proc(
00495 PDEVICE_EXTENSION deviceExtension,
00496 PUCHAR FrameBuffer,
00497 WORD Attributes
00498 );
00499
00500
VOID
00501
ColorSetGridMask(
00502 PDEVICE_EXTENSION deviceExtension,
00503 BYTE BitMask
00504 );
00505
00506
VOID
00507
ColorSetDirect(
00508 PDEVICE_EXTENSION deviceExtension,
00509 PUCHAR FrameBuffer,
00510 BYTE ColorFg,
00511 BYTE ColorBg
00512 );
00513
00514
#endif // _FSVGA_