ReactOS  0.4.14-dev-55-g2da92ac
display.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING.ARM in the top level directory
3  * PROJECT: ReactOS UEFI Boot Library
4  * FILE: boot/environ/lib/platform/display.c
5  * PURPOSE: Boot Library Display Management Routines
6  * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include "bl.h"
12 #include <bcd.h>
13 
14 /* DATA VARIABLES ************************************************************/
15 
20 
23 {
24  {1024, 768, 1024},
25  {800, 600, 800},
26  {1024, 600, 1024}
27 };
29 
31 {
32  {80, 25, 80}
33 };
34 
39 
40 /* FUNCTIONS *****************************************************************/
41 
42 BOOLEAN
44  VOID
45  )
46 {
49 
50  /* Get the boot option, and if present, return the result */
53  &Disabled);
54  return (NT_SUCCESS(Status) && (Disabled));
55 }
56 
59  _In_ PWCHAR FontFileName
60  )
61 {
62  PBL_DEVICE_DESCRIPTOR FontDevice;
64  SIZE_T NameLength, DirectoryLength, TotalLength;
65  PWCHAR FontPath, FontDirectory;
66  BL_LIBRARY_PARAMETERS LibraryParameters;
67  BOOLEAN CustomDirectory, CustomDevice;
68 
69  /* Initialize locals */
70  CustomDirectory = TRUE;
71  CustomDevice = TRUE;
72  FontDevice = NULL;
73  FontPath = NULL;
74  FontDirectory = NULL;
75 
76  /* Check if a custom font path should be used */
79  &FontDirectory);
80  if (!NT_SUCCESS(Status))
81  {
82  /* Nope, use the one configured by the library */
83  CustomDirectory = FALSE;
84  RtlCopyMemory(&LibraryParameters,
86  sizeof(LibraryParameters)),
87  FontDirectory = LibraryParameters.FontBaseDirectory;
88  }
89 
90  /* Do we still not have a font directory? */
91  if (!FontDirectory)
92  {
93  /* Use the boot device and boot directory */
94  FontDevice = BlpBootDevice;
95  FontDirectory = L"\\EFI\\Microsoft\\Boot\\Fonts";
96  CustomDevice = FALSE;
97  }
98  else
99  {
100  /* Otherwise, if we have a font directory, what device is the app on? */
103  &FontDevice,
104  NULL);
105  if (!NT_SUCCESS(Status))
106  {
107  /* If we don't know the device, we can't open the path */
108  goto Quickie;
109  }
110  }
111 
112  /* Figure out the length of the file name, and of the directory */
113  NameLength = wcslen(FontFileName);
114  DirectoryLength = wcslen(FontDirectory);
115 
116  /* Safely add them up*/
117  Status = RtlSIZETAdd(NameLength, DirectoryLength, &TotalLength);
118  if (!NT_SUCCESS(Status))
119  {
120  goto Quickie;
121  }
122 
123  /* Convert to bytes */
124  Status = RtlSIZETMult(TotalLength, sizeof(WCHAR), &TotalLength);
125  if (!NT_SUCCESS(Status))
126  {
127  goto Quickie;
128  }
129 
130  /* Add a terminating NUL */
131  Status = RtlSIZETAdd(TotalLength, sizeof(UNICODE_NULL), &TotalLength);
132  if (!NT_SUCCESS(Status))
133  {
134  goto Quickie;
135  }
136 
137  /* Allocate the final buffer for it */
138  FontPath = BlMmAllocateHeap(TotalLength);
139  if (!FontPath)
140  {
142  goto Quickie;
143  }
144 
145  /* Concatenate the directory with the file name */
146  wcscpy(FontPath, FontDirectory);
147  wcscat(FontPath, FontFileName);
148 
149  /* Try to load this font */
150  Status = BfLoadFontFile(FontDevice, FontPath);
151 
152 Quickie:
153  /* Check if we had a custom font device allocated and free it */
154  if ((CustomDevice) && (FontDevice))
155  {
156  BlMmFreeHeap(FontDevice);
157  }
158 
159  /* Check if we had a custom font directory allocated and free it */
160  if ((FontDirectory) && (CustomDirectory))
161  {
162  BlMmFreeHeap(FontDirectory);
163  }
164 
165  /* Check if we had allocated a font path and free it */
166  if (FontPath)
167  {
168  BlMmFreeHeap(FontPath);
169  }
170 
171  /* Return back */
172  return Status;
173 }
174 
175 NTSTATUS
177  _In_ PWCHAR Locale
178  )
179 {
180  BOOLEAN StandardLocale;
182  PWCHAR FontFileName;
183  PBL_DEFERRED_FONT_FILE DeferredFont;
184  PLIST_ENTRY NextEntry;
185  WCHAR Prefix[3];
186 
187  /* Assume custom locale */
188  StandardLocale = FALSE;
189 
190  /* Bail out if the locale string seems invalid */
191  if (wcslen(Locale) < 2)
192  {
194  }
195 
196  /* Check the prefix first, then traditional vs. simplified */
197  Prefix[0] = Locale[0];
198  Prefix[1] = Locale[1];
199  Prefix[2] = UNICODE_NULL;
200  if (!_wcsicmp(Prefix, L"ja"))
201  {
202  FontFileName = L"\\jpn_boot.ttf";
203  }
204  else if (!_wcsicmp(Prefix, L"ko"))
205  {
206  FontFileName = L"\\kor_boot.ttf";
207  }
208  else if (!(_wcsicmp(Locale, L"zh-CN")) ||
209  !(_wcsicmp(Locale, L"zh-CHS")) ||
210  !(_wcsicmp(Locale, L"zh-Hans")))
211  {
212  FontFileName = L"\\chs_boot.ttf";
213  }
214  else if (!(_wcsicmp(Locale, L"zh-TW")) &&
215  !(_wcsicmp(Locale, L"zh-CHT")) &&
216  !(_wcsicmp(Locale, L"zh-HK")) &&
217  !(_wcsicmp(Locale, L"zh-Hant")))
218  {
219  FontFileName = L"\\cht_boot.ttf";
220  }
221  else
222  {
223  StandardLocale = TRUE;
224  FontFileName = L"\\wgl4_boot.ttf";
225  }
226 
227  /* Parse all the currently deferred fonts*/
228  NextEntry = BfiDeferredListHead.Flink;
229  while (NextEntry != &BfiDeferredListHead)
230  {
231  /* Grab the font */
232  DeferredFont = CONTAINING_RECORD(NextEntry, BL_DEFERRED_FONT_FILE, ListEntry);
233 
234  /* Move to the next entry, and remove this one */
235  NextEntry = NextEntry->Flink;
236  RemoveEntryList(&DeferredFont->ListEntry);
237 
238  /* Free the deferred font, we'll be loading a new one */
239  BfiFreeDeferredFontFile(DeferredFont);
240  }
241 
242  /* Load the primary font */
243  Status = DsppLoadFontFile(FontFileName);
244  if (NT_SUCCESS(Status) && !(StandardLocale))
245  {
246  /* Also load the standard US one if we loaded a different one */
247  Status = DsppLoadFontFile(L"\\wgl4_boot.ttf");
248  }
249 
250  /* Return back to caller */
251  return Status;
252 }
253 
254 NTSTATUS
257  )
258 {
259  BL_LIBRARY_PARAMETERS LibraryParameters = BlpLibraryParameters;
260  BOOLEAN NoGraphics, HighestMode;
263  ULONGLONG GraphicsResolution;
264  PBL_GRAPHICS_CONSOLE GraphicsConsole;
265  PBL_TEXT_CONSOLE TextConsole, RemoteConsole;
266 
267  /* Initialize font data */
271 
272  /* Allocate the font rectangle */
275  {
276  return STATUS_NO_MEMORY;
277  }
278 
279  /* Check if display re-initialization is requested */
280  if (LibraryParameters.LibraryFlags & BL_LIBRARY_FLAG_REINITIALIZE_ALL)
281  {
282  /* Recreate a local input console */
284  }
285 
286  /* Check if no graphics console is needed */
289  {
290  /* Remember this */
291  NoGraphics = TRUE;
292  }
293  else
294  {
295  /* No graphics -- remember this */
296  NoGraphics = FALSE;
297  }
298 
299  /* On first load, we always initialize a graphics display */
300  GraphicsConsole = NULL;
301  if (!(Flags & BL_LIBRARY_FLAG_REINITIALIZE_ALL) || !(NoGraphics))
302  {
303  /* Default to mode 0 (1024x768) */
305 
306  /* Check what resolution to use*/
309  &GraphicsResolution);
310  if (NT_SUCCESS(Status))
311  {
313  EfiPrintf(L"Display selection not yet handled\r\n");
314  return STATUS_NOT_IMPLEMENTED;
315  }
316 
317  /* Check if the highest mode should be forced */
320  &HighestMode);
321  if (NT_SUCCESS(Status))
322  {
324  EfiPrintf(L"High res mode not yet handled\r\n");
325  return STATUS_NOT_IMPLEMENTED;
326  }
327 
328  /* Do we need graphics mode after all? */
329  if (!NoGraphics)
330  {
331  /* Yep -- go allocate it */
332  GraphicsConsole = BlMmAllocateHeap(sizeof(*GraphicsConsole));
333  if (GraphicsConsole)
334  {
335  /* Construct it */
336  Status = ConsoleGraphicalConstruct(GraphicsConsole);
337  if (!NT_SUCCESS(Status))
338  {
339  EfiPrintf(L"GFX FAILED: %lx\r\n", Status);
340  BlMmFreeHeap(GraphicsConsole);
341  GraphicsConsole = NULL;
342  }
343  }
344  }
345 
346  /* Are we using something else than the default mode? */
348  {
349  EfiPrintf(L"Display path not handled\r\n");
350  return STATUS_NOT_SUPPORTED;
351  }
352 
353  /* Mask out all the flags now */
356  }
357 
358  /* Do we have a graphics console? */
359  TextConsole = NULL;
360  if (!GraphicsConsole)
361  {
362  /* Nope -- go allocate a text console */
363  TextConsole = BlMmAllocateHeap(sizeof(*TextConsole));
364  if (TextConsole)
365  {
366  /* Construct it */
367  Status = ConsoleTextLocalConstruct(TextConsole, TRUE);
368  if (!NT_SUCCESS(Status))
369  {
370  BlMmFreeHeap(TextConsole);
371  TextConsole = NULL;
372  }
373  }
374  }
375 
376  /* Initialize all globals to NULL */
380 
381  /* If we don't have a text console, go get a remote console */
382  RemoteConsole = NULL;
383  if (!TextConsole)
384  {
385  ConsoleCreateRemoteConsole(&RemoteConsole);
386  }
387 
388  /* Do we have a remote console? */
389  if (!RemoteConsole)
390  {
391  /* Nope -- what about a graphical one? */
392  if (GraphicsConsole)
393  {
394  /* Yes, use it for both graphics and text */
395  DspGraphicalConsole = GraphicsConsole;
396  DspTextConsole = GraphicsConsole;
397  }
398  else if (TextConsole)
399  {
400  /* Nope, but we have a text console */
401  DspTextConsole = TextConsole;
402  }
403 
404  /* Console has been setup */
405  return STATUS_SUCCESS;
406  }
407 
408  /* We have a remote console -- have to figure out how to use it*/
409  EfiPrintf(L"Display path not handled\r\n");
410  return STATUS_NOT_SUPPORTED;
411 }
412 
413 NTSTATUS
416  )
417 {
418  PBL_TEXT_CONSOLE TextConsole;
419  PBL_GRAPHICS_CONSOLE GraphicsConsole;
421  ULONGLONG GraphicsResolution;
422  BOOLEAN HighestMode;
423  BL_DISPLAY_MODE CurrentResolution;
424 
425  /* Do we have local input yet? */
427  {
428  /* Create it now */
430  }
431 
432  /* If a graphics console is present without a remote console... */
433  TextConsole = NULL;
435  {
436  /* Try to create a remote console */
437  ConsoleCreateRemoteConsole(&TextConsole);
438  }
439 
440  /* All good for now */
442 
443  /* Now check if we were able to create the remote console */
444  if (TextConsole)
445  {
446  EfiPrintf(L"EMS not supported\r\n");
447  return STATUS_NOT_IMPLEMENTED;
448  }
449 
450  /* Set a local for the right cast */
451  GraphicsConsole = DspGraphicalConsole;
452 
453  /* Nothing to do without a graphics console being reinitialized */
455  !(GraphicsConsole) ||
456  !(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
457  {
458  return Status;
459  }
460 
461  /* Check if graphics are disabled in the BCD */
463  {
464  /* Turn off the graphics console, switching back to text mode */
465  Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->Enable(GraphicsConsole, FALSE);
466  }
467 
468  /* Check if a custom graphics resolution is set */
471  {
472  /* Check what it's set to */
475  &GraphicsResolution);
476  if (!NT_SUCCESS(Status))
477  {
478  return Status;
479  }
480 
481  /* Now check our current graphical resolution */
482  Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetGraphicalResolution(GraphicsConsole,
483  &CurrentResolution);
484  if (!NT_SUCCESS(Status))
485  {
486  return Status;
487  }
488 
489  /* Remember that we're forcing a video mode */
491 
492  /* Check which resolution to set */
493  if (!GraphicsResolution)
494  {
495  /* 1024x768 */
496  EfiPrintf(L"Display selection not yet handled\r\n");
497  return STATUS_NOT_IMPLEMENTED;
498  }
499  else if (GraphicsResolution == 1)
500  {
501  /* 800x600 */
502  EfiPrintf(L"Display selection not yet handled\r\n");
503  return STATUS_NOT_IMPLEMENTED;
504  }
505  else if (GraphicsResolution == 2)
506  {
507  /* 1024x600 */
508  EfiPrintf(L"Display selection not yet handled\r\n");
509  return STATUS_NOT_IMPLEMENTED;
510  }
511  }
512 
513  /* Check if the force highest mode setting is present */
516  {
517  /* Check what it's set to */
520  &HighestMode);
521  if ((NT_SUCCESS(Status)) && (HighestMode))
522  {
523  /* Remember that high rest mode is being forced */
525 
526  /* Turn it on */
527  //((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->SetGraphicalResolution(GraphicsConsole, 0, 0);
528 
529  /* All done now */
531  EfiPrintf(L"High res mode not yet handled\r\n");
533  }
534  }
535 
536  /* Return back to the caller */
537  return Status;
538 }
539 
540 NTSTATUS
542  VOID
543  )
544 {
546  PBL_TEXT_CONSOLE TextConsole;
547  PBL_INPUT_CONSOLE InputConsole;
548 
549  /* Do we have a local console? */
550  InputConsole = DspLocalInputConsole;
551  if (InputConsole)
552  {
553  /* Reinitialize it */
554  Status = InputConsole->Callbacks->Reinitialize((PBL_TEXT_CONSOLE)InputConsole);
555  if (!NT_SUCCESS(Status))
556  {
557  return Status;
558  }
559  }
560 
561  /* Do we have a text console? */
562  TextConsole = DspTextConsole;
563  if (TextConsole)
564  {
565  /* Reinitialize it */
566  Status = TextConsole->Callbacks->Reinitialize(TextConsole);
567  }
568 
569  /* Return status */
570  return Status;
571 }
572 
573 NTSTATUS
576  )
577 {
579 
580  /* Are we resetting or initializing? */
582  {
583  /* This is a reset */
585  if (NT_SUCCESS(Status))
586  {
587  /* Re-initialize the class as well */
589  }
590  }
591  else
592  {
593  /* Initialize the display */
595  }
596 
597  /* Return display initialization state */
598  return Status;
599 }
600 
601 VOID
603  _Out_ PULONG TextWidth,
604  _Out_ PULONG TextHeight
605  )
606 {
608  PBL_GRAPHICS_CONSOLE GraphicsConsole;
609 
610  /* If the caller doesn't want anything, bail out */
611  if (!(TextWidth) || !(TextHeight))
612  {
613  return;
614  }
615 
616  /* Do we have a text console? */
618  if (DspTextConsole)
619  {
620  /* Do we have a graphics console? */
621  GraphicsConsole = DspGraphicalConsole;
622  if (GraphicsConsole)
623  {
624  /* Is it currently active? */
625  if (((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole))
626  {
627  /* Yep -- query it */
628  EfiPrintf(L"GFX active, not supported query\r\n");
630  //Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetTextCellResolution(GraphicsConsole);
631  }
632  }
633  }
634 
635  /* Check if we failed to get it from the graphics console */
636  if (!NT_SUCCESS(Status))
637  {
638  /* Set default text size */
639  *TextWidth = 8;
640  *TextHeight = 8;
641  }
642 }
643 
644 NTSTATUS
646  VOID
647  )
648 {
651 
652  /* Assume success */
654 
655  /* Do we have a graphics console? */
657  if (Console)
658  {
659  /* Is it currently active? */
660  if (((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->IsEnabled(Console))
661  {
662  /* If so, disable it */
663  return ((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->Enable(Console, FALSE);
664  }
665  }
666 
667  /* We should've now fallen back to text mode */
668  if (!DspTextConsole)
669  {
670  /* Then fail, as no display appears active */
672  }
673 
674  /* Return back to the caller */
675  return Status;
676 }
677 
678 NTSTATUS
680  _Out_ PULONG HRes,
681  _Out_ PULONG VRes
682  )
683 {
686  PBL_GRAPHICS_CONSOLE GraphicsConsole;
687 
688  /* Assume failure if no consoles are active */
690 
691  /* Do we have a text console? */
692  if (DspTextConsole)
693  {
694  /* Do we have an active graphics console? */
695  GraphicsConsole = DspGraphicalConsole;
696  if ((GraphicsConsole) &&
697  (((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
698  {
699  /* Get the resolution */
700  Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetGraphicalResolution(GraphicsConsole, &Resolution);
701  if (NT_SUCCESS(Status))
702  {
703  /* Return it back to the caller */
704  *HRes = Resolution.HRes;
705  *VRes = Resolution.VRes;
706  }
707  }
708  else
709  {
710  /* Return defaults */
711  *HRes = 640;
712  *VRes = 200;
714  }
715  }
716 
717  /* Return if we got a valid resolution back */
718  return Status;
719 }
720 
721 VOID
723  VOID
724  )
725 {
726  PBGRT_TABLE BgrtTable;
728 
729  /* Search for the BGRT */
730  Status = BlUtlGetAcpiTable((PVOID*)&BgrtTable, BGRT_SIGNATURE);
731  if (NT_SUCCESS(Status))
732  {
733  /* Mark the bitmap as invalid */
734  BgrtTable->Status &= ~BGRT_STATUS_IMAGE_VALID;
735 
736  /* Unmap the table */
737  BlMmUnmapVirtualAddressEx(BgrtTable, BgrtTable->Header.Length);
738  }
739 }
740 
741 PBITMAP
743  _In_opt_ PCOORD Offsets,
745  )
746 {
748  ULONG Size;
750  PBGRT_TABLE BgrtTable;
751  PBITMAP Bitmap;
753 
754  Bitmap = NULL;
755  BgrtTable = NULL;
756 
757  /* Search for the BGRT */
758  Status = BlUtlGetAcpiTable((PVOID*)&BgrtTable, BGRT_SIGNATURE);
759  if (!NT_SUCCESS(Status))
760  {
761  goto Quickie;
762  }
763 
764  /* Make sure this is really a BGRT */
765  if (BgrtTable->Header.Signature != BGRT_SIGNATURE)
766  {
768  goto Quickie;
769  }
770 
771  /* Make sure the BGRT table length is valid */
772  if (BgrtTable->Header.Length != sizeof(*BgrtTable))
773  {
775  goto Quickie;
776  }
777 
778  /* Make sure its a bitmap */
779  if (BgrtTable->ImageType != BgrtImageTypeBitmap)
780  {
782  goto Quickie;
783  }
784 
785  /* Make sure it's somewhere in RAM */
786  if (!BgrtTable->LogoAddress)
787  {
789  goto Quickie;
790  }
791 
792  /* Map the bitmap header only for now */
793  PhysicalAddress.QuadPart = BgrtTable->LogoAddress;
795  0,
796  sizeof(BMP_HEADER),
798  if (!NT_SUCCESS(Status))
799  {
800  goto Quickie;
801  }
802 
803  /* Capture the real size of the header */
804  Size = Header->Size;
805 
806  /* Unmap the bitmap header */
807  BlMmUnmapVirtualAddressEx(BgrtTable, sizeof(BMP_HEADER));
808 
809  /* If the real size is smaller than at least a V3 bitmap, bail out */
810  if (Size < sizeof(BITMAP))
811  {
813  goto Quickie;
814  }
815 
816  /* Map the real size of the header */
818  0,
819  Size,
821  if (!NT_SUCCESS(Status))
822  {
823  goto Quickie;
824  }
825 
826  /* Make sure this is a non-compressed 24-bit or 32-bit V3 bitmap */
827  if ((Bitmap->BmpHeader.Signature != 'MB') ||
828  (Bitmap->DibHeader.Compression) ||
829  ((Bitmap->DibHeader.BitCount != 24) &&
830  (Bitmap->DibHeader.BitCount != 32)) ||
831  (Bitmap->DibHeader.Size != sizeof(DIB_HEADER)))
832  {
834  goto Quickie;
835  }
836 
837  /* Check if caller wants the offsets back */
838  if (Offsets)
839  {
840  /* Give them away */
841  Offsets->X = BgrtTable->OffsetX;
842  Offsets->Y = BgrtTable->OffsetY;
843  }
844 
845  /* Check if the caller wants flags */
846  if (Flags)
847  {
848  /* Return if the image is valid */
849  *Flags = BgrtTable->Status & BGRT_STATUS_IMAGE_VALID;
850  }
851 
852 Quickie:
853  /* Check if we had mapped the BGRT */
854  if (BgrtTable)
855  {
856  /* Unmap it */
857  BlMmUnmapVirtualAddressEx(BgrtTable, BgrtTable->Header.Length);
858  }
859 
860  /* Check if this is the failure path */
861  if (!NT_SUCCESS(Status))
862  {
863  /* Did we have the OEM bitmap mapped? */
864  if (Bitmap)
865  {
866  /* Unmap it */
867  BlMmUnmapVirtualAddressEx(Bitmap, Bitmap->BmpHeader.Size);
868  }
869 
870  /* No bitmap to return */
871  Bitmap = NULL;
872  }
873 
874  /* Return the bitmap back, if any */
875  return Bitmap;
876 }
877 
878 BOOLEAN
880  VOID
881  )
882 {
883  PBITMAP Bitmap;
884  ULONG HRes, VRes, Height, Width, Flags;
885  COORD Offsets;
886  BOOLEAN Result;
888 
889  /* First check if mobile graphics are enabled */
892  &Result);
893  if ((NT_SUCCESS(Status)) && (Result))
894  {
895  /* Yes, so use the firmware image */
896  return TRUE;
897  }
898 
899  /* Nope, so we'll check the ACPI OEM bitmap */
900  Result = FALSE;
901  Bitmap = BlDisplayGetOemBitmap(&Offsets, &Flags);
902 
903  /* Is there one? */
904  if (Bitmap)
905  {
906  /* Is it valid? */
908  {
909  /* Get the current screen resolution */
910  Status = BlDisplayGetScreenResolution(&HRes, &VRes);
911  if (NT_SUCCESS(Status))
912  {
913  /* Is there a valid width? */
914  Width = Bitmap->DibHeader.Width;
915  if (Width)
916  {
917  /* Is there a valid height? */
918  Height = Bitmap->DibHeader.Height;
919  if (Height)
920  {
921  /* Will if fit on this screen? */
922  if (((Width + Offsets.X) <= HRes) &&
923  ((Height + Offsets.Y) <= VRes))
924  {
925  /* Then it's all good! */
926  Result = TRUE;
927  }
928  }
929  }
930  }
931  }
932 
933  /* Unmap the bitmap for now, it will be drawn later */
934  BlMmUnmapVirtualAddressEx(Bitmap, Bitmap->BmpHeader.Size);
935  }
936 
937  /* Return that a valid OEM bitmap exists */
938  return Result;
939 }
940 
941 NTSTATUS
943  VOID
944  )
945 {
947  PBL_TEXT_CONSOLE TextConsole;
948 
949  /* Nothing to do if there's no text console */
951  TextConsole = DspTextConsole;
952  if (TextConsole)
953  {
954  /* Otherwise, clear the whole screen */
955  Status = TextConsole->Callbacks->ClearText(TextConsole, FALSE);
956  if (NT_SUCCESS(Status))
957  {
958  /* Invalidate the OEM bitmap at this point */
960  }
961  }
962 
963  /* All done */
964  return Status;
965 };
966 
967 NTSTATUS
969  _In_ ULONG Type
970  )
971 {
973  PBL_TEXT_CONSOLE TextConsole;
975 
976  /* Nothing to do if there's no text console */
978  TextConsole = DspTextConsole;
979  if (TextConsole)
980  {
981  /* Write visibility state and call the function to change it */
982  State.CursorVisible = Type;
983  Status = TextConsole->Callbacks->SetTextState(TextConsole, 8, &State);
984  }
985 
986  /* All done */
987  return Status;
988 }
PBL_DEVICE_DESCRIPTOR BlpBootDevice
Definition: bootlib.c:16
BL_LIBRARY_PARAMETERS BlpLibraryParameters
Definition: bootlib.c:15
#define BL_LIBRARY_FLAG_REINITIALIZE
Definition: bl.h:129
#define TRUE
Definition: types.h:120
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PCONSOLE_CLEAR_TEXT ClearText
Definition: bl.h:1093
NTSTATUS BlUtlGetAcpiTable(_Out_ PVOID *TableAddress, _In_ ULONG Signature)
Definition: util.c:34
NTSTATUS ConsoleCreateLocalInputConsole(VOID)
Definition: textcons.c:243
NTSTATUS BlMmMapPhysicalAddressEx(_In_ PVOID *VirtualAddress, _In_ ULONG Attributes, _In_ ULONGLONG Size, _In_ PHYSICAL_ADDRESS PhysicalAddress)
Definition: mm.c:192
NTSTATUS BlpDisplayReinitialize(VOID)
Definition: display.c:541
Type
Definition: Type.h:6
BL_TEXT_CONSOLE TextConsole
Definition: bl.h:1147
VOID BlDisplayGetTextCellResolution(_Out_ PULONG TextWidth, _Out_ PULONG TextHeight)
Definition: display.c:602
ULONG ConsoleGraphicalResolutionListSize
Definition: display.c:28
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NTSTATUS ConsoleCreateRemoteConsole(_In_ PBL_TEXT_CONSOLE *TextConsole)
Definition: emscons.c:31
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
BOOLEAN BlDisplayValidOemBitmap(VOID)
Definition: display.c:879
PBITMAP BlDisplayGetOemBitmap(_In_opt_ PCOORD Offsets, _Out_opt_ PULONG Flags)
Definition: display.c:742
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
PBL_TEXT_CONSOLE_VTABLE Callbacks
Definition: bl.h:1111
#define BL_LIBRARY_FLAG_NO_GRAPHICS_CONSOLE
Definition: bl.h:133
LIST_ENTRY BfiDeferredListHead
Definition: display.c:17
#define BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG
Definition: bl.h:136
PBL_INPUT_CONSOLE_VTABLE Callbacks
Definition: bl.h:1132
#define BGRT_STATUS_IMAGE_VALID
Definition: acpi.h:53
uint16_t * PWCHAR
Definition: typedefs.h:54
_In_ ULONG TotalLength
Definition: usbdlib.h:145
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
Definition: heapalloc.c:663
#define _In_opt_
Definition: no_sal2.h:213
NTSTATUS BlGetBootOptionInteger(_In_ PBL_BCD_OPTION List, _In_ ULONG Type, _Out_ PULONGLONG Value)
Definition: bcdopt.c:467
BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry
Definition: bootlib.c:19
NTSTATUS ConsoleGraphicalConstruct(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: guicons.c:58
LIST_ENTRY ListEntry
Definition: bl.h:1300
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
NTSTATUS BfLoadFontFile(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PWCHAR FontPath)
Definition: font.c:51
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSTATUS BlpDisplayRegisterLocale(_In_ PWCHAR Locale)
Definition: display.c:176
PVOID DspGraphicalConsole
Definition: display.c:37
#define UNICODE_NULL
BL_DISPLAY_MODE ConsoleTextResolutionList[1]
Definition: display.c:30
Definition: Header.h:8
#define BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG
Definition: bl.h:135
PBL_BCD_OPTION BcdData
Definition: bl.h:868
ULONG LibraryFlags
Definition: bl.h:758
#define BGRT_SIGNATURE
Definition: acpi.h:43
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS BlGetBootOptionBoolean(_In_ PBL_BCD_OPTION List, _In_ ULONG Type, _Out_ PBOOLEAN Value)
Definition: bcdopt.c:504
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
Definition: heapalloc.c:569
_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
#define _Out_
Definition: no_sal2.h:323
NTSTATUS ConsoleTextLocalConstruct(_In_ PBL_TEXT_CONSOLE TextConsole, _In_ BOOLEAN Activate)
Definition: textcons.c:104
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG X
Definition: bl.h:1340
PVOID BfiGraphicsRectangle
Definition: display.c:19
#define _Out_opt_
Definition: no_sal2.h:339
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PBL_BCD_OPTION MiscGetBootOption(_In_ PBL_BCD_OPTION List, _In_ ULONG Type)
Definition: bcdopt.c:17
PCONSOLE_SET_TEXT_STATE SetTextState
Definition: bl.h:1090
PVOID DspLocalInputConsole
Definition: display.c:38
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
uint64_t ULONGLONG
Definition: typedefs.h:65
VOID BlDisplayInvalidateOemBitmap(VOID)
Definition: display.c:722
PVOID DspRemoteInputConsole
Definition: display.c:35
NTSTATUS BlMmUnmapVirtualAddressEx(_In_ PVOID VirtualAddress, _In_ ULONGLONG Size)
Definition: mm.c:487
struct _BL_GRAPHICS_CONSOLE_VTABLE * PBL_GRAPHICS_CONSOLE_VTABLE
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
PCONSOLE_REINITIALIZE Reinitialize
Definition: bl.h:1088
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
BL_DISPLAY_MODE ConsoleGraphicalResolutionList[3]
Definition: display.c:22
NTSTATUS BlGetBootOptionString(_In_ PBL_BCD_OPTION List, _In_ ULONG Type, _Out_ PWCHAR *Value)
Definition: bcdopt.c:146
NTSTATUS DsppReinitialize(_In_ ULONG Flags)
Definition: display.c:414
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Definition: bl.h:1338
#define STATUS_ACPI_INVALID_TABLE
Definition: ntstatus.h:1097
Status
Definition: gdiplustypes.h:24
#define _In_
Definition: no_sal2.h:204
PVOID DspTextConsole
Definition: display.c:36
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS BlGetBootOptionDevice(_In_ PBL_BCD_OPTION List, _In_ ULONG Type, _Out_ PBL_DEVICE_DESCRIPTOR *Value, _In_opt_ PBL_BCD_OPTION *ExtraOptions)
Definition: bcdopt.c:321
enum State_ State
Definition: pofuncs.h:54
PCONSOLE_REINITIALIZE Reinitialize
Definition: bl.h:1123
NTSTATUS DsppLoadFontFile(_In_ PWCHAR FontFileName)
Definition: display.c:58
BOOLEAN DsppGraphicsDisabledByBcd(VOID)
Definition: display.c:43
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
Definition: bl.h:1331
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
NTSTATUS BlDisplayClearScreen(VOID)
Definition: display.c:942
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned int * PULONG
Definition: retypes.h:1
VOID BfiFreeDeferredFontFile(_In_ PBL_DEFERRED_FONT_FILE DeferredFontFile)
Definition: font.c:30
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
ULONG ConsoleGraphicalResolutionListFlags
Definition: display.c:21
NTSTATUS BlDisplaySetCursorType(_In_ ULONG Type)
Definition: display.c:968
#define BL_LIBRARY_FLAG_REINITIALIZE_ALL
Definition: bl.h:130
NTSTATUS BlDisplaySetScreenResolution(VOID)
Definition: display.c:645
CConsole Console
PVOID BfiCachedStrikeData
Definition: display.c:16
static BYTE Resolution
Definition: mouse.c:35
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
ULONG Y
Definition: bl.h:1341
PWCHAR FontBaseDirectory
Definition: bl.h:765
NTSTATUS BlDisplayGetScreenResolution(_Out_ PULONG HRes, _Out_ PULONG VRes)
Definition: display.c:679
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
NTSTATUS DsppInitialize(_In_ ULONG Flags)
Definition: display.c:255
LONGLONG QuadPart
Definition: typedefs.h:112
NTSTATUS BlpDisplayInitialize(_In_ ULONG Flags)
Definition: display.c:574
LIST_ENTRY BfiFontFileListHead
Definition: display.c:18