summaryrefslogtreecommitdiff
path: root/Nt32Pkg/Include
diff options
context:
space:
mode:
Diffstat (limited to 'Nt32Pkg/Include')
-rw-r--r--Nt32Pkg/Include/Common/WinNTInclude.h71
-rw-r--r--Nt32Pkg/Include/FlashLayout.h64
-rw-r--r--Nt32Pkg/Include/Library/EdkGenericBdsLib.h395
-rw-r--r--Nt32Pkg/Include/Library/WinNtLib.h27
-rw-r--r--Nt32Pkg/Include/Ppi/NtAutoscan.h66
-rw-r--r--Nt32Pkg/Include/Ppi/NtFwh.h62
-rw-r--r--Nt32Pkg/Include/Ppi/NtPeiLoadFile.h65
-rw-r--r--Nt32Pkg/Include/Ppi/NtThunk.h56
-rw-r--r--Nt32Pkg/Include/Protocol/WinNtIo.h150
-rw-r--r--Nt32Pkg/Include/Protocol/WinNtThunk.h1265
-rw-r--r--Nt32Pkg/Include/WinNtDxe.h29
-rw-r--r--Nt32Pkg/Include/WinNtPeim.h31
12 files changed, 2281 insertions, 0 deletions
diff --git a/Nt32Pkg/Include/Common/WinNTInclude.h b/Nt32Pkg/Include/Common/WinNTInclude.h
new file mode 100644
index 0000000000..a8d31c3518
--- /dev/null
+++ b/Nt32Pkg/Include/Common/WinNTInclude.h
@@ -0,0 +1,71 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+ WinNtLib.h
+
+Abstract:
+ Public include file for the WinNt Library
+
+--*/
+
+#ifndef __WIN_NT_INCLUDE_H__
+#define __WIN_NT_INCLUDE_H__
+
+//
+// Win32 include files do not compile clean with /W4, so we use the warning
+// pragma to suppress the warnings for Win32 only. This way our code can stil
+// compile at /W4 (highest warning level) with /WX (warnings cause build
+// errors).
+//
+#pragma warning(disable : 4115)
+#pragma warning(disable : 4201)
+#pragma warning(disable : 4214)
+#pragma warning(disable : 4028)
+#pragma warning(disable : 4133)
+
+#define GUID _WINNT_DUP_GUID_____
+#define _LIST_ENTRY _WINNT_DUP_LIST_ENTRY_FORWARD
+#define LIST_ENTRY _WINNT_DUP_LIST_ENTRY
+#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
+#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
+#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
+#undef UNALIGNED
+#undef CONST
+#undef VOID
+
+#include "windows.h"
+
+#undef GUID
+#undef _LIST_ENTRY
+#undef LIST_ENTRY
+#undef InterlockedIncrement
+#undef InterlockedDecrement
+#undef InterlockedCompareExchange64
+#undef InterlockedCompareExchangePointer
+
+#define VOID void
+
+//
+// Prevent collisions with Windows API name macros that deal with Unicode/Not issues
+//
+#undef LoadImage
+#undef CreateEvent
+
+//
+// Set the warnings back on as the EFI code must be /W4.
+//
+#pragma warning(default : 4115)
+#pragma warning(default : 4201)
+#pragma warning(default : 4214)
+
+
+#endif
diff --git a/Nt32Pkg/Include/FlashLayout.h b/Nt32Pkg/Include/FlashLayout.h
new file mode 100644
index 0000000000..1a13f16c50
--- /dev/null
+++ b/Nt32Pkg/Include/FlashLayout.h
@@ -0,0 +1,64 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ FlashLayout.h
+
+Abstract:
+
+ Platform specific flash layout
+
+ BugBug: We need a better way
+
+--*/
+
+#ifndef __EFI_FLASH_LAYOUT__
+#define __EFI_FLASH_LAYOUT__
+
+//
+// Firmware Volume Information for Nt32
+// adding one working block before FFS FV,
+// and another one for spare block behind FFS FV
+//
+//
+// Note: When block number is changed in .dsc file,
+// this value should be changed accordingly!!!
+//
+#define FIRMWARE_BLOCK_NUMBER 0x28
+
+#define EFI_WINNT_FIRMWARE_OFFSET 0x0
+#define EFI_WINNT_FIRMWARE_LENGTH (0x10000 * FIRMWARE_BLOCK_NUMBER)
+
+#define EFI_WINNT_RUNTIME_UPDATABLE_OFFSET (EFI_WINNT_FIRMWARE_OFFSET + EFI_WINNT_FIRMWARE_LENGTH)
+
+#define EFI_WINNT_RUNTIME_UPDATABLE_LENGTH 0x10000
+
+#define EFI_WINNT_FTW_SPARE_BLOCK_OFFSET (EFI_WINNT_RUNTIME_UPDATABLE_OFFSET + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH)
+
+#define EFI_WINNT_FTW_SPARE_BLOCK_LENGTH 0x10000
+
+#define EFI_WINNT_RUNTIME_UPDATABLE_FV_HEADER_LENGTH 0x48
+
+#define EFI_VARIABLE_STORE_OFFSET EFI_WINNT_RUNTIME_UPDATABLE_OFFSET
+
+#define EFI_VARIABLE_STORE_LENGTH 0x00C000
+
+#define EFI_EVENT_LOG_OFFSET (EFI_VARIABLE_STORE_OFFSET + EFI_VARIABLE_STORE_LENGTH)
+
+#define EFI_EVENT_LOG_LENGTH 0x002000
+
+#define EFI_FTW_WORKING_OFFSET (EFI_EVENT_LOG_OFFSET + EFI_EVENT_LOG_LENGTH)
+
+#define EFI_FTW_WORKING_LENGTH 0x002000
+
+#endif
+
diff --git a/Nt32Pkg/Include/Library/EdkGenericBdsLib.h b/Nt32Pkg/Include/Library/EdkGenericBdsLib.h
new file mode 100644
index 0000000000..5ef183850e
--- /dev/null
+++ b/Nt32Pkg/Include/Library/EdkGenericBdsLib.h
@@ -0,0 +1,395 @@
+/*++
+
+Copyright (c) 2006 - 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BdsLib.h
+
+Abstract:
+
+ BDS library definition, include the file and data structure
+
+--*/
+
+#ifndef _BDS_LIB_H_
+#define _BDS_LIB_H_
+
+extern EFI_HANDLE mBdsImageHandle;
+
+//
+// Constants which are variable names used to access variables
+//
+#define VarLegacyDevOrder L"LegacyDevOrder"
+
+//
+// Data structures and defines
+//
+#define FRONT_PAGE_QUESTION_ID 0x0000
+#define FRONT_PAGE_DATA_WIDTH 0x01
+
+//
+// ConnectType
+//
+#define CONSOLE_OUT 0x00000001
+#define STD_ERROR 0x00000002
+#define CONSOLE_IN 0x00000004
+#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
+
+//
+// Load Option Attributes defined in EFI Specification
+//
+#define LOAD_OPTION_ACTIVE 0x00000001
+#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
+#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)
+
+//
+// Define Maxmim characters that will be accepted
+//
+#define MAX_CHAR 480
+#define MAX_CHAR_SIZE (MAX_CHAR * 2)
+
+#define MIN_ALIGNMENT_SIZE 4
+#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
+
+//
+// Define maximum characters for boot option variable "BootXXXX"
+//
+#define BOOT_OPTION_MAX_CHAR 10
+
+//
+// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.
+//
+#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')
+
+typedef struct {
+
+ UINTN Signature;
+ LIST_ENTRY Link;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ CHAR16 *OptionName;
+ UINTN OptionNumber;
+ UINT16 BootCurrent;
+ UINT32 Attribute;
+ CHAR16 *Description;
+ VOID *LoadOptions;
+ UINT32 LoadOptionsSize;
+
+} BDS_COMMON_OPTION;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN ConnectType;
+} BDS_CONSOLE_CONNECT_ENTRY;
+
+//
+// Lib Functions
+//
+
+//
+// Bds boot relate lib functions
+//
+EFI_STATUS
+BdsLibUpdateBootOrderList (
+ IN LIST_ENTRY *BdsOptionList,
+ IN CHAR16 *VariableName
+ );
+
+VOID
+BdsLibBootNext (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibBootViaBootOption (
+ IN BDS_COMMON_OPTION * Option,
+ IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ );
+
+EFI_STATUS
+BdsLibEnumerateAllBootOption (
+ IN OUT LIST_ENTRY *BdsBootOptionList
+ );
+
+VOID
+BdsLibBuildOptionFromHandle (
+ IN EFI_HANDLE Handle,
+ IN LIST_ENTRY *BdsBootOptionList
+ );
+
+VOID
+BdsLibBuildOptionFromShell (
+ IN EFI_HANDLE Handle,
+ IN LIST_ENTRY *BdsBootOptionList
+ );
+
+//
+// Bds misc lib functions
+//
+UINT16
+BdsLibGetTimeout (
+ VOID
+ );
+
+VOID
+BdsLibLoadDrivers (
+ IN LIST_ENTRY *BdsDriverLists
+ );
+
+EFI_STATUS
+BdsLibBuildOptionFromVar (
+ IN LIST_ENTRY *BdsCommonOptionList,
+ IN CHAR16 *VariableName
+ );
+
+VOID *
+BdsLibGetVariableAndSize (
+ IN CHAR16 *Name,
+ IN EFI_GUID *VendorGuid,
+ OUT UINTN *VariableSize
+ );
+
+EFI_STATUS
+BdsLibOutputStrings (
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut,
+ ...
+ );
+
+BDS_COMMON_OPTION *
+BdsLibVariableToOption (
+ IN OUT LIST_ENTRY *BdsCommonOptionList,
+ IN CHAR16 *VariableName
+ );
+
+EFI_STATUS
+BdsLibRegisterNewOption (
+ IN LIST_ENTRY *BdsOptionList,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *String,
+ IN CHAR16 *VariableName
+ );
+
+//
+// Bds connect or disconnect driver lib funcion
+//
+VOID
+BdsLibConnectAllDriversToAllControllers (
+ VOID
+ );
+
+VOID
+BdsLibConnectAll (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibConnectDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
+ );
+
+EFI_STATUS
+BdsLibConnectAllEfi (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibDisconnectAllEfi (
+ VOID
+ );
+
+//
+// Bds console relate lib functions
+//
+VOID
+BdsLibConnectAllConsoles (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibConnectAllDefaultConsoles (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibUpdateConsoleVariable (
+ IN CHAR16 *ConVarName,
+ IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
+ );
+
+EFI_STATUS
+BdsLibConnectConsoleVariable (
+ IN CHAR16 *ConVarName
+ );
+
+//
+// Bds device path relate lib functions
+//
+EFI_DEVICE_PATH_PROTOCOL *
+BdsLibUnpackDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+ );
+
+VOID
+BdsLibSafeFreePool (
+ IN VOID *Buffer
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsLibDelPartMatchInstance (
+ IN EFI_DEVICE_PATH_PROTOCOL *Multi,
+ IN EFI_DEVICE_PATH_PROTOCOL *Single
+ );
+
+BOOLEAN
+BdsLibMatchDevicePaths (
+ IN EFI_DEVICE_PATH_PROTOCOL *Multi,
+ IN EFI_DEVICE_PATH_PROTOCOL *Single
+ );
+
+CHAR16 *
+DevicePathToStr (
+ EFI_DEVICE_PATH_PROTOCOL *DevPath
+ );
+
+VOID *
+EfiLibGetVariable (
+ IN CHAR16 *Name,
+ IN EFI_GUID *VendorGuid
+ );
+
+//
+// Internal definitions
+//
+typedef struct {
+ CHAR16 *str;
+ UINTN len;
+ UINTN maxlen;
+} POOL_PRINT;
+
+typedef struct {
+ UINT8 Type;
+ UINT8 SubType;
+ VOID (*Function) (POOL_PRINT *, VOID *);
+} DEVICE_PATH_STRING_TABLE;
+
+//
+// Internal functions
+//
+EFI_STATUS
+BdsBootByDiskSignatureAndPartition (
+ IN BDS_COMMON_OPTION * Option,
+ IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
+ IN UINT32 LoadOptionsSize,
+ IN VOID *LoadOptions,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ );
+
+//
+// Notes: EFI 64 shadow all option rom
+//
+#if defined (MDE_CPU_IPF)
+#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();
+VOID
+ShadowAllOptionRom();
+#else
+#define EFI64_SHADOW_ALL_LEGACY_ROM()
+#endif
+
+//
+// BBS support macros and functions
+//
+#if defined (MDE_CPU_IA32)
+#define REFRESH_LEGACY_BOOT_OPTIONS \
+ BdsDeleteAllInvalidLegacyBootOptions ();\
+ BdsAddNonExistingLegacyBootOptions (); \
+ BdsUpdateLegacyDevOrder ()
+#else
+#define REFRESH_LEGACY_BOOT_OPTIONS
+#endif
+
+EFI_STATUS
+BdsDeleteAllInvalidLegacyBootOptions (
+ VOID
+ );
+
+EFI_STATUS
+BdsAddNonExistingLegacyBootOptions (
+ VOID
+ );
+
+EFI_STATUS
+BdsUpdateLegacyDevOrder (
+ VOID
+ );
+
+EFI_STATUS
+BdsRefreshBbsTableForBoot (
+ IN BDS_COMMON_OPTION *Entry
+ );
+
+EFI_STATUS
+BdsDeleteBootOption (
+ IN UINTN OptionNumber,
+ IN OUT UINT16 *BootOrder,
+ IN OUT UINTN *BootOrderSize
+ );
+
+//
+//The interface functions relate with Setup Browser Reset Reminder feature
+//
+VOID
+EnableResetReminderFeature (
+ VOID
+ );
+
+VOID
+DisableResetReminderFeature (
+ VOID
+ );
+
+VOID
+EnableResetRequired (
+ VOID
+ );
+
+VOID
+DisableResetRequired (
+ VOID
+ );
+
+BOOLEAN
+IsResetReminderFeatureEnable (
+ VOID
+ );
+
+BOOLEAN
+IsResetRequired (
+ VOID
+ );
+
+VOID
+SetupResetReminder (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibGetHiiHandles (
+ IN EFI_HII_PROTOCOL *Hii,
+ IN OUT UINT16 *HandleBufferLength,
+ OUT EFI_HII_HANDLE **HiiHandles
+ );
+
+#endif // _BDS_LIB_H_
diff --git a/Nt32Pkg/Include/Library/WinNtLib.h b/Nt32Pkg/Include/Library/WinNtLib.h
new file mode 100644
index 0000000000..b9bccfc008
--- /dev/null
+++ b/Nt32Pkg/Include/Library/WinNtLib.h
@@ -0,0 +1,27 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ WinNtLib.h
+
+Abstract:
+
+ Public include file for the WinNt Library
+
+--*/
+
+#ifndef __WIN_NT_LIB_H__
+#define __WIN_NT_LIB_H__
+
+extern EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;
+
+#endif \ No newline at end of file
diff --git a/Nt32Pkg/Include/Ppi/NtAutoscan.h b/Nt32Pkg/Include/Ppi/NtAutoscan.h
new file mode 100644
index 0000000000..6098819f3f
--- /dev/null
+++ b/Nt32Pkg/Include/Ppi/NtAutoscan.h
@@ -0,0 +1,66 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ NtAutoscan.h
+
+Abstract:
+
+Nt Autoscan PPI
+
+--*/
+
+#ifndef __NT_PEI_AUTOSCAN_H__
+#define __NT_PEI_AUTOSCAN_H__
+
+#include <WinNtDxe.h>
+
+#define PEI_NT_AUTOSCAN_PPI_GUID \
+ { \
+ 0xdce384d, 0x7c, 0x4ba5, {0x94, 0xbd, 0xf, 0x6e, 0xb6, 0x4d, 0x2a, 0xa9 } \
+ }
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_NT_AUTOSCAN) (
+ IN UINTN Index,
+ OUT EFI_PHYSICAL_ADDRESS * MemoryBase,
+ OUT UINT64 *MemorySize
+ );
+
+/*++
+
+Routine Description:
+ This service is called from Index == 0 until it returns EFI_UNSUPPORTED.
+ It allows discontiguous memory regions to be supported by the emulator.
+ It uses gSystemMemory[] and gSystemMemoryCount that were created by
+ parsing the Windows environment variable EFI_MEMORY_SIZE.
+ The size comes from the varaible and the address comes from the call to
+ WinNtOpenFile.
+
+Arguments:
+ Index - Which memory region to use
+ MemoryBase - Return Base address of memory region
+ MemorySize - Return size in bytes of the memory region
+
+Returns:
+ EFI_SUCCESS - If memory region was mapped
+ EFI_UNSUPPORTED - If Index is not supported
+
+--*/
+typedef struct {
+ PEI_NT_AUTOSCAN NtAutoScan;
+} PEI_NT_AUTOSCAN_PPI;
+
+extern EFI_GUID gPeiNtAutoScanPpiGuid;
+
+#endif
diff --git a/Nt32Pkg/Include/Ppi/NtFwh.h b/Nt32Pkg/Include/Ppi/NtFwh.h
new file mode 100644
index 0000000000..90b41094cf
--- /dev/null
+++ b/Nt32Pkg/Include/Ppi/NtFwh.h
@@ -0,0 +1,62 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ NtFwh.h
+
+Abstract:
+
+ WinNt FWH PPI as defined in Tiano
+
+--*/
+
+#ifndef __NT_PEI_FWH_H__
+#define __NT_PEI_FWH_H__
+
+#include <WinNtDxe.h>
+
+#define NT_FWH_PPI_GUID \
+ { \
+ 0x4e76928f, 0x50ad, 0x4334, {0xb0, 0x6b, 0xa8, 0x42, 0x13, 0x10, 0x8a, 0x57 } \
+ }
+
+typedef
+EFI_STATUS
+(EFIAPI *NT_FWH_INFORMATION) (
+ IN UINTN Index,
+ IN OUT EFI_PHYSICAL_ADDRESS * FdBase,
+ IN OUT UINT64 *FdSize
+ );
+
+/*++
+
+Routine Description:
+ Return the FD Size and base address. Since the FD is loaded from a
+ file into Windows memory only the SEC will know it's address.
+
+Arguments:
+ Index - Which FD, starts at zero.
+ FdSize - Size of the FD in bytes
+ FdBase - Start address of the FD. Assume it points to an FV Header
+
+Returns:
+ EFI_SUCCESS - Return the Base address and size of the FV
+ EFI_UNSUPPORTED - Index does nto map to an FD in the system
+
+--*/
+typedef struct {
+ NT_FWH_INFORMATION NtFwh;
+} NT_FWH_PPI;
+
+extern EFI_GUID gNtFwhPpiGuid;
+
+#endif
diff --git a/Nt32Pkg/Include/Ppi/NtPeiLoadFile.h b/Nt32Pkg/Include/Ppi/NtPeiLoadFile.h
new file mode 100644
index 0000000000..622e01a145
--- /dev/null
+++ b/Nt32Pkg/Include/Ppi/NtPeiLoadFile.h
@@ -0,0 +1,65 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ NtPeiLoadFile.h
+
+Abstract:
+
+ WinNt Load File PPI.
+
+ When the PEI core is done it calls the DXE IPL via PPI
+
+--*/
+
+#ifndef __NT_PEI_LOAD_FILE_H__
+#define __NT_PEI_LOAD_FILE_H__
+
+#include <WinNtDxe.h>
+
+#define NT_PEI_LOAD_FILE_GUID \
+ { \
+ 0xfd0c65eb, 0x405, 0x4cd2, {0x8a, 0xee, 0xf4, 0x0, 0xef, 0x13, 0xba, 0xc2 } \
+ }
+
+typedef
+EFI_STATUS
+(EFIAPI *NT_PEI_LOAD_FILE) (
+ VOID *Pe32Data,
+ EFI_PHYSICAL_ADDRESS *ImageAddress,
+ UINT64 *ImageSize,
+ EFI_PHYSICAL_ADDRESS *EntryPoint
+ );
+
+/*++
+
+Routine Description:
+ Loads and relocates a PE/COFF image into memory.
+
+Arguments:
+ Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
+ ImageAddress - The base address of the relocated PE/COFF image
+ ImageSize - The size of the relocated PE/COFF image
+ EntryPoint - The entry point of the relocated PE/COFF image
+
+Returns:
+ EFI_SUCCESS - The file was loaded and relocated
+ EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
+
+--*/
+typedef struct {
+ NT_PEI_LOAD_FILE PeiLoadFileService;
+} NT_PEI_LOAD_FILE_PPI;
+
+extern EFI_GUID gNtPeiLoadFilePpiGuid;
+
+#endif
diff --git a/Nt32Pkg/Include/Ppi/NtThunk.h b/Nt32Pkg/Include/Ppi/NtThunk.h
new file mode 100644
index 0000000000..782c510a30
--- /dev/null
+++ b/Nt32Pkg/Include/Ppi/NtThunk.h
@@ -0,0 +1,56 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ NtThunk.h
+
+Abstract:
+
+ WinNt Thunk interface PPI
+
+--*/
+
+#ifndef __NT_PEI_WIN_NT_THUNK_H__
+#define __NT_PEI_WIN_NT_THUNK_H__
+
+#include <WinNtDxe.h>
+
+#define PEI_NT_THUNK_PPI_GUID \
+ { \
+ 0x98c281e5, 0xf906, 0x43dd, {0xa9, 0x2b, 0xb0, 0x3, 0xbf, 0x27, 0x65, 0xda } \
+ }
+
+typedef
+VOID *
+(EFIAPI *PEI_NT_THUNK_INTERFACE) (
+ VOID
+ );
+
+/*++
+
+Routine Description:
+ Export of EFI_WIN_NT_THUNK_PROTOCOL from the Windows SEC.
+
+Arguments:
+ InterfaceBase - Address of the EFI_WIN_NT_THUNK_PROTOCOL
+
+Returns:
+ EFI_SUCCESS - Data returned
+
+--*/
+typedef struct {
+ PEI_NT_THUNK_INTERFACE NtThunk;
+} PEI_NT_THUNK_PPI;
+
+extern EFI_GUID gPeiNtThunkPpiGuid;
+
+#endif
diff --git a/Nt32Pkg/Include/Protocol/WinNtIo.h b/Nt32Pkg/Include/Protocol/WinNtIo.h
new file mode 100644
index 0000000000..1f2aaa51ad
--- /dev/null
+++ b/Nt32Pkg/Include/Protocol/WinNtIo.h
@@ -0,0 +1,150 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ WinNtIo.h
+
+Abstract:
+
+--*/
+
+#ifndef __WIN_NT_IO_H__
+#define __WIN_NT_IO_H__
+
+#define EFI_WIN_NT_IO_PROTOCOL_GUID \
+ { 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+extern EFI_GUID gEfiWinNtIoProtocolGuid;
+
+typedef struct {
+ EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
+ EFI_GUID *TypeGuid;
+ CHAR16 *EnvString;
+ UINT16 InstanceNumber;
+} EFI_WIN_NT_IO_PROTOCOL;
+
+//
+// The following GUIDs are used in EFI_WIN_NT_IO_PROTOCOL_GUID
+// Device paths. They map 1:1 with NT envirnment variables. The variables
+// define what virtual hardware the emulator/WinNtBusDriver will produce.
+//
+//
+// EFI_WIN_NT_VIRTUAL_DISKS
+//
+#define EFI_WIN_NT_VIRTUAL_DISKS_GUID \
+ { \
+ 0xc95a928, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtVirtualDisksGuid;
+
+//
+// EFI_WIN_NT_PHYSICAL_DISKS
+//
+#define EFI_WIN_NT_PHYSICAL_DISKS_GUID \
+ { \
+ 0xc95a92f, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtPhysicalDisksGuid;
+
+//
+// EFI_WIN_NT_GOP_GUID
+//
+#define EFI_WIN_NT_GOP_GUID \
+ { \
+ 0x4e11e955, 0xccca, 0x11d4, {0xbd, 0x0d, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81} \
+ }
+
+extern EFI_GUID gEfiWinNtGopGuid;
+
+//
+// EFI_WIN_NT_FILE_SYSTEM
+//
+#define EFI_WIN_NT_FILE_SYSTEM_GUID \
+ { \
+ 0xc95a935, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtFileSystemGuid;
+
+//
+// EFI_WIN_NT_SERIAL_PORT
+//
+#define EFI_WIN_NT_SERIAL_PORT_GUID \
+ { \
+ 0xc95a93d, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtSerialPortGuid;
+
+//
+// EFI_WIN_NT_UGA
+//
+#define EFI_WIN_NT_UGA_GUID \
+ { \
+ 0xab248e99, 0xabe1, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtUgaGuid;
+
+//
+// EFI_WIN_NT_CONSOLE
+//
+#define EFI_WIN_NT_CONSOLE_GUID \
+ { \
+ 0xba73672c, 0xa5d3, 0x11d4, {0xbd, 0x0, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtConsoleGuid;
+
+//
+// EFI_WIN_NT_MEMORY
+//
+#define EFI_WIN_NT_MEMORY_GUID \
+ { \
+ 0x99042912, 0x122a, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtMemoryGuid;
+
+//
+// EFI_WIN_NT_CPU_MODEL
+//
+#define EFI_WIN_NT_CPU_MODEL_GUID \
+ { \
+ 0xbee9b6ce, 0x2f8a, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtCPUModelGuid;
+
+//
+// EFI_WIN_NT_CPU_SPEED
+//
+#define EFI_WIN_NT_CPU_SPEED_GUID \
+ { \
+ 0xd4f29055, 0xe1fb, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+ }
+
+extern EFI_GUID gEfiWinNtCPUSpeedGuid;
+
+//
+// EFI_WIN_NT_PASS_THROUGH
+//
+#define EFI_WIN_NT_PASS_THROUGH_GUID \
+ { \
+ 0xcc664eb8, 0x3c24, 0x4086, {0xb6, 0xf6, 0x34, 0xe8, 0x56, 0xbc, 0xe3, 0x6e } \
+ }
+
+extern EFI_GUID gEfiWinNtPassThroughGuid;
+
+#endif
diff --git a/Nt32Pkg/Include/Protocol/WinNtThunk.h b/Nt32Pkg/Include/Protocol/WinNtThunk.h
new file mode 100644
index 0000000000..b3e161f7cd
--- /dev/null
+++ b/Nt32Pkg/Include/Protocol/WinNtThunk.h
@@ -0,0 +1,1265 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ WinNtThunk.h
+
+Abstract:
+
+ This protocol allows an EFI driver (DLL) in the NT emulation envirnment
+ to make Win32 API calls.
+
+ NEVER make a Win32 call directly, always make the call via this protocol.
+
+ There are no This pointers on the protocol member functions as they map
+ exactly into Win32 system calls.
+
+ YOU MUST include EfiWinNT.h in place of Efi.h to make this file compile.
+
+--*/
+
+#ifndef __WIN_NT_THUNK_H__
+#define __WIN_NT_THUNK_H__
+
+#define EFI_WIN_NT_THUNK_PROTOCOL_GUID \
+ { 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtSleep) (
+ DWORD Milliseconds
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtSuspendThread) (
+ HANDLE hThread
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtGetCurrentThread) (
+ VOID
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtGetCurrentThreadId) (
+ VOID
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtGetCurrentProcess) (
+ VOID
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtCreateThread) (
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ DWORD dwStackSize,
+ LPTHREAD_START_ROUTINE lpStartAddress,
+ LPVOID lpParameter,
+ DWORD dwCreationFlags,
+ LPDWORD lpThreadId
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtTerminateThread) (
+ HANDLE hThread,
+ DWORD dwExitCode
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSendMessage) (
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtExitThread) (
+ DWORD dwExitCode
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtResumeThread) (
+ HANDLE hThread
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetThreadPriority) (
+ HANDLE hThread,
+ INTN nPriority
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtInitializeCriticalSection) (
+ LPCRITICAL_SECTION lpCriticalSection
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtDeleteCriticalSection) (
+ LPCRITICAL_SECTION lpCriticalSection
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtEnterCriticalSection) (
+ LPCRITICAL_SECTION lpCriticalSection
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtLeaveCriticalSection) (
+ LPCRITICAL_SECTION lpCriticalSection
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtTlsAlloc) (
+ VOID
+ );
+
+typedef
+WINBASEAPI
+LPVOID
+(WINAPI *WinNtTlsGetValue) (
+ DWORD dwTlsIndex
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtTlsSetValue) (
+ DWORD dwTlsIndex,
+ LPVOID lpTlsValue
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtTlsFree) (
+ DWORD dwTlsIndex
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtCreateSemaphore) (
+ LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
+ LONG lInitialCount,
+ LONG lMaximumCount,
+ LPCWSTR lpName
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtWaitForSingleObject) (
+ HANDLE hHandle,
+ DWORD dwMilliseconds
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtReleaseSemaphore) (
+ HANDLE hSemaphore,
+ LONG lReleaseCount,
+ LPLONG lpPreviousCount
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtDuplicateHandle) (
+ HANDLE hSourceProcessHandle,
+ HANDLE hSourceHandle,
+ HANDLE hTargetProcessHandle,
+ LPHANDLE lpTargetHandle,
+ DWORD dwDesiredAccess,
+ BOOL bInheritHandle,
+ DWORD dwOptions
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtCreateConsoleScreenBuffer) (
+ DWORD DesiredAccess,
+ DWORD ShareMode,
+ CONST SECURITY_ATTRIBUTES *SecurityAttributes,
+ DWORD Flags,
+ LPVOID ScreenBufferData
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetConsoleScreenBufferSize) (
+ HANDLE ConsoleOutput,
+ COORD Size
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetConsoleActiveScreenBuffer) (
+ HANDLE ConsoleOutput
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFillConsoleOutputAttribute) (
+ HANDLE ConsoleOutput,
+ WORD Attribute,
+ DWORD Length,
+ COORD WriteCoord,
+ LPDWORD NumberOfAttrsWritten
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFillConsoleOutputCharacter) (
+ HANDLE ConsoleOutput,
+ TCHAR Character,
+ DWORD Length,
+ COORD WriteCoord,
+ LPDWORD NumberOfCharsWritten
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtWriteConsoleOutput) (
+ HANDLE ConsoleOutput,
+ CONST CHAR_INFO *Buffer,
+ COORD BufferSize,
+ COORD BufferCoord,
+ PSMALL_RECT WriteRegion
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtScrollConsoleScreenBuffer) (
+ HANDLE ConsoleOutput,
+ CONST SMALL_RECT *ScrollRectangle,
+ CONST SMALL_RECT *ClipRectangle,
+ COORD DestinationOrigin,
+ CONST CHAR_INFO *Fill
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetConsoleTitleW) (
+ LPCTSTR ConsoleTitle
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetConsoleCursorInfo) (
+ HANDLE ConsoleOutput,
+ PCONSOLE_CURSOR_INFO ConsoleCursorInfo
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetConsoleCursorInfo) (
+ HANDLE ConsoleOutput,
+ CONST CONSOLE_CURSOR_INFO *ConsoleCursorInfo
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetPriorityClass) (
+ HANDLE Process,
+ DWORD PriorityClass
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtWriteConsoleInput) (
+ HANDLE ConsoleInput,
+ CONST INPUT_RECORD *Buffer,
+ DWORD Legnth,
+ LPDWORD NumberOfEventsWritten
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetNumberOfConsoleInputEvents) (
+ HANDLE ConsoleInput,
+ LPDWORD NumberOfEvents
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtGetStdHandle) (
+ DWORD StdHandle
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtReadConsoleInput) (
+ HANDLE ConsoleInput,
+ PINPUT_RECORD Buffer,
+ DWORD Length,
+ LPDWORD NumberOfEventsRead
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtPeekConsoleInput) (
+ HANDLE ConsoleInput,
+ PINPUT_RECORD Buffer,
+ DWORD Length,
+ LPDWORD NumberOfEventsRead
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetConsoleCursorPosition) (
+ HANDLE ConsoleInput,
+ COORD CursorPosition
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtCreateFile) (
+ LPCWSTR FileName,
+ DWORD DesiredAccess,
+ DWORD SharedMode,
+ LPSECURITY_ATTRIBUTES SecurityAttributes,
+ DWORD CreationDisposition,
+ DWORD FlagsAndAttributes,
+ HANDLE TemplateFile
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtDeviceIoControl) (
+ HANDLE DeviceHandle,
+ DWORD IoControlCode,
+ LPVOID InBuffer,
+ DWORD InBufferSize,
+ LPVOID OutBuffer,
+ DWORD OutBufferSize,
+ LPDWORD BytesReturned,
+ LPOVERLAPPED Overlapped
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtCreateDirectory) (
+ LPCWSTR PathName,
+ LPSECURITY_ATTRIBUTES SecurityAttributes
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtRemoveDirectory) (
+ LPCWSTR PathName
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtGetFileAttributes) (
+ LPCWSTR FileName
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetFileAttributes) (
+ LPCWSTR FileName,
+ DWORD FileAttributes
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtCreateFileMapping) (
+ HANDLE FileHandle,
+ LPSECURITY_ATTRIBUTES Attributes,
+ DWORD Protect,
+ DWORD MaximumSizeHigh,
+ DWORD MaximumSizeLow,
+ LPCTSTR Name
+ );
+
+typedef
+WINBASEAPI
+LPVOID
+(WINAPI *WinNtMapViewOfFileEx) (
+ HANDLE FileHandle,
+ DWORD DesiredAccess,
+ DWORD FileOffsetHigh,
+ DWORD FileOffsetLow,
+ DWORD NumberOfBytesToMap,
+ LPVOID BaseAddress
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtGetEnvironmentVariable) (
+ LPCTSTR Name,
+ LPTSTR Buffer,
+ DWORD Size
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtCloseHandle) (
+ HANDLE Object
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtSetFilePointer) (
+ HANDLE FileHandle,
+ LONG DistanceToMove,
+ PLONG DistanceToHoveHigh,
+ DWORD MoveMethod
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetEndOfFile) (
+ HANDLE FileHandle
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtReadFile) (
+ HANDLE FileHandle,
+ LPVOID Buffer,
+ DWORD NumberOfBytesToRead,
+ LPDWORD NumberOfBytesRead,
+ LPOVERLAPPED Overlapped
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtWriteFile) (
+ HANDLE FileHandle,
+ LPCVOID Buffer,
+ DWORD NumberOfBytesToWrite,
+ LPDWORD NumberOfBytesWritten,
+ LPOVERLAPPED Overlapped
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetFileInformationByHandle) (
+ HANDLE FileHandle,
+ BY_HANDLE_FILE_INFORMATION *FileInfo
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetDiskFreeSpace) (
+ LPCTSTR RootPathName,
+ LPDWORD SectorsPerCluster,
+ LPDWORD BytesPerSector,
+ LPDWORD NumberOfFreeClusters,
+ LPDWORD TotalNumberOfClusters
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetDiskFreeSpaceEx) (
+ LPCTSTR DirectoryName,
+ PULARGE_INTEGER FreeBytesAvailable,
+ PULARGE_INTEGER TotalNumberOfBytes,
+ PULARGE_INTEGER TotoalNumberOfFreeBytes
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtMoveFile) (
+ LPCTSTR ExistingFileName,
+ LPCTSTR NewFileName
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetFileTime) (
+ HANDLE FileHandle,
+ FILETIME *CreationTime,
+ FILETIME *LastAccessTime,
+ FILETIME *LastWriteTime
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSystemTimeToFileTime) (
+ SYSTEMTIME * SystemTime,
+ FILETIME * FileTime
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtDeleteFile) (
+ LPCTSTR FileName
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFlushFileBuffers) (
+ HANDLE
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtGetLastError) (
+ VOID
+ );
+
+typedef
+WINBASEAPI
+UINT
+(WINAPI *WinNtSetErrorMode) (
+ UINT Mode
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtGetTickCount) (
+ VOID
+ );
+
+typedef
+WINBASEAPI
+HMODULE
+(WINAPI *WinNtLoadLibraryEx) (
+ LPCTSTR LibFileName,
+ HANDLE FileHandle,
+ DWORD Flags
+ );
+
+typedef
+WINBASEAPI
+FARPROC
+(WINAPI *WinNtGetProcAddress) (
+ HMODULE Module,
+ LPCSTR ProcName
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtGetTimeZoneInformation) (
+ LPTIME_ZONE_INFORMATION timeZoneInformation
+ );
+
+typedef
+WINBASEAPI
+MMRESULT
+(WINAPI *WinNttimeSetEvent) (
+ UINT uDelay,
+ UINT uResolution,
+ LPTIMECALLBACK lpTimeProc,
+ DWORD_PTR dwUser,
+ UINT fuEvent
+ );
+
+typedef
+WINBASEAPI
+MMRESULT
+(WINAPI *WinNttimeKillEvent) (
+ UINT uTimerID
+ );
+
+typedef
+WINBASEAPI
+DWORD
+(WINAPI *WinNtSetTimeZoneInformation) (
+ LPTIME_ZONE_INFORMATION timeZoneInformation
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtGetSystemTime) (
+ LPSYSTEMTIME SystemTime
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetSystemTime) (
+ CONST SYSTEMTIME *SystemTime
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtGetLocalTime) (
+ LPSYSTEMTIME SystemTime
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetLocalTime) (
+ CONST SYSTEMTIME *SystemTime
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFileTimeToLocalFileTime) (
+ CONST FILETIME *FileTime,
+ LPFILETIME LocalFileTime
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFileTimeToSystemTime) (
+ CONST FILETIME *FileTime,
+ LPSYSTEMTIME SystemTime
+ );
+
+typedef
+WINBASEAPI
+HANDLE
+(WINAPI *WinNtFindFirstFile) (
+ LPCTSTR FileName,
+ LPWIN32_FIND_DATA FindFileData
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFindNextFile) (
+ HANDLE FindFile,
+ LPWIN32_FIND_DATA FindFileData
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFindClose) (
+ HANDLE FindFile
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetCommState) (
+ HANDLE FileHandle,
+ LPDCB DCB
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetCommState) (
+ HANDLE FileHandle,
+ LPDCB DCB
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetCommState) (
+ HANDLE FileHandle,
+ LPDCB DCB
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtSetCommTimeouts) (
+ HANDLE FileHandle,
+ LPCOMMTIMEOUTS CommTimeouts
+ );
+
+typedef
+WINBASEAPI
+VOID
+(WINAPI *WinNtExitProcess) (
+ UINT uExitCode // exit code for all threads
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtPurgeComm) (
+ HANDLE FileHandle,
+ DWORD Flags
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtEscapeCommFunction) (
+ HANDLE FileHandle,
+ DWORD Func
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtGetCommModemStatus) (
+ HANDLE FileHandle,
+ LPDWORD ModemStat
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtClearCommError) (
+ HANDLE FileHandle,
+ LPDWORD Errors,
+ LPCOMSTAT Stat
+ );
+
+typedef
+WINUSERAPI
+INT32
+(WINAPIV *WinNtSprintf) (
+ LPWSTR Buffer,
+ size_t Count,
+ LPCWSTR String,
+ ...
+ );
+
+typedef
+WINUSERAPI
+HWND
+(WINAPI *WinNtGetDesktopWindow) (
+ VOID
+ );
+
+typedef
+WINUSERAPI
+HWND
+(WINAPI *WinNtGetForegroundWindow) (
+ VOID
+ );
+
+typedef
+WINUSERAPI
+HWND
+(WINAPI *WinNtCreateWindowEx) (
+ DWORD dwExStyle,
+ LPCTSTR lpClassName,
+ LPCTSTR lpWindowName,
+ DWORD dwStyle,
+ INT32 x,
+ INT32 y,
+ INT32 nWidth,
+ INT32 nHeight,
+ HWND hWndParent,
+ HMENU hMenu,
+ HINSTANCE hInstance,
+ LPVOID *lpParam
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtUpdateWindow) (
+ HWND hWnd
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtShowWindow) (
+ HWND hWnd,
+ INT32 nCmdShow
+ );
+
+typedef
+WINGDIAPI
+BOOL
+(WINAPI *WinNtDestroyWindow) (
+ HWND hWnd
+ );
+
+typedef
+WINUSERAPI
+HDC
+(WINAPI *WinNtGetWindowDC) (
+ HWND hWnd
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtGetClientRect) (
+ HWND hWnd,
+ LPRECT lpRect
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtAdjustWindowRect) (
+ LPRECT lpRect,
+ DWORD dwStyle,
+ BOOL bMenu
+ );
+
+typedef
+WINGDIAPI
+INT32
+(WINAPI *WinNtSetDIBitsToDevice) (
+ HDC,
+ INT32,
+ INT32,
+ DWORD,
+ DWORD,
+ INT32,
+ INT32,
+ UINT,
+ UINT,
+ CONST VOID *,
+ CONST BITMAPINFO *,
+ UINT
+ );
+
+typedef
+WINGDIAPI
+BOOL
+(WINAPI *WinNtBitBlt) (
+ HDC,
+ INT32,
+ INT32,
+ INT32,
+ INT32,
+ HDC,
+ INT32,
+ INT32,
+ DWORD
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtInvalidateRect) (
+ HWND hWnd,
+ CONST RECT *lpRect,
+ BOOL bErase
+ );
+
+typedef
+WINUSERAPI
+HDC
+(WINAPI *WinNtGetDC) (
+ HWND hWnd
+ );
+
+typedef
+WINUSERAPI
+INT32
+(WINAPI *WinNtReleaseDC) (
+ HWND hWnd,
+ HDC hDC
+ );
+
+typedef
+WINUSERAPI
+ATOM
+(WINAPI *WinNtRegisterClassEx) (
+ CONST WNDCLASSEX *
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtUnregisterClass) (
+ LPCTSTR lpClassName,
+ HINSTANCE hInstance
+ );
+
+typedef
+WINUSERAPI
+HDC
+(WINAPI *WinNtBeginPaint) (
+ HWND hWnd,
+ LPPAINTSTRUCT lpPaint
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtEndPaint) (
+ HWND hWnd,
+ CONST PAINTSTRUCT *lpPaint
+ );
+
+typedef
+WINUSERAPI
+VOID
+(WINAPI *WinNtPostQuitMessage) (
+ INT32 nExitCode
+ );
+
+typedef
+WINUSERAPI
+LRESULT
+(WINAPI *WinNtDefWindowProc) (
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
+typedef
+WINUSERAPI
+HICON
+(WINAPI *WinNtLoadIcon) (
+ HINSTANCE hInstance,
+ LPCTSTR lpIconName
+ );
+
+typedef
+WINUSERAPI
+HCURSOR
+(WINAPI *WinNtLoadCursor) (
+ HINSTANCE hInstance,
+ LPCTSTR lpCursorName
+ );
+
+typedef
+WINGDIAPI
+HGDIOBJ
+(WINAPI *WinNtGetStockObject) (
+ INT32
+ );
+
+typedef
+WINGDIAPI
+BOOL
+(WINAPI *WinNtSetViewportOrgEx) (
+ HDC,
+ INT32,
+ INT32,
+ LPPOINT
+ );
+
+typedef
+WINGDIAPI
+BOOL
+(WINAPI *WinNtSetWindowOrgEx) (
+ HDC,
+ INT32,
+ INT32,
+ LPPOINT
+ );
+typedef
+WINGDIAPI
+BOOL
+(WINAPI *WinNtMoveWindow) (
+ HWND,
+ INT32,
+ INT32,
+ INT32,
+ INT32,
+ BOOL
+ );
+
+typedef
+WINGDIAPI
+BOOL
+(WINAPI *WinNtGetWindowRect) (
+ HWND,
+ LPRECT
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtGetMessage) (
+ LPMSG lpMsg,
+ HWND hWnd,
+ UINT wMsgFilterMin,
+ UINT wMsgFilterMax
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtTranslateMessage) (
+ CONST MSG *lpMsg
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtDispatchMessage) (
+ CONST MSG *lpMsg
+ );
+
+typedef
+WINUSERAPI
+HANDLE
+(WINAPI *WinNtGetProcessHeap) ();
+
+typedef
+WINUSERAPI
+LPVOID
+(WINAPI *WinNtHeapAlloc) (
+ HANDLE hHeap,
+ DWORD dwFlags,
+ SIZE_T dwBytes
+ );
+
+typedef
+WINUSERAPI
+BOOL
+(WINAPI *WinNtHeapFree) (
+ HANDLE hHeap,
+ DWORD dwFlags,
+ LPVOID lpMem
+ );
+
+typedef
+WINBASEAPI
+BOOL
+(WINAPI *WinNtFreeLibrary) (
+ HANDLE ModHandle
+ );
+//
+//
+//
+
+#define EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'T', 'T')
+
+typedef struct {
+ UINT64 Signature;
+
+ //
+ // Win32 Process APIs
+ //
+ WinNtGetProcAddress GetProcAddress;
+ WinNtGetTickCount GetTickCount;
+ WinNtLoadLibraryEx LoadLibraryEx;
+ WinNtFreeLibrary FreeLibrary;
+
+ WinNtSetPriorityClass SetPriorityClass;
+ WinNtSetThreadPriority SetThreadPriority;
+ WinNtSleep Sleep;
+
+ WinNtSuspendThread SuspendThread;
+ WinNtGetCurrentThread GetCurrentThread;
+ WinNtGetCurrentThreadId GetCurrentThreadId;
+ WinNtGetCurrentProcess GetCurrentProcess;
+ WinNtCreateThread CreateThread;
+ WinNtTerminateThread TerminateThread;
+ WinNtSendMessage SendMessage;
+ WinNtExitThread ExitThread;
+ WinNtResumeThread ResumeThread;
+ WinNtDuplicateHandle DuplicateHandle;
+
+ //
+ // Wint32 Mutex primitive
+ //
+ WinNtInitializeCriticalSection InitializeCriticalSection;
+ WinNtEnterCriticalSection EnterCriticalSection;
+ WinNtLeaveCriticalSection LeaveCriticalSection;
+ WinNtDeleteCriticalSection DeleteCriticalSection;
+ WinNtTlsAlloc TlsAlloc;
+ WinNtTlsFree TlsFree;
+ WinNtTlsSetValue TlsSetValue;
+ WinNtTlsGetValue TlsGetValue;
+ WinNtCreateSemaphore CreateSemaphore;
+ WinNtWaitForSingleObject WaitForSingleObject;
+ WinNtReleaseSemaphore ReleaseSemaphore;
+
+ //
+ // Win32 Console APIs
+ //
+ WinNtCreateConsoleScreenBuffer CreateConsoleScreenBuffer;
+ WinNtFillConsoleOutputAttribute FillConsoleOutputAttribute;
+ WinNtFillConsoleOutputCharacter FillConsoleOutputCharacter;
+ WinNtGetConsoleCursorInfo GetConsoleCursorInfo;
+ WinNtGetNumberOfConsoleInputEvents GetNumberOfConsoleInputEvents;
+ WinNtPeekConsoleInput PeekConsoleInput;
+ WinNtScrollConsoleScreenBuffer ScrollConsoleScreenBuffer;
+ WinNtReadConsoleInput ReadConsoleInput;
+
+ WinNtSetConsoleActiveScreenBuffer SetConsoleActiveScreenBuffer;
+ WinNtSetConsoleCursorInfo SetConsoleCursorInfo;
+ WinNtSetConsoleCursorPosition SetConsoleCursorPosition;
+ WinNtSetConsoleScreenBufferSize SetConsoleScreenBufferSize;
+ WinNtSetConsoleTitleW SetConsoleTitleW;
+ WinNtWriteConsoleInput WriteConsoleInput;
+ WinNtWriteConsoleOutput WriteConsoleOutput;
+
+ //
+ // Win32 File APIs
+ //
+ WinNtCreateFile CreateFile;
+ WinNtDeviceIoControl DeviceIoControl;
+ WinNtCreateDirectory CreateDirectory;
+ WinNtRemoveDirectory RemoveDirectory;
+ WinNtGetFileAttributes GetFileAttributes;
+ WinNtSetFileAttributes SetFileAttributes;
+ WinNtCreateFileMapping CreateFileMapping;
+ WinNtCloseHandle CloseHandle;
+ WinNtDeleteFile DeleteFile;
+ WinNtFindFirstFile FindFirstFile;
+ WinNtFindNextFile FindNextFile;
+ WinNtFindClose FindClose;
+ WinNtFlushFileBuffers FlushFileBuffers;
+ WinNtGetEnvironmentVariable GetEnvironmentVariable;
+ WinNtGetLastError GetLastError;
+ WinNtSetErrorMode SetErrorMode;
+ WinNtGetStdHandle GetStdHandle;
+ WinNtMapViewOfFileEx MapViewOfFileEx;
+ WinNtReadFile ReadFile;
+ WinNtSetEndOfFile SetEndOfFile;
+ WinNtSetFilePointer SetFilePointer;
+ WinNtWriteFile WriteFile;
+ WinNtGetFileInformationByHandle GetFileInformationByHandle;
+ WinNtGetDiskFreeSpace GetDiskFreeSpace;
+ WinNtGetDiskFreeSpaceEx GetDiskFreeSpaceEx;
+ WinNtMoveFile MoveFile;
+ WinNtSetFileTime SetFileTime;
+ WinNtSystemTimeToFileTime SystemTimeToFileTime;
+
+ //
+ // Win32 Time APIs
+ //
+ WinNtFileTimeToLocalFileTime FileTimeToLocalFileTime;
+ WinNtFileTimeToSystemTime FileTimeToSystemTime;
+ WinNtGetSystemTime GetSystemTime;
+ WinNtSetSystemTime SetSystemTime;
+ WinNtGetLocalTime GetLocalTime;
+ WinNtSetLocalTime SetLocalTime;
+ WinNtGetTimeZoneInformation GetTimeZoneInformation;
+ WinNtSetTimeZoneInformation SetTimeZoneInformation;
+ WinNttimeSetEvent timeSetEvent;
+ WinNttimeKillEvent timeKillEvent;
+
+ //
+ // Win32 Serial APIs
+ //
+ WinNtClearCommError ClearCommError;
+ WinNtEscapeCommFunction EscapeCommFunction;
+ WinNtGetCommModemStatus GetCommModemStatus;
+ WinNtGetCommState GetCommState;
+ WinNtSetCommState SetCommState;
+ WinNtPurgeComm PurgeComm;
+ WinNtSetCommTimeouts SetCommTimeouts;
+
+ WinNtExitProcess ExitProcess;
+
+ WinNtSprintf SPrintf;
+
+ WinNtGetDesktopWindow GetDesktopWindow;
+ WinNtGetForegroundWindow GetForegroundWindow;
+ WinNtCreateWindowEx CreateWindowEx;
+ WinNtShowWindow ShowWindow;
+ WinNtUpdateWindow UpdateWindow;
+ WinNtDestroyWindow DestroyWindow;
+ WinNtInvalidateRect InvalidateRect;
+ WinNtGetWindowDC GetWindowDC;
+ WinNtGetClientRect GetClientRect;
+ WinNtAdjustWindowRect AdjustWindowRect;
+ WinNtSetDIBitsToDevice SetDIBitsToDevice;
+ WinNtBitBlt BitBlt;
+ WinNtGetDC GetDC;
+ WinNtReleaseDC ReleaseDC;
+ WinNtRegisterClassEx RegisterClassEx;
+ WinNtUnregisterClass UnregisterClass;
+
+ WinNtBeginPaint BeginPaint;
+ WinNtEndPaint EndPaint;
+ WinNtPostQuitMessage PostQuitMessage;
+ WinNtDefWindowProc DefWindowProc;
+ WinNtLoadIcon LoadIcon;
+ WinNtLoadCursor LoadCursor;
+ WinNtGetStockObject GetStockObject;
+ WinNtSetViewportOrgEx SetViewportOrgEx;
+ WinNtSetWindowOrgEx SetWindowOrgEx;
+ WinNtMoveWindow MoveWindow;
+ WinNtGetWindowRect GetWindowRect;
+
+ WinNtGetMessage GetMessage;
+ WinNtTranslateMessage TranslateMessage;
+ WinNtDispatchMessage DispatchMessage;
+
+ WinNtGetProcessHeap GetProcessHeap;
+ WinNtHeapAlloc HeapAlloc;
+ WinNtHeapFree HeapFree;
+
+} EFI_WIN_NT_THUNK_PROTOCOL;
+
+extern EFI_GUID gEfiWinNtThunkProtocolGuid;
+
+#endif
diff --git a/Nt32Pkg/Include/WinNtDxe.h b/Nt32Pkg/Include/WinNtDxe.h
new file mode 100644
index 0000000000..ee9770aebf
--- /dev/null
+++ b/Nt32Pkg/Include/WinNtDxe.h
@@ -0,0 +1,29 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+ WinNtLib.h
+
+Abstract:
+ Public include file for the WinNt Library
+
+--*/
+
+#ifndef __WIN_NT_DXE_H__
+#define __WIN_NT_DXE_H__
+
+//
+// This forces Windows.h WIN32 include file to be included
+// it's needed for WinNtThunk.h
+// WinNtIo.h depends on WinNtThunk.h
+//
+#include <Common/WinNtInclude.h>
+#endif
diff --git a/Nt32Pkg/Include/WinNtPeim.h b/Nt32Pkg/Include/WinNtPeim.h
new file mode 100644
index 0000000000..a3dab24e1a
--- /dev/null
+++ b/Nt32Pkg/Include/WinNtPeim.h
@@ -0,0 +1,31 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+ WinNtLib.h
+
+Abstract:
+ Public include file for the WinNt Library
+
+--*/
+
+#ifndef __WIN_NT_PEIM_H__
+#define __WIN_NT_PEIM_H__
+
+//
+// This forces Windows.h WIN32 include file to be included
+// it's needed for WinNtThunk.h
+//
+#include <Common/WinNtInclude.h>
+
+#include <Protocol/WinNtThunk.h>
+
+#endif