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