windows-nt/Source/XPSP1/NT/base/boot/inc/netboot.h

312 lines
6.1 KiB
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
/*++
Copyright (c) 1997 Microsoft Corporation
Module Name:
netboot.h
Abstract:
This module defines globally used procedure and data structures used
by net boot.
Author:
Chuck Lenzmeier (chuckl) 09-Jan-1997
Revision History:
--*/
#ifndef _NETBOOT_
#define _NETBOOT_
#include <oscpkt.h> // defines NET_CARD_INFO
#ifdef EFI
#include <efi.h>
#endif
#define NET_DEVICE_ID 'dten'
//
// The following structure is used to define the parameters of the net
// volume. Given a FileId we can access the structure context through
// the structure context field in the global BlFileTable (e.g.,
// BlFileTable[FileId].StructureContext).
//
typedef struct _NET_STRUCTURE_CONTEXT {
ULONG Dummy;
} NET_STRUCTURE_CONTEXT, *PNET_STRUCTURE_CONTEXT;
//
// The following structure is used to define the location and size of each
// opened file. There is one of these of every opened file. It is part of
// the union of a BL_FILE_TABLE structuure. Given a FileId we can access the
// file context via the BlFileTable (e.g., BlFileTable[FileId].u.NetFileContext)
//
typedef struct _NET_FILE_CONTEXT {
PUCHAR InMemoryCopy;
ULONG FileSize;
#if defined(REMOTE_BOOT)
BOOLEAN CachedFile;
ULONG CachedFileId;
#endif // defined(REMOTE_BOOT)
} NET_FILE_CONTEXT, *PNET_FILE_CONTEXT;
#if defined(REMOTE_BOOT)
//
// The following defines are for parameter passing between loaders, when switching.
// Each parameter contains a 4-byte quantity which is completely random, and then a
// 4 byte checksum generated by the following formula:
// CkSum = (((b1 * 2) + b2) * 2) + b3) * 2 + b4
//
#define NET_REBOOT_WRITE_SECRET_ONLY 0x53A590F10000073D
#define NET_REBOOT_DISK_SECRET_VALID 0xE32C78B70000096F
#endif // defined(REMOTE_BOOT)
#define NET_REBOOT_COMMAND_CONSOLE_ONLY 0x83CDA43F000008D3
#define NET_REBOOT_ASR 0x9cb2521700000863
//
// Global variables available outside of the "network file system" part
// of the loader.
//
extern ULONG NetLocalIpAddress;
extern ULONG NetLocalSubnetMask;
extern ULONG NetServerIpAddress;
extern ULONG NetGatewayIpAddress;
extern CHAR NetBootPath[129];
extern PCHAR NetServerShare;
extern UCHAR NetBootIniContents[1020 + 1];
extern UCHAR NetBootIniPath[256 + 1];
extern USHORT NetMaxTranUnit; // MTU
extern USHORT NetHwAddrLen; // actual length of hardware address
extern USHORT NetHwType; // Type of protocol at the hardware level from rfc1010
extern BOOLEAN NetBootTftpUsedPassword2;
#if defined(_IA64_)
extern EFI_PXE_BASE_CODE *PXEClient;
extern EFI_HANDLE PXEHandle;
#endif
#if defined(REMOTE_BOOT)
extern BOOLEAN NetBootRepin;
extern BOOLEAN NetworkBootRom;
extern BOOLEAN NetBootCSC;
extern CHAR NetBootActivePartitionName[80];
extern CHAR NetBootCSCPartitionName[80];
extern BOOLEAN NetBootSearchedForCSC;
#endif // defined(REMOTE_BOOT)
//
// Define ARC hooks.
//
ARC_STATUS
NetArcClose (
IN ULONG FileId
);
ARC_STATUS
NetArcOpen (
IN CHAR * FIRMWARE_PTR OpenPath,
IN OPEN_MODE OpenMode,
OUT ULONG * FIRMWARE_PTR FileId
);
//
// Define file I/O prototypes.
//
ARC_STATUS
NetClose (
IN ULONG FileId
);
ARC_STATUS
NetMount (
IN CHAR * FIRMWARE_PTR MountPath,
IN MOUNT_OPERATION Operation
);
ARC_STATUS
NetOpen (
IN CHAR * FIRMWARE_PTR OpenPath,
IN OPEN_MODE OpenMode,
OUT ULONG * FIRMWARE_PTR FileId
);
ARC_STATUS
NetRead (
IN ULONG FileId,
OUT VOID * FIRMWARE_PTR Buffer,
IN ULONG Length,
OUT ULONG * FIRMWARE_PTR Count
);
ARC_STATUS
NetGetReadStatus (
IN ULONG FileId
);
ARC_STATUS
NetSeek (
IN ULONG FileId,
IN LARGE_INTEGER * FIRMWARE_PTR Offset,
IN SEEK_MODE SeekMode
);
ARC_STATUS
NetWrite (
IN ULONG FileId,
IN VOID * FIRMWARE_PTR Buffer,
IN ULONG Length,
OUT ULONG * FIRMWARE_PTR Count
);
ARC_STATUS
NetGetFileInformation (
IN ULONG FileId,
OUT FILE_INFORMATION * FIRMWARE_PTR Buffer
);
ARC_STATUS
NetSetFileInformation (
IN ULONG FileId,
IN ULONG AttributeFlags,
IN ULONG AttributeMask
);
ARC_STATUS
NetRename (
IN ULONG FileId,
IN CHAR * FIRMWARE_PTR NewFileName
);
ARC_STATUS
NetGetDirectoryEntry (
IN ULONG FileId,
IN DIRECTORY_ENTRY * FIRMWARE_PTR DirEntry,
IN ULONG NumberDir,
OUT ULONG * FIRMWARE_PTR CountDir
);
ARC_STATUS
NetInitialize (
VOID
);
VOID
NetTerminate (
VOID
);
//
//
// Define network helper functions for the loaders.
//
NTSTATUS
NetQueryCardInfo(
IN OUT PNET_CARD_INFO CardInfo
);
NTSTATUS
NetQueryDriverInfo(
IN PNET_CARD_INFO CardInfo,
IN PCHAR SetupPath,
IN PCHAR NtBootPathName,
IN OUT PWCHAR HardwareId,
IN ULONG HardwareIdLength, // in bytes
IN OUT PWCHAR DriverName,
IN OUT PCHAR DriverNameAnsi,
IN ULONG DriverNameLength, // in bytes
IN OUT PWCHAR ServiceName,
IN ULONG ServiceNameLength, // in bytes
OUT PCHAR * Registry,
OUT ULONG * RegistryLength
);
#if defined(REMOTE_BOOT)
NTSTATUS
NetCopyHalAndKernel(
IN PCHAR HalName,
IN PCHAR Guid,
IN ULONG GuidLength
);
NTSTATUS
NetPrepareIpsec(
IN ULONG InboundSpi,
OUT ULONG * SessionKey,
OUT ULONG * OutboundSpi
);
#endif // defined(REMOTE_BOOT)
VOID
GetGuid(
OUT PUCHAR *Guid,
OUT PULONG GuidLength
);
VOID
NetGetRebootParameters(
OUT PULONGLONG Param OPTIONAL,
OUT PUCHAR RebootFile OPTIONAL,
OUT PUCHAR SifFile OPTIONAL,
OUT PUCHAR User OPTIONAL,
OUT PUCHAR Domain OPTIONAL,
OUT PUCHAR Password OPTIONAL,
OUT PUCHAR AdministratorPassword OPTIONAL,
IN BOOLEAN ClearRestartBlock
);
NTSTATUS
NetSoftReboot(
IN PUCHAR NextBootFile,
IN ULONGLONG Param,
IN PUCHAR RebootFile OPTIONAL,
IN PUCHAR SifFile OPTIONAL,
IN PUCHAR User OPTIONAL,
IN PUCHAR Domain OPTIONAL,
IN PUCHAR Password OPTIONAL,
IN PUCHAR AdministratorPassword OPTIONAL
);
ARC_STATUS
NetFillNetworkLoaderBlock (
PNETWORK_LOADER_BLOCK NetworkLoaderBlock
);
#if defined(_ALPHA_)
#define NetFindCSCPartitionName() FALSE
#else
BOOLEAN
NetFindCSCPartitionName(
VOID
);
#endif
#endif // _NETBOOT_