]>
Commit | Line | Data |
---|---|---|
d933e70a JW |
1 | /** @file\r |
2 | The DriverEntryPoint and Unload for HttpUtilities driver.\r | |
3 | \r | |
f75a7f56 | 4 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r |
d933e70a | 5 | \r |
ecf98fbc | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d933e70a JW |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #include "HttpUtilitiesDxe.h"\r | |
11 | \r | |
d933e70a JW |
12 | /**\r |
13 | Unloads an image.\r | |
14 | \r | |
15 | @param ImageHandle Handle that identifies the image to be unloaded.\r | |
16 | \r | |
17 | @retval EFI_SUCCESS The image has been unloaded.\r | |
18 | @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r | |
19 | \r | |
20 | **/\r | |
f75a7f56 | 21 | EFI_STATUS\r |
d933e70a JW |
22 | EFIAPI\r |
23 | HttpUtilitiesDxeUnload (\r | |
24 | IN EFI_HANDLE ImageHandle\r | |
25 | )\r | |
26 | {\r | |
d1050b9d MK |
27 | EFI_STATUS Status;\r |
28 | UINTN HandleNum;\r | |
29 | EFI_HANDLE *HandleBuffer;\r | |
30 | UINT32 Index;\r | |
31 | EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;\r | |
d933e70a | 32 | \r |
d1050b9d | 33 | HandleBuffer = NULL;\r |
d933e70a JW |
34 | \r |
35 | //\r | |
36 | // Locate all the handles with HttpUtilities protocol.\r | |
37 | //\r | |
38 | Status = gBS->LocateHandleBuffer (\r | |
39 | ByProtocol,\r | |
40 | &gEfiHttpUtilitiesProtocolGuid,\r | |
41 | NULL,\r | |
42 | &HandleNum,\r | |
43 | &HandleBuffer\r | |
44 | );\r | |
45 | if (EFI_ERROR (Status)) {\r | |
46 | return Status;\r | |
47 | }\r | |
48 | \r | |
49 | for (Index = 0; Index < HandleNum; Index++) {\r | |
50 | //\r | |
51 | // Firstly, find HttpUtilitiesProtocol interface\r | |
52 | //\r | |
53 | Status = gBS->OpenProtocol (\r | |
f75a7f56 LG |
54 | HandleBuffer[Index],\r |
55 | &gEfiHttpUtilitiesProtocolGuid,\r | |
d1050b9d | 56 | (VOID **)&HttpUtilitiesProtocol,\r |
f75a7f56 LG |
57 | ImageHandle,\r |
58 | NULL,\r | |
d933e70a JW |
59 | EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL\r |
60 | );\r | |
61 | if (EFI_ERROR (Status)) {\r | |
62 | return Status;\r | |
63 | }\r | |
64 | \r | |
65 | //\r | |
66 | // Then, uninstall HttpUtilities interface\r | |
f75a7f56 | 67 | //\r |
d933e70a JW |
68 | Status = gBS->UninstallMultipleProtocolInterfaces (\r |
69 | HandleBuffer[Index],\r | |
d1050b9d MK |
70 | &gEfiHttpUtilitiesProtocolGuid,\r |
71 | HttpUtilitiesProtocol,\r | |
d933e70a JW |
72 | NULL\r |
73 | );\r | |
74 | if (EFI_ERROR (Status)) {\r | |
75 | return Status;\r | |
76 | }\r | |
77 | }\r | |
78 | \r | |
79 | return EFI_SUCCESS;\r | |
80 | }\r | |
81 | \r | |
d933e70a JW |
82 | /**\r |
83 | This is the declaration of an EFI image entry point. This entry point is\r | |
84 | the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r | |
85 | both device drivers and bus drivers.\r | |
86 | \r | |
87 | @param ImageHandle The firmware allocated handle for the UEFI image.\r | |
88 | @param SystemTable A pointer to the EFI System Table.\r | |
89 | \r | |
90 | @retval EFI_SUCCESS The operation completed successfully.\r | |
91 | @retval Others An unexpected error occurred.\r | |
92 | **/\r | |
93 | EFI_STATUS\r | |
94 | EFIAPI\r | |
95 | HttpUtilitiesDxeDriverEntryPoint (\r | |
96 | IN EFI_HANDLE ImageHandle,\r | |
97 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
98 | )\r | |
99 | {\r | |
d1050b9d | 100 | EFI_STATUS Status;\r |
d933e70a | 101 | \r |
d1050b9d | 102 | EFI_HANDLE Handle;\r |
d933e70a JW |
103 | \r |
104 | Handle = NULL;\r | |
105 | \r | |
106 | //\r | |
107 | // Install the HttpUtilities Protocol onto Handle\r | |
108 | //\r | |
109 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
110 | &Handle,\r | |
111 | &gEfiHttpUtilitiesProtocolGuid,\r | |
112 | &mHttpUtilitiesProtocol,\r | |
113 | NULL\r | |
114 | );\r | |
f75a7f56 | 115 | \r |
d933e70a JW |
116 | return Status;\r |
117 | }\r |