3 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
4 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
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.
18 This protocol allows an EFI driver (DLL) in the NT emulation envirnment
19 to make Win32 API calls.
21 NEVER make a Win32 call directly, always make the call via this protocol.
23 There are no This pointers on the protocol member functions as they map
24 exactly into Win32 system calls.
26 YOU MUST include EfiWinNT.h in place of Efi.h to make this file compile.
30 #ifndef __WIN_NT_THUNK_H__
31 #define __WIN_NT_THUNK_H__
33 #include <Common/WinNtInclude.h>
35 #define EFI_WIN_NT_THUNK_PROTOCOL_GUID \
36 { 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
41 (WINAPI
*WinNtSleep
) (
48 (WINAPI
*WinNtSuspendThread
) (
55 (WINAPI
*WinNtGetCurrentThread
) (
62 (WINAPI
*WinNtGetCurrentThreadId
) (
69 (WINAPI
*WinNtGetCurrentProcess
) (
76 (WINAPI
*WinNtCreateThread
) (
77 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
79 LPTHREAD_START_ROUTINE lpStartAddress
,
81 DWORD dwCreationFlags
,
88 (WINAPI
*WinNtTerminateThread
) (
96 (WINAPI
*WinNtSendMessage
) (
106 (WINAPI
*WinNtExitThread
) (
113 (WINAPI
*WinNtResumeThread
) (
120 (WINAPI
*WinNtSetThreadPriority
) (
128 (WINAPI
*WinNtInitializeCriticalSection
) (
129 LPCRITICAL_SECTION lpCriticalSection
135 (WINAPI
*WinNtDeleteCriticalSection
) (
136 LPCRITICAL_SECTION lpCriticalSection
142 (WINAPI
*WinNtEnterCriticalSection
) (
143 LPCRITICAL_SECTION lpCriticalSection
149 (WINAPI
*WinNtLeaveCriticalSection
) (
150 LPCRITICAL_SECTION lpCriticalSection
156 (WINAPI
*WinNtTlsAlloc
) (
163 (WINAPI
*WinNtTlsGetValue
) (
170 (WINAPI
*WinNtTlsSetValue
) (
178 (WINAPI
*WinNtTlsFree
) (
185 (WINAPI
*WinNtCreateSemaphore
) (
186 LPSECURITY_ATTRIBUTES lpSemaphoreAttributes
,
195 (WINAPI
*WinNtWaitForSingleObject
) (
203 (WINAPI
*WinNtReleaseSemaphore
) (
206 LPLONG lpPreviousCount
212 (WINAPI
*WinNtDuplicateHandle
) (
213 HANDLE hSourceProcessHandle
,
214 HANDLE hSourceHandle
,
215 HANDLE hTargetProcessHandle
,
216 LPHANDLE lpTargetHandle
,
217 DWORD dwDesiredAccess
,
225 (WINAPI
*WinNtCreateConsoleScreenBuffer
) (
228 CONST SECURITY_ATTRIBUTES
*SecurityAttributes
,
230 LPVOID ScreenBufferData
236 (WINAPI
*WinNtSetConsoleScreenBufferSize
) (
237 HANDLE ConsoleOutput
,
244 (WINAPI
*WinNtSetConsoleActiveScreenBuffer
) (
251 (WINAPI
*WinNtFillConsoleOutputAttribute
) (
252 HANDLE ConsoleOutput
,
256 LPDWORD NumberOfAttrsWritten
262 (WINAPI
*WinNtFillConsoleOutputCharacter
) (
263 HANDLE ConsoleOutput
,
267 LPDWORD NumberOfCharsWritten
273 (WINAPI
*WinNtWriteConsoleOutput
) (
274 HANDLE ConsoleOutput
,
275 CONST CHAR_INFO
*Buffer
,
278 PSMALL_RECT WriteRegion
284 (WINAPI
*WinNtScrollConsoleScreenBuffer
) (
285 HANDLE ConsoleOutput
,
286 CONST SMALL_RECT
*ScrollRectangle
,
287 CONST SMALL_RECT
*ClipRectangle
,
288 COORD DestinationOrigin
,
289 CONST CHAR_INFO
*Fill
295 (WINAPI
*WinNtSetConsoleTitleW
) (
302 (WINAPI
*WinNtGetConsoleCursorInfo
) (
303 HANDLE ConsoleOutput
,
304 PCONSOLE_CURSOR_INFO ConsoleCursorInfo
310 (WINAPI
*WinNtSetConsoleCursorInfo
) (
311 HANDLE ConsoleOutput
,
312 CONST CONSOLE_CURSOR_INFO
*ConsoleCursorInfo
318 (WINAPI
*WinNtSetPriorityClass
) (
326 (WINAPI
*WinNtWriteConsoleInput
) (
328 CONST INPUT_RECORD
*Buffer
,
330 LPDWORD NumberOfEventsWritten
336 (WINAPI
*WinNtGetNumberOfConsoleInputEvents
) (
338 LPDWORD NumberOfEvents
344 (WINAPI
*WinNtGetStdHandle
) (
351 (WINAPI
*WinNtReadConsoleInput
) (
353 PINPUT_RECORD Buffer
,
355 LPDWORD NumberOfEventsRead
361 (WINAPI
*WinNtPeekConsoleInput
) (
363 PINPUT_RECORD Buffer
,
365 LPDWORD NumberOfEventsRead
371 (WINAPI
*WinNtSetConsoleCursorPosition
) (
379 (WINAPI
*WinNtCreateFile
) (
383 LPSECURITY_ATTRIBUTES SecurityAttributes
,
384 DWORD CreationDisposition
,
385 DWORD FlagsAndAttributes
,
392 (WINAPI
*WinNtDeviceIoControl
) (
399 LPDWORD BytesReturned
,
400 LPOVERLAPPED Overlapped
406 (WINAPI
*WinNtCreateDirectory
) (
408 LPSECURITY_ATTRIBUTES SecurityAttributes
414 (WINAPI
*WinNtRemoveDirectory
) (
421 (WINAPI
*WinNtGetFileAttributes
) (
428 (WINAPI
*WinNtSetFileAttributes
) (
436 (WINAPI
*WinNtCreateFileMapping
) (
438 LPSECURITY_ATTRIBUTES Attributes
,
440 DWORD MaximumSizeHigh
,
441 DWORD MaximumSizeLow
,
448 (WINAPI
*WinNtMapViewOfFileEx
) (
451 DWORD FileOffsetHigh
,
453 DWORD NumberOfBytesToMap
,
460 (WINAPI
*WinNtGetEnvironmentVariable
) (
469 (WINAPI
*WinNtCloseHandle
) (
476 (WINAPI
*WinNtSetFilePointer
) (
479 PLONG DistanceToHoveHigh
,
486 (WINAPI
*WinNtSetEndOfFile
) (
493 (WINAPI
*WinNtReadFile
) (
496 DWORD NumberOfBytesToRead
,
497 LPDWORD NumberOfBytesRead
,
498 LPOVERLAPPED Overlapped
504 (WINAPI
*WinNtWriteFile
) (
507 DWORD NumberOfBytesToWrite
,
508 LPDWORD NumberOfBytesWritten
,
509 LPOVERLAPPED Overlapped
515 (WINAPI
*WinNtGetFileInformationByHandle
) (
517 BY_HANDLE_FILE_INFORMATION
*FileInfo
523 (WINAPI
*WinNtGetDiskFreeSpace
) (
524 LPCTSTR RootPathName
,
525 LPDWORD SectorsPerCluster
,
526 LPDWORD BytesPerSector
,
527 LPDWORD NumberOfFreeClusters
,
528 LPDWORD TotalNumberOfClusters
534 (WINAPI
*WinNtGetDiskFreeSpaceEx
) (
535 LPCTSTR DirectoryName
,
536 PULARGE_INTEGER FreeBytesAvailable
,
537 PULARGE_INTEGER TotalNumberOfBytes
,
538 PULARGE_INTEGER TotoalNumberOfFreeBytes
544 (WINAPI
*WinNtMoveFile
) (
545 LPCTSTR ExistingFileName
,
552 (WINAPI
*WinNtSetFileTime
) (
554 FILETIME
*CreationTime
,
555 FILETIME
*LastAccessTime
,
556 FILETIME
*LastWriteTime
562 (WINAPI
*WinNtSystemTimeToFileTime
) (
563 SYSTEMTIME
* SystemTime
,
570 (WINAPI
*WinNtDeleteFile
) (
577 (WINAPI
*WinNtFlushFileBuffers
) (
584 (WINAPI
*WinNtGetLastError
) (
591 (WINAPI
*WinNtSetErrorMode
) (
598 (WINAPI
*WinNtGetTickCount
) (
605 (WINAPI
*WinNtLoadLibraryEx
) (
614 (WINAPI
*WinNtGetProcAddress
) (
622 (WINAPI
*WinNtGetTimeZoneInformation
) (
623 LPTIME_ZONE_INFORMATION timeZoneInformation
629 (WINAPI
*WinNttimeSetEvent
) (
632 LPTIMECALLBACK lpTimeProc
,
640 (WINAPI
*WinNttimeKillEvent
) (
647 (WINAPI
*WinNtSetTimeZoneInformation
) (
648 LPTIME_ZONE_INFORMATION timeZoneInformation
654 (WINAPI
*WinNtGetSystemTime
) (
655 LPSYSTEMTIME SystemTime
661 (WINAPI
*WinNtSetSystemTime
) (
662 CONST SYSTEMTIME
*SystemTime
668 (WINAPI
*WinNtGetLocalTime
) (
669 LPSYSTEMTIME SystemTime
675 (WINAPI
*WinNtSetLocalTime
) (
676 CONST SYSTEMTIME
*SystemTime
682 (WINAPI
*WinNtLocalFileTimeToFileTime
) (
683 CONST FILETIME
*LocalFileTime
,
691 (WINAPI
*WinNtFileTimeToLocalFileTime
) (
692 CONST FILETIME
*FileTime
,
693 LPFILETIME LocalFileTime
699 (WINAPI
*WinNtFileTimeToSystemTime
) (
700 CONST FILETIME
*FileTime
,
701 LPSYSTEMTIME SystemTime
707 (WINAPI
*WinNtFindFirstFile
) (
709 LPWIN32_FIND_DATA FindFileData
715 (WINAPI
*WinNtFindNextFile
) (
717 LPWIN32_FIND_DATA FindFileData
723 (WINAPI
*WinNtFindClose
) (
730 (WINAPI
*WinNtGetCommState
) (
738 (WINAPI
*WinNtSetCommState
) (
746 (WINAPI
*WinNtSetCommState
) (
754 (WINAPI
*WinNtSetCommTimeouts
) (
756 LPCOMMTIMEOUTS CommTimeouts
762 (WINAPI
*WinNtExitProcess
) (
763 UINT uExitCode
// exit code for all threads
769 (WINAPI
*WinNtPurgeComm
) (
777 (WINAPI
*WinNtEscapeCommFunction
) (
785 (WINAPI
*WinNtGetCommModemStatus
) (
793 (WINAPI
*WinNtClearCommError
) (
802 (WINAPIV
*WinNtSprintf
) (
812 (WINAPI
*WinNtGetDesktopWindow
) (
819 (WINAPI
*WinNtGetForegroundWindow
) (
826 (WINAPI
*WinNtCreateWindowEx
) (
829 LPCTSTR lpWindowName
,
844 (WINAPI
*WinNtUpdateWindow
) (
851 (WINAPI
*WinNtShowWindow
) (
859 (WINAPI
*WinNtDestroyWindow
) (
866 (WINAPI
*WinNtGetWindowDC
) (
873 (WINAPI
*WinNtGetClientRect
) (
881 (WINAPI
*WinNtAdjustWindowRect
) (
890 (WINAPI
*WinNtSetDIBitsToDevice
) (
908 (WINAPI
*WinNtBitBlt
) (
923 (WINAPI
*WinNtInvalidateRect
) (
932 (WINAPI
*WinNtGetDC
) (
939 (WINAPI
*WinNtReleaseDC
) (
947 (WINAPI
*WinNtRegisterClassEx
) (
954 (WINAPI
*WinNtUnregisterClass
) (
962 (WINAPI
*WinNtBeginPaint
) (
964 LPPAINTSTRUCT lpPaint
970 (WINAPI
*WinNtEndPaint
) (
972 CONST PAINTSTRUCT
*lpPaint
978 (WINAPI
*WinNtPostQuitMessage
) (
985 (WINAPI
*WinNtDefWindowProc
) (
995 (WINAPI
*WinNtLoadIcon
) (
1003 (WINAPI
*WinNtLoadCursor
) (
1004 HINSTANCE hInstance
,
1005 LPCTSTR lpCursorName
1011 (WINAPI
*WinNtGetStockObject
) (
1018 (WINAPI
*WinNtSetViewportOrgEx
) (
1028 (WINAPI
*WinNtSetWindowOrgEx
) (
1037 (WINAPI
*WinNtMoveWindow
) (
1049 (WINAPI
*WinNtGetWindowRect
) (
1057 (WINAPI
*WinNtGetMessage
) (
1067 (WINAPI
*WinNtTranslateMessage
) (
1074 (WINAPI
*WinNtDispatchMessage
) (
1081 (WINAPI
*WinNtGetProcessHeap
) ();
1086 (WINAPI
*WinNtHeapAlloc
) (
1095 (WINAPI
*WinNtHeapFree
) (
1104 (WINAPI
*WinNtFreeLibrary
) (
1110 (WINAPI
*WinNtQueryPerformanceCounter
) (
1111 LARGE_INTEGER
*PerformanceCount
1117 (WINAPI
*WinNtQueryPerformanceFrequency
) (
1118 LARGE_INTEGER
*Frequency
1124 #define EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE SIGNATURE_32 ('N', 'T', 'T', 'T')
1130 // Win32 Process APIs
1132 WinNtGetProcAddress GetProcAddress
;
1133 WinNtGetTickCount GetTickCount
;
1134 WinNtLoadLibraryEx LoadLibraryEx
;
1135 WinNtFreeLibrary FreeLibrary
;
1137 WinNtSetPriorityClass SetPriorityClass
;
1138 WinNtSetThreadPriority SetThreadPriority
;
1141 WinNtSuspendThread SuspendThread
;
1142 WinNtGetCurrentThread GetCurrentThread
;
1143 WinNtGetCurrentThreadId GetCurrentThreadId
;
1144 WinNtGetCurrentProcess GetCurrentProcess
;
1145 WinNtCreateThread CreateThread
;
1146 WinNtTerminateThread TerminateThread
;
1147 WinNtSendMessage SendMessage
;
1148 WinNtExitThread ExitThread
;
1149 WinNtResumeThread ResumeThread
;
1150 WinNtDuplicateHandle DuplicateHandle
;
1153 // Wint32 Mutex primitive
1155 WinNtInitializeCriticalSection InitializeCriticalSection
;
1156 WinNtEnterCriticalSection EnterCriticalSection
;
1157 WinNtLeaveCriticalSection LeaveCriticalSection
;
1158 WinNtDeleteCriticalSection DeleteCriticalSection
;
1159 WinNtTlsAlloc TlsAlloc
;
1160 WinNtTlsFree TlsFree
;
1161 WinNtTlsSetValue TlsSetValue
;
1162 WinNtTlsGetValue TlsGetValue
;
1163 WinNtCreateSemaphore CreateSemaphore
;
1164 WinNtWaitForSingleObject WaitForSingleObject
;
1165 WinNtReleaseSemaphore ReleaseSemaphore
;
1168 // Win32 Console APIs
1170 WinNtCreateConsoleScreenBuffer CreateConsoleScreenBuffer
;
1171 WinNtFillConsoleOutputAttribute FillConsoleOutputAttribute
;
1172 WinNtFillConsoleOutputCharacter FillConsoleOutputCharacter
;
1173 WinNtGetConsoleCursorInfo GetConsoleCursorInfo
;
1174 WinNtGetNumberOfConsoleInputEvents GetNumberOfConsoleInputEvents
;
1175 WinNtPeekConsoleInput PeekConsoleInput
;
1176 WinNtScrollConsoleScreenBuffer ScrollConsoleScreenBuffer
;
1177 WinNtReadConsoleInput ReadConsoleInput
;
1179 WinNtSetConsoleActiveScreenBuffer SetConsoleActiveScreenBuffer
;
1180 WinNtSetConsoleCursorInfo SetConsoleCursorInfo
;
1181 WinNtSetConsoleCursorPosition SetConsoleCursorPosition
;
1182 WinNtSetConsoleScreenBufferSize SetConsoleScreenBufferSize
;
1183 WinNtSetConsoleTitleW SetConsoleTitleW
;
1184 WinNtWriteConsoleInput WriteConsoleInput
;
1185 WinNtWriteConsoleOutput WriteConsoleOutput
;
1190 WinNtCreateFile CreateFile
;
1191 WinNtDeviceIoControl DeviceIoControl
;
1192 WinNtCreateDirectory CreateDirectory
;
1193 WinNtRemoveDirectory RemoveDirectory
;
1194 WinNtGetFileAttributes GetFileAttributes
;
1195 WinNtSetFileAttributes SetFileAttributes
;
1196 WinNtCreateFileMapping CreateFileMapping
;
1197 WinNtCloseHandle CloseHandle
;
1198 WinNtDeleteFile DeleteFile
;
1199 WinNtFindFirstFile FindFirstFile
;
1200 WinNtFindNextFile FindNextFile
;
1201 WinNtFindClose FindClose
;
1202 WinNtFlushFileBuffers FlushFileBuffers
;
1203 WinNtGetEnvironmentVariable GetEnvironmentVariable
;
1204 WinNtGetLastError GetLastError
;
1205 WinNtSetErrorMode SetErrorMode
;
1206 WinNtGetStdHandle GetStdHandle
;
1207 WinNtMapViewOfFileEx MapViewOfFileEx
;
1208 WinNtReadFile ReadFile
;
1209 WinNtSetEndOfFile SetEndOfFile
;
1210 WinNtSetFilePointer SetFilePointer
;
1211 WinNtWriteFile WriteFile
;
1212 WinNtGetFileInformationByHandle GetFileInformationByHandle
;
1213 WinNtGetDiskFreeSpace GetDiskFreeSpace
;
1214 WinNtGetDiskFreeSpaceEx GetDiskFreeSpaceEx
;
1215 WinNtMoveFile MoveFile
;
1216 WinNtSetFileTime SetFileTime
;
1217 WinNtSystemTimeToFileTime SystemTimeToFileTime
;
1222 WinNtLocalFileTimeToFileTime LocalFileTimeToFileTime
;
1223 WinNtFileTimeToLocalFileTime FileTimeToLocalFileTime
;
1224 WinNtFileTimeToSystemTime FileTimeToSystemTime
;
1225 WinNtGetSystemTime GetSystemTime
;
1226 WinNtSetSystemTime SetSystemTime
;
1227 WinNtGetLocalTime GetLocalTime
;
1228 WinNtSetLocalTime SetLocalTime
;
1229 WinNtGetTimeZoneInformation GetTimeZoneInformation
;
1230 WinNtSetTimeZoneInformation SetTimeZoneInformation
;
1231 WinNttimeSetEvent timeSetEvent
;
1232 WinNttimeKillEvent timeKillEvent
;
1235 // Win32 Serial APIs
1237 WinNtClearCommError ClearCommError
;
1238 WinNtEscapeCommFunction EscapeCommFunction
;
1239 WinNtGetCommModemStatus GetCommModemStatus
;
1240 WinNtGetCommState GetCommState
;
1241 WinNtSetCommState SetCommState
;
1242 WinNtPurgeComm PurgeComm
;
1243 WinNtSetCommTimeouts SetCommTimeouts
;
1245 WinNtExitProcess ExitProcess
;
1247 WinNtSprintf SPrintf
;
1249 WinNtGetDesktopWindow GetDesktopWindow
;
1250 WinNtGetForegroundWindow GetForegroundWindow
;
1251 WinNtCreateWindowEx CreateWindowEx
;
1252 WinNtShowWindow ShowWindow
;
1253 WinNtUpdateWindow UpdateWindow
;
1254 WinNtDestroyWindow DestroyWindow
;
1255 WinNtInvalidateRect InvalidateRect
;
1256 WinNtGetWindowDC GetWindowDC
;
1257 WinNtGetClientRect GetClientRect
;
1258 WinNtAdjustWindowRect AdjustWindowRect
;
1259 WinNtSetDIBitsToDevice SetDIBitsToDevice
;
1262 WinNtReleaseDC ReleaseDC
;
1263 WinNtRegisterClassEx RegisterClassEx
;
1264 WinNtUnregisterClass UnregisterClass
;
1266 WinNtBeginPaint BeginPaint
;
1267 WinNtEndPaint EndPaint
;
1268 WinNtPostQuitMessage PostQuitMessage
;
1269 WinNtDefWindowProc DefWindowProc
;
1270 WinNtLoadIcon LoadIcon
;
1271 WinNtLoadCursor LoadCursor
;
1272 WinNtGetStockObject GetStockObject
;
1273 WinNtSetViewportOrgEx SetViewportOrgEx
;
1274 WinNtSetWindowOrgEx SetWindowOrgEx
;
1275 WinNtMoveWindow MoveWindow
;
1276 WinNtGetWindowRect GetWindowRect
;
1278 WinNtGetMessage GetMessage
;
1279 WinNtTranslateMessage TranslateMessage
;
1280 WinNtDispatchMessage DispatchMessage
;
1282 WinNtGetProcessHeap GetProcessHeap
;
1283 WinNtHeapAlloc HeapAlloc
;
1284 WinNtHeapFree HeapFree
;
1286 WinNtQueryPerformanceCounter QueryPerformanceCounter
;
1287 WinNtQueryPerformanceFrequency QueryPerformanceFrequency
;
1289 } EFI_WIN_NT_THUNK_PROTOCOL
;
1291 extern EFI_GUID gEfiWinNtThunkProtocolGuid
;