]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Library/Dxe/WinNt/WinNtLib.c
278692802d1bd5b4811804ac7b5b502318e5b05a
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Library / Dxe / WinNt / WinNtLib.c
1 /*++
2
3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 WinNtLib.c
15
16 Abstract:
17
18 Setup gWinNt global
19
20 --*/
21
22 #include "Efi2WinNT.h"
23 #include "EfiWinNtLib.h"
24 #include "EfiDriverLib.h"
25 #include "EfiHobLib.h"
26 #include EFI_GUID_DEFINITION (Hob)
27
28 EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;
29
30 EFI_GUID mEfiHobListGuid = EFI_HOB_LIST_GUID;
31
32 EFI_STATUS
33 EfiInitializeWinNtDriverLib (
34 IN EFI_HANDLE ImageHandle,
35 IN EFI_SYSTEM_TABLE *SystemTable
36 )
37 /*++
38
39 Routine Description:
40
41 Intialize gWinNt and initialize debug console.
42
43 Arguments:
44
45 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
46
47 Returns:
48
49 None
50
51 --*/
52 // TODO: ImageHandle - add argument and description to function comment
53 // TODO: SystemTable - add argument and description to function comment
54 // TODO: EFI_NOT_FOUND - add return value to function comment
55 // TODO: EFI_NOT_FOUND - add return value to function comment
56 // TODO: EFI_SUCCESS - add return value to function comment
57 {
58 EFI_STATUS Status;
59 VOID *HobList;
60 VOID *Pointer;
61
62 Status = EfiLibGetSystemConfigurationTable (&mEfiHobListGuid, &HobList);
63 if (EFI_ERROR (Status)) {
64 return EFI_NOT_FOUND;
65 }
66
67 ASSERT (NULL != HobList);
68 Status = GetNextGuidHob (&HobList, &gEfiWinNtThunkProtocolGuid, &Pointer, NULL);
69 if (EFI_ERROR (Status)) {
70 return EFI_NOT_FOUND;
71 }
72
73 gWinNt = (VOID *) (*(UINTN *) (Pointer));
74 return EFI_SUCCESS;
75 }