aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib/tbi/screen.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-11-15 19:12:06 +0300
committerJoursoir <chat@joursoir.net>2021-11-15 19:12:06 +0300
commitedd62f8e7d00b56bd19217b56d0d2cdf3ef6c945 (patch)
treea8b095f66a70ac64cb44e036798ae955f1eea561 /Library/UefiShellUfmCommandLib/tbi/screen.c
parent01c9c0c71bedbf8a82c20f41ab8b1d9f8b156af0 (diff)
downloadufm-edd62f8e7d00b56bd19217b56d0d2cdf3ef6c945.tar.gz
ufm-edd62f8e7d00b56bd19217b56d0d2cdf3ef6c945.tar.bz2
ufm-edd62f8e7d00b56bd19217b56d0d2cdf3ef6c945.zip
move all sources to the right place
Diffstat (limited to 'Library/UefiShellUfmCommandLib/tbi/screen.c')
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/screen.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/tbi/screen.c b/Library/UefiShellUfmCommandLib/tbi/screen.c
new file mode 100644
index 0000000..ae4f2be
--- /dev/null
+++ b/Library/UefiShellUfmCommandLib/tbi/screen.c
@@ -0,0 +1,36 @@
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+#include "screen.h"
+
+struct screen *prepare_screen(VOID)
+{
+ struct screen *scr;
+ scr = AllocateZeroPool(sizeof(struct screen));
+ if(!scr)
+ return NULL;
+
+ scr->stdin = gST->ConIn;
+ scr->stdout = gST->ConOut;
+ scr->stderr = gST->StdErr;
+
+ gST->ConOut->QueryMode(
+ gST->ConOut,
+ gST->ConOut->Mode->Mode,
+ &(scr->columns),
+ &(scr->lines)
+ );
+ scr->attr = gST->ConOut->Mode->Attribute;
+
+ return scr;
+}
+
+VOID forget_screen(struct screen *scr)
+{
+ ASSERT(scr != NULL);
+
+ FreePool(scr);
+}