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 #define EFI_WIN_NT_THUNK_PROTOCOL_GUID \
34 { 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
39 (WINAPI
*WinNtSleep
) (
46 (WINAPI
*WinNtSuspendThread
) (
53 (WINAPI
*WinNtGetCurrentThread
) (
60 (WINAPI
*WinNtGetCurrentThreadId
) (
67 (WINAPI
*WinNtGetCurrentProcess
) (
74 (WINAPI
*WinNtCreateThread
) (
75 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
77 LPTHREAD_START_ROUTINE lpStartAddress
,
79 DWORD dwCreationFlags
,
86 (WINAPI
*WinNtTerminateThread
) (
94 (WINAPI
*WinNtSendMessage
) (
104 (WINAPI
*WinNtExitThread
) (
111 (WINAPI
*WinNtResumeThread
) (
118 (WINAPI
*WinNtSetThreadPriority
) (
126 (WINAPI
*WinNtInitializeCriticalSection
) (
127 LPCRITICAL_SECTION lpCriticalSection
133 (WINAPI
*WinNtDeleteCriticalSection
) (
134 LPCRITICAL_SECTION lpCriticalSection
140 (WINAPI
*WinNtEnterCriticalSection
) (
141 LPCRITICAL_SECTION lpCriticalSection
147 (WINAPI
*WinNtLeaveCriticalSection
) (
148 LPCRITICAL_SECTION lpCriticalSection
154 (WINAPI
*WinNtTlsAlloc
) (
161 (WINAPI
*WinNtTlsGetValue
) (
168 (WINAPI
*WinNtTlsSetValue
) (
176 (WINAPI
*WinNtTlsFree
) (
183 (WINAPI
*WinNtCreateSemaphore
) (
184 LPSECURITY_ATTRIBUTES lpSemaphoreAttributes
,
193 (WINAPI
*WinNtWaitForSingleObject
) (
201 (WINAPI
*WinNtReleaseSemaphore
) (
204 LPLONG lpPreviousCount
210 (WINAPI
*WinNtDuplicateHandle
) (
211 HANDLE hSourceProcessHandle
,
212 HANDLE hSourceHandle
,
213 HANDLE hTargetProcessHandle
,
214 LPHANDLE lpTargetHandle
,
215 DWORD dwDesiredAccess
,
223 (WINAPI
*WinNtCreateConsoleScreenBuffer
) (
226 CONST SECURITY_ATTRIBUTES
*SecurityAttributes
,
228 LPVOID ScreenBufferData
234 (WINAPI
*WinNtSetConsoleScreenBufferSize
) (
235 HANDLE ConsoleOutput
,
242 (WINAPI
*WinNtSetConsoleActiveScreenBuffer
) (
249 (WINAPI
*WinNtFillConsoleOutputAttribute
) (
250 HANDLE ConsoleOutput
,
254 LPDWORD NumberOfAttrsWritten
260 (WINAPI
*WinNtFillConsoleOutputCharacter
) (
261 HANDLE ConsoleOutput
,
265 LPDWORD NumberOfCharsWritten
271 (WINAPI
*WinNtWriteConsoleOutput
) (
272 HANDLE ConsoleOutput
,
273 CONST CHAR_INFO
*Buffer
,
276 PSMALL_RECT WriteRegion
282 (WINAPI
*WinNtScrollConsoleScreenBuffer
) (
283 HANDLE ConsoleOutput
,
284 CONST SMALL_RECT
*ScrollRectangle
,
285 CONST SMALL_RECT
*ClipRectangle
,
286 COORD DestinationOrigin
,
287 CONST CHAR_INFO
*Fill
293 (WINAPI
*WinNtSetConsoleTitleW
) (
300 (WINAPI
*WinNtGetConsoleCursorInfo
) (
301 HANDLE ConsoleOutput
,
302 PCONSOLE_CURSOR_INFO ConsoleCursorInfo
308 (WINAPI
*WinNtSetConsoleCursorInfo
) (
309 HANDLE ConsoleOutput
,
310 CONST CONSOLE_CURSOR_INFO
*ConsoleCursorInfo
316 (WINAPI
*WinNtSetPriorityClass
) (
324 (WINAPI
*WinNtWriteConsoleInput
) (
326 CONST INPUT_RECORD
*Buffer
,
328 LPDWORD NumberOfEventsWritten
334 (WINAPI
*WinNtGetNumberOfConsoleInputEvents
) (
336 LPDWORD NumberOfEvents
342 (WINAPI
*WinNtGetStdHandle
) (
349 (WINAPI
*WinNtReadConsoleInput
) (
351 PINPUT_RECORD Buffer
,
353 LPDWORD NumberOfEventsRead
359 (WINAPI
*WinNtPeekConsoleInput
) (
361 PINPUT_RECORD Buffer
,
363 LPDWORD NumberOfEventsRead
369 (WINAPI
*WinNtSetConsoleCursorPosition
) (
377 (WINAPI
*WinNtCreateFile
) (
381 LPSECURITY_ATTRIBUTES SecurityAttributes
,
382 DWORD CreationDisposition
,
383 DWORD FlagsAndAttributes
,
390 (WINAPI
*WinNtDeviceIoControl
) (
397 LPDWORD BytesReturned
,
398 LPOVERLAPPED Overlapped
404 (WINAPI
*WinNtCreateDirectory
) (
406 LPSECURITY_ATTRIBUTES SecurityAttributes
412 (WINAPI
*WinNtRemoveDirectory
) (
419 (WINAPI
*WinNtGetFileAttributes
) (
426 (WINAPI
*WinNtSetFileAttributes
) (
434 (WINAPI
*WinNtCreateFileMapping
) (
436 LPSECURITY_ATTRIBUTES Attributes
,
438 DWORD MaximumSizeHigh
,
439 DWORD MaximumSizeLow
,
446 (WINAPI
*WinNtMapViewOfFileEx
) (
449 DWORD FileOffsetHigh
,
451 DWORD NumberOfBytesToMap
,
458 (WINAPI
*WinNtGetEnvironmentVariable
) (
467 (WINAPI
*WinNtCloseHandle
) (
474 (WINAPI
*WinNtSetFilePointer
) (
477 PLONG DistanceToHoveHigh
,
484 (WINAPI
*WinNtSetEndOfFile
) (
491 (WINAPI
*WinNtReadFile
) (
494 DWORD NumberOfBytesToRead
,
495 LPDWORD NumberOfBytesRead
,
496 LPOVERLAPPED Overlapped
502 (WINAPI
*WinNtWriteFile
) (
505 DWORD NumberOfBytesToWrite
,
506 LPDWORD NumberOfBytesWritten
,
507 LPOVERLAPPED Overlapped
513 (WINAPI
*WinNtGetFileInformationByHandle
) (
515 BY_HANDLE_FILE_INFORMATION
*FileInfo
521 (WINAPI
*WinNtGetDiskFreeSpace
) (
522 LPCTSTR RootPathName
,
523 LPDWORD SectorsPerCluster
,
524 LPDWORD BytesPerSector
,
525 LPDWORD NumberOfFreeClusters
,
526 LPDWORD TotalNumberOfClusters
532 (WINAPI
*WinNtGetDiskFreeSpaceEx
) (
533 LPCTSTR DirectoryName
,
534 PULARGE_INTEGER FreeBytesAvailable
,
535 PULARGE_INTEGER TotalNumberOfBytes
,
536 PULARGE_INTEGER TotoalNumberOfFreeBytes
542 (WINAPI
*WinNtMoveFile
) (
543 LPCTSTR ExistingFileName
,
550 (WINAPI
*WinNtSetFileTime
) (
552 FILETIME
*CreationTime
,
553 FILETIME
*LastAccessTime
,
554 FILETIME
*LastWriteTime
560 (WINAPI
*WinNtSystemTimeToFileTime
) (
561 SYSTEMTIME
* SystemTime
,
568 (WINAPI
*WinNtDeleteFile
) (
575 (WINAPI
*WinNtFlushFileBuffers
) (
582 (WINAPI
*WinNtGetLastError
) (
589 (WINAPI
*WinNtSetErrorMode
) (
596 (WINAPI
*WinNtGetTickCount
) (
603 (WINAPI
*WinNtLoadLibraryEx
) (
612 (WINAPI
*WinNtGetProcAddress
) (
620 (WINAPI
*WinNtGetTimeZoneInformation
) (
621 LPTIME_ZONE_INFORMATION timeZoneInformation
627 (WINAPI
*WinNttimeSetEvent
) (
630 LPTIMECALLBACK lpTimeProc
,
638 (WINAPI
*WinNttimeKillEvent
) (
645 (WINAPI
*WinNtSetTimeZoneInformation
) (
646 LPTIME_ZONE_INFORMATION timeZoneInformation
652 (WINAPI
*WinNtGetSystemTime
) (
653 LPSYSTEMTIME SystemTime
659 (WINAPI
*WinNtSetSystemTime
) (
660 CONST SYSTEMTIME
*SystemTime
666 (WINAPI
*WinNtGetLocalTime
) (
667 LPSYSTEMTIME SystemTime
673 (WINAPI
*WinNtSetLocalTime
) (
674 CONST SYSTEMTIME
*SystemTime
680 (WINAPI
*WinNtFileTimeToLocalFileTime
) (
681 CONST FILETIME
*FileTime
,
682 LPFILETIME LocalFileTime
688 (WINAPI
*WinNtFileTimeToSystemTime
) (
689 CONST FILETIME
*FileTime
,
690 LPSYSTEMTIME SystemTime
696 (WINAPI
*WinNtFindFirstFile
) (
698 LPWIN32_FIND_DATA FindFileData
704 (WINAPI
*WinNtFindNextFile
) (
706 LPWIN32_FIND_DATA FindFileData
712 (WINAPI
*WinNtFindClose
) (
719 (WINAPI
*WinNtGetCommState
) (
727 (WINAPI
*WinNtSetCommState
) (
735 (WINAPI
*WinNtSetCommState
) (
743 (WINAPI
*WinNtSetCommTimeouts
) (
745 LPCOMMTIMEOUTS CommTimeouts
751 (WINAPI
*WinNtExitProcess
) (
752 UINT uExitCode
// exit code for all threads
758 (WINAPI
*WinNtPurgeComm
) (
766 (WINAPI
*WinNtEscapeCommFunction
) (
774 (WINAPI
*WinNtGetCommModemStatus
) (
782 (WINAPI
*WinNtClearCommError
) (
791 (WINAPIV
*WinNtSprintf
) (
801 (WINAPI
*WinNtGetDesktopWindow
) (
808 (WINAPI
*WinNtGetForegroundWindow
) (
815 (WINAPI
*WinNtCreateWindowEx
) (
818 LPCTSTR lpWindowName
,
833 (WINAPI
*WinNtUpdateWindow
) (
840 (WINAPI
*WinNtShowWindow
) (
848 (WINAPI
*WinNtDestroyWindow
) (
855 (WINAPI
*WinNtGetWindowDC
) (
862 (WINAPI
*WinNtGetClientRect
) (
870 (WINAPI
*WinNtAdjustWindowRect
) (
879 (WINAPI
*WinNtSetDIBitsToDevice
) (
897 (WINAPI
*WinNtBitBlt
) (
912 (WINAPI
*WinNtInvalidateRect
) (
921 (WINAPI
*WinNtGetDC
) (
928 (WINAPI
*WinNtReleaseDC
) (
936 (WINAPI
*WinNtRegisterClassEx
) (
943 (WINAPI
*WinNtUnregisterClass
) (
951 (WINAPI
*WinNtBeginPaint
) (
953 LPPAINTSTRUCT lpPaint
959 (WINAPI
*WinNtEndPaint
) (
961 CONST PAINTSTRUCT
*lpPaint
967 (WINAPI
*WinNtPostQuitMessage
) (
974 (WINAPI
*WinNtDefWindowProc
) (
984 (WINAPI
*WinNtLoadIcon
) (
992 (WINAPI
*WinNtLoadCursor
) (
1000 (WINAPI
*WinNtGetStockObject
) (
1007 (WINAPI
*WinNtSetViewportOrgEx
) (
1017 (WINAPI
*WinNtSetWindowOrgEx
) (
1026 (WINAPI
*WinNtMoveWindow
) (
1038 (WINAPI
*WinNtGetWindowRect
) (
1046 (WINAPI
*WinNtGetMessage
) (
1056 (WINAPI
*WinNtTranslateMessage
) (
1063 (WINAPI
*WinNtDispatchMessage
) (
1070 (WINAPI
*WinNtGetProcessHeap
) ();
1075 (WINAPI
*WinNtHeapAlloc
) (
1084 (WINAPI
*WinNtHeapFree
) (
1093 (WINAPI
*WinNtFreeLibrary
) (
1100 #define EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'T', 'T')
1106 // Win32 Process APIs
1108 WinNtGetProcAddress GetProcAddress
;
1109 WinNtGetTickCount GetTickCount
;
1110 WinNtLoadLibraryEx LoadLibraryEx
;
1111 WinNtFreeLibrary FreeLibrary
;
1113 WinNtSetPriorityClass SetPriorityClass
;
1114 WinNtSetThreadPriority SetThreadPriority
;
1117 WinNtSuspendThread SuspendThread
;
1118 WinNtGetCurrentThread GetCurrentThread
;
1119 WinNtGetCurrentThreadId GetCurrentThreadId
;
1120 WinNtGetCurrentProcess GetCurrentProcess
;
1121 WinNtCreateThread CreateThread
;
1122 WinNtTerminateThread TerminateThread
;
1123 WinNtSendMessage SendMessage
;
1124 WinNtExitThread ExitThread
;
1125 WinNtResumeThread ResumeThread
;
1126 WinNtDuplicateHandle DuplicateHandle
;
1129 // Wint32 Mutex primitive
1131 WinNtInitializeCriticalSection InitializeCriticalSection
;
1132 WinNtEnterCriticalSection EnterCriticalSection
;
1133 WinNtLeaveCriticalSection LeaveCriticalSection
;
1134 WinNtDeleteCriticalSection DeleteCriticalSection
;
1135 WinNtTlsAlloc TlsAlloc
;
1136 WinNtTlsFree TlsFree
;
1137 WinNtTlsSetValue TlsSetValue
;
1138 WinNtTlsGetValue TlsGetValue
;
1139 WinNtCreateSemaphore CreateSemaphore
;
1140 WinNtWaitForSingleObject WaitForSingleObject
;
1141 WinNtReleaseSemaphore ReleaseSemaphore
;
1144 // Win32 Console APIs
1146 WinNtCreateConsoleScreenBuffer CreateConsoleScreenBuffer
;
1147 WinNtFillConsoleOutputAttribute FillConsoleOutputAttribute
;
1148 WinNtFillConsoleOutputCharacter FillConsoleOutputCharacter
;
1149 WinNtGetConsoleCursorInfo GetConsoleCursorInfo
;
1150 WinNtGetNumberOfConsoleInputEvents GetNumberOfConsoleInputEvents
;
1151 WinNtPeekConsoleInput PeekConsoleInput
;
1152 WinNtScrollConsoleScreenBuffer ScrollConsoleScreenBuffer
;
1153 WinNtReadConsoleInput ReadConsoleInput
;
1155 WinNtSetConsoleActiveScreenBuffer SetConsoleActiveScreenBuffer
;
1156 WinNtSetConsoleCursorInfo SetConsoleCursorInfo
;
1157 WinNtSetConsoleCursorPosition SetConsoleCursorPosition
;
1158 WinNtSetConsoleScreenBufferSize SetConsoleScreenBufferSize
;
1159 WinNtSetConsoleTitleW SetConsoleTitleW
;
1160 WinNtWriteConsoleInput WriteConsoleInput
;
1161 WinNtWriteConsoleOutput WriteConsoleOutput
;
1166 WinNtCreateFile CreateFile
;
1167 WinNtDeviceIoControl DeviceIoControl
;
1168 WinNtCreateDirectory CreateDirectory
;
1169 WinNtRemoveDirectory RemoveDirectory
;
1170 WinNtGetFileAttributes GetFileAttributes
;
1171 WinNtSetFileAttributes SetFileAttributes
;
1172 WinNtCreateFileMapping CreateFileMapping
;
1173 WinNtCloseHandle CloseHandle
;
1174 WinNtDeleteFile DeleteFile
;
1175 WinNtFindFirstFile FindFirstFile
;
1176 WinNtFindNextFile FindNextFile
;
1177 WinNtFindClose FindClose
;
1178 WinNtFlushFileBuffers FlushFileBuffers
;
1179 WinNtGetEnvironmentVariable GetEnvironmentVariable
;
1180 WinNtGetLastError GetLastError
;
1181 WinNtSetErrorMode SetErrorMode
;
1182 WinNtGetStdHandle GetStdHandle
;
1183 WinNtMapViewOfFileEx MapViewOfFileEx
;
1184 WinNtReadFile ReadFile
;
1185 WinNtSetEndOfFile SetEndOfFile
;
1186 WinNtSetFilePointer SetFilePointer
;
1187 WinNtWriteFile WriteFile
;
1188 WinNtGetFileInformationByHandle GetFileInformationByHandle
;
1189 WinNtGetDiskFreeSpace GetDiskFreeSpace
;
1190 WinNtGetDiskFreeSpaceEx GetDiskFreeSpaceEx
;
1191 WinNtMoveFile MoveFile
;
1192 WinNtSetFileTime SetFileTime
;
1193 WinNtSystemTimeToFileTime SystemTimeToFileTime
;
1198 WinNtFileTimeToLocalFileTime FileTimeToLocalFileTime
;
1199 WinNtFileTimeToSystemTime FileTimeToSystemTime
;
1200 WinNtGetSystemTime GetSystemTime
;
1201 WinNtSetSystemTime SetSystemTime
;
1202 WinNtGetLocalTime GetLocalTime
;
1203 WinNtSetLocalTime SetLocalTime
;
1204 WinNtGetTimeZoneInformation GetTimeZoneInformation
;
1205 WinNtSetTimeZoneInformation SetTimeZoneInformation
;
1206 WinNttimeSetEvent timeSetEvent
;
1207 WinNttimeKillEvent timeKillEvent
;
1210 // Win32 Serial APIs
1212 WinNtClearCommError ClearCommError
;
1213 WinNtEscapeCommFunction EscapeCommFunction
;
1214 WinNtGetCommModemStatus GetCommModemStatus
;
1215 WinNtGetCommState GetCommState
;
1216 WinNtSetCommState SetCommState
;
1217 WinNtPurgeComm PurgeComm
;
1218 WinNtSetCommTimeouts SetCommTimeouts
;
1220 WinNtExitProcess ExitProcess
;
1222 WinNtSprintf SPrintf
;
1224 WinNtGetDesktopWindow GetDesktopWindow
;
1225 WinNtGetForegroundWindow GetForegroundWindow
;
1226 WinNtCreateWindowEx CreateWindowEx
;
1227 WinNtShowWindow ShowWindow
;
1228 WinNtUpdateWindow UpdateWindow
;
1229 WinNtDestroyWindow DestroyWindow
;
1230 WinNtInvalidateRect InvalidateRect
;
1231 WinNtGetWindowDC GetWindowDC
;
1232 WinNtGetClientRect GetClientRect
;
1233 WinNtAdjustWindowRect AdjustWindowRect
;
1234 WinNtSetDIBitsToDevice SetDIBitsToDevice
;
1237 WinNtReleaseDC ReleaseDC
;
1238 WinNtRegisterClassEx RegisterClassEx
;
1239 WinNtUnregisterClass UnregisterClass
;
1241 WinNtBeginPaint BeginPaint
;
1242 WinNtEndPaint EndPaint
;
1243 WinNtPostQuitMessage PostQuitMessage
;
1244 WinNtDefWindowProc DefWindowProc
;
1245 WinNtLoadIcon LoadIcon
;
1246 WinNtLoadCursor LoadCursor
;
1247 WinNtGetStockObject GetStockObject
;
1248 WinNtSetViewportOrgEx SetViewportOrgEx
;
1249 WinNtSetWindowOrgEx SetWindowOrgEx
;
1250 WinNtMoveWindow MoveWindow
;
1251 WinNtGetWindowRect GetWindowRect
;
1253 WinNtGetMessage GetMessage
;
1254 WinNtTranslateMessage TranslateMessage
;
1255 WinNtDispatchMessage DispatchMessage
;
1257 WinNtGetProcessHeap GetProcessHeap
;
1258 WinNtHeapAlloc HeapAlloc
;
1259 WinNtHeapFree HeapFree
;
1261 } EFI_WIN_NT_THUNK_PROTOCOL
;
1263 extern EFI_GUID gEfiWinNtThunkProtocolGuid
;