Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1999 Intel Corporation
  3. Module Name:
  4. main.c
  5. Abstract:
  6. --*/
  7. #include "libMisc.h"
  8. EFI_STATUS
  9. InitializeEFIEditor (
  10. IN EFI_HANDLE ImageHandle,
  11. IN EFI_SYSTEM_TABLE *SystemTable
  12. );
  13. EFI_DRIVER_ENTRY_POINT(InitializeEFIEditor)
  14. EFI_STATUS
  15. InitializeEFIEditor (
  16. IN EFI_HANDLE ImageHandle,
  17. IN EFI_SYSTEM_TABLE *SystemTable
  18. )
  19. {
  20. EFI_STATUS Status;
  21. InstallInternalShellCommand (
  22. ImageHandle, SystemTable, InitializeEFIEditor,
  23. L"edit", /* command */
  24. L"edit [file name]", /* command syntax */
  25. L"Edit a file", /* 1 line descriptor */
  26. NULL /* command help page */
  27. );
  28. InitializeShellApplication (ImageHandle, SystemTable);
  29. Status = MainEditor.Init();
  30. if (EFI_ERROR(Status)) {
  31. Out->ClearScreen(Out);
  32. Out->EnableCursor(Out,TRUE);
  33. Print(L"EDIT : Initialization Failed\n");
  34. return EFI_SUCCESS;
  35. }
  36. Status = MainEditor.FileImage->Init (ImageHandle);
  37. if (EFI_ERROR(Status)) {
  38. Out->ClearScreen(Out);
  39. Out->EnableCursor(Out,TRUE);
  40. Print(L"EDIT : File Handle Initialization Failed\n");
  41. return EFI_SUCCESS;
  42. }
  43. if (SI->Argc > 1) {
  44. MainEditor.FileImage->SetFilename(SI->Argv[1]);
  45. Status = MainEditor.FileImage->OpenFile ();
  46. if (EFI_ERROR(Status)) {
  47. Out->ClearScreen(Out);
  48. Out->EnableCursor(Out,TRUE);
  49. Print(L"EDIT : Could Not Open File\n");
  50. return EFI_SUCCESS;
  51. }
  52. MainEditor.TitleBar->SetTitleString (SI->Argv[1]);
  53. MainEditor.FileImage->ReadFile();
  54. }
  55. MainEditor.Refresh ();
  56. MainEditor.KeyInput ();
  57. MainEditor.Cleanup();
  58. return EFI_SUCCESS;
  59. }