========================By vscpp start===============================
The code is from Microsoft MU project.
- Download UDK2018 code
- Copy PrintScreenLogger to ShellPkg/Application/PrintScreenLogger
- DSC Nt32Pkg.dsc change [Components] ShellPkg/Application/PrintScreenLogger/PrintScreenLogger.inf
- Run build command: edksetup.bat --nt32 build -m ShellPkg\Application\PrintScreenLogger\PrintScreenLogger.inf -a X64 -t VS2017 -b RELEASE
- Find the EFI driver PrintScreenLogger.efi in Build\NT32X64\RELEASE_VS2017\X64
- Boot to UEFI Shell environment
- Run: load PrintScreenLogger.efi
- Refer to "PrintScreenLogger operation"
========================By vscpp end===============================
PrintScreenLogger is a DXE_DRIVER you can include in your platform to obtain Screen Captures during the preboot environment by pressing the Ctrl-PrtScn key combination. This action will creates a 24bbp (Bits Per Pixel) .BMP file of the screen's contents and write it to a enabled USB drive.
This package is not architecturally dependent. This package is dependent upon the Gop pixel format, and only supports these two pixel formats:
- PixelRedGreenBlueReserved8BitPerColor
- PixelBlueGreenRedReserved8BitPerColor
During initialization, the Print Screen Loggger registers for notification of the Ctrl-PrtScn key combination is pressed.
When a Print Screen callback occurs:
- Looks for a mounted USB drive that contains a file in the root directory called PrintScreenEnable.txt. This limits PrintScreenLogger to only write to enabled USB devices.
- Looks for the next available filename in the form PrtScreen####.bmp, starting with 0000.
- Creates the new PrtScreen####.bmp file.
- Call GraphicsOutput->Blt to obtain the complete screen.
- Converts the BLT buffer to a 24bbp BMP structure.
- Writes the BMP structure to the new PrtScreen####.bmp file.
[Components.<arch>]
...
...
MsGraphicsPkg/PrintScreenFileLogger/PrintScreenFileLogger.inf
[FV.<a DXE firmware volume>]
...
...
INF MsGraphicsPkg/PrintScreenFileLogger/PrintScreenFileLogger.inf
Copyright (c) 2018, Microsoft Corporation
All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.