]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Sample/Library/Dxe/WinNt/WinNtLib.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Library / Dxe / WinNt / WinNtLib.c
diff --git a/EdkCompatibilityPkg/Sample/Library/Dxe/WinNt/WinNtLib.c b/EdkCompatibilityPkg/Sample/Library/Dxe/WinNt/WinNtLib.c
new file mode 100644 (file)
index 0000000..f883a9c
--- /dev/null
@@ -0,0 +1,75 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  WinNtLib.c\r
+\r
+Abstract:\r
+\r
+  Setup gWinNt global \r
+\r
+--*/\r
+\r
+#include "Efi2WinNT.h"\r
+#include "EfiWinNtLib.h"\r
+#include "EfiDriverLib.h"\r
+#include "EfiHobLib.h"\r
+#include EFI_GUID_DEFINITION (Hob)\r
+\r
+EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;\r
+\r
+EFI_GUID                  mEfiHobListGuid = EFI_HOB_LIST_GUID;\r
+\r
+EFI_STATUS\r
+EfiInitializeWinNtDriverLib (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Intialize gWinNt and initialize debug console. \r
+\r
+Arguments:\r
+\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+// TODO:    ImageHandle - add argument and description to function comment\r
+// TODO:    SystemTable - add argument and description to function comment\r
+// TODO:    EFI_NOT_FOUND - add return value to function comment\r
+// TODO:    EFI_NOT_FOUND - add return value to function comment\r
+// TODO:    EFI_SUCCESS - add return value to function comment\r
+{\r
+  EFI_STATUS  Status;\r
+  VOID        *HobList;\r
+  VOID        *Pointer;\r
+\r
+  Status = EfiLibGetSystemConfigurationTable (&mEfiHobListGuid, &HobList);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  ASSERT (NULL != HobList);\r
+  Status = GetNextGuidHob (&HobList, &gEfiWinNtThunkProtocolGuid, &Pointer, NULL);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  gWinNt = (VOID *) (*(UINTN *) (Pointer));\r
+  return EFI_SUCCESS;\r
+}\r