From b87fc6b140772ba3017de311c7063c259424264c Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 15 Aug 2016 17:11:31 +0200 Subject: First public release. Used by VeraCrypt 1.18. --- DcsCfg/DcsCfgGraphics.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 DcsCfg/DcsCfgGraphics.c (limited to 'DcsCfg/DcsCfgGraphics.c') diff --git a/DcsCfg/DcsCfgGraphics.c b/DcsCfg/DcsCfgGraphics.c new file mode 100644 index 0000000..3c5addb --- /dev/null +++ b/DcsCfg/DcsCfgGraphics.c @@ -0,0 +1,81 @@ +/** @file +DCS configuration graphics devices + +Copyright (c) 2016. Disk Cryptography Services for EFI (DCS), Alex Kolotnikov +Copyright (c) 2016. VeraCrypt, Mounir IDRASSI + +This program and the accompanying materials +are licensed and made available under the terms and conditions +of the GNU Lesser General Public License, version 3.0 (LGPL-3.0). + +The full text of the license may be found at +https://opensource.org/licenses/LGPL-3.0 +**/ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "DcsCfg.h" + + +////////////////////////////////////////////////////////////////////////// +// Graphics +////////////////////////////////////////////////////////////////////////// + +void GraphPrintDevicePath(EFI_HANDLE handle) { + EFI_GRAPHICS_OUTPUT_PROTOCOL* grfio = NULL; + EFI_STATUS res; + EfiPrintDevicePath(handle); + res = GraphGetIO(handle, &grfio); + if (!EFI_ERROR(res) && grfio != NULL) { + UINT32 i; + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* cout; + res = ConsoleGetOutput(handle, &cout); + OUT_PRINT(L" - %d [%d (%d,%d) %d] %s", + grfio->Mode->MaxMode, grfio->Mode->Mode, + grfio->Mode->Info->HorizontalResolution, grfio->Mode->Info->VerticalResolution, + grfio->Mode->Info->PixelFormat, + EFI_ERROR(res) ? L"" : L"console" + ); + + for (i = 0; i < grfio->Mode->MaxMode; i++) { + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; + UINTN szInfo; + res = grfio->QueryMode(grfio, i, &szInfo, &info); + if (!EFI_ERROR(res)) { + OUT_PRINT(L"\n [%d (%d,%d) %d]", + i, + info->HorizontalResolution, info->VerticalResolution, + grfio->Mode->Info->PixelFormat + ); + } + } + } +} + +void GraphPrintDevicePathByIndex(UINTN index) { + OUT_PRINT(L"%V%d%N ", index); + GraphPrintDevicePath(gGraphHandles[index]); +} + +void GraphPrintDevicePaths(CHAR16* msg) { + UINTN i; + OUT_PRINT(msg); + for (i = 0; i < gGraphCount; ++i) { + GraphPrintDevicePathByIndex(i); + OUT_PRINT(L"\n"); + } +} + +VOID +PrintGraphList() { + InitGraph(); + GraphPrintDevicePaths(L"%HGraphics handles%N\n"); +} -- cgit v1.2.3