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
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
*WinNtFileTimeToLocalFileTime
) (
683 CONST FILETIME
*FileTime
,
684 LPFILETIME LocalFileTime
690 (WINAPI
*WinNtFileTimeToSystemTime
) (
691 CONST FILETIME
*FileTime
,
692 LPSYSTEMTIME SystemTime
698 (WINAPI
*WinNtFindFirstFile
) (
700 LPWIN32_FIND_DATA FindFileData
706 (WINAPI
*WinNtFindNextFile
) (
708 LPWIN32_FIND_DATA FindFileData
714 (WINAPI
*WinNtFindClose
) (
721 (WINAPI
*WinNtGetCommState
) (
729 (WINAPI
*WinNtSetCommState
) (
737 (WINAPI
*WinNtSetCommState
) (
745 (WINAPI
*WinNtSetCommTimeouts
) (
747 LPCOMMTIMEOUTS CommTimeouts
753 (WINAPI
*WinNtExitProcess
) (
754 UINT uExitCode
// exit code for all threads
760 (WINAPI
*WinNtPurgeComm
) (
768 (WINAPI
*WinNtEscapeCommFunction
) (
776 (WINAPI
*WinNtGetCommModemStatus
) (
784 (WINAPI
*WinNtClearCommError
) (
793 (WINAPIV
*WinNtSprintf
) (
803 (WINAPI
*WinNtGetDesktopWindow
) (
810 (WINAPI
*WinNtGetForegroundWindow
) (
817 (WINAPI
*WinNtCreateWindowEx
) (
820 LPCTSTR lpWindowName
,
835 (WINAPI
*WinNtUpdateWindow
) (
842 (WINAPI
*WinNtShowWindow
) (
850 (WINAPI
*WinNtDestroyWindow
) (
857 (WINAPI
*WinNtGetWindowDC
) (
864 (WINAPI
*WinNtGetClientRect
) (
872 (WINAPI
*WinNtAdjustWindowRect
) (
881 (WINAPI
*WinNtSetDIBitsToDevice
) (
899 (WINAPI
*WinNtBitBlt
) (
914 (WINAPI
*WinNtInvalidateRect
) (
923 (WINAPI
*WinNtGetDC
) (
930 (WINAPI
*WinNtReleaseDC
) (
938 (WINAPI
*WinNtRegisterClassEx
) (
945 (WINAPI
*WinNtUnregisterClass
) (
953 (WINAPI
*WinNtBeginPaint
) (
955 LPPAINTSTRUCT lpPaint
961 (WINAPI
*WinNtEndPaint
) (
963 CONST PAINTSTRUCT
*lpPaint
969 (WINAPI
*WinNtPostQuitMessage
) (
976 (WINAPI
*WinNtDefWindowProc
) (
986 (WINAPI
*WinNtLoadIcon
) (
994 (WINAPI
*WinNtLoadCursor
) (
1002 (WINAPI
*WinNtGetStockObject
) (
1009 (WINAPI
*WinNtSetViewportOrgEx
) (
1019 (WINAPI
*WinNtSetWindowOrgEx
) (
1028 (WINAPI
*WinNtMoveWindow
) (
1040 (WINAPI
*WinNtGetWindowRect
) (
1048 (WINAPI
*WinNtGetMessage
) (
1058 (WINAPI
*WinNtTranslateMessage
) (
1065 (WINAPI
*WinNtDispatchMessage
) (
1072 (WINAPI
*WinNtGetProcessHeap
) ();
1077 (WINAPI
*WinNtHeapAlloc
) (
1086 (WINAPI
*WinNtHeapFree
) (
1095 (WINAPI
*WinNtFreeLibrary
) (
1102 #define EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'T', 'T')
1108 // Win32 Process APIs
1110 WinNtGetProcAddress GetProcAddress
;
1111 WinNtGetTickCount GetTickCount
;
1112 WinNtLoadLibraryEx LoadLibraryEx
;
1113 WinNtFreeLibrary FreeLibrary
;
1115 WinNtSetPriorityClass SetPriorityClass
;
1116 WinNtSetThreadPriority SetThreadPriority
;
1119 WinNtSuspendThread SuspendThread
;
1120 WinNtGetCurrentThread GetCurrentThread
;
1121 WinNtGetCurrentThreadId GetCurrentThreadId
;
1122 WinNtGetCurrentProcess GetCurrentProcess
;
1123 WinNtCreateThread CreateThread
;
1124 WinNtTerminateThread TerminateThread
;
1125 WinNtSendMessage SendMessage
;
1126 WinNtExitThread ExitThread
;
1127 WinNtResumeThread ResumeThread
;
1128 WinNtDuplicateHandle DuplicateHandle
;
1131 // Wint32 Mutex primitive
1133 WinNtInitializeCriticalSection InitializeCriticalSection
;
1134 WinNtEnterCriticalSection EnterCriticalSection
;
1135 WinNtLeaveCriticalSection LeaveCriticalSection
;
1136 WinNtDeleteCriticalSection DeleteCriticalSection
;
1137 WinNtTlsAlloc TlsAlloc
;
1138 WinNtTlsFree TlsFree
;
1139 WinNtTlsSetValue TlsSetValue
;
1140 WinNtTlsGetValue TlsGetValue
;
1141 WinNtCreateSemaphore CreateSemaphore
;
1142 WinNtWaitForSingleObject WaitForSingleObject
;
1143 WinNtReleaseSemaphore ReleaseSemaphore
;
1146 // Win32 Console APIs
1148 WinNtCreateConsoleScreenBuffer CreateConsoleScreenBuffer
;
1149 WinNtFillConsoleOutputAttribute FillConsoleOutputAttribute
;
1150 WinNtFillConsoleOutputCharacter FillConsoleOutputCharacter
;
1151 WinNtGetConsoleCursorInfo GetConsoleCursorInfo
;
1152 WinNtGetNumberOfConsoleInputEvents GetNumberOfConsoleInputEvents
;
1153 WinNtPeekConsoleInput PeekConsoleInput
;
1154 WinNtScrollConsoleScreenBuffer ScrollConsoleScreenBuffer
;
1155 WinNtReadConsoleInput ReadConsoleInput
;
1157 WinNtSetConsoleActiveScreenBuffer SetConsoleActiveScreenBuffer
;
1158 WinNtSetConsoleCursorInfo SetConsoleCursorInfo
;
1159 WinNtSetConsoleCursorPosition SetConsoleCursorPosition
;
1160 WinNtSetConsoleScreenBufferSize SetConsoleScreenBufferSize
;
1161 WinNtSetConsoleTitleW SetConsoleTitleW
;
1162 WinNtWriteConsoleInput WriteConsoleInput
;
1163 WinNtWriteConsoleOutput WriteConsoleOutput
;
1168 WinNtCreateFile CreateFile
;
1169 WinNtDeviceIoControl DeviceIoControl
;
1170 WinNtCreateDirectory CreateDirectory
;
1171 WinNtRemoveDirectory RemoveDirectory
;
1172 WinNtGetFileAttributes GetFileAttributes
;
1173 WinNtSetFileAttributes SetFileAttributes
;
1174 WinNtCreateFileMapping CreateFileMapping
;
1175 WinNtCloseHandle CloseHandle
;
1176 WinNtDeleteFile DeleteFile
;
1177 WinNtFindFirstFile FindFirstFile
;
1178 WinNtFindNextFile FindNextFile
;
1179 WinNtFindClose FindClose
;
1180 WinNtFlushFileBuffers FlushFileBuffers
;
1181 WinNtGetEnvironmentVariable GetEnvironmentVariable
;
1182 WinNtGetLastError GetLastError
;
1183 WinNtSetErrorMode SetErrorMode
;
1184 WinNtGetStdHandle GetStdHandle
;
1185 WinNtMapViewOfFileEx MapViewOfFileEx
;
1186 WinNtReadFile ReadFile
;
1187 WinNtSetEndOfFile SetEndOfFile
;
1188 WinNtSetFilePointer SetFilePointer
;
1189 WinNtWriteFile WriteFile
;
1190 WinNtGetFileInformationByHandle GetFileInformationByHandle
;
1191 WinNtGetDiskFreeSpace GetDiskFreeSpace
;
1192 WinNtGetDiskFreeSpaceEx GetDiskFreeSpaceEx
;
1193 WinNtMoveFile MoveFile
;
1194 WinNtSetFileTime SetFileTime
;
1195 WinNtSystemTimeToFileTime SystemTimeToFileTime
;
1200 WinNtFileTimeToLocalFileTime FileTimeToLocalFileTime
;
1201 WinNtFileTimeToSystemTime FileTimeToSystemTime
;
1202 WinNtGetSystemTime GetSystemTime
;
1203 WinNtSetSystemTime SetSystemTime
;
1204 WinNtGetLocalTime GetLocalTime
;
1205 WinNtSetLocalTime SetLocalTime
;
1206 WinNtGetTimeZoneInformation GetTimeZoneInformation
;
1207 WinNtSetTimeZoneInformation SetTimeZoneInformation
;
1208 WinNttimeSetEvent timeSetEvent
;
1209 WinNttimeKillEvent timeKillEvent
;
1212 // Win32 Serial APIs
1214 WinNtClearCommError ClearCommError
;
1215 WinNtEscapeCommFunction EscapeCommFunction
;
1216 WinNtGetCommModemStatus GetCommModemStatus
;
1217 WinNtGetCommState GetCommState
;
1218 WinNtSetCommState SetCommState
;
1219 WinNtPurgeComm PurgeComm
;
1220 WinNtSetCommTimeouts SetCommTimeouts
;
1222 WinNtExitProcess ExitProcess
;
1224 WinNtSprintf SPrintf
;
1226 WinNtGetDesktopWindow GetDesktopWindow
;
1227 WinNtGetForegroundWindow GetForegroundWindow
;
1228 WinNtCreateWindowEx CreateWindowEx
;
1229 WinNtShowWindow ShowWindow
;
1230 WinNtUpdateWindow UpdateWindow
;
1231 WinNtDestroyWindow DestroyWindow
;
1232 WinNtInvalidateRect InvalidateRect
;
1233 WinNtGetWindowDC GetWindowDC
;
1234 WinNtGetClientRect GetClientRect
;
1235 WinNtAdjustWindowRect AdjustWindowRect
;
1236 WinNtSetDIBitsToDevice SetDIBitsToDevice
;
1239 WinNtReleaseDC ReleaseDC
;
1240 WinNtRegisterClassEx RegisterClassEx
;
1241 WinNtUnregisterClass UnregisterClass
;
1243 WinNtBeginPaint BeginPaint
;
1244 WinNtEndPaint EndPaint
;
1245 WinNtPostQuitMessage PostQuitMessage
;
1246 WinNtDefWindowProc DefWindowProc
;
1247 WinNtLoadIcon LoadIcon
;
1248 WinNtLoadCursor LoadCursor
;
1249 WinNtGetStockObject GetStockObject
;
1250 WinNtSetViewportOrgEx SetViewportOrgEx
;
1251 WinNtSetWindowOrgEx SetWindowOrgEx
;
1252 WinNtMoveWindow MoveWindow
;
1253 WinNtGetWindowRect GetWindowRect
;
1255 WinNtGetMessage GetMessage
;
1256 WinNtTranslateMessage TranslateMessage
;
1257 WinNtDispatchMessage DispatchMessage
;
1259 WinNtGetProcessHeap GetProcessHeap
;
1260 WinNtHeapAlloc HeapAlloc
;
1261 WinNtHeapFree HeapFree
;
1263 } EFI_WIN_NT_THUNK_PROTOCOL
;
1265 extern EFI_GUID gEfiWinNtThunkProtocolGuid
;