Home | History | Annotate | Download | only in WinNtThunk
      1 /*++
      2 
      3 Copyright (c) 2004 - 2008, 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
      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.h
     15 
     16 Abstract:
     17 
     18   This protocol allows an EFI driver (DLL) in the NT emulation envirnment
     19   to make Win32 API calls.
     20 
     21   NEVER make a Win32 call directly, always make the call via this protocol.
     22 
     23   There are no This pointers on the protocol member functions as they map
     24   exactly into Win32 system calls.
     25 
     26   YOU MUST include EfiWinNT.h in place of Efi.h to make this file compile.
     27 
     28 --*/
     29 
     30 #ifndef _WIN_NT_THUNK_H_
     31 #define _WIN_NT_THUNK_H_
     32 
     33 #define EFI_WIN_NT_THUNK_PROTOCOL_GUID \
     34   { \
     35     0x58c518b1, 0x76f3, 0x11d4, {0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} \
     36   }
     37 
     38 //
     39 // The following APIs require EfiWinNT.h. In some environmnets the GUID
     40 // definitions are needed but the EfiWinNT.h is not included.
     41 // EfiWinNT.h is needed to support WINDOWS API requirements.
     42 //
     43 #ifdef _EFI_WIN_NT_H_
     44 
     45 typedef
     46 WINBASEAPI
     47 VOID
     48 (WINAPI *WinNtSleep) (
     49   DWORD Milliseconds
     50   );
     51 
     52 typedef
     53 WINBASEAPI
     54 DWORD
     55 (WINAPI *WinNtSuspendThread) (
     56   HANDLE hThread
     57   );
     58 
     59 typedef
     60 WINBASEAPI
     61 HANDLE
     62 (WINAPI *WinNtGetCurrentThread) (
     63   VOID
     64   );
     65 
     66 typedef
     67 WINBASEAPI
     68 DWORD
     69 (WINAPI *WinNtGetCurrentThreadId) (
     70   VOID
     71   );
     72 
     73 typedef
     74 WINBASEAPI
     75 HANDLE
     76 (WINAPI *WinNtGetCurrentProcess) (
     77   VOID
     78   );
     79 
     80 typedef
     81 WINBASEAPI
     82 HANDLE
     83 (WINAPI *WinNtCreateThread) (
     84   LPSECURITY_ATTRIBUTES   lpThreadAttributes,
     85   DWORD                   dwStackSize,
     86   LPTHREAD_START_ROUTINE  lpStartAddress,
     87   LPVOID                  lpParameter,
     88   DWORD                   dwCreationFlags,
     89   LPDWORD                 lpThreadId
     90   );
     91 
     92 typedef
     93 WINBASEAPI
     94 BOOL
     95 (WINAPI *WinNtTerminateThread) (
     96   HANDLE hThread,
     97   DWORD  dwExitCode
     98   );
     99 
    100 typedef
    101 WINBASEAPI
    102 BOOL
    103 (WINAPI *WinNtSendMessage) (
    104   HWND    hWnd,
    105   UINT    Msg,
    106   WPARAM  wParam,
    107   LPARAM  lParam
    108   );
    109 
    110 typedef
    111 WINBASEAPI
    112 VOID
    113 (WINAPI *WinNtExitThread) (
    114   DWORD   dwExitCode
    115   );
    116 
    117 typedef
    118 WINBASEAPI
    119 DWORD
    120 (WINAPI *WinNtResumeThread) (
    121   HANDLE hThread
    122   );
    123 
    124 typedef
    125 WINBASEAPI
    126 BOOL
    127 (WINAPI *WinNtSetThreadPriority) (
    128   HANDLE    hThread,
    129   INTN      nPriority
    130   );
    131 
    132 typedef
    133 WINBASEAPI
    134 VOID
    135 (WINAPI *WinNtInitializeCriticalSection) (
    136   LPCRITICAL_SECTION lpCriticalSection
    137   );
    138 
    139 typedef
    140 WINBASEAPI
    141 VOID
    142 (WINAPI *WinNtDeleteCriticalSection) (
    143   LPCRITICAL_SECTION lpCriticalSection
    144   );
    145 
    146 typedef
    147 WINBASEAPI
    148 VOID
    149 (WINAPI *WinNtEnterCriticalSection) (
    150   LPCRITICAL_SECTION lpCriticalSection
    151   );
    152 
    153 typedef
    154 WINBASEAPI
    155 VOID
    156 (WINAPI *WinNtLeaveCriticalSection) (
    157   LPCRITICAL_SECTION lpCriticalSection
    158   );
    159 
    160 typedef
    161 WINBASEAPI
    162 BOOL
    163 (WINAPI *WinNtTlsAlloc) (
    164   VOID
    165   );
    166 
    167 typedef
    168 WINBASEAPI
    169 LPVOID
    170 (WINAPI *WinNtTlsGetValue) (
    171   DWORD dwTlsIndex
    172   );
    173 
    174 typedef
    175 WINBASEAPI
    176 BOOL
    177 (WINAPI *WinNtTlsSetValue) (
    178   DWORD  dwTlsIndex,
    179   LPVOID lpTlsValue
    180   );
    181 
    182 typedef
    183 WINBASEAPI
    184 BOOL
    185 (WINAPI *WinNtTlsFree) (
    186   DWORD dwTlsIndex
    187   );
    188 
    189 typedef
    190 WINBASEAPI
    191 HANDLE
    192 (WINAPI *WinNtCreateSemaphore) (
    193   LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
    194   LONG                  lInitialCount,
    195   LONG                  lMaximumCount,
    196   LPCWSTR               lpName
    197   );
    198 
    199 typedef
    200 WINBASEAPI
    201 DWORD
    202 (WINAPI *WinNtWaitForSingleObject) (
    203   HANDLE  hHandle,
    204   DWORD   dwMilliseconds
    205   );
    206 
    207 typedef
    208 WINBASEAPI
    209 BOOL
    210 (WINAPI *WinNtReleaseSemaphore) (
    211   HANDLE  hSemaphore,
    212   LONG    lReleaseCount,
    213   LPLONG  lpPreviousCount
    214   );
    215 
    216 typedef
    217 WINBASEAPI
    218 BOOL
    219 (WINAPI *WinNtDuplicateHandle) (
    220   HANDLE   hSourceProcessHandle,
    221   HANDLE   hSourceHandle,
    222   HANDLE   hTargetProcessHandle,
    223   LPHANDLE lpTargetHandle,
    224   DWORD    dwDesiredAccess,
    225   BOOL     bInheritHandle,
    226   DWORD    dwOptions
    227   );
    228 
    229 typedef
    230 WINBASEAPI
    231 HANDLE
    232 (WINAPI *WinNtCreateConsoleScreenBuffer) (
    233   DWORD                       DesiredAccess,
    234   DWORD                       ShareMode,
    235   CONST SECURITY_ATTRIBUTES   *SecurityAttributes,
    236   DWORD                       Flags,
    237   LPVOID                      ScreenBufferData
    238   );
    239 
    240 typedef
    241 WINBASEAPI
    242 BOOL
    243 (WINAPI *WinNtSetConsoleScreenBufferSize) (
    244   HANDLE  ConsoleOutput,
    245   COORD   Size
    246   );
    247 
    248 typedef
    249 WINBASEAPI
    250 BOOL
    251 (WINAPI *WinNtSetConsoleActiveScreenBuffer) (
    252   HANDLE  ConsoleOutput
    253   );
    254 
    255 typedef
    256 WINBASEAPI
    257 BOOL
    258 (WINAPI *WinNtFillConsoleOutputAttribute) (
    259   HANDLE  ConsoleOutput,
    260   WORD    Attribute,
    261   DWORD   Length,
    262   COORD   WriteCoord,
    263   LPDWORD NumberOfAttrsWritten
    264   );
    265 
    266 typedef
    267 WINBASEAPI
    268 BOOL
    269 (WINAPI *WinNtFillConsoleOutputCharacter) (
    270   HANDLE  ConsoleOutput,
    271   TCHAR   Character,
    272   DWORD   Length,
    273   COORD   WriteCoord,
    274   LPDWORD NumberOfCharsWritten
    275   );
    276 
    277 typedef
    278 WINBASEAPI
    279 BOOL
    280 (WINAPI *WinNtWriteConsoleOutput) (
    281   HANDLE          ConsoleOutput,
    282   CONST CHAR_INFO *Buffer,
    283   COORD           BufferSize,
    284   COORD           BufferCoord,
    285   PSMALL_RECT     WriteRegion
    286   );
    287 
    288 typedef
    289 WINBASEAPI
    290 BOOL
    291 (WINAPI *WinNtScrollConsoleScreenBuffer) (
    292   HANDLE            ConsoleOutput,
    293   CONST SMALL_RECT  *ScrollRectangle,
    294   CONST SMALL_RECT  *ClipRectangle,
    295   COORD             DestinationOrigin,
    296   CONST CHAR_INFO   *Fill
    297   );
    298 
    299 typedef
    300 WINBASEAPI
    301 BOOL
    302 (WINAPI *WinNtSetConsoleTitleW) (
    303   LPCTSTR   ConsoleTitle
    304   );
    305 
    306 typedef
    307 WINBASEAPI
    308 BOOL
    309 (WINAPI *WinNtGetConsoleCursorInfo) (
    310   HANDLE                ConsoleOutput,
    311   PCONSOLE_CURSOR_INFO  ConsoleCursorInfo
    312   );
    313 
    314 typedef
    315 WINBASEAPI
    316 BOOL
    317 (WINAPI *WinNtSetConsoleCursorInfo) (
    318   HANDLE                      ConsoleOutput,
    319   CONST CONSOLE_CURSOR_INFO   *ConsoleCursorInfo
    320   );
    321 
    322 typedef
    323 WINBASEAPI
    324 BOOL
    325 (WINAPI *WinNtSetPriorityClass) (
    326   HANDLE  Process,
    327   DWORD   PriorityClass
    328   );
    329 
    330 typedef
    331 WINBASEAPI
    332 BOOL
    333 (WINAPI *WinNtWriteConsoleInput) (
    334   HANDLE              ConsoleInput,
    335   CONST INPUT_RECORD  *Buffer,
    336   DWORD               Legnth,
    337   LPDWORD             NumberOfEventsWritten
    338   );
    339 
    340 typedef
    341 WINBASEAPI
    342 BOOL
    343 (WINAPI *WinNtGetNumberOfConsoleInputEvents) (
    344   HANDLE              ConsoleInput,
    345   LPDWORD             NumberOfEvents
    346   );
    347 
    348 typedef
    349 WINBASEAPI
    350 HANDLE
    351 (WINAPI *WinNtGetStdHandle) (
    352   DWORD   StdHandle
    353   );
    354 
    355 typedef
    356 WINBASEAPI
    357 BOOL
    358 (WINAPI *WinNtReadConsoleInput) (
    359   HANDLE              ConsoleInput,
    360   PINPUT_RECORD       Buffer,
    361   DWORD               Length,
    362   LPDWORD             NumberOfEventsRead
    363   );
    364 
    365 typedef
    366 WINBASEAPI
    367 BOOL
    368 (WINAPI *WinNtPeekConsoleInput) (
    369   HANDLE              ConsoleInput,
    370   PINPUT_RECORD       Buffer,
    371   DWORD               Length,
    372   LPDWORD             NumberOfEventsRead
    373   );
    374 
    375 typedef
    376 WINBASEAPI
    377 BOOL
    378 (WINAPI *WinNtSetConsoleCursorPosition) (
    379   HANDLE              ConsoleInput,
    380   COORD               CursorPosition
    381   );
    382 
    383 typedef
    384 WINBASEAPI
    385 HANDLE
    386 (WINAPI *WinNtCreateFile) (
    387   LPCWSTR               FileName,
    388   DWORD                 DesiredAccess,
    389   DWORD                 SharedMode,
    390   LPSECURITY_ATTRIBUTES SecurityAttributes,
    391   DWORD                 CreationDisposition,
    392   DWORD                 FlagsAndAttributes,
    393   HANDLE                TemplateFile
    394   );
    395 
    396 typedef
    397 WINBASEAPI
    398 BOOL
    399 (WINAPI *WinNtDeviceIoControl) (
    400   HANDLE                DeviceHandle,
    401   DWORD                 IoControlCode,
    402   LPVOID                InBuffer,
    403   DWORD                 InBufferSize,
    404   LPVOID                OutBuffer,
    405   DWORD                 OutBufferSize,
    406   LPDWORD               BytesReturned,
    407   LPOVERLAPPED          Overlapped
    408   );
    409 
    410 typedef
    411 WINBASEAPI
    412 BOOL
    413 (WINAPI *WinNtCreateDirectory) (
    414   LPCWSTR               PathName,
    415   LPSECURITY_ATTRIBUTES SecurityAttributes
    416   );
    417 
    418 typedef
    419 WINBASEAPI
    420 BOOL
    421 (WINAPI *WinNtRemoveDirectory) (
    422   LPCWSTR               PathName
    423   );
    424 
    425 typedef
    426 WINBASEAPI
    427 DWORD
    428 (WINAPI *WinNtGetFileAttributes) (
    429   LPCWSTR               FileName
    430   );
    431 
    432 typedef
    433 WINBASEAPI
    434 BOOL
    435 (WINAPI *WinNtSetFileAttributes) (
    436   LPCWSTR               FileName,
    437   DWORD                 FileAttributes
    438   );
    439 
    440 typedef
    441 WINBASEAPI
    442 HANDLE
    443 (WINAPI *WinNtCreateFileMapping) (
    444   HANDLE                  FileHandle,
    445   LPSECURITY_ATTRIBUTES   Attributes,
    446   DWORD                   Protect,
    447   DWORD                   MaximumSizeHigh,
    448   DWORD                   MaximumSizeLow,
    449   LPCTSTR                 Name
    450   );
    451 
    452 typedef
    453 WINBASEAPI
    454 LPVOID
    455 (WINAPI *WinNtMapViewOfFileEx) (
    456   HANDLE                  FileHandle,
    457   DWORD                   DesiredAccess,
    458   DWORD                   FileOffsetHigh,
    459   DWORD                   FileOffsetLow,
    460   DWORD                   NumberOfBytesToMap,
    461   LPVOID                  BaseAddress
    462   );
    463 
    464 typedef
    465 WINBASEAPI
    466 DWORD
    467 (WINAPI *WinNtGetEnvironmentVariable) (
    468   LPCTSTR Name,
    469   LPTSTR  Buffer,
    470   DWORD   Size
    471   );
    472 
    473 typedef
    474 WINBASEAPI
    475 BOOL
    476 (WINAPI *WinNtCloseHandle) (
    477   HANDLE    Object
    478   );
    479 
    480 typedef
    481 WINBASEAPI
    482 DWORD
    483 (WINAPI *WinNtSetFilePointer) (
    484   HANDLE    FileHandle,
    485   LONG      DistanceToMove,
    486   PLONG     DistanceToHoveHigh,
    487   DWORD     MoveMethod
    488   );
    489 
    490 typedef
    491 WINBASEAPI
    492 BOOL
    493 (WINAPI *WinNtSetEndOfFile) (
    494   HANDLE    FileHandle
    495   );
    496 
    497 typedef
    498 WINBASEAPI
    499 BOOL
    500 (WINAPI *WinNtReadFile) (
    501   HANDLE        FileHandle,
    502   LPVOID        Buffer,
    503   DWORD         NumberOfBytesToRead,
    504   LPDWORD       NumberOfBytesRead,
    505   LPOVERLAPPED  Overlapped
    506   );
    507 
    508 typedef
    509 WINBASEAPI
    510 BOOL
    511 (WINAPI *WinNtWriteFile) (
    512   HANDLE        FileHandle,
    513   LPCVOID       Buffer,
    514   DWORD         NumberOfBytesToWrite,
    515   LPDWORD       NumberOfBytesWritten,
    516   LPOVERLAPPED  Overlapped
    517   );
    518 
    519 typedef
    520 WINBASEAPI
    521 BOOL
    522 (WINAPI *WinNtGetFileInformationByHandle) (
    523   HANDLE                      FileHandle,
    524   BY_HANDLE_FILE_INFORMATION  *FileInfo
    525   );
    526 
    527 typedef
    528 WINBASEAPI
    529 BOOL
    530 (WINAPI *WinNtGetDiskFreeSpace) (
    531   LPCTSTR     RootPathName,
    532   LPDWORD     SectorsPerCluster,
    533   LPDWORD     BytesPerSector,
    534   LPDWORD     NumberOfFreeClusters,
    535   LPDWORD     TotalNumberOfClusters
    536   );
    537 
    538 typedef
    539 WINBASEAPI
    540 BOOL
    541 (WINAPI *WinNtGetDiskFreeSpaceEx) (
    542   LPCTSTR             DirectoryName,
    543   PULARGE_INTEGER     FreeBytesAvailable,
    544   PULARGE_INTEGER     TotalNumberOfBytes,
    545   PULARGE_INTEGER     TotoalNumberOfFreeBytes
    546   );
    547 
    548 typedef
    549 WINBASEAPI
    550 BOOL
    551 (WINAPI *WinNtMoveFile) (
    552   LPCTSTR     ExistingFileName,
    553   LPCTSTR     NewFileName
    554   );
    555 
    556 typedef
    557 WINBASEAPI
    558 BOOL
    559 (WINAPI *WinNtSetFileTime) (
    560   HANDLE      FileHandle,
    561   FILETIME    *CreationTime,
    562   FILETIME    *LastAccessTime,
    563   FILETIME    *LastWriteTime
    564   );
    565 
    566 typedef
    567 WINBASEAPI
    568 BOOL
    569 (WINAPI *WinNtSystemTimeToFileTime) (
    570   SYSTEMTIME  * SystemTime,
    571   FILETIME    * FileTime
    572   );
    573 
    574 typedef
    575 WINBASEAPI
    576 BOOL
    577 (WINAPI *WinNtDeleteFile) (
    578   LPCTSTR   FileName
    579   );
    580 
    581 typedef
    582 WINBASEAPI
    583 BOOL
    584 (WINAPI *WinNtFlushFileBuffers) (
    585   HANDLE
    586   );
    587 
    588 typedef
    589 WINBASEAPI
    590 DWORD
    591 (WINAPI *WinNtGetLastError) (
    592   VOID
    593   );
    594 
    595 typedef
    596 WINBASEAPI
    597 UINT
    598 (WINAPI *WinNtSetErrorMode) (
    599   UINT  Mode
    600   );
    601 
    602 typedef
    603 WINBASEAPI
    604 DWORD
    605 (WINAPI *WinNtGetTickCount) (
    606   VOID
    607   );
    608 
    609 typedef
    610 WINBASEAPI
    611 HMODULE
    612 (WINAPI *WinNtLoadLibraryEx) (
    613   LPCTSTR LibFileName,
    614   HANDLE  FileHandle,
    615   DWORD   Flags
    616   );
    617 
    618 typedef
    619 WINBASEAPI
    620 FARPROC
    621 (WINAPI *WinNtGetProcAddress) (
    622   HMODULE Module,
    623   LPCSTR  ProcName
    624   );
    625 
    626 typedef
    627 WINBASEAPI
    628 DWORD
    629 (WINAPI *WinNtGetTimeZoneInformation) (
    630   LPTIME_ZONE_INFORMATION timeZoneInformation
    631   );
    632 
    633 typedef
    634 WINBASEAPI
    635 MMRESULT
    636 (WINAPI *WinNttimeSetEvent) (
    637   UINT           uDelay,
    638   UINT           uResolution,
    639   LPTIMECALLBACK lpTimeProc,
    640   DWORD_PTR      dwUser,
    641   UINT           fuEvent
    642   );
    643 
    644 typedef
    645 WINBASEAPI
    646 MMRESULT
    647 (WINAPI *WinNttimeKillEvent) (
    648   UINT           uTimerID
    649   );
    650 
    651 typedef
    652 WINBASEAPI
    653 DWORD
    654 (WINAPI *WinNtSetTimeZoneInformation) (
    655   LPTIME_ZONE_INFORMATION timeZoneInformation
    656   );
    657 
    658 typedef
    659 WINBASEAPI
    660 VOID
    661 (WINAPI *WinNtGetSystemTime) (
    662   LPSYSTEMTIME        SystemTime
    663   );
    664 
    665 typedef
    666 WINBASEAPI
    667 BOOL
    668 (WINAPI *WinNtSetSystemTime) (
    669   CONST SYSTEMTIME    *SystemTime
    670   );
    671 
    672 typedef
    673 WINBASEAPI
    674 VOID
    675 (WINAPI *WinNtGetLocalTime) (
    676   LPSYSTEMTIME        SystemTime
    677   );
    678 
    679 typedef
    680 WINBASEAPI
    681 BOOL
    682 (WINAPI *WinNtSetLocalTime) (
    683   CONST SYSTEMTIME    *SystemTime
    684   );
    685 
    686 typedef
    687 WINBASEAPI
    688 BOOL
    689 (WINAPI *WinNtFileTimeToLocalFileTime) (
    690   CONST FILETIME  *FileTime,
    691   LPFILETIME      LocalFileTime
    692   );
    693 
    694 typedef
    695 WINBASEAPI
    696 BOOL
    697 (WINAPI *WinNtFileTimeToSystemTime) (
    698   CONST FILETIME  *FileTime,
    699   LPSYSTEMTIME    SystemTime
    700   );
    701 
    702 typedef
    703 WINBASEAPI
    704 HANDLE
    705 (WINAPI *WinNtFindFirstFile) (
    706   LPCTSTR           FileName,
    707   LPWIN32_FIND_DATA FindFileData
    708   );
    709 
    710 typedef
    711 WINBASEAPI
    712 BOOL
    713 (WINAPI *WinNtFindNextFile) (
    714   HANDLE            FindFile,
    715   LPWIN32_FIND_DATA FindFileData
    716   );
    717 
    718 typedef
    719 WINBASEAPI
    720 BOOL
    721 (WINAPI *WinNtFindClose) (
    722   HANDLE            FindFile
    723   );
    724 
    725 typedef
    726 WINBASEAPI
    727 BOOL
    728 (WINAPI *WinNtGetCommState) (
    729   HANDLE  FileHandle,
    730   LPDCB   DCB
    731   );
    732 
    733 typedef
    734 WINBASEAPI
    735 BOOL
    736 (WINAPI *WinNtSetCommState) (
    737   HANDLE  FileHandle,
    738   LPDCB   DCB
    739   );
    740 
    741 typedef
    742 WINBASEAPI
    743 BOOL
    744 (WINAPI *WinNtSetCommState) (
    745   HANDLE  FileHandle,
    746   LPDCB   DCB
    747   );
    748 
    749 typedef
    750 WINBASEAPI
    751 BOOL
    752 (WINAPI *WinNtSetCommTimeouts) (
    753   HANDLE          FileHandle,
    754   LPCOMMTIMEOUTS  CommTimeouts
    755   );
    756 
    757 typedef
    758 WINBASEAPI
    759 VOID
    760 (WINAPI *WinNtExitProcess) (
    761   UINT uExitCode  // exit code for all threads
    762   );
    763 
    764 typedef
    765 WINBASEAPI
    766 BOOL
    767 (WINAPI *WinNtPurgeComm) (
    768   HANDLE  FileHandle,
    769   DWORD   Flags
    770   );
    771 
    772 typedef
    773 WINBASEAPI
    774 BOOL
    775 (WINAPI *WinNtEscapeCommFunction) (
    776   HANDLE  FileHandle,
    777   DWORD   Func
    778   );
    779 
    780 typedef
    781 WINBASEAPI
    782 BOOL
    783 (WINAPI *WinNtGetCommModemStatus) (
    784   HANDLE  FileHandle,
    785   LPDWORD ModemStat
    786   );
    787 
    788 typedef
    789 WINBASEAPI
    790 BOOL
    791 (WINAPI *WinNtClearCommError) (
    792   HANDLE    FileHandle,
    793   LPDWORD   Errors,
    794   LPCOMSTAT Stat
    795   );
    796 
    797 typedef
    798 WINUSERAPI
    799 INT32
    800 (WINAPIV *WinNtSprintf) (
    801   LPWSTR    Buffer,
    802   LPCWSTR   String,
    803   ...
    804   );
    805 
    806 typedef
    807 WINUSERAPI
    808 HWND
    809 (WINAPI *WinNtGetDesktopWindow) (
    810   VOID
    811   );
    812 
    813 typedef
    814 WINUSERAPI
    815 HWND
    816 (WINAPI *WinNtGetForegroundWindow) (
    817   VOID
    818   );
    819 
    820 typedef
    821 WINUSERAPI
    822 HWND
    823 (WINAPI *WinNtCreateWindowEx) (
    824   DWORD     dwExStyle,
    825   LPCTSTR   lpClassName,
    826   LPCTSTR   lpWindowName,
    827   DWORD     dwStyle,
    828   INT32     x,
    829   INT32     y,
    830   INT32     nWidth,
    831   INT32     nHeight,
    832   HWND      hWndParent,
    833   HMENU     hMenu,
    834   HINSTANCE hInstance,
    835   LPVOID    *lpParam
    836   );
    837 
    838 typedef
    839 WINUSERAPI
    840 BOOL
    841 (WINAPI *WinNtUpdateWindow) (
    842   HWND      hWnd
    843   );
    844 
    845 typedef
    846 WINUSERAPI
    847 BOOL
    848 (WINAPI *WinNtShowWindow) (
    849   HWND        hWnd,
    850   INT32       nCmdShow
    851   );
    852 
    853 typedef
    854 WINGDIAPI
    855 BOOL
    856 (WINAPI *WinNtDestroyWindow) (
    857   HWND    hWnd
    858   );
    859 
    860 typedef
    861 WINUSERAPI
    862 HDC
    863 (WINAPI *WinNtGetWindowDC) (
    864   HWND    hWnd
    865   );
    866 
    867 typedef
    868 WINUSERAPI
    869 BOOL
    870 (WINAPI *WinNtGetClientRect) (
    871   HWND    hWnd,
    872   LPRECT  lpRect
    873   );
    874 
    875 typedef
    876 WINUSERAPI
    877 BOOL
    878 (WINAPI *WinNtAdjustWindowRect) (
    879   LPRECT  lpRect,
    880   DWORD   dwStyle,
    881   BOOL    bMenu
    882   );
    883 
    884 typedef
    885 WINGDIAPI
    886 INT32
    887 (WINAPI *WinNtSetDIBitsToDevice) (
    888   HDC,
    889   INT32,
    890   INT32,
    891   DWORD,
    892   DWORD,
    893   INT32,
    894   INT32,
    895   UINT,
    896   UINT,
    897   CONST VOID       *,
    898   CONST BITMAPINFO *,
    899   UINT
    900   );
    901 
    902 typedef
    903 WINGDIAPI
    904 BOOL
    905 (WINAPI *WinNtBitBlt) (
    906   HDC,
    907   INT32,
    908   INT32,
    909   INT32,
    910   INT32,
    911   HDC,
    912   INT32,
    913   INT32,
    914   DWORD
    915   );
    916 
    917 typedef
    918 WINUSERAPI
    919 BOOL
    920 (WINAPI *WinNtInvalidateRect) (
    921   HWND        hWnd,
    922   CONST RECT  *lpRect,
    923   BOOL        bErase
    924   );
    925 
    926 typedef
    927 WINUSERAPI
    928 HDC
    929 (WINAPI *WinNtGetDC) (
    930   HWND    hWnd
    931   );
    932 
    933 typedef
    934 WINUSERAPI
    935 INT32
    936 (WINAPI *WinNtReleaseDC) (
    937   HWND    hWnd,
    938   HDC     hDC
    939   );
    940 
    941 typedef
    942 WINUSERAPI
    943 ATOM
    944 (WINAPI *WinNtRegisterClassEx) (
    945   CONST   WNDCLASSEX *
    946   );
    947 
    948 typedef
    949 WINUSERAPI
    950 BOOL
    951 (WINAPI *WinNtUnregisterClass) (
    952   LPCTSTR   lpClassName,
    953   HINSTANCE hInstance
    954   );
    955 
    956 typedef
    957 WINUSERAPI
    958 HDC
    959 (WINAPI *WinNtBeginPaint) (
    960   HWND          hWnd,
    961   LPPAINTSTRUCT lpPaint
    962   );
    963 
    964 typedef
    965 WINUSERAPI
    966 BOOL
    967 (WINAPI *WinNtEndPaint) (
    968   HWND                hWnd,
    969   CONST PAINTSTRUCT   *lpPaint
    970   );
    971 
    972 typedef
    973 WINUSERAPI
    974 VOID
    975 (WINAPI *WinNtPostQuitMessage) (
    976   INT32   nExitCode
    977   );
    978 
    979 typedef
    980 WINUSERAPI
    981 LRESULT
    982 (WINAPI *WinNtDefWindowProc) (
    983   HWND    hWnd,
    984   UINT    Msg,
    985   WPARAM  wParam,
    986   LPARAM  lParam
    987   );
    988 
    989 typedef
    990 WINUSERAPI
    991 HICON
    992 (WINAPI *WinNtLoadIcon) (
    993   HINSTANCE hInstance,
    994   LPCTSTR   lpIconName
    995   );
    996 
    997 typedef
    998 WINUSERAPI
    999 HCURSOR
   1000 (WINAPI *WinNtLoadCursor) (
   1001   HINSTANCE   hInstance,
   1002   LPCTSTR     lpCursorName
   1003   );
   1004 
   1005 typedef
   1006 WINGDIAPI
   1007 HGDIOBJ
   1008 (WINAPI *WinNtGetStockObject) (
   1009   INT32
   1010   );
   1011 
   1012 typedef
   1013 WINGDIAPI
   1014 BOOL
   1015 (WINAPI *WinNtSetViewportOrgEx) (
   1016   HDC,
   1017   INT32,
   1018   INT32,
   1019   LPPOINT
   1020   );
   1021 
   1022 typedef
   1023 WINGDIAPI
   1024 BOOL
   1025 (WINAPI *WinNtSetWindowOrgEx) (
   1026   HDC,
   1027   INT32,
   1028   INT32,
   1029   LPPOINT
   1030   );
   1031 typedef
   1032 WINGDIAPI
   1033 BOOL
   1034 (WINAPI *WinNtMoveWindow) (
   1035   HWND,
   1036   INT32,
   1037   INT32,
   1038   INT32,
   1039   INT32,
   1040   BOOL
   1041   );
   1042 
   1043 typedef
   1044 WINGDIAPI
   1045 BOOL
   1046 (WINAPI *WinNtGetWindowRect) (
   1047   HWND,
   1048   LPRECT
   1049   );
   1050 
   1051 typedef
   1052 WINUSERAPI
   1053 BOOL
   1054 (WINAPI *WinNtGetMessage) (
   1055   LPMSG     lpMsg,
   1056   HWND      hWnd,
   1057   UINT      wMsgFilterMin,
   1058   UINT      wMsgFilterMax
   1059   );
   1060 
   1061 typedef
   1062 WINUSERAPI
   1063 BOOL
   1064 (WINAPI *WinNtTranslateMessage) (
   1065   CONST MSG *lpMsg
   1066   );
   1067 
   1068 typedef
   1069 WINUSERAPI
   1070 BOOL
   1071 (WINAPI *WinNtDispatchMessage) (
   1072   CONST MSG *lpMsg
   1073   );
   1074 
   1075 typedef
   1076 WINUSERAPI
   1077 HANDLE
   1078 (WINAPI *WinNtGetProcessHeap) ();
   1079 
   1080 typedef
   1081 WINUSERAPI
   1082 LPVOID
   1083 (WINAPI *WinNtHeapAlloc) (
   1084   HANDLE  hHeap,
   1085   DWORD   dwFlags,
   1086   SIZE_T  dwBytes
   1087   );
   1088 
   1089 typedef
   1090 WINUSERAPI
   1091 BOOL
   1092 (WINAPI *WinNtHeapFree) (
   1093   HANDLE  hHeap,
   1094   DWORD   dwFlags,
   1095   LPVOID  lpMem
   1096   );
   1097 
   1098 typedef
   1099 WINBASEAPI
   1100 BOOL
   1101 (WINAPI *WinNtFreeLibrary) (
   1102   HANDLE  ModHandle
   1103   );
   1104 //
   1105 //
   1106 //
   1107 EFI_FORWARD_DECLARATION (EFI_WIN_NT_THUNK_PROTOCOL);
   1108 
   1109 #define EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'T', 'T')
   1110 
   1111 typedef struct _EFI_WIN_NT_THUNK_PROTOCOL {
   1112   UINT64                              Signature;
   1113 
   1114   //
   1115   // Win32 Process APIs
   1116   //
   1117   WinNtGetProcAddress                 GetProcAddress;
   1118   WinNtGetTickCount                   GetTickCount;
   1119   WinNtLoadLibraryEx                  LoadLibraryEx;
   1120   WinNtFreeLibrary                    FreeLibrary;
   1121 
   1122   WinNtSetPriorityClass               SetPriorityClass;
   1123   WinNtSetThreadPriority              SetThreadPriority;
   1124   WinNtSleep                          Sleep;
   1125 
   1126   WinNtSuspendThread                  SuspendThread;
   1127   WinNtGetCurrentThread               GetCurrentThread;
   1128   WinNtGetCurrentThreadId             GetCurrentThreadId;
   1129   WinNtGetCurrentProcess              GetCurrentProcess;
   1130   WinNtCreateThread                   CreateThread;
   1131   WinNtTerminateThread                TerminateThread;
   1132   WinNtSendMessage                    SendMessage;
   1133   WinNtExitThread                     ExitThread;
   1134   WinNtResumeThread                   ResumeThread;
   1135   WinNtDuplicateHandle                DuplicateHandle;
   1136 
   1137   //
   1138   // Wint32 Mutex primitive
   1139   //
   1140   WinNtInitializeCriticalSection      InitializeCriticalSection;
   1141   WinNtEnterCriticalSection           EnterCriticalSection;
   1142   WinNtLeaveCriticalSection           LeaveCriticalSection;
   1143   WinNtDeleteCriticalSection          DeleteCriticalSection;
   1144   WinNtTlsAlloc                       TlsAlloc;
   1145   WinNtTlsFree                        TlsFree;
   1146   WinNtTlsSetValue                    TlsSetValue;
   1147   WinNtTlsGetValue                    TlsGetValue;
   1148   WinNtCreateSemaphore                CreateSemaphore;
   1149   WinNtWaitForSingleObject            WaitForSingleObject;
   1150   WinNtReleaseSemaphore               ReleaseSemaphore;
   1151 
   1152   //
   1153   // Win32 Console APIs
   1154   //
   1155   WinNtCreateConsoleScreenBuffer      CreateConsoleScreenBuffer;
   1156   WinNtFillConsoleOutputAttribute     FillConsoleOutputAttribute;
   1157   WinNtFillConsoleOutputCharacter     FillConsoleOutputCharacter;
   1158   WinNtGetConsoleCursorInfo           GetConsoleCursorInfo;
   1159   WinNtGetNumberOfConsoleInputEvents  GetNumberOfConsoleInputEvents;
   1160   WinNtPeekConsoleInput               PeekConsoleInput;
   1161   WinNtScrollConsoleScreenBuffer      ScrollConsoleScreenBuffer;
   1162   WinNtReadConsoleInput               ReadConsoleInput;
   1163 
   1164   WinNtSetConsoleActiveScreenBuffer   SetConsoleActiveScreenBuffer;
   1165   WinNtSetConsoleCursorInfo           SetConsoleCursorInfo;
   1166   WinNtSetConsoleCursorPosition       SetConsoleCursorPosition;
   1167   WinNtSetConsoleScreenBufferSize     SetConsoleScreenBufferSize;
   1168   WinNtSetConsoleTitleW               SetConsoleTitleW;
   1169   WinNtWriteConsoleInput              WriteConsoleInput;
   1170   WinNtWriteConsoleOutput             WriteConsoleOutput;
   1171 
   1172   //
   1173   // Win32 File APIs
   1174   //
   1175   WinNtCreateFile                     CreateFile;
   1176   WinNtDeviceIoControl                DeviceIoControl;
   1177   WinNtCreateDirectory                CreateDirectory;
   1178   WinNtRemoveDirectory                RemoveDirectory;
   1179   WinNtGetFileAttributes              GetFileAttributes;
   1180   WinNtSetFileAttributes              SetFileAttributes;
   1181   WinNtCreateFileMapping              CreateFileMapping;
   1182   WinNtCloseHandle                    CloseHandle;
   1183   WinNtDeleteFile                     DeleteFile;
   1184   WinNtFindFirstFile                  FindFirstFile;
   1185   WinNtFindNextFile                   FindNextFile;
   1186   WinNtFindClose                      FindClose;
   1187   WinNtFlushFileBuffers               FlushFileBuffers;
   1188   WinNtGetEnvironmentVariable         GetEnvironmentVariable;
   1189   WinNtGetLastError                   GetLastError;
   1190   WinNtSetErrorMode                   SetErrorMode;
   1191   WinNtGetStdHandle                   GetStdHandle;
   1192   WinNtMapViewOfFileEx                MapViewOfFileEx;
   1193   WinNtReadFile                       ReadFile;
   1194   WinNtSetEndOfFile                   SetEndOfFile;
   1195   WinNtSetFilePointer                 SetFilePointer;
   1196   WinNtWriteFile                      WriteFile;
   1197   WinNtGetFileInformationByHandle     GetFileInformationByHandle;
   1198   WinNtGetDiskFreeSpace               GetDiskFreeSpace;
   1199   WinNtGetDiskFreeSpaceEx             GetDiskFreeSpaceEx;
   1200   WinNtMoveFile                       MoveFile;
   1201   WinNtSetFileTime                    SetFileTime;
   1202   WinNtSystemTimeToFileTime           SystemTimeToFileTime;
   1203 
   1204   //
   1205   // Win32 Time APIs
   1206   //
   1207   WinNtFileTimeToLocalFileTime        FileTimeToLocalFileTime;
   1208   WinNtFileTimeToSystemTime           FileTimeToSystemTime;
   1209   WinNtGetSystemTime                  GetSystemTime;
   1210   WinNtSetSystemTime                  SetSystemTime;
   1211   WinNtGetLocalTime                   GetLocalTime;
   1212   WinNtSetLocalTime                   SetLocalTime;
   1213   WinNtGetTimeZoneInformation         GetTimeZoneInformation;
   1214   WinNtSetTimeZoneInformation         SetTimeZoneInformation;
   1215   WinNttimeSetEvent                   timeSetEvent;
   1216   WinNttimeKillEvent                  timeKillEvent;
   1217 
   1218   //
   1219   // Win32 Serial APIs
   1220   //
   1221   WinNtClearCommError                 ClearCommError;
   1222   WinNtEscapeCommFunction             EscapeCommFunction;
   1223   WinNtGetCommModemStatus             GetCommModemStatus;
   1224   WinNtGetCommState                   GetCommState;
   1225   WinNtSetCommState                   SetCommState;
   1226   WinNtPurgeComm                      PurgeComm;
   1227   WinNtSetCommTimeouts                SetCommTimeouts;
   1228 
   1229   WinNtExitProcess                    ExitProcess;
   1230 
   1231   WinNtSprintf                        SPrintf;
   1232 
   1233   WinNtGetDesktopWindow               GetDesktopWindow;
   1234   WinNtGetForegroundWindow            GetForegroundWindow;
   1235   WinNtCreateWindowEx                 CreateWindowEx;
   1236   WinNtShowWindow                     ShowWindow;
   1237   WinNtUpdateWindow                   UpdateWindow;
   1238   WinNtDestroyWindow                  DestroyWindow;
   1239   WinNtInvalidateRect                 InvalidateRect;
   1240   WinNtGetWindowDC                    GetWindowDC;
   1241   WinNtGetClientRect                  GetClientRect;
   1242   WinNtAdjustWindowRect               AdjustWindowRect;
   1243   WinNtSetDIBitsToDevice              SetDIBitsToDevice;
   1244   WinNtBitBlt                         BitBlt;
   1245   WinNtGetDC                          GetDC;
   1246   WinNtReleaseDC                      ReleaseDC;
   1247   WinNtRegisterClassEx                RegisterClassEx;
   1248   WinNtUnregisterClass                UnregisterClass;
   1249 
   1250   WinNtBeginPaint                     BeginPaint;
   1251   WinNtEndPaint                       EndPaint;
   1252   WinNtPostQuitMessage                PostQuitMessage;
   1253   WinNtDefWindowProc                  DefWindowProc;
   1254   WinNtLoadIcon                       LoadIcon;
   1255   WinNtLoadCursor                     LoadCursor;
   1256   WinNtGetStockObject                 GetStockObject;
   1257   WinNtSetViewportOrgEx               SetViewportOrgEx;
   1258   WinNtSetWindowOrgEx                 SetWindowOrgEx;
   1259   WinNtMoveWindow                     MoveWindow;
   1260   WinNtGetWindowRect                  GetWindowRect;
   1261 
   1262   WinNtGetMessage                     GetMessage;
   1263   WinNtTranslateMessage               TranslateMessage;
   1264   WinNtDispatchMessage                DispatchMessage;
   1265 
   1266   WinNtGetProcessHeap                 GetProcessHeap;
   1267   WinNtHeapAlloc                      HeapAlloc;
   1268   WinNtHeapFree                       HeapFree;
   1269 
   1270 } EFI_WIN_NT_THUNK_PROTOCOL;
   1271 
   1272 #endif
   1273 
   1274 extern EFI_GUID gEfiWinNtThunkProtocolGuid;
   1275 
   1276 #endif
   1277