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