]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/Sec/WinNtThunk.c
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / Sec / WinNtThunk.c
1 /**@file
2
3 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 Module Name:
7
8 WinNtThunk.c
9
10 Abstract:
11
12 Since the SEC is the only windows program in our emulation we
13 must use a Tiano mechanism to export Win32 APIs to other modules.
14 This is the role of the EFI_WIN_NT_THUNK_PROTOCOL.
15
16 The mWinNtThunkTable exists so that a change to EFI_WIN_NT_THUNK_PROTOCOL
17 will cause an error in initializing the array if all the member functions
18 are not added. It looks like adding a element to end and not initializing
19 it may cause the table to be initaliized with the members at the end being
20 set to zero. This is bad as jumping to zero will case the NT32 to crash.
21
22 All the member functions in mWinNtThunkTable are Win32
23 API calls, so please reference Microsoft documentation.
24
25
26 gWinNt is a a public exported global that contains the initialized
27 data.
28
29 **/
30
31 #include "SecMain.h"
32
33 //
34 // This pragma is needed for all the DLL entry points to be asigned to the array.
35 // if warning 4232 is not dissabled a warning will be generated as a DLL entry
36 // point could be modified dynamically. The SEC does not do that, so we must
37 // disable the warning so we can compile the SEC. The previous method was to
38 // asign each element in code. The disadvantage to that approach is it's harder
39 // to tell if all the elements have been initialized properly.
40 //
41 #pragma warning(disable : 4232)
42 #pragma warning(disable : 4996)
43
44 #if __INTEL_COMPILER
45 #pragma warning ( disable : 144 )
46 #endif
47
48 EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {
49 EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE,
50 GetProcAddress,
51 GetTickCount,
52 LoadLibraryEx,
53 FreeLibrary,
54 SetPriorityClass,
55 SetThreadPriority,
56 Sleep,
57 SuspendThread,
58 GetCurrentThread,
59 GetCurrentThreadId,
60 GetCurrentProcess,
61 CreateThread,
62 TerminateThread,
63 SendMessage,
64 ExitThread,
65 ResumeThread,
66 DuplicateHandle,
67 InitializeCriticalSection,
68 EnterCriticalSection,
69 LeaveCriticalSection,
70 DeleteCriticalSection,
71 TlsAlloc,
72 TlsFree,
73 TlsSetValue,
74 TlsGetValue,
75 CreateSemaphore,
76 WaitForSingleObject,
77 ReleaseSemaphore,
78 CreateConsoleScreenBuffer,
79 FillConsoleOutputAttribute,
80 FillConsoleOutputCharacter,
81 GetConsoleCursorInfo,
82 GetNumberOfConsoleInputEvents,
83 PeekConsoleInput,
84 ScrollConsoleScreenBuffer,
85 ReadConsoleInput,
86 SetConsoleActiveScreenBuffer,
87 SetConsoleCursorInfo,
88 SetConsoleCursorPosition,
89 SetConsoleScreenBufferSize,
90 SetConsoleTitleW,
91 WriteConsoleInput,
92 WriteConsoleOutput,
93 CreateFile,
94 DeviceIoControl,
95 CreateDirectory,
96 RemoveDirectory,
97 GetFileAttributes,
98 SetFileAttributes,
99 CreateFileMapping,
100 CloseHandle,
101 DeleteFile,
102 FindFirstFile,
103 FindNextFile,
104 FindClose,
105 FlushFileBuffers,
106 GetEnvironmentVariable,
107 GetLastError,
108 SetErrorMode,
109 GetStdHandle,
110 MapViewOfFileEx,
111 ReadFile,
112 SetEndOfFile,
113 SetFilePointer,
114 WriteFile,
115 GetFileInformationByHandle,
116 GetDiskFreeSpace,
117 GetDiskFreeSpaceEx,
118 MoveFile,
119 SetFileTime,
120 SystemTimeToFileTime,
121 LocalFileTimeToFileTime,
122 FileTimeToLocalFileTime,
123 FileTimeToSystemTime,
124 GetSystemTime,
125 SetSystemTime,
126 GetLocalTime,
127 SetLocalTime,
128 GetTimeZoneInformation,
129 SetTimeZoneInformation,
130 timeSetEvent,
131 timeKillEvent,
132 ClearCommError,
133 EscapeCommFunction,
134 GetCommModemStatus,
135 GetCommState,
136 SetCommState,
137 PurgeComm,
138 SetCommTimeouts,
139 ExitProcess,
140 _snwprintf,
141 GetDesktopWindow,
142 GetForegroundWindow,
143 CreateWindowEx,
144 ShowWindow,
145 UpdateWindow,
146 DestroyWindow,
147 InvalidateRect,
148 GetWindowDC,
149 GetClientRect,
150 AdjustWindowRect,
151 SetDIBitsToDevice,
152 BitBlt,
153 GetDC,
154 ReleaseDC,
155 RegisterClassEx,
156 UnregisterClass,
157 BeginPaint,
158 EndPaint,
159 PostQuitMessage,
160 DefWindowProc,
161 LoadIcon,
162 LoadCursor,
163 GetStockObject,
164 SetViewportOrgEx,
165 SetWindowOrgEx,
166 MoveWindow,
167 GetWindowRect,
168 GetMessage,
169 TranslateMessage,
170 DispatchMessage,
171 GetProcessHeap,
172 HeapAlloc,
173 HeapFree,
174 QueryPerformanceCounter,
175 QueryPerformanceFrequency
176 };
177
178 #pragma warning(default : 4996)
179 #pragma warning(default : 4232)
180
181 EFI_WIN_NT_THUNK_PROTOCOL *gWinNt = &mWinNtThunkTable;