Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fsvga.c File Reference

#include "stdarg.h"
#include "stdio.h"
#include "ntddk.h"
#include "fsvga.h"
#include "fsvgalog.h"

Go to the source code of this file.

Defines

#define NAME_MAX   256
#define DUMP_COUNT   4
#define PARAMETER_MAX   256
#define DUMP_COUNT   4
#define DUMP_COUNT   4

Functions

NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
VOID FsVgaConfiguration (IN PDEVICE_EXTENSION DeviceExtension, IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING FsVgaDeviceName)
NTSTATUS FsVgaPeripheralCallout (IN PVOID Context, IN PUNICODE_STRING PathName, IN INTERFACE_TYPE BusType, IN ULONG BusNumber, IN PKEY_VALUE_FULL_INFORMATION *BusInformation, IN CONFIGURATION_TYPE ControllerType, IN ULONG ControllerNumber, IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation, IN CONFIGURATION_TYPE PeripheralType, IN ULONG PeripheralNumber, IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
VOID FsVgaServiceParameters (IN PDEVICE_EXTENSION DeviceExtension, IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING FsVgaDeviceName)
VOID FsVgaBuildResourceList (IN PDEVICE_EXTENSION DeviceExtension, OUT PCM_RESOURCE_LIST *ResourceList, OUT PULONG ResourceListSize)
NTSTATUS FsVgaOpenCloseDispatch (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS FsVgaDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS FsVgaCopyFrameBuffer (PDEVICE_EXTENSION DeviceExtension, PFSVIDEO_COPY_FRAME_BUFFER CopyFrameBuffer, ULONG inputBufferLength)
NTSTATUS FsVgaWriteToFrameBuffer (PDEVICE_EXTENSION DeviceExtension, PFSVIDEO_WRITE_TO_FRAME_BUFFER WriteFrameBuffer, ULONG inputBufferLength)
NTSTATUS FsVgaReverseMousePointer (PDEVICE_EXTENSION DeviceExtension, PFSVIDEO_REVERSE_MOUSE_POINTER MouseBuffer, ULONG inputBufferLength)
NTSTATUS FsVgaSetMode (PDEVICE_EXTENSION DeviceExtension, PFSVIDEO_MODE_INFORMATION ModeInformation, ULONG inputBufferLength)
NTSTATUS FsVgaSetScreenInformation (PDEVICE_EXTENSION DeviceExtension, PFSVIDEO_SCREEN_INFORMATION ScreenInformation, ULONG inputBufferLength)
NTSTATUS FsVgaSetCursorPosition (PDEVICE_EXTENSION DeviceExtension, PFSVIDEO_CURSOR_POSITION CursorPosition, ULONG inputBufferLength)
NTSTATUS FsVgaSetCursorAttribute (PDEVICE_EXTENSION DeviceExtension, PVIDEO_CURSOR_ATTRIBUTES CursorAttributes, ULONG inputBufferLength)
VOID FsVgaLogError (IN PDEVICE_OBJECT DeviceObject, IN NTSTATUS ErrorCode, IN ULONG UniqueErrorValue, IN NTSTATUS FinalStatus, IN PULONG DumpData, IN ULONG DumpCount)


Define Documentation

#define DUMP_COUNT   4
 

#define DUMP_COUNT   4
 

#define DUMP_COUNT   4
 

Referenced by DriverEntry(), FsVgaBuildResourceList(), and FsVgaWriteToFrameBuffer().

#define NAME_MAX   256
 

Referenced by DriverEntry().

#define PARAMETER_MAX   256
 


Function Documentation

NTSTATUS DriverEntry IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath
 

Definition at line 53 of file fsvga.c.

References ASSERT, _FSVGA_CONFIGURATION_INFORMATION::BusNumber, CdfsFileSystem, _DEVICE_EXTENSION::Configuration, DEVICE_EXTENSION, _DEVICE_OBJECT::DeviceExtension, _DEVICE_EXTENSION::DeviceObject, _DEVICE_EXTENSION::DeviceRegisters, DriverEntry(), DUMP_COUNT, ExAllocatePool, ExAllocatePoolWithTag, ExFreePool(), FALSE, FatFileSystem, FSREC_POOL_TAG, FsRecCleanupClose(), FsRecCreate(), FsRecCreateAndRegisterDO(), FsRecFsControl(), FsRecLoadSync, FsRecUnload(), FSVGA_ERROR_VALUE_BASE, FSVGA_HARDWARE_PRESENT, FsVgaBuildResourceList(), FsVgaConfiguration(), FsVgaDeviceControl(), FsVgaOpenCloseDispatch(), FsVgaPrint, HalTranslateBusAddress(), _DEVICE_EXTENSION::HardwarePresent, _FSVGA_CONFIGURATION_INFORMATION::InterfaceType, IoAllocateErrorLogEntry(), IoCreateDevice(), IoDeleteDevice(), IoReportResourceUsage(), IoWriteErrorLogEntry(), IRP_MJ_CLEANUP, IRP_MJ_CLOSE, IRP_MJ_CREATE, IRP_MJ_DEVICE_CONTROL, IRP_MJ_FILE_SYSTEM_CONTROL, KeInitializeEvent, L, MmMapIoSpace(), MmPageEntireDriver(), MmUnmapIoSpace(), NAME_MAX, NonPagedPool, NT_SUCCESS, NtfsFileSystem, NTSTATUS(), NULL, PAGED_CODE, PagedPool, _FSVGA_CONFIGURATION_INFORMATION::PortList, _FSVGA_CONFIGURATION_INFORMATION::PortListCount, RtlAppendUnicodeStringToString(), RtlAppendUnicodeToString(), RtlInitUnicodeString(), RtlIntegerToUnicodeString(), RtlWriteRegistryValue(), TRUE, UdfsFileSystem, _DEVICE_EXTENSION::UnmapRegistersRequired, and USHORT.

00060 : 00061 00062 Installable driver initialization entry point. 00063 This entry point is called directly by the I/O system. 00064 00065 Arguments: 00066 00067 DriverObject - Pointer to driver object created by system. 00068 00069 RegistryPath - Pointer to the Unicode name of the registry path 00070 for this driver. 00071 00072 Return Value: 00073 00074 The function value is the final status from the initialization operation. 00075 00076 --*/ 00077 00078 { 00079 PDEVICE_OBJECT DeviceObject = NULL; 00080 PDEVICE_EXTENSION deviceExtension = NULL; 00081 DEVICE_EXTENSION tmpDeviceExtension; 00082 NTSTATUS status = STATUS_SUCCESS; 00083 PCM_RESOURCE_LIST resources = NULL; 00084 ULONG resourceListSize = 0; 00085 BOOLEAN overrideConflict; 00086 BOOLEAN conflictDetected; 00087 ULONG addressSpace; 00088 PHYSICAL_ADDRESS cardAddress; 00089 ULONG i; 00090 UNICODE_STRING fullFsVgaName; 00091 UNICODE_STRING baseFsVgaName; 00092 UNICODE_STRING deviceNameSuffix; 00093 UNICODE_STRING resourceDeviceClass; 00094 UNICODE_STRING registryPath; 00095 00096 #define NAME_MAX 256 00097 WCHAR FsVgaBuffer[NAME_MAX]; 00098 00099 ULONG uniqueErrorValue; 00100 NTSTATUS errorCode = STATUS_SUCCESS; 00101 ULONG dumpCount = 0; 00102 00103 #define DUMP_COUNT 4 00104 ULONG dumpData[DUMP_COUNT]; 00105 00106 FsVgaPrint((1, 00107 "\n\nFSVGA-FSVGAInitialize: enter\n")); 00108 00109 // 00110 // Zero-initialize various structures. 00111 // 00112 RtlZeroMemory(&tmpDeviceExtension, sizeof(DEVICE_EXTENSION)); 00113 00114 fullFsVgaName.MaximumLength = 0; 00115 fullFsVgaName.Length = 0; 00116 deviceNameSuffix.MaximumLength = 0; 00117 deviceNameSuffix.Length = 0; 00118 resourceDeviceClass.MaximumLength = 0; 00119 resourceDeviceClass.Length = 0; 00120 registryPath.MaximumLength = 0; 00121 registryPath.Length = 0; 00122 00123 RtlZeroMemory(FsVgaBuffer, NAME_MAX * sizeof(WCHAR)); 00124 baseFsVgaName.Buffer = FsVgaBuffer; 00125 baseFsVgaName.Length = 0; 00126 baseFsVgaName.MaximumLength = NAME_MAX * sizeof(WCHAR); 00127 00128 RtlZeroMemory(dumpData, sizeof(dumpData)); 00129 00130 // 00131 // Need to ensure that the registry path is null-terminated. 00132 // Allocate pool to hold a null-terminated copy of the path. 00133 // 00134 registryPath.Buffer = ExAllocatePool(PagedPool, 00135 RegistryPath->Length + sizeof(UNICODE_NULL)); 00136 if (!registryPath.Buffer) 00137 { 00138 FsVgaPrint((1, 00139 "FSVGA-FSVGAInitialize: Couldn't allocate pool for registry path\n")); 00140 status = STATUS_UNSUCCESSFUL; 00141 errorCode = FSVGA_INSUFFICIENT_RESOURCES; 00142 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 2; 00143 dumpData[0] = (ULONG) RegistryPath->Length + sizeof(UNICODE_NULL); 00144 dumpCount = 1; 00145 goto FsVgaInitializeExit; 00146 } 00147 else 00148 { 00149 registryPath.Length = RegistryPath->Length + sizeof(UNICODE_NULL); 00150 registryPath.MaximumLength = registryPath.Length; 00151 00152 RtlZeroMemory(registryPath.Buffer, 00153 registryPath.Length); 00154 RtlMoveMemory(registryPath.Buffer, 00155 RegistryPath->Buffer, 00156 RegistryPath->Length); 00157 } 00158 00159 // 00160 // Get the configuration information for this driver. 00161 // 00162 00163 FsVgaConfiguration(&tmpDeviceExtension, 00164 &registryPath, 00165 &baseFsVgaName); 00166 00167 if (!(tmpDeviceExtension.HardwarePresent & FSVGA_HARDWARE_PRESENT)) { 00168 00169 // 00170 // There is neither a Full Screen Video attached. Free 00171 // resources and return with unsuccessful status. 00172 // 00173 00174 FsVgaPrint((1, 00175 "FSVGA-FsVgaInitialize: No Full Screen Video attached.\n")); 00176 status = STATUS_NO_SUCH_DEVICE; 00177 errorCode = FSVGA_NO_SUCH_DEVICE; 00178 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 4; 00179 goto FsVgaInitializeExit; 00180 00181 } 00182 00183 // 00184 // Set up space for the port's device object suffix. Note that 00185 // we overallocate space for the suffix string because it is much 00186 // easier than figuring out exactly how much space is required. 00187 // The storage gets freed at the end of driver initialization, so 00188 // who cares... 00189 // 00190 00191 RtlInitUnicodeString(&deviceNameSuffix, 00192 NULL); 00193 00194 deviceNameSuffix.MaximumLength = FULLSCREEN_VIDEO_SUFFIX_MAXIMUM * sizeof(WCHAR); 00195 deviceNameSuffix.MaximumLength += sizeof(UNICODE_NULL); 00196 00197 deviceNameSuffix.Buffer = ExAllocatePool(PagedPool, 00198 deviceNameSuffix.MaximumLength); 00199 if (!deviceNameSuffix.Buffer) { 00200 FsVgaPrint((1, 00201 "FSVGA-FsVgaInitialize: Couldn't allocate string for device object suffix\n")); 00202 00203 status = STATUS_UNSUCCESSFUL; 00204 errorCode = FSVGA_INSUFFICIENT_RESOURCES; 00205 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 8; 00206 dumpData[0] = (ULONG) deviceNameSuffix.MaximumLength; 00207 dumpCount = 1; 00208 goto FsVgaInitializeExit; 00209 } 00210 00211 RtlZeroMemory(deviceNameSuffix.Buffer, 00212 deviceNameSuffix.MaximumLength); 00213 00214 // 00215 // Set up space for the port's Full Screen Video device object name. 00216 // 00217 00218 RtlInitUnicodeString(&fullFsVgaName, 00219 NULL); 00220 00221 fullFsVgaName.MaximumLength = sizeof(L"\\Device\\") + 00222 baseFsVgaName.Length + 00223 deviceNameSuffix.MaximumLength; 00224 00225 fullFsVgaName.Buffer = ExAllocatePool(PagedPool, 00226 fullFsVgaName.MaximumLength); 00227 if (!fullFsVgaName.Buffer) { 00228 FsVgaPrint((1, 00229 "FSVGA-FsVgaInitialize: Couldn't allocate string for Full Screen Video device object name\n")); 00230 00231 status = STATUS_UNSUCCESSFUL; 00232 errorCode = FSVGA_INSUFFICIENT_RESOURCES; 00233 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 10; 00234 dumpData[0] = (ULONG) fullFsVgaName.MaximumLength; 00235 dumpCount = 1; 00236 goto FsVgaInitializeExit; 00237 00238 } 00239 00240 RtlZeroMemory(fullFsVgaName.Buffer, 00241 fullFsVgaName.MaximumLength); 00242 RtlAppendUnicodeToString(&fullFsVgaName, 00243 L"\\Device\\"); 00244 RtlAppendUnicodeToString(&fullFsVgaName, 00245 baseFsVgaName.Buffer); 00246 00247 // 00248 // Append the suffix to the device object name string. E.g., turn 00249 // \Device\FullScreenVideo into \Device\FullScreenVideo0. Then we attempt 00250 // to create the device object. If the device object already 00251 // exists (because it was already created by another port driver), 00252 // increment the suffix and try again. 00253 // 00254 00255 status = RtlIntegerToUnicodeString( 0, // suffix number = 0 00256 10, 00257 &deviceNameSuffix); 00258 if (!NT_SUCCESS(status)) 00259 { 00260 FsVgaPrint((1, 00261 "FSVGA-FsVgaInitialize: Could not create suffix number\n")); 00262 errorCode = FSVGA_INSUFFICIENT_RESOURCES; 00263 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 12; 00264 dumpData[0] = (ULONG) 0; // suffix number = 0 00265 dumpCount = 1; 00266 goto FsVgaInitializeExit; 00267 } 00268 00269 RtlAppendUnicodeStringToString(&fullFsVgaName, 00270 &deviceNameSuffix); 00271 00272 FsVgaPrint((1, 00273 "FSVGA-FSVGAInitialize: Creating device object named %ws\n", 00274 fullFsVgaName.Buffer)); 00275 00276 // 00277 // Create device object for the FsVga device. 00278 // Note that we specify that this is a exclusive device. 00279 // 00280 00281 status = IoCreateDevice(DriverObject, 00282 sizeof(DEVICE_EXTENSION), 00283 &fullFsVgaName, 00284 FILE_DEVICE_FULLSCREEN_VIDEO, 00285 0, 00286 TRUE, 00287 &DeviceObject); 00288 if (!NT_SUCCESS(status)) 00289 { 00290 FsVgaPrint((1, 00291 "FSVGA-FSVGAInitialize: Couldn't create device object = %ws\n")); 00292 status = STATUS_UNSUCCESSFUL; 00293 errorCode = FSVGA_INSUFFICIENT_RESOURCES; 00294 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 2; 00295 dumpData[0] = (ULONG) RegistryPath->Length + sizeof(UNICODE_NULL); 00296 dumpCount = 1; 00297 goto FsVgaInitializeExit; 00298 } 00299 00300 // 00301 // Set up the device extension. 00302 // 00303 00304 deviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; 00305 *deviceExtension = tmpDeviceExtension; 00306 deviceExtension->DeviceObject = DeviceObject; 00307 00308 // 00309 // Set up the resource list prior to reporting resource usage. 00310 // 00311 00312 FsVgaBuildResourceList(deviceExtension, &resources, &resourceListSize); 00313 00314 // 00315 // Set up space for the resource device class name. 00316 // 00317 00318 RtlInitUnicodeString(&resourceDeviceClass, 00319 NULL); 00320 00321 resourceDeviceClass.MaximumLength = baseFsVgaName.Length; 00322 00323 resourceDeviceClass.Buffer = ExAllocatePool(PagedPool, 00324 resourceDeviceClass.MaximumLength); 00325 00326 if (!resourceDeviceClass.Buffer) { 00327 00328 FsVgaPrint((1, 00329 "FSVGA-FsVgaInitialize: Couldn't allocate string for resource device class name\n")); 00330 00331 status = STATUS_UNSUCCESSFUL; 00332 errorCode = FSVGA_INSUFFICIENT_RESOURCES; 00333 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 15; 00334 dumpData[0] = (ULONG) resourceDeviceClass.MaximumLength; 00335 dumpCount = 1; 00336 goto FsVgaInitializeExit; 00337 00338 } 00339 00340 // 00341 // Form the resource device class name from the Full Screen Video 00342 // device names. 00343 // 00344 00345 RtlZeroMemory(resourceDeviceClass.Buffer, 00346 resourceDeviceClass.MaximumLength); 00347 RtlAppendUnicodeStringToString(&resourceDeviceClass, 00348 &baseFsVgaName); 00349 00350 // 00351 // Report resource usage for the registry. 00352 // 00353 00354 // 00355 // If we are loading the VGA, do not generate an error if it conflicts 00356 // with another driver. 00357 // 00358 // overrideConflict = pOverrideConflict(DeviceExtension, TRUE); 00359 overrideConflict = TRUE; 00360 #if DBG 00361 if (overrideConflict) { 00362 FsVgaPrint((2, "We are checking the vga driver resources\n")); 00363 } else { 00364 FsVgaPrint((2, "We are NOT checking vga driver resources\n")); 00365 } 00366 #endif 00367 00368 status = IoReportResourceUsage(&resourceDeviceClass, 00369 DriverObject, 00370 NULL, 00371 0, 00372 DeviceObject, 00373 resources, 00374 resourceListSize, 00375 overrideConflict, 00376 &conflictDetected 00377 ); 00378 00379 // 00380 // If we tried to override the conflict, let's take a look a what 00381 // we want to do with the result 00382 // 00383 00384 if ((NT_SUCCESS(status)) && 00385 overrideConflict && 00386 conflictDetected) { 00387 00388 // 00389 // For cases like DetectDisplay, a conflict is bad and we do 00390 // want to fail. 00391 // 00392 // In the case of Basevideo, a conflict is possible. But we still 00393 // want to load the VGA anyways. Return success and reset the 00394 // conflict flag ! 00395 // 00396 // pOverrideConflict with the FALSE flag will check that. 00397 // 00398 // 00399 // if (pOverrideConflict(DeviceExtension, FALSE)) { 00400 // error 00401 // } 00402 // else { 00403 00404 conflictDetected = FALSE; 00405 00406 // } 00407 } 00408 00409 00410 if (conflictDetected) { 00411 00412 // 00413 // Some other device already owns the Full Screen Video ports. 00414 // Fatal error. 00415 // 00416 00417 FsVgaPrint((1, 00418 "FSVGA-FsVgaInitialize: Resource usage conflict\n")); 00419 00420 // 00421 // Set up error log info. 00422 // 00423 00424 status = STATUS_INSUFFICIENT_RESOURCES; 00425 errorCode = FSVGA_RESOURCE_CONFLICT; 00426 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 20; 00427 dumpData[0] = (ULONG) 00428 resources->List[0].PartialResourceList.PartialDescriptors[0].u.Port.Start.LowPart; 00429 dumpData[1] = (ULONG) 00430 resources->List[0].PartialResourceList.PartialDescriptors[1].u.Port.Start.LowPart; 00431 dumpData[2] = (ULONG) 00432 resources->List[0].PartialResourceList.PartialDescriptors[2].u.Port.Start.LowPart; 00433 dumpCount = 3; 00434 00435 goto FsVgaInitializeExit; 00436 00437 } 00438 00439 // 00440 // Map the VGA controller registers. 00441 // 00442 00443 for (i = 0; i < deviceExtension->Configuration.PortListCount; i++) { 00444 00445 addressSpace = (deviceExtension->Configuration.PortList[i].Flags 00446 & CM_RESOURCE_PORT_IO) == CM_RESOURCE_PORT_IO? 1:0; 00447 00448 if (!HalTranslateBusAddress(deviceExtension->Configuration.InterfaceType, 00449 deviceExtension->Configuration.BusNumber, 00450 deviceExtension->Configuration.PortList[i].u.Port.Start, 00451 &addressSpace, 00452 &cardAddress 00453 )) { 00454 00455 addressSpace = 1; 00456 cardAddress.QuadPart = 0; 00457 } 00458 00459 if (!addressSpace) { 00460 00461 deviceExtension->UnmapRegistersRequired = TRUE; 00462 deviceExtension->DeviceRegisters[i] = 00463 MmMapIoSpace( 00464 cardAddress, 00465 deviceExtension->Configuration.PortList[i].u.Port.Length, 00466 FALSE 00467 ); 00468 00469 } else { 00470 00471 deviceExtension->UnmapRegistersRequired = FALSE; 00472 deviceExtension->DeviceRegisters[i] = (PVOID)cardAddress.LowPart; 00473 00474 } 00475 00476 if (!deviceExtension->DeviceRegisters[i]) { 00477 00478 FsVgaPrint((1, 00479 "FSVGA-FsVgaInitialize: Couldn't map the device registers.\n")); 00480 status = STATUS_NONE_MAPPED; 00481 00482 // 00483 // Set up error log info. 00484 // 00485 00486 errorCode = FSVGA_REGISTERS_NOT_MAPPED; 00487 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 30; 00488 dumpData[0] = cardAddress.LowPart; 00489 dumpCount = 1; 00490 00491 goto FsVgaInitializeExit; 00492 00493 } 00494 } 00495 00496 00497 00498 // 00499 // Once initialization is finished, load the device map information 00500 // into the registry so that setup can determine which full screen 00501 // port are active. 00502 // 00503 00504 if (deviceExtension->HardwarePresent & FSVGA_HARDWARE_PRESENT) { 00505 00506 status = RtlWriteRegistryValue(RTL_REGISTRY_DEVICEMAP, 00507 baseFsVgaName.Buffer, 00508 fullFsVgaName.Buffer, 00509 REG_SZ, 00510 registryPath.Buffer, 00511 registryPath.Length); 00512 00513 if (!NT_SUCCESS(status)) 00514 { 00515 FsVgaPrint((1, 00516 "FSVGA-FSVGAInitialize: Could not store keyboard name in DeviceMap\n")); 00517 errorCode = FSVGA_NO_DEVICEMAP_CREATED; 00518 uniqueErrorValue = FSVGA_ERROR_VALUE_BASE + 90; 00519 dumpCount = 0; 00520 goto FsVgaInitializeExit; 00521 } 00522 else 00523 { 00524 FsVgaPrint((1, 00525 "FSVGA-FSVGAInitialize: Stored pointer name in DeviceMap\n")); 00526 } 00527 } 00528 00529 ASSERT(status == STATUS_SUCCESS); 00530 00531 // 00532 // Set up the device driver entry points. 00533 // 00534 DriverObject->MajorFunction[IRP_MJ_CREATE] = FsVgaOpenCloseDispatch; 00535 DriverObject->MajorFunction[IRP_MJ_CLOSE] = FsVgaOpenCloseDispatch; 00536 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FsVgaDeviceControl; 00537 00538 FsVgaInitializeExit: 00539 00540 if (errorCode != STATUS_SUCCESS) 00541 { 00542 PIO_ERROR_LOG_PACKET errorLogEntry; 00543 ULONG i; 00544 00545 // 00546 // Log an error/warning message. 00547 // 00548 errorLogEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry( 00549 (DeviceObject == NULL) ? (PVOID) DriverObject : (PVOID) DeviceObject, 00550 (UCHAR) (sizeof(IO_ERROR_LOG_PACKET) 00551 + (dumpCount * sizeof(ULONG))) 00552 ); 00553 00554 if (errorLogEntry != NULL) 00555 { 00556 errorLogEntry->ErrorCode = errorCode; 00557 errorLogEntry->DumpDataSize = (USHORT) dumpCount * sizeof(ULONG); 00558 errorLogEntry->SequenceNumber = 0; 00559 errorLogEntry->MajorFunctionCode = 0; 00560 errorLogEntry->IoControlCode = 0; 00561 errorLogEntry->RetryCount = 0; 00562 errorLogEntry->UniqueErrorValue = uniqueErrorValue; 00563 errorLogEntry->FinalStatus = status; 00564 for (i = 0; i < dumpCount; i++) 00565 errorLogEntry->DumpData[i] = dumpData[i]; 00566 00567 IoWriteErrorLogEntry(errorLogEntry); 00568 } 00569 } 00570 00571 if (!NT_SUCCESS(status)) 00572 { 00573 // 00574 // The initialization failed. Cleanup resources before exiting. 00575 // 00576 00577 if (resources) { 00578 00579 // 00580 // Call IoReportResourceUsage to remove the resources from 00581 // the map. 00582 // 00583 00584 resources->Count = 0; 00585 00586 IoReportResourceUsage(&resourceDeviceClass, 00587 DriverObject, 00588 NULL, 00589 0, 00590 DeviceObject, 00591 resources, 00592 resourceListSize, 00593 FALSE, 00594 &conflictDetected 00595 ); 00596 00597 } 00598 00599 if (deviceExtension) { 00600 00601 if (deviceExtension->UnmapRegistersRequired) { 00602 for (i = 0; 00603 i < deviceExtension->Configuration.PortListCount; i++){ 00604 if (deviceExtension->DeviceRegisters[i]) { 00605 MmUnmapIoSpace( 00606 deviceExtension->DeviceRegisters[i], 00607 deviceExtension->Configuration.PortList[i].u.Port.Length); 00608 } 00609 } 00610 } 00611 } 00612 00613 if (DeviceObject) { 00614 IoDeleteDevice(DeviceObject); 00615 } 00616 } 00617 00618 // 00619 // Free the resource list. 00620 // 00621 // N.B. If we ever decide to hang on to the resource list instead, 00622 // we need to allocate it from non-paged pool (it is now paged pool). 00623 // 00624 00625 if (resources) { 00626 ExFreePool(resources); 00627 } 00628 00629 // 00630 // Free the unicode strings for device names. 00631 // 00632 if (deviceNameSuffix.MaximumLength != 0) 00633 ExFreePool(deviceNameSuffix.Buffer); 00634 if (fullFsVgaName.MaximumLength != 0) 00635 ExFreePool(fullFsVgaName.Buffer); 00636 if (resourceDeviceClass.MaximumLength != 0) 00637 ExFreePool(resourceDeviceClass.Buffer); 00638 if (registryPath.MaximumLength != 0) 00639 ExFreePool(registryPath.Buffer); 00640 00641 FsVgaPrint((1, 00642 "FSVGA-FsVgaInitialize: exit\n")); 00643 00644 return(status); 00645 }

VOID FsVgaBuildResourceList IN PDEVICE_EXTENSION  DeviceExtension,
OUT PCM_RESOURCE_LIST *  ResourceList,
OUT PULONG  ResourceListSize
 

Definition at line 1056 of file fsvga.c.

References DUMP_COUNT, ExAllocatePool, FSVGA_ERROR_VALUE_BASE, FsVgaLogError(), FsVgaPrint, and PagedPool.

Referenced by DriverEntry().

01064 : 01065 01066 Creates a resource list that is used to query or report resource usage. 01067 01068 Arguments: 01069 01070 DeviceExtension - Pointer to the port's device extension. 01071 01072 ResourceList - Pointer to a pointer to the resource list to be allocated 01073 and filled. 01074 01075 ResourceListSize - Pointer to the returned size of the resource 01076 list (in bytes). 01077 01078 Return Value: 01079 01080 None. If the call succeeded, *ResourceList points to the built 01081 resource list and *ResourceListSize is set to the size (in bytes) 01082 of the resource list; otherwise, *ResourceList is NULL. 01083 01084 Note: 01085 01086 Memory may be allocated here for *ResourceList. It must be 01087 freed up by the caller, by calling ExFreePool(); 01088 01089 --*/ 01090 01091 { 01092 ULONG count = 0; 01093 ULONG i = 0; 01094 ULONG j = 0; 01095 #define DUMP_COUNT 4 01096 ULONG dumpData[DUMP_COUNT]; 01097 01098 count += DeviceExtension->Configuration.PortListCount; 01099 01100 *ResourceListSize = sizeof(CM_RESOURCE_LIST) + 01101 ((count - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); 01102 01103 *ResourceList = (PCM_RESOURCE_LIST) ExAllocatePool(PagedPool, 01104 *ResourceListSize); 01105 01106 // 01107 // Return NULL if the structure could not be allocated. 01108 // Otherwise, fill in the resource list. 01109 // 01110 01111 if (!*ResourceList) { 01112 01113 // 01114 // Could not allocate memory for the resource list. 01115 // 01116 01117 FsVgaPrint((1, 01118 "FSVGA-FsVgaBuildResourceList: Could not allocate resource list\n")); 01119 01120 // 01121 // Log an error. 01122 // 01123 01124 dumpData[0] = *ResourceListSize; 01125 *ResourceListSize = 0; 01126 01127 FsVgaLogError(DeviceExtension->DeviceObject, 01128 FSVGA_INSUFFICIENT_RESOURCES, 01129 FSVGA_ERROR_VALUE_BASE + 110, 01130 STATUS_INSUFFICIENT_RESOURCES, 01131 dumpData, 01132 1 01133 ); 01134 01135 return; 01136 } 01137 01138 RtlZeroMemory(*ResourceList, 01139 *ResourceListSize); 01140 01141 // 01142 // Concoct one full resource descriptor. 01143 // 01144 01145 (*ResourceList)->Count = 1; 01146 01147 (*ResourceList)->List[0].InterfaceType = 01148 DeviceExtension->Configuration.InterfaceType; 01149 (*ResourceList)->List[0].BusNumber = 01150 DeviceExtension->Configuration.BusNumber; 01151 01152 // 01153 // Build the partial resource descriptors for port 01154 // resources from the saved values. 01155 // 01156 01157 (*ResourceList)->List[0].PartialResourceList.Count = count; 01158 01159 for (j = 0; j < DeviceExtension->Configuration.PortListCount; j++) { 01160 (*ResourceList)->List[0].PartialResourceList.PartialDescriptors[i++] = 01161 DeviceExtension->Configuration.PortList[j]; 01162 } 01163 01164 }

VOID FsVgaConfiguration IN PDEVICE_EXTENSION  DeviceExtension,
IN PUNICODE_STRING  RegistryPath,
IN PUNICODE_STRING  FsVgaDeviceName
 

Definition at line 649 of file fsvga.c.

References FSVGA_HARDWARE_PRESENT, FsVgaPeripheralCallout(), FsVgaPrint, FsVgaServiceParameters(), IoQueryDeviceDescription(), NTSTATUS(), NULL, and PFSVGA_CONFIGURATION_INFORMATION.

Referenced by DriverEntry().

00657 : 00658 00659 This routine retrieves the configuration information for the keyboard. 00660 00661 Arguments: 00662 00663 DeviceExtension - Pointer to the device extension. 00664 00665 RegistryPath - Pointer to the null-terminated Unicode name of the 00666 registry path for this driver. 00667 00668 FsVgaDeviceName - Pointer to the Unicode string that will receive 00669 the Full Screen Video port device name. 00670 00671 Return Value: 00672 00673 None. As a side-effect, may set DeviceExtension->HardwarePresent. 00674 00675 --*/ 00676 { 00677 NTSTATUS status = STATUS_SUCCESS; 00678 PFSVGA_CONFIGURATION_INFORMATION configuration; 00679 INTERFACE_TYPE interfaceType; 00680 ULONG i; 00681 00682 for (i = 0; i < MaximumInterfaceType; i++) 00683 { 00684 00685 // 00686 // Get the registry information for this device. 00687 // 00688 00689 interfaceType = i; 00690 status = IoQueryDeviceDescription(&interfaceType, 00691 NULL, 00692 NULL, 00693 NULL, 00694 NULL, 00695 NULL, 00696 FsVgaPeripheralCallout, 00697 (PVOID) DeviceExtension); 00698 00699 if (DeviceExtension->HardwarePresent & FSVGA_HARDWARE_PRESENT) 00700 { 00701 // 00702 // Get the service parameters (e.g., user-configurable number 00703 // of resends, polling iterations, etc.). 00704 // 00705 00706 FsVgaServiceParameters(DeviceExtension, 00707 RegistryPath, 00708 FsVgaDeviceName); 00709 00710 break; 00711 } 00712 else 00713 { 00714 FsVgaPrint((1, 00715 "FSVGA-FsVgaConfiguration: IoQueryDeviceDescription for bus type %d failed\n", 00716 interfaceType)); 00717 } 00718 } 00719 }

NTSTATUS FsVgaCopyFrameBuffer PDEVICE_EXTENSION  DeviceExtension,
PFSVIDEO_COPY_FRAME_BUFFER  CopyFrameBuffer,
ULONG  inputBufferLength
 

Definition at line 1349 of file fsvga.c.

References _DEVICE_EXTENSION::CurrentMode, FsgCopyFrameBuffer(), and SCREEN_BUFFER_POINTER.

Referenced by FsVgaDeviceControl().

01357 : 01358 01359 This routine copy the frame buffer. 01360 01361 Arguments: 01362 01363 DeviceExtension - Pointer to the miniport driver's device extension. 01364 01365 CopyFrameBuffer - Pointer to the structure containing the information about the copy frame buffer. 01366 01367 inputBufferLength - Length of the input buffer supplied by the user. 01368 01369 Return Value: 01370 01371 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01372 for the input data. 01373 01374 STATUS_SUCCESS if the operation completed successfully. 01375 01376 --*/ 01377 01378 { 01379 // 01380 // Check if the size of the data in the input buffer is large enough. 01381 // 01382 01383 if (inputBufferLength < sizeof(FSVIDEO_COPY_FRAME_BUFFER)) { 01384 return STATUS_INVALID_BUFFER_SIZE; 01385 } 01386 01387 if (CopyFrameBuffer->SrcScreen.nNumberOfChars != CopyFrameBuffer->DestScreen.nNumberOfChars) { 01388 return STATUS_INVALID_PARAMETER; 01389 } 01390 01391 if (! (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS)) 01392 { 01393 /* 01394 * This is the TEXT frame buffer. 01395 */ 01396 01397 ULONG OffsSrc; 01398 ULONG OffsDest; 01399 PUCHAR pFrameBuf = DeviceExtension->CurrentMode.VideoMemory.FrameBufferBase; 01400 01401 OffsSrc = SCREEN_BUFFER_POINTER(CopyFrameBuffer->SrcScreen.Position.X, 01402 CopyFrameBuffer->SrcScreen.Position.Y, 01403 CopyFrameBuffer->SrcScreen.ScreenSize.X, 01404 sizeof(VGA_CHAR)); 01405 01406 OffsDest = SCREEN_BUFFER_POINTER(CopyFrameBuffer->DestScreen.Position.X, 01407 CopyFrameBuffer->DestScreen.Position.Y, 01408 CopyFrameBuffer->DestScreen.ScreenSize.X, 01409 sizeof(VGA_CHAR)); 01410 01411 RtlMoveMemory(pFrameBuf + OffsDest, 01412 pFrameBuf + OffsSrc, 01413 CopyFrameBuffer->SrcScreen.nNumberOfChars * sizeof(VGA_CHAR)); 01414 } 01415 else 01416 { 01417 /* 01418 * This is the GRAPHICS frame buffer. 01419 */ 01420 return FsgCopyFrameBuffer(DeviceExtension, 01421 CopyFrameBuffer, 01422 inputBufferLength); 01423 } 01424 01425 return STATUS_SUCCESS; 01426 }

NTSTATUS FsVgaDeviceControl IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp
 

Definition at line 1213 of file fsvga.c.

References _IRP::AssociatedIrp, FsVgaCopyFrameBuffer(), FsVgaPrint, FsVgaReverseMousePointer(), FsVgaSetCursorAttribute(), FsVgaSetCursorPosition(), FsVgaSetMode(), FsVgaSetScreenInformation(), FsVgaWriteToFrameBuffer(), IO_NO_INCREMENT, IoCompleteRequest, IoGetCurrentIrpStackLocation, _IRP::IoStatus, Irp, NTSTATUS(), PAGED_CODE, and _IO_STACK_LOCATION::Parameters.

Referenced by DriverEntry().

01220 : 01221 01222 This routine is the dispatch routine for device control requests. 01223 01224 Arguments: 01225 01226 DeviceObject - Pointer to the device object. 01227 01228 Irp - Pointer to the request packet. 01229 01230 Return Value: 01231 01232 Status is returned. 01233 01234 --*/ 01235 01236 { 01237 PIO_STACK_LOCATION irpSp; 01238 PVOID ioBuffer; 01239 ULONG inputBufferLength; 01240 ULONG outputBufferLength; 01241 PDEVICE_EXTENSION deviceExtension; 01242 NTSTATUS status = STATUS_SUCCESS; 01243 01244 FsVgaPrint((2,"FSVGA-FsVgaDeviceControl: enter\n")); 01245 01246 PAGED_CODE(); 01247 01248 // 01249 // Get a pointer to the device extension. 01250 // 01251 01252 deviceExtension = DeviceObject->DeviceExtension; 01253 01254 // 01255 // Initialize the returned Information field. 01256 // 01257 01258 Irp->IoStatus.Information = 0; 01259 01260 // 01261 // Get a pointer to the current parameters for this request. The 01262 // information is contained in the current stack location. 01263 // 01264 01265 irpSp = IoGetCurrentIrpStackLocation(Irp); 01266 01267 // 01268 // Get the pointer to the input/output buffer and it's length 01269 // 01270 01271 ioBuffer = Irp->AssociatedIrp.SystemBuffer; 01272 inputBufferLength = irpSp->Parameters.DeviceIoControl.InputBufferLength; 01273 outputBufferLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength; 01274 01275 // 01276 // Case on the device control subfunction that is being performed by the 01277 // requestor. 01278 // 01279 01280 switch (irpSp->Parameters.DeviceIoControl.IoControlCode) 01281 { 01282 case IOCTL_FSVIDEO_COPY_FRAME_BUFFER: 01283 FsVgaPrint((2, "FsVgaDeviceControl - CopyFrameBuffer\n")); 01284 status = FsVgaCopyFrameBuffer(deviceExtension, 01285 (PFSVIDEO_COPY_FRAME_BUFFER) ioBuffer, 01286 inputBufferLength); 01287 break; 01288 01289 case IOCTL_FSVIDEO_WRITE_TO_FRAME_BUFFER: 01290 FsVgaPrint((2, "FsVgaDeviceControl - WriteToFrameBuffer\n")); 01291 status = FsVgaWriteToFrameBuffer(deviceExtension, 01292 (PFSVIDEO_WRITE_TO_FRAME_BUFFER) ioBuffer, 01293 inputBufferLength); 01294 break; 01295 01296 case IOCTL_FSVIDEO_REVERSE_MOUSE_POINTER: 01297 FsVgaPrint((2, "FsVgaDeviceControl - ReverseMousePointer\n")); 01298 status = FsVgaReverseMousePointer(deviceExtension, 01299 (PFSVIDEO_REVERSE_MOUSE_POINTER) ioBuffer, 01300 inputBufferLength); 01301 break; 01302 01303 case IOCTL_FSVIDEO_SET_CURRENT_MODE: 01304 FsVgaPrint((2, "FsVgaDeviceControl - SetCurrentModes\n")); 01305 status = FsVgaSetMode(deviceExtension, 01306 (PFSVIDEO_MODE_INFORMATION) ioBuffer, 01307 inputBufferLength); 01308 break; 01309 01310 case IOCTL_FSVIDEO_SET_SCREEN_INFORMATION: 01311 FsVgaPrint((2, "FsVgaDeviceControl - SetScreenInformation\n")); 01312 status = FsVgaSetScreenInformation(deviceExtension, 01313 (PFSVIDEO_SCREEN_INFORMATION) ioBuffer, 01314 inputBufferLength); 01315 break; 01316 01317 case IOCTL_FSVIDEO_SET_CURSOR_POSITION: 01318 FsVgaPrint((2, "FsVgaDeviceControl - SetCursorPosition\n")); 01319 status = FsVgaSetCursorPosition(deviceExtension, 01320 (PFSVIDEO_CURSOR_POSITION) ioBuffer, 01321 inputBufferLength); 01322 break; 01323 01324 case IOCTL_VIDEO_SET_CURSOR_ATTR: 01325 FsVgaPrint((2, "FsVgaDeviceControl - SetCursorAttribute\n")); 01326 status = FsVgaSetCursorAttribute(deviceExtension, 01327 (PVIDEO_CURSOR_ATTRIBUTES) ioBuffer, 01328 inputBufferLength); 01329 break; 01330 01331 default: 01332 FsVgaPrint((1, 01333 "FSVGA-FsVgaDeviceControl: INVALID REQUEST (0x%x)\n", 01334 irpSp->Parameters.DeviceIoControl.IoControlCode)); 01335 01336 status = STATUS_INVALID_DEVICE_REQUEST; 01337 break; 01338 } 01339 01340 Irp->IoStatus.Status = status; 01341 IoCompleteRequest(Irp, IO_NO_INCREMENT); 01342 01343 FsVgaPrint((2,"FSVGA-FsVgaDeviceControl: exit\n")); 01344 01345 return(status); 01346 }

VOID FsVgaLogError IN PDEVICE_OBJECT  DeviceObject,
IN NTSTATUS  ErrorCode,
IN ULONG  UniqueErrorValue,
IN NTSTATUS  FinalStatus,
IN PULONG  DumpData,
IN ULONG  DumpCount
 

Definition at line 1844 of file fsvga.c.

References IoAllocateErrorLogEntry(), IoWriteErrorLogEntry(), NULL, and USHORT.

Referenced by FsVgaBuildResourceList(), and FsVgaWriteToFrameBuffer().

01855 : 01856 01857 This routine contains common code to write an error log entry. It is 01858 called from other routines, especially FsVgaInitialize, to avoid 01859 duplication of code. Note that some routines continue to have their 01860 own error logging code (especially in the case where the error logging 01861 can be localized and/or the routine has more data because there is 01862 and IRP). 01863 01864 Arguments: 01865 01866 DeviceObject - Pointer to the device object. 01867 01868 ErrorCode - The error code for the error log packet. 01869 01870 UniqueErrorValue - The unique error value for the error log packet. 01871 01872 FinalStatus - The final status of the operation for the error log packet. 01873 01874 DumpData - Pointer to an array of dump data for the error log packet. 01875 01876 DumpCount - The number of entries in the dump data array. 01877 01878 01879 Return Value: 01880 01881 None. 01882 01883 --*/ 01884 01885 { 01886 PIO_ERROR_LOG_PACKET errorLogEntry; 01887 ULONG i; 01888 01889 errorLogEntry = (PIO_ERROR_LOG_PACKET) IoAllocateErrorLogEntry( 01890 DeviceObject, 01891 (UCHAR) 01892 (sizeof(IO_ERROR_LOG_PACKET) 01893 + (DumpCount * sizeof(ULONG))) 01894 ); 01895 01896 if (errorLogEntry != NULL) { 01897 01898 errorLogEntry->ErrorCode = ErrorCode; 01899 errorLogEntry->DumpDataSize = (USHORT) (DumpCount * sizeof(ULONG)); 01900 errorLogEntry->SequenceNumber = 0; 01901 errorLogEntry->MajorFunctionCode = 0; 01902 errorLogEntry->IoControlCode = 0; 01903 errorLogEntry->RetryCount = 0; 01904 errorLogEntry->UniqueErrorValue = UniqueErrorValue; 01905 errorLogEntry->FinalStatus = FinalStatus; 01906 for (i = 0; i < DumpCount; i++) 01907 errorLogEntry->DumpData[i] = DumpData[i]; 01908 01909 IoWriteErrorLogEntry(errorLogEntry); 01910 } 01911 }

NTSTATUS FsVgaOpenCloseDispatch IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp
 

Definition at line 1167 of file fsvga.c.

References FsVgaPrint, IO_NO_INCREMENT, IoCompleteRequest, _IRP::IoStatus, Irp, and PAGED_CODE.

Referenced by DriverEntry().

01174 : 01175 01176 This is the dispatch routine for create/open and close requests. 01177 These requests complete successfully. 01178 01179 Arguments: 01180 01181 DeviceObject - Pointer to the device object. 01182 01183 Irp - Pointer to the request packet. 01184 01185 Return Value: 01186 01187 Status is returned. 01188 01189 --*/ 01190 01191 { 01192 UNREFERENCED_PARAMETER(DeviceObject); 01193 01194 FsVgaPrint((3,"FSVGA-FsVgaOpenCloseDispatch: enter\n")); 01195 01196 PAGED_CODE(); 01197 01198 // 01199 // Complete the request with successful status. 01200 // 01201 01202 Irp->IoStatus.Status = STATUS_SUCCESS; 01203 Irp->IoStatus.Information = 0; 01204 IoCompleteRequest(Irp, IO_NO_INCREMENT); 01205 01206 FsVgaPrint((3,"FSVGA-FsVgaOpenCloseDispatch: exit\n")); 01207 01208 return(STATUS_SUCCESS); 01209 01210 }

NTSTATUS FsVgaPeripheralCallout IN PVOID  Context,
IN PUNICODE_STRING  PathName,
IN INTERFACE_TYPE  BusType,
IN ULONG  BusNumber,
IN PKEY_VALUE_FULL_INFORMATION *  BusInformation,
IN CONFIGURATION_TYPE  ControllerType,
IN ULONG  ControllerNumber,
IN PKEY_VALUE_FULL_INFORMATION *  ControllerInformation,
IN CONFIGURATION_TYPE  PeripheralType,
IN ULONG  PeripheralNumber,
IN PKEY_VALUE_FULL_INFORMATION *  PeripheralInformation
 

Definition at line 722 of file fsvga.c.

References BusNumber, _FSVGA_CONFIGURATION_INFORMATION::BusNumber, _DEVICE_EXTENSION::Configuration, ControllerType, CRTC_ADDRESS_PORT_COLOR, CRTC_DATA_PORT_COLOR, FSVGA_HARDWARE_PRESENT, FsVgaPrint, GRAPH_ADDRESS_PORT, _DEVICE_EXTENSION::HardwarePresent, _FSVGA_CONFIGURATION_INFORMATION::InterfaceType, NTSTATUS(), PeripheralType, _FSVGA_CONFIGURATION_INFORMATION::PortList, _FSVGA_CONFIGURATION_INFORMATION::PortListCount, SEQ_ADDRESS_PORT, and VGA_BASE_IO_PORT.

Referenced by FsVgaConfiguration().

00738 : 00739 00740 This is the callout routine sent as a parameter to 00741 IoQueryDeviceDescription. It grabs the Display controller 00742 configuration information. 00743 00744 Arguments: 00745 00746 Context - Context parameter that was passed in by the routine 00747 that called IoQueryDeviceDescription. 00748 00749 PathName - The full pathname for the registry key. 00750 00751 BusType - Bus interface type (Isa, Eisa, Mca, etc.). 00752 00753 BusNumber - The bus sub-key (0, 1, etc.). 00754 00755 BusInformation - Pointer to the array of pointers to the full value 00756 information for the bus. 00757 00758 ControllerType - The controller type (should be DisplayController). 00759 00760 ControllerNumber - The controller sub-key (0, 1, etc.). 00761 00762 ControllerInformation - Pointer to the array of pointers to the full 00763 value information for the controller key. 00764 00765 PeripheralType - The peripheral type (should be MonitorPeripheral). 00766 00767 PeripheralNumber - The peripheral sub-key. 00768 00769 PeripheralInformation - Pointer to the array of pointers to the full 00770 value information for the peripheral key. 00771 00772 00773 Return Value: 00774 00775 None. If successful, will have the following side-effects: 00776 00777 - Sets DeviceObject->DeviceExtension->HardwarePresent. 00778 - Sets configuration fields in 00779 DeviceObject->DeviceExtension->Configuration. 00780 00781 --*/ 00782 00783 { 00784 PDEVICE_EXTENSION deviceExtension; 00785 PFSVGA_CONFIGURATION_INFORMATION configuration; 00786 NTSTATUS status = STATUS_SUCCESS; 00787 CM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; 00788 00789 FsVgaPrint((1, 00790 "FSVGA-FsVgaPeripheralCallout: Path @ 0x%x, Bus Type 0x%x, Bus Number 0x%x\n", 00791 PathName, BusType, BusNumber)); 00792 FsVgaPrint((1, 00793 " Controller Type 0x%x, Controller Number 0x%x, Controller info @ 0x%x\n", 00794 ControllerType, ControllerNumber, ControllerInformation)); 00795 FsVgaPrint((1, 00796 " Peripheral Type 0x%x, Peripheral Number 0x%x, Peripheral info @ 0x%x\n", 00797 PeripheralType, PeripheralNumber, PeripheralInformation)); 00798 00799 // 00800 // If we already have the configuration information for the 00801 // keyboard peripheral, or if the peripheral identifier is missing, 00802 // just return. 00803 // 00804 00805 deviceExtension = (PDEVICE_EXTENSION) Context; 00806 if (deviceExtension->HardwarePresent & FSVGA_HARDWARE_PRESENT) 00807 { 00808 return (status); 00809 } 00810 00811 configuration = &deviceExtension->Configuration; 00812 00813 deviceExtension->HardwarePresent |= FSVGA_HARDWARE_PRESENT; 00814 00815 // 00816 // Get the bus information. 00817 // 00818 00819 configuration->InterfaceType = BusType; 00820 configuration->BusNumber = BusNumber; 00821 00822 // 00823 // Get logical IO port addresses. 00824 // 00825 ResourceDescriptor.Type = CmResourceTypePort; 00826 ResourceDescriptor.ShareDisposition = CmResourceShareShared; 00827 ResourceDescriptor.Flags = CM_RESOURCE_PORT_IO; 00828 00829 ResourceDescriptor.u.Port.Start.LowPart = VGA_BASE_IO_PORT+CRTC_ADDRESS_PORT_COLOR; 00830 ResourceDescriptor.u.Port.Start.HighPart = 0; 00831 ResourceDescriptor.u.Port.Length = 1; 00832 configuration->PortList[configuration->PortListCount] = ResourceDescriptor; 00833 configuration->PortListCount += 1; 00834 00835 ResourceDescriptor.u.Port.Start.LowPart = VGA_BASE_IO_PORT+CRTC_DATA_PORT_COLOR; 00836 ResourceDescriptor.u.Port.Start.HighPart = 0; 00837 ResourceDescriptor.u.Port.Length = 1; 00838 configuration->PortList[configuration->PortListCount] = ResourceDescriptor; 00839 configuration->PortListCount += 1; 00840 00841 ResourceDescriptor.u.Port.Start.LowPart = VGA_BASE_IO_PORT+GRAPH_ADDRESS_PORT; 00842 ResourceDescriptor.u.Port.Start.HighPart = 0; 00843 ResourceDescriptor.u.Port.Length = 2; 00844 configuration->PortList[configuration->PortListCount] = ResourceDescriptor; 00845 configuration->PortListCount += 1; 00846 00847 ResourceDescriptor.u.Port.Start.LowPart = VGA_BASE_IO_PORT+SEQ_ADDRESS_PORT; 00848 ResourceDescriptor.u.Port.Start.HighPart = 0; 00849 ResourceDescriptor.u.Port.Length = 2; 00850 configuration->PortList[configuration->PortListCount] = ResourceDescriptor; 00851 configuration->PortListCount += 1; 00852 00853 return(status); 00854 }

NTSTATUS FsVgaReverseMousePointer PDEVICE_EXTENSION  DeviceExtension,
PFSVIDEO_REVERSE_MOUSE_POINTER  MouseBuffer,
ULONG  inputBufferLength
 

Definition at line 1546 of file fsvga.c.

References BYTE, _DEVICE_EXTENSION::CurrentMode, FsgReverseMousePointer(), and SCREEN_BUFFER_POINTER.

Referenced by FsVgaDeviceControl().

01554 : 01555 01556 This routine reverse the frame buffer for mouse pointer. 01557 01558 Arguments: 01559 01560 DeviceExtension - Pointer to the miniport driver's device extension. 01561 01562 MouseBuffer - Pointer to the structure containing the information about the mouse frame buffer. 01563 01564 inputBufferLength - Length of the input buffer supplied by the user. 01565 01566 Return Value: 01567 01568 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01569 for the input data. 01570 01571 STATUS_SUCCESS if the operation completed successfully. 01572 01573 --*/ 01574 01575 { 01576 // 01577 // Check if the size of the data in the input buffer is large enough. 01578 // 01579 01580 if (inputBufferLength < sizeof(FSVIDEO_REVERSE_MOUSE_POINTER)) { 01581 return STATUS_INVALID_BUFFER_SIZE; 01582 } 01583 01584 if (! (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS)) 01585 { 01586 /* 01587 * This is the TEXT frame buffer. 01588 */ 01589 01590 ULONG Offs; 01591 PUCHAR pFrameBuf = DeviceExtension->CurrentMode.VideoMemory.FrameBufferBase; 01592 BYTE Attribute; 01593 01594 Offs = SCREEN_BUFFER_POINTER(MouseBuffer->Screen.Position.X, 01595 MouseBuffer->Screen.Position.Y, 01596 MouseBuffer->Screen.ScreenSize.X, 01597 sizeof(VGA_CHAR)); 01598 pFrameBuf += Offs; 01599 01600 Attribute = (*(pFrameBuf + 1) & 0xF0) >> 4; 01601 Attribute |= (*(pFrameBuf + 1) & 0x0F) << 4; 01602 *(pFrameBuf + 1) = Attribute; 01603 } 01604 else 01605 { 01606 /* 01607 * This is the GRAPHICS frame buffer. 01608 */ 01609 return FsgReverseMousePointer(DeviceExtension, 01610 MouseBuffer, 01611 inputBufferLength); 01612 } 01613 01614 return STATUS_SUCCESS; 01615 }

VOID FsVgaServiceParameters IN PDEVICE_EXTENSION  DeviceExtension,
IN PUNICODE_STRING  RegistryPath,
IN PUNICODE_STRING  FsVgaDeviceName
 

Definition at line 858 of file fsvga.c.

References _FSVGA_CONFIGURATION_INFORMATION::EmulationMode, ExAllocatePool, ExFreePool(), FsVgaPrint, _FSVGA_CONFIGURATION_INFORMATION::HardwareCursor, _FSVGA_CONFIGURATION_INFORMATION::HardwareScroll, L, NO_HARDWARE_CURSOR, NO_HARDWARE_SCROLL, NT_SUCCESS, NTSTATUS(), NULL, PagedPool, path, RtlAppendUnicodeToString(), RtlCopyUnicodeString(), RtlInitUnicodeString(), RtlQueryRegistryValues(), and USHORT.

Referenced by FsVgaConfiguration().

00866 : 00867 00868 This routine retrieves this driver's service parameters information 00869 from the registry. 00870 00871 Arguments: 00872 00873 DeviceExtension - Pointer to the device extension. 00874 00875 RegistryPath - Pointer to the null-terminated Unicode name of the 00876 registry path for this driver. 00877 00878 FsVgaDeviceName - Pointer to the Unicode string that will receive 00879 the Full Screen Video port device name. 00880 00881 Return Value: 00882 00883 None. As a side-effect, sets fields in DeviceExtension->Configuration. 00884 00885 --*/ 00886 00887 { 00888 PFSVGA_CONFIGURATION_INFORMATION configuration; 00889 UNICODE_STRING parametersPath; 00890 PWSTR path; 00891 PRTL_QUERY_REGISTRY_TABLE parameters = NULL; 00892 USHORT queriesPlusOne = 4; 00893 NTSTATUS status = STATUS_SUCCESS; 00894 #define PARAMETER_MAX 256 00895 ULONG EmulationMode; 00896 ULONG HardwareCursor; 00897 ULONG HardwareScroll; 00898 USHORT defaultEmulationMode = 0; 00899 USHORT defaultHardwareCursor = NO_HARDWARE_CURSOR; 00900 USHORT defaultHardwareScroll = NO_HARDWARE_SCROLL; 00901 UNICODE_STRING defaultFsVgaName; 00902 00903 configuration = &DeviceExtension->Configuration; 00904 parametersPath.Buffer = NULL; 00905 00906 // 00907 // Registry path is already null-terminated, so just use it. 00908 // 00909 00910 path = RegistryPath->Buffer; 00911 00912 // 00913 // Allocate the Rtl query table. 00914 // 00915 00916 parameters = ExAllocatePool(PagedPool, 00917 sizeof(RTL_QUERY_REGISTRY_TABLE) * queriesPlusOne); 00918 if (!parameters) 00919 { 00920 FsVgaPrint((1, 00921 "FSVGA-FsVgaServiceParameters: Couldn't allocate table for Rtl query to parameters for %ws\n", 00922 path)); 00923 status = STATUS_UNSUCCESSFUL; 00924 } 00925 else 00926 { 00927 RtlZeroMemory(parameters, 00928 sizeof(RTL_QUERY_REGISTRY_TABLE) * queriesPlusOne); 00929 00930 // 00931 // Form a path to this driver's Parameters subkey. 00932 // 00933 00934 RtlInitUnicodeString(&parametersPath, 00935 NULL); 00936 00937 parametersPath.MaximumLength = RegistryPath->Length + 00938 sizeof(L"\\Parameters"); 00939 parametersPath.Buffer = ExAllocatePool(PagedPool, 00940 parametersPath.MaximumLength); 00941 if (!parametersPath.Buffer) 00942 { 00943 FsVgaPrint((1, 00944 "FSVGA-FsVgaServiceParameters: Couldn't allocate string for path to parameters for %ws\n", 00945 path)); 00946 status = STATUS_UNSUCCESSFUL; 00947 } 00948 } 00949 00950 if (NT_SUCCESS(status)) 00951 { 00952 // 00953 // Form the parameters path. 00954 // 00955 RtlZeroMemory(parametersPath.Buffer, 00956 parametersPath.MaximumLength); 00957 RtlAppendUnicodeToString(&parametersPath, 00958 path); 00959 RtlAppendUnicodeToString(&parametersPath, 00960 L"\\Parameters"); 00961 00962 FsVgaPrint((1, 00963 "FsVga-FsVgaServiceParameters: parameters path is %ws\n", 00964 parametersPath.Buffer)); 00965 00966 // 00967 // Gather all of the "user specified" information from 00968 // the registry. 00969 // 00970 parameters[0].Flags = RTL_QUERY_REGISTRY_DIRECT; 00971 parameters[0].Name = L"ConsoleFullScreen.EmulationMode"; 00972 parameters[0].EntryContext = &EmulationMode; 00973 parameters[0].DefaultType = REG_DWORD; 00974 parameters[0].DefaultData = &defaultEmulationMode; 00975 parameters[0].DefaultLength = sizeof(USHORT); 00976 00977 parameters[1].Flags = RTL_QUERY_REGISTRY_DIRECT; 00978 parameters[1].Name = L"ConsoleFullScreen.HardwareCursor"; 00979 parameters[1].EntryContext = &HardwareCursor; 00980 parameters[1].DefaultType = REG_DWORD; 00981 parameters[1].DefaultData = &defaultHardwareCursor; 00982 parameters[1].DefaultLength = sizeof(USHORT); 00983 00984 parameters[2].Flags = RTL_QUERY_REGISTRY_DIRECT; 00985 parameters[2].Name = L"ConsoleFullScreen.HardwareScroll"; 00986 parameters[2].EntryContext = &HardwareScroll; 00987 parameters[2].DefaultType = REG_DWORD; 00988 parameters[2].DefaultData = &defaultHardwareScroll; 00989 parameters[2].DefaultLength = sizeof(USHORT); 00990 00991 status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, 00992 parametersPath.Buffer, 00993 parameters, 00994 NULL, 00995 NULL); 00996 if (!NT_SUCCESS(status)) 00997 { 00998 FsVgaPrint((1, 00999 "FsVga-FsVgaServiceParameters: RtlQueryRegistryValues failed with 0x%x\n", 01000 status)); 01001 } 01002 } 01003 01004 if (!NT_SUCCESS(status)) 01005 { 01006 // 01007 // Go ahead and assign driver defaults. 01008 // 01009 configuration->EmulationMode = defaultEmulationMode; 01010 configuration->HardwareCursor = defaultHardwareCursor; 01011 configuration->HardwareScroll = defaultHardwareScroll; 01012 } 01013 else 01014 { 01015 configuration->EmulationMode = (USHORT)EmulationMode; 01016 configuration->HardwareCursor = (USHORT)HardwareCursor; 01017 configuration->HardwareScroll = (USHORT)HardwareScroll; 01018 } 01019 01020 // 01021 // Form the default port device names, in case they are not 01022 // specified in the registry. 01023 // 01024 01025 RtlInitUnicodeString(&defaultFsVgaName, 01026 DD_FULLSCREEN_PORT_BASE_NAME_U); 01027 RtlCopyUnicodeString(FsVgaDeviceName, &defaultFsVgaName); 01028 01029 FsVgaPrint((1, 01030 "FsVga-FsVgaServiceParameters: Full Screen Video port base name = %ws\n", 01031 FsVgaDeviceName->Buffer)); 01032 01033 FsVgaPrint((1, 01034 "FsVga-FsVgaServiceParameters: Emulation Mode = %d\n", 01035 configuration->EmulationMode)); 01036 01037 FsVgaPrint((1, 01038 "FsVga-FsVgaServiceParameters: Hardware Cursor = %d\n", 01039 configuration->HardwareCursor)); 01040 01041 FsVgaPrint((1, 01042 "FsVga-FsVgaServiceParameters: Hardware Scroll = %d\n", 01043 configuration->HardwareScroll)); 01044 01045 // 01046 // Free the allocated memory before returning. 01047 // 01048 01049 if (parametersPath.Buffer) 01050 ExFreePool(parametersPath.Buffer); 01051 if (parameters) 01052 ExFreePool(parameters); 01053 }

NTSTATUS FsVgaSetCursorAttribute PDEVICE_EXTENSION  DeviceExtension,
PVIDEO_CURSOR_ATTRIBUTES  CursorAttributes,
ULONG  inputBufferLength
 

Definition at line 1777 of file fsvga.c.

References _DEVICE_EXTENSION::CurrentMode, _EMULATE_BUFFER_INFORMATION::CursorAttributes, _DEVICE_EXTENSION::EmulateInfo, FALSE, FsgInvertCursor(), and TRUE.

Referenced by FsVgaDeviceControl().

01785 : 01786 01787 This routine sets the cursor attributes. 01788 01789 Arguments: 01790 01791 DeviceExtension - Pointer to the miniport driver's device extension. 01792 01793 CursorAttributes - Pointer to the structure containing the information about the 01794 cursor attributes. 01795 01796 inputBufferLength - Length of the input buffer supplied by the user. 01797 01798 Return Value: 01799 01800 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01801 for the input data. 01802 01803 STATUS_SUCCESS if the operation completed successfully. 01804 01805 --*/ 01806 01807 { 01808 // 01809 // Check if the size of the data in the input buffer is large enough. 01810 // 01811 01812 if (inputBufferLength < sizeof(VIDEO_CURSOR_ATTRIBUTES)) { 01813 return STATUS_INVALID_BUFFER_SIZE; 01814 } 01815 01816 if (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS) 01817 { 01818 FsgInvertCursor(DeviceExtension,FALSE); 01819 } 01820 01821 DeviceExtension->EmulateInfo.CursorAttributes = *CursorAttributes; 01822 01823 if (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS) 01824 { 01825 FsgInvertCursor(DeviceExtension,TRUE); 01826 return STATUS_SUCCESS; 01827 } 01828 else 01829 { 01830 /* 01831 * If current video mode is a TEXT MODE. 01832 * FSVGA.SYS didn't handling hardware cursor 01833 * because I don't know device of VGA.SYS or others. 01834 * 01835 * In this case, by returns STATUS_UNSUCCESSFUL, caller 01836 * do DeviceIoControl to VGA miniport driver. 01837 */ 01838 return STATUS_UNSUCCESSFUL; 01839 } 01840 }

NTSTATUS FsVgaSetCursorPosition PDEVICE_EXTENSION  DeviceExtension,
PFSVIDEO_CURSOR_POSITION  CursorPosition,
ULONG  inputBufferLength
 

Definition at line 1710 of file fsvga.c.

References _DEVICE_EXTENSION::CurrentMode, _EMULATE_BUFFER_INFORMATION::CursorPosition, _DEVICE_EXTENSION::EmulateInfo, FALSE, FsgInvertCursor(), and TRUE.

Referenced by FsVgaDeviceControl().

01718 : 01719 01720 This routine sets the cursor position. 01721 01722 Arguments: 01723 01724 DeviceExtension - Pointer to the miniport driver's device extension. 01725 01726 CursorPosition - Pointer to the structure containing the information about the 01727 cursor position. 01728 01729 inputBufferLength - Length of the input buffer supplied by the user. 01730 01731 Return Value: 01732 01733 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01734 for the input data. 01735 01736 STATUS_SUCCESS if the operation completed successfully. 01737 01738 --*/ 01739 01740 { 01741 // 01742 // Check if the size of the data in the input buffer is large enough. 01743 // 01744 01745 if (inputBufferLength < sizeof(VIDEO_CURSOR_POSITION)) { 01746 return STATUS_INVALID_BUFFER_SIZE; 01747 } 01748 01749 if (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS) 01750 { 01751 FsgInvertCursor(DeviceExtension,FALSE); 01752 } 01753 01754 DeviceExtension->EmulateInfo.CursorPosition = *CursorPosition; 01755 01756 if (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS) 01757 { 01758 FsgInvertCursor(DeviceExtension,TRUE); 01759 return STATUS_SUCCESS; 01760 } 01761 else 01762 { 01763 /* 01764 * If current video mode is a TEXT MODE. 01765 * FSVGA.SYS didn't handling hardware cursor 01766 * because I don't know device of VGA.SYS or others. 01767 * 01768 * In this case, by returns STATUS_UNSUCCESSFUL, caller 01769 * do DeviceIoControl to VGA miniport driver. 01770 */ 01771 return STATUS_UNSUCCESSFUL; 01772 } 01773 }

NTSTATUS FsVgaSetMode PDEVICE_EXTENSION  DeviceExtension,
PFSVIDEO_MODE_INFORMATION  ModeInformation,
ULONG  inputBufferLength
 

Definition at line 1618 of file fsvga.c.

References _DEVICE_EXTENSION::CurrentMode.

Referenced by FsVgaDeviceControl().

01626 : 01627 01628 This routine sets the current video information. 01629 01630 Arguments: 01631 01632 DeviceExtension - Pointer to the miniport driver's device extension. 01633 01634 ModeInformation - Pointer to the structure containing the information about the 01635 full screen video. 01636 01637 inputBufferLength - Length of the input buffer supplied by the user. 01638 01639 Return Value: 01640 01641 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01642 for the input data. 01643 01644 STATUS_SUCCESS if the operation completed successfully. 01645 01646 --*/ 01647 01648 { 01649 // 01650 // Check if the size of the data in the input buffer is large enough. 01651 // 01652 01653 if (inputBufferLength < sizeof(FSVIDEO_MODE_INFORMATION)) { 01654 return STATUS_INVALID_BUFFER_SIZE; 01655 } 01656 01657 DeviceExtension->CurrentMode = *ModeInformation; 01658 01659 return STATUS_SUCCESS; 01660 }

NTSTATUS FsVgaSetScreenInformation PDEVICE_EXTENSION  DeviceExtension,
PFSVIDEO_SCREEN_INFORMATION  ScreenInformation,
ULONG  inputBufferLength
 

Definition at line 1663 of file fsvga.c.

References FsgVgaInitializeHWFlags(), and _DEVICE_EXTENSION::ScreenAndFont.

Referenced by FsVgaDeviceControl().

01671 : 01672 01673 This routine sets the screen and font information. 01674 01675 Arguments: 01676 01677 DeviceExtension - Pointer to the miniport driver's device extension. 01678 01679 ScreenInformation - Pointer to the structure containing the information about the 01680 screen anf font. 01681 01682 inputBufferLength - Length of the input buffer supplied by the user. 01683 01684 Return Value: 01685 01686 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01687 for the input data. 01688 01689 STATUS_SUCCESS if the operation completed successfully. 01690 01691 --*/ 01692 01693 { 01694 // 01695 // Check if the size of the data in the input buffer is large enough. 01696 // 01697 01698 if (inputBufferLength < sizeof(FSVIDEO_SCREEN_INFORMATION)) { 01699 return STATUS_INVALID_BUFFER_SIZE; 01700 } 01701 01702 DeviceExtension->ScreenAndFont = *ScreenInformation; 01703 01704 FsgVgaInitializeHWFlags(DeviceExtension); 01705 01706 return STATUS_SUCCESS; 01707 }

NTSTATUS FsVgaWriteToFrameBuffer PDEVICE_EXTENSION  DeviceExtension,
PFSVIDEO_WRITE_TO_FRAME_BUFFER  WriteFrameBuffer,
ULONG  inputBufferLength
 

Definition at line 1429 of file fsvga.c.

References _DEVICE_EXTENSION::CurrentMode, _DEVICE_EXTENSION::DeviceObject, DUMP_COUNT, DWORD, ExAllocatePool, ExFreePool(), FsgWriteToFrameBuffer(), FSVGA_ERROR_VALUE_BASE, FsVgaLogError(), FsVgaPrint, NULL, PagedPool, SCREEN_BUFFER_POINTER, _DEVICE_EXTENSION::ScreenAndFont, SHORT, and TranslateOutputToOem().

Referenced by FsVgaDeviceControl().

01437 : 01438 01439 This routine write the frame buffer. 01440 01441 Arguments: 01442 01443 DeviceExtension - Pointer to the miniport driver's device extension. 01444 01445 WriteFrameBuffer - Pointer to the structure containing the information about the write frame buffer. 01446 01447 inputBufferLength - Length of the input buffer supplied by the user. 01448 01449 Return Value: 01450 01451 STATUS_INSUFFICIENT_BUFFER if the input buffer was not large enough 01452 for the input data. 01453 01454 STATUS_SUCCESS if the operation completed successfully. 01455 01456 --*/ 01457 01458 { 01459 // 01460 // Check if the size of the data in the input buffer is large enough. 01461 // 01462 01463 if (inputBufferLength < sizeof(FSVIDEO_WRITE_TO_FRAME_BUFFER)) { 01464 return STATUS_INVALID_BUFFER_SIZE; 01465 } 01466 01467 if (WriteFrameBuffer->DestScreen.Position.X < 0 || 01468 WriteFrameBuffer->DestScreen.Position.X > DeviceExtension->ScreenAndFont.ScreenSize.X || 01469 (SHORT)(WriteFrameBuffer->DestScreen.Position.X + 01470 WriteFrameBuffer->DestScreen.nNumberOfChars) 01471 > DeviceExtension->ScreenAndFont.ScreenSize.X || 01472 WriteFrameBuffer->DestScreen.Position.Y < 0 || 01473 WriteFrameBuffer->DestScreen.Position.Y > DeviceExtension->ScreenAndFont.ScreenSize.Y) { 01474 return STATUS_INVALID_BUFFER_SIZE; 01475 } 01476 01477 if (! (DeviceExtension->CurrentMode.VideoMode.AttributeFlags & VIDEO_MODE_GRAPHICS)) 01478 { 01479 /* 01480 * This is the TEXT frame buffer. 01481 */ 01482 01483 ULONG Offs; 01484 PUCHAR pFrameBuf = DeviceExtension->CurrentMode.VideoMemory.FrameBufferBase; 01485 PCHAR_IMAGE_INFO pCharInfoUni = WriteFrameBuffer->SrcBuffer; 01486 PCHAR_IMAGE_INFO pCharInfoAsc; 01487 DWORD Length = WriteFrameBuffer->DestScreen.nNumberOfChars; 01488 PVOID pCapBuffer = NULL; 01489 ULONG cCapBuffer = 0; 01490 01491 Offs = SCREEN_BUFFER_POINTER(WriteFrameBuffer->DestScreen.Position.X, 01492 WriteFrameBuffer->DestScreen.Position.Y, 01493 WriteFrameBuffer->DestScreen.ScreenSize.X, 01494 sizeof(VGA_CHAR)); 01495 01496 cCapBuffer = Length * sizeof(CHAR_IMAGE_INFO); 01497 pCapBuffer = ExAllocatePool(PagedPool, cCapBuffer); 01498 01499 if (!pCapBuffer) { 01500 #define DUMP_COUNT 4 01501 ULONG dumpData[DUMP_COUNT]; 01502 01503 FsVgaPrint((1, 01504 "FSVGA-FsVgaWriteToFrameBuffer: Could not allocate resource list\n")); 01505 // 01506 // Log an error. 01507 // 01508 dumpData[0] = cCapBuffer; 01509 FsVgaLogError(DeviceExtension->DeviceObject, 01510 FSVGA_INSUFFICIENT_RESOURCES, 01511 FSVGA_ERROR_VALUE_BASE + 200, 01512 STATUS_INSUFFICIENT_RESOURCES, 01513 dumpData, 01514 1 01515 ); 01516 return STATUS_UNSUCCESSFUL; 01517 } 01518 01519 TranslateOutputToOem(pCapBuffer, pCharInfoUni, Length); 01520 01521 pCharInfoAsc = pCapBuffer; 01522 pFrameBuf += Offs; 01523 while (Length--) 01524 { 01525 *pFrameBuf++ = pCharInfoAsc->CharInfo.Char.AsciiChar; 01526 *pFrameBuf++ = (UCHAR) (pCharInfoAsc->CharInfo.Attributes); 01527 pCharInfoAsc++; 01528 } 01529 01530 ExFreePool(pCapBuffer); 01531 } 01532 else 01533 { 01534 /* 01535 * This is the GRAPHICS frame buffer. 01536 */ 01537 return FsgWriteToFrameBuffer(DeviceExtension, 01538 WriteFrameBuffer, 01539 inputBufferLength); 01540 } 01541 01542 return STATUS_SUCCESS; 01543 }


Generated on Sat May 15 19:43:47 2004 for test by doxygen 1.3.7