]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/ResetRuntimeDxe/reset.c
Fix a security hole in shell binaries:
[mirror_edk2.git] / Nt32Pkg / ResetRuntimeDxe / reset.c
CommitLineData
6ae81428 1/**@file\r
8681bee2 2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 Reset.c\r
15\r
16Abstract:\r
17\r
18 Reset Architectural Protocol as defined in Tiano under NT Emulation\r
19\r
6ae81428 20**/\r
8681bee2 21\r
60c93673 22#include <Uefi.h>\r
f2569572
A
23#include <WinNtDxe.h>\r
24#include <Protocol/Reset.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/UefiDriverEntryPoint.h>\r
27#include <Library/WinNtLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
8681bee2 29\r
30\r
8681bee2 31EFI_STATUS\r
32EFIAPI\r
33InitializeNtReset (\r
34 IN EFI_HANDLE ImageHandle,\r
35 IN EFI_SYSTEM_TABLE *SystemTable\r
36 );\r
37\r
0b94e319 38VOID\r
8681bee2 39EFIAPI\r
40WinNtResetSystem (\r
41 IN EFI_RESET_TYPE ResetType,\r
42 IN EFI_STATUS ResetStatus,\r
43 IN UINTN DataSize,\r
a00ec39b 44 IN VOID *ResetData OPTIONAL\r
8681bee2 45 );\r
46\r
47\r
48EFI_STATUS\r
49EFIAPI\r
50InitializeNtReset (\r
51 IN EFI_HANDLE ImageHandle,\r
52 IN EFI_SYSTEM_TABLE *SystemTable\r
53 )\r
54/*++\r
55\r
56Routine Description:\r
57\r
58\r
59Arguments:\r
60\r
61 ImageHandle of the loaded driver\r
62 Pointer to the System Table\r
63\r
64Returns:\r
65\r
66 Status\r
67--*/\r
68// TODO: SystemTable - add argument and description to function comment\r
69{\r
70 EFI_STATUS Status;\r
71 EFI_HANDLE Handle;\r
72\r
73 SystemTable->RuntimeServices->ResetSystem = WinNtResetSystem;\r
74\r
75 Handle = NULL;\r
76 Status = gBS->InstallMultipleProtocolInterfaces (\r
77 &Handle,\r
78 &gEfiResetArchProtocolGuid,\r
79 NULL,\r
80 NULL\r
81 );\r
82 ASSERT_EFI_ERROR (Status);\r
83\r
84 return Status;\r
85}\r
86\r
0b94e319 87VOID\r
8681bee2 88EFIAPI\r
89WinNtResetSystem (\r
90 IN EFI_RESET_TYPE ResetType,\r
91 IN EFI_STATUS ResetStatus,\r
92 IN UINTN DataSize,\r
a00ec39b 93 IN VOID *ResetData OPTIONAL\r
8681bee2 94 )\r
95/*++\r
96\r
97Routine Description:\r
98\r
99 TODO: Add function description\r
100\r
101Arguments:\r
102\r
103 ResetType - TODO: add argument description\r
104 ResetStatus - TODO: add argument description\r
105 DataSize - TODO: add argument description\r
106 ResetData - TODO: add argument description\r
107\r
108Returns:\r
109\r
110 EFI_SUCCESS - TODO: Add description for return value\r
111\r
112--*/\r
113{\r
114 //\r
115 // BUGBUG Need to kill all console windows later\r
116 //\r
117 //\r
118 // Discard ResetType, always return 0 as exit code\r
119 //\r
120 gWinNt->ExitProcess (0);\r
121\r
122 //\r
123 // Should never go here\r
124 //\r
0b94e319 125 ASSERT (FALSE);\r
8681bee2 126}\r