878ddf1f |
1 | /*++\r |
2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r |
4 | All rights reserved. This program and the accompanying materials \r |
5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r |
7 | http://opensource.org/licenses/bsd-license.php \r |
8 | \r |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r |
11 | \r |
12 | Module Name:\r |
13 | \r |
14 | WinNtThunk.c\r |
15 | \r |
16 | Abstract:\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 |
48 | \r |
49 | EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {\r |
50 | EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE,\r |
51 | GetProcAddress,\r |
52 | GetTickCount,\r |
53 | LoadLibraryEx,\r |
54 | FreeLibrary,\r |
55 | SetPriorityClass,\r |
56 | SetThreadPriority,\r |
57 | Sleep,\r |
58 | SuspendThread,\r |
59 | GetCurrentThread,\r |
60 | GetCurrentThreadId,\r |
61 | GetCurrentProcess,\r |
62 | CreateThread,\r |
63 | TerminateThread,\r |
64 | SendMessage,\r |
65 | ExitThread,\r |
66 | ResumeThread,\r |
67 | DuplicateHandle,\r |
68 | InitializeCriticalSection,\r |
69 | EnterCriticalSection,\r |
70 | LeaveCriticalSection,\r |
71 | DeleteCriticalSection,\r |
72 | TlsAlloc,\r |
73 | TlsFree,\r |
74 | TlsSetValue,\r |
75 | TlsGetValue,\r |
76 | CreateSemaphore,\r |
77 | WaitForSingleObject,\r |
78 | ReleaseSemaphore,\r |
79 | CreateConsoleScreenBuffer,\r |
80 | FillConsoleOutputAttribute,\r |
81 | FillConsoleOutputCharacter,\r |
82 | GetConsoleCursorInfo,\r |
83 | GetNumberOfConsoleInputEvents,\r |
84 | PeekConsoleInput,\r |
85 | ScrollConsoleScreenBuffer,\r |
86 | ReadConsoleInput,\r |
87 | SetConsoleActiveScreenBuffer,\r |
88 | SetConsoleCursorInfo,\r |
89 | SetConsoleCursorPosition,\r |
90 | SetConsoleScreenBufferSize,\r |
91 | SetConsoleTitleW,\r |
92 | WriteConsoleInput,\r |
93 | WriteConsoleOutput,\r |
94 | CreateFile,\r |
95 | DeviceIoControl,\r |
96 | CreateDirectory,\r |
97 | RemoveDirectory,\r |
98 | GetFileAttributes,\r |
99 | SetFileAttributes,\r |
100 | CreateFileMapping,\r |
101 | CloseHandle,\r |
102 | DeleteFile,\r |
103 | FindFirstFile,\r |
104 | FindNextFile,\r |
105 | FindClose,\r |
106 | FlushFileBuffers,\r |
107 | GetEnvironmentVariable,\r |
108 | GetLastError,\r |
109 | SetErrorMode,\r |
110 | GetStdHandle,\r |
111 | MapViewOfFileEx,\r |
112 | ReadFile,\r |
113 | SetEndOfFile,\r |
114 | SetFilePointer,\r |
115 | WriteFile,\r |
116 | GetFileInformationByHandle,\r |
117 | GetDiskFreeSpace,\r |
118 | GetDiskFreeSpaceEx,\r |
119 | MoveFile,\r |
120 | SetFileTime,\r |
121 | SystemTimeToFileTime,\r |
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 | swprintf,\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 |
173 | HeapFree\r |
174 | };\r |
175 | \r |
176 | #pragma warning(default : 4232)\r |
177 | \r |
178 | EFI_WIN_NT_THUNK_PROTOCOL *gWinNt = &mWinNtThunkTable;\r |