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