]> git.proxmox.com Git - mirror_edk2.git/blob - EdkNt32Pkg/Sec/WinNtThunk.c
Adjust Nt32 SecMain user-defined build file to use OBJECTS.
[mirror_edk2.git] / EdkNt32Pkg / Sec / WinNtThunk.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 WinNtThunk.c
15
16 Abstract:
17
18 Since the SEC is the only windows program in our emulation we
19 must use a Tiano mechanism to export Win32 APIs to other modules.
20 This is the role of the EFI_WIN_NT_THUNK_PROTOCOL.
21
22 The mWinNtThunkTable exists so that a change to EFI_WIN_NT_THUNK_PROTOCOL
23 will cause an error in initializing the array if all the member functions
24 are not added. It looks like adding a element to end and not initializing
25 it may cause the table to be initaliized with the members at the end being
26 set to zero. This is bad as jumping to zero will case the NT32 to crash.
27
28 All the member functions in mWinNtThunkTable are Win32
29 API calls, so please reference Microsoft documentation.
30
31
32 gWinNt is a a public exported global that contains the initialized
33 data.
34
35 --*/
36
37 #include "SecMain.h"
38
39 //
40 // This pragma is needed for all the DLL entry points to be asigned to the array.
41 // if warning 4232 is not dissabled a warning will be generated as a DLL entry
42 // point could be modified dynamically. The SEC does not do that, so we must
43 // disable the warning so we can compile the SEC. The previous method was to
44 // asign each element in code. The disadvantage to that approach is it's harder
45 // to tell if all the elements have been initailized properly.
46 //
47 #pragma warning(disable : 4232)
48
49 EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {
50 EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE,
51 GetProcAddress,
52 GetTickCount,
53 LoadLibraryEx,
54 FreeLibrary,
55 SetPriorityClass,
56 SetThreadPriority,
57 Sleep,
58 SuspendThread,
59 GetCurrentThread,
60 GetCurrentThreadId,
61 GetCurrentProcess,
62 CreateThread,
63 TerminateThread,
64 SendMessage,
65 ExitThread,
66 ResumeThread,
67 DuplicateHandle,
68 InitializeCriticalSection,
69 EnterCriticalSection,
70 LeaveCriticalSection,
71 DeleteCriticalSection,
72 TlsAlloc,
73 TlsFree,
74 TlsSetValue,
75 TlsGetValue,
76 CreateSemaphore,
77 WaitForSingleObject,
78 ReleaseSemaphore,
79 CreateConsoleScreenBuffer,
80 FillConsoleOutputAttribute,
81 FillConsoleOutputCharacter,
82 GetConsoleCursorInfo,
83 GetNumberOfConsoleInputEvents,
84 PeekConsoleInput,
85 ScrollConsoleScreenBuffer,
86 ReadConsoleInput,
87 SetConsoleActiveScreenBuffer,
88 SetConsoleCursorInfo,
89 SetConsoleCursorPosition,
90 SetConsoleScreenBufferSize,
91 SetConsoleTitleW,
92 WriteConsoleInput,
93 WriteConsoleOutput,
94 CreateFile,
95 DeviceIoControl,
96 CreateDirectory,
97 RemoveDirectory,
98 GetFileAttributes,
99 SetFileAttributes,
100 CreateFileMapping,
101 CloseHandle,
102 DeleteFile,
103 FindFirstFile,
104 FindNextFile,
105 FindClose,
106 FlushFileBuffers,
107 GetEnvironmentVariable,
108 GetLastError,
109 SetErrorMode,
110 GetStdHandle,
111 MapViewOfFileEx,
112 ReadFile,
113 SetEndOfFile,
114 SetFilePointer,
115 WriteFile,
116 GetFileInformationByHandle,
117 GetDiskFreeSpace,
118 GetDiskFreeSpaceEx,
119 MoveFile,
120 SetFileTime,
121 SystemTimeToFileTime,
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 swprintf,
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 };
175
176 #pragma warning(default : 4232)
177
178 EFI_WIN_NT_THUNK_PROTOCOL *gWinNt = &mWinNtThunkTable;