some MSVC compat fixes

svn path=/trunk/; revision=32493
This commit is contained in:
Christoph von Wittich
2008-02-26 15:23:57 +00:00
parent 5f67896462
commit 3c437562b5
11 changed files with 171 additions and 157 deletions
+6 -4
View File
@@ -54,7 +54,7 @@ extern PVOID FsStaticBufferDisk, FsStaticBufferData;
#ifndef ASM
#include <pshpack1.h>
typedef struct
{
unsigned long eax;
@@ -72,7 +72,7 @@ typedef struct
unsigned long eflags;
} PACKED DWORDREGS;
} DWORDREGS;
typedef struct
{
@@ -91,7 +91,7 @@ typedef struct
unsigned short flags, _upper_flags;
} PACKED WORDREGS;
} WORDREGS;
typedef struct
{
@@ -118,7 +118,8 @@ typedef struct
unsigned short flags, _upper_flags;
} PACKED BYTEREGS;
} BYTEREGS;
typedef union
{
@@ -127,6 +128,7 @@ typedef union
WORDREGS w;
BYTEREGS b;
} REGS;
#include <poppack.h>
// Int386()
//
+5 -3
View File
@@ -33,6 +33,7 @@ typedef struct _GEOMETRY
//
// Extended disk geometry (Int13 / ah=48h)
//
#include <pshpack1.h>
typedef struct _EXTENDED_GEOMETRY
{
USHORT Size;
@@ -43,7 +44,7 @@ typedef struct _EXTENDED_GEOMETRY
ULONGLONG Sectors;
USHORT BytesPerSector;
ULONG PDPTE;
} __attribute__((packed)) EXTENDED_GEOMETRY, *PEXTENDED_GEOMETRY;
} EXTENDED_GEOMETRY, *PEXTENDED_GEOMETRY;
//
// Define the structure of a partition table entry
@@ -61,7 +62,7 @@ typedef struct _PARTITION_TABLE_ENTRY
ULONG SectorCountBeforePartition; // Number of sectors preceding the partition
ULONG PartitionSectorCount; // Number of sectors in the partition
} PACKED PARTITION_TABLE_ENTRY, *PPARTITION_TABLE_ENTRY;
} PARTITION_TABLE_ENTRY, *PPARTITION_TABLE_ENTRY;
//
// Define the structure of the master boot record
@@ -74,7 +75,8 @@ typedef struct _MASTER_BOOT_RECORD
PARTITION_TABLE_ENTRY PartitionTable[4]; /* 0x1BE */
USHORT MasterBootRecordMagic; /* 0x1FE */
} PACKED MASTER_BOOT_RECORD, *PMASTER_BOOT_RECORD;
} MASTER_BOOT_RECORD, *PMASTER_BOOT_RECORD;
#include <poppack.h>
//
// Partition type defines
@@ -21,13 +21,13 @@
#define __DRIVEMAP_H
#ifdef __i386__
#include <pshpack1.h>
typedef struct
{
UCHAR DriveMapCount; // Count of drives currently mapped
CHAR DriveMap[8]; // Map of BIOS drives
} PACKED DRIVE_MAP_LIST, *PDRIVE_MAP_LIST;
} DRIVE_MAP_LIST, *PDRIVE_MAP_LIST;
#include <poppack.h>
VOID DriveMapMapDrivesInSection(PCSTR SectionName);
BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString); // Checks the drive string ("hd0") for validity
@@ -73,7 +73,11 @@
printk (KERN_DEBUG f, ## a); \
} while (0)
#else
#define ext3_debug(f, a...) do {} while (0)
#ifdef __GNUC__
#define ext3_debug(f, a...) do {} while (0)
#else
#define ext3_debug
#endif
#endif
/*
@@ -20,6 +20,7 @@
#ifndef __FAT_H
#define __FAT_H
#include <pshpack1.h>
typedef struct _FAT_BOOTSECTOR
{
UCHAR JumpBoot[3]; // Jump instruction to boot code
@@ -47,7 +48,7 @@ typedef struct _FAT_BOOTSECTOR
USHORT BootSectorMagic; // 0xAA55
} PACKED FAT_BOOTSECTOR, *PFAT_BOOTSECTOR;
} FAT_BOOTSECTOR, *PFAT_BOOTSECTOR;
typedef struct _FAT32_BOOTSECTOR
{
@@ -83,7 +84,7 @@ typedef struct _FAT32_BOOTSECTOR
USHORT BootSectorMagic; // 0xAA55
} PACKED FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR;
} FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR;
typedef struct _FATX_BOOTSECTOR
{
@@ -94,7 +95,7 @@ typedef struct _FATX_BOOTSECTOR
ULONG Unknown; /* Always 0? */
UCHAR Unused[494]; /* Actually size should be 4078 (boot block is 4096 bytes) */
} PACKED FATX_BOOTSECTOR, *PFATX_BOOTSECTOR;
} FATX_BOOTSECTOR, *PFATX_BOOTSECTOR;
/*
* Structure of MSDOS directory entry
@@ -113,7 +114,7 @@ typedef struct //_DIRENTRY
USHORT Date; /* Date last modified */
USHORT ClusterLow; /* First cluster number low word */
ULONG Size; /* File size */
} PACKED DIRENTRY, * PDIRENTRY;
} DIRENTRY, * PDIRENTRY;
typedef struct
{
@@ -125,7 +126,7 @@ typedef struct
WCHAR Name5_10[6]; /* 6 more characters in name */
USHORT StartCluster; /* Starting cluster number */
WCHAR Name11_12[2]; /* Last 2 characters in name */
} PACKED LFN_DIRENTRY, * PLFN_DIRENTRY;
} LFN_DIRENTRY, * PLFN_DIRENTRY;
typedef struct
{
@@ -140,7 +141,8 @@ typedef struct
USHORT CreateDate; /* Date file was created */
USHORT LastAccessTime; /* Time file was last accessed */
USHORT LastAccessDate; /* Date file was last accessed */
} PACKED FATX_DIRENTRY, * PFATX_DIRENTRY;
} FATX_DIRENTRY, * PFATX_DIRENTRY;
#include <poppack.h>
typedef struct
{
+5 -10
View File
@@ -20,7 +20,7 @@
#ifndef __ISO_H
#define __ISO_H
#include <pshpack1.h>
struct _DIR_RECORD
{
UCHAR RecordLength; // 1
@@ -42,25 +42,20 @@ struct _DIR_RECORD
ULONG VolumeSequenceNumber; // 29-32
UCHAR FileIdLength; // 33
UCHAR FileId[1]; // 34
} __attribute__((packed));
};
typedef struct _DIR_RECORD DIR_RECORD, *PDIR_RECORD;
/* Volume Descriptor header*/
struct _VD_HEADER
{
UCHAR VdType; // 1
UCHAR StandardId[5]; // 2-6
UCHAR VdVersion; // 7
} __attribute__((packed));
};
typedef struct _VD_HEADER VD_HEADER, *PVD_HEADER;
/* Primary Volume Descriptor */
struct _PVD
{
@@ -89,8 +84,8 @@ struct _PVD
/* more data ... */
} __attribute__((packed));
};
#include <poppack.h>
typedef struct _PVD PVD, *PPVD;
+19 -15
View File
@@ -59,6 +59,7 @@
#define NTFS_FILE_NAME_DOS 2
#define NTFS_FILE_NAME_WIN32_AND_DOS 3
#include <pshpack1.h>
typedef struct
{
UCHAR JumpBoot[3]; // Jump to the boot loader routine
@@ -85,14 +86,14 @@ typedef struct
ULONGLONG VolumeSerialNumber; // Volume serial number
UCHAR BootCodeAndData[430]; // The remainder of the boot sector
USHORT BootSectorMagic; // 0xAA55
} PACKED NTFS_BOOTSECTOR, *PNTFS_BOOTSECTOR;
} NTFS_BOOTSECTOR, *PNTFS_BOOTSECTOR;
typedef struct
{
ULONG Magic;
USHORT USAOffset; // Offset to the Update Sequence Array from the start of the ntfs record
USHORT USACount;
} PACKED NTFS_RECORD, *PNTFS_RECORD;
} NTFS_RECORD, *PNTFS_RECORD;
typedef struct
{
@@ -108,7 +109,7 @@ typedef struct
ULONG BytesAllocated;
ULONGLONG BaseMFTRecord;
USHORT NextAttributeInstance;
} PACKED NTFS_MFT_RECORD, *PNTFS_MFT_RECORD;
} NTFS_MFT_RECORD, *PNTFS_MFT_RECORD;
typedef struct
{
@@ -127,7 +128,7 @@ typedef struct
ULONG ValueLength;
USHORT ValueOffset;
USHORT Flags;
} PACKED Resident;
} Resident;
// Non-resident attributes
struct
{
@@ -140,9 +141,9 @@ typedef struct
LONGLONG DataSize;
LONGLONG InitializedSize;
LONGLONG CompressedSize;
} PACKED NonResident;
} PACKED;
} PACKED NTFS_ATTR_RECORD, *PNTFS_ATTR_RECORD;
} NonResident;
};
} NTFS_ATTR_RECORD, *PNTFS_ATTR_RECORD;
typedef struct
{
@@ -151,7 +152,7 @@ typedef struct
ULONG AllocatedSize;
UCHAR Flags;
UCHAR Reserved[3];
} PACKED NTFS_INDEX_HEADER, *PNTFS_INDEX_HEADER;
} NTFS_INDEX_HEADER, *PNTFS_INDEX_HEADER;
typedef struct
{
@@ -161,7 +162,7 @@ typedef struct
UCHAR ClustersPerIndexBlock;
UCHAR Reserved[3];
NTFS_INDEX_HEADER IndexHeader;
} PACKED NTFS_INDEX_ROOT, *PNTFS_INDEX_ROOT;
} NTFS_INDEX_ROOT, *PNTFS_INDEX_ROOT;
typedef struct
{
@@ -178,7 +179,7 @@ typedef struct
UCHAR FileNameLength;
UCHAR FileNameType;
WCHAR FileName[0];
} PACKED NTFS_FILE_NAME_ATTR, *PNTFS_FILE_NAME_ATTR;
} NTFS_FILE_NAME_ATTR, *PNTFS_FILE_NAME_ATTR;
typedef struct {
union
@@ -186,20 +187,21 @@ typedef struct {
struct
{
ULONGLONG IndexedFile;
} PACKED Directory;
} Directory;
struct
{
USHORT DataOffset;
USHORT DataLength;
ULONG Reserved;
} PACKED ViewIndex;
} PACKED Data;
} ViewIndex;
} Data;
USHORT Length;
USHORT KeyLength;
USHORT Flags;
USHORT Reserved;
NTFS_FILE_NAME_ATTR FileName;
} PACKED NTFS_INDEX_ENTRY, *PNTFS_INDEX_ENTRY;
} NTFS_INDEX_ENTRY, *PNTFS_INDEX_ENTRY;
#include <poppack.h>
typedef struct
{
@@ -212,11 +214,13 @@ typedef struct
NTFS_ATTR_RECORD Record;
} NTFS_ATTR_CONTEXT, *PNTFS_ATTR_CONTEXT;
#include <pshpack1.h>
typedef struct
{
PNTFS_ATTR_CONTEXT DataContext;
ULONGLONG Offset;
} PACKED NTFS_FILE_HANDLE, *PNTFS_FILE_HANDLE;
} NTFS_FILE_HANDLE, *PNTFS_FILE_HANDLE;
#include <poppack.h>
BOOLEAN NtfsOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount);
FILE* NtfsOpenFile(PCSTR FileName);
+4 -2
View File
@@ -43,6 +43,7 @@
#define LINUX_MAX_INITRD_ADDRESS 0x38000000
#include <pshpack1.h>
typedef struct
{
UCHAR BootCode1[0x20];
@@ -61,7 +62,7 @@ typedef struct
USHORT RootDevice;
USHORT BootFlag; // 0xAA55
} PACKED LINUX_BOOTSECTOR, *PLINUX_BOOTSECTOR;
} LINUX_BOOTSECTOR, *PLINUX_BOOTSECTOR;
typedef struct
{
@@ -122,7 +123,8 @@ typedef struct
ULONG InitrdAddressMax; // Highest legal initrd address
} PACKED LINUX_SETUPSECTOR, *PLINUX_SETUPSECTOR;
} LINUX_SETUPSECTOR, *PLINUX_SETUPSECTOR;
#include <poppack.h>
VOID BootNewLinuxKernel(VOID); // Implemented in linux.S
VOID BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S
+6 -2
View File
@@ -29,13 +29,15 @@ typedef enum
BiosMemoryAcpiNvs
} BIOS_MEMORY_TYPE;
#include <pshpack1.h>
typedef struct
{
ULONGLONG BaseAddress;
ULONGLONG Length;
ULONG Type;
ULONG Reserved;
} PACKED BIOS_MEMORY_MAP, *PBIOS_MEMORY_MAP;
} BIOS_MEMORY_MAP, *PBIOS_MEMORY_MAP;
#include <poppack.h>
#if defined(__i386__) || defined(_PPC_) || defined(_MIPS_) || defined(_ARM_)
@@ -52,11 +54,13 @@ typedef struct
#define HEAP_PAGES 0x400
#define STACK_PAGES 0x00
#include <pshpack1.h>
typedef struct
{
TYPE_OF_MEMORY PageAllocated; // Type of allocated memory (LoaderFree if this memory is free)
ULONG PageAllocationLength; // Number of pages allocated (or zero if this isn't the first page in the chain)
} PACKED PAGE_LOOKUP_TABLE_ITEM, *PPAGE_LOOKUP_TABLE_ITEM;
} PAGE_LOOKUP_TABLE_ITEM, *PPAGE_LOOKUP_TABLE_ITEM;
#include <poppack.h>
//
// Define this to 1 if you want the entire contents
+3 -1
View File
@@ -20,12 +20,14 @@
#ifndef __VIDEO_H
#define __VIDEO_H
#include <pshpack1.h>
typedef struct
{
UCHAR Red;
UCHAR Green;
UCHAR Blue;
} PACKED PALETTE_ENTRY, *PPALETTE_ENTRY;
} PALETTE_ENTRY, *PPALETTE_ENTRY;
#include <poppack.h>
extern PVOID VideoOffScreenBuffer;
+107 -110
View File
@@ -1,111 +1,108 @@
/*
* FreeLoader
* Copyright (C) 1998-2003 Brian Palmer <[email protected]>
* Copyright (C) 2006 Aleksey Bragin <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __WINLDR_H
#define __WINLDR_H
///////////////////////////////////////////////////////////////////////////////////////
//
// ReactOS Loading Functions
//
///////////////////////////////////////////////////////////////////////////////////////
VOID LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion);
/* Entry-point to kernel */
typedef
VOID
NTAPI
(*KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock);
// Some definitions
#define SECTOR_SIZE 512
// Descriptors
#define NUM_GDT 128 // Must be 128
#define NUM_IDT 0x100 // only 16 are used though. Must be 0x100
// conversion.c
PVOID VaToPa(PVOID Va);
PVOID PaToVa(PVOID Pa);
VOID List_PaToVa(LIST_ENTRY *ListEntry);
VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start);
// peloader.c
BOOLEAN
WinLdrLoadImage(IN PCHAR FileName,
TYPE_OF_MEMORY MemoryType,
OUT PVOID *ImageBasePA);
BOOLEAN
WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
IN PCCH BaseDllName,
IN PCCH FullDllName,
IN PVOID BasePA,
OUT PLDR_DATA_TABLE_ENTRY *NewEntry);
BOOLEAN
WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
IN PCCH DirectoryPath,
IN PLDR_DATA_TABLE_ENTRY ScanDTE);
// winldr.c
/*
* FreeLoader
* Copyright (C) 1998-2003 Brian Palmer <[email protected]>
* Copyright (C) 2006 Aleksey Bragin <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __WINLDR_H
#define __WINLDR_H
///////////////////////////////////////////////////////////////////////////////////////
//
// ReactOS Loading Functions
//
///////////////////////////////////////////////////////////////////////////////////////
VOID LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion);
/* Entry-point to kernel */
typedef VOID (NTAPI *KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock);
// Some definitions
#define SECTOR_SIZE 512
// Descriptors
#define NUM_GDT 128 // Must be 128
#define NUM_IDT 0x100 // only 16 are used though. Must be 0x100
// conversion.c
PVOID VaToPa(PVOID Va);
PVOID PaToVa(PVOID Pa);
VOID List_PaToVa(LIST_ENTRY *ListEntry);
VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start);
// peloader.c
BOOLEAN
WinLdrLoadImage(IN PCHAR FileName,
TYPE_OF_MEMORY MemoryType,
OUT PVOID *ImageBasePA);
BOOLEAN
WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
IN PCCH BaseDllName,
IN PCCH FullDllName,
IN PVOID BasePA,
OUT PLDR_DATA_TABLE_ENTRY *NewEntry);
BOOLEAN
WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
IN PCCH DirectoryPath,
IN PLDR_DATA_TABLE_ENTRY ScanDTE);
// winldr.c
PVOID WinLdrLoadModule(PCSTR ModuleName, ULONG *Size,
TYPE_OF_MEMORY MemoryType);
// wlmemory.c
BOOLEAN
WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG PcrBasePage,
ULONG TssBasePage,
PVOID GdtIdt);
// wlregistry.c
BOOLEAN WinLdrLoadAndScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
IN LPCSTR DirectoryPath);
/* FIXME: Should be moved to NDK, and respective ACPI header files */
typedef struct _ACPI_BIOS_DATA
{
PHYSICAL_ADDRESS RSDTAddress;
ULONGLONG Count;
BIOS_MEMORY_MAP MemoryMap[1]; /* Count of BIOS memory map entries */
} ACPI_BIOS_DATA, *PACPI_BIOS_DATA;
#include <pshpack1.h>
typedef struct /* Root System Descriptor Pointer */
{
CHAR signature [8]; /* contains "RSD PTR " */
UCHAR checksum; /* to make sum of struct == 0 */
CHAR oem_id [6]; /* OEM identification */
UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
ULONG length; /* XSDT Length in bytes including hdr */
ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
UCHAR extended_checksum; /* Checksum of entire table */
CHAR reserved [3]; /* reserved field must be 0 */
} RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR;
#include <poppack.h>
#endif // defined __WINLDR_H
TYPE_OF_MEMORY MemoryType);
// wlmemory.c
BOOLEAN
WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG PcrBasePage,
ULONG TssBasePage,
PVOID GdtIdt);
// wlregistry.c
BOOLEAN WinLdrLoadAndScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
IN LPCSTR DirectoryPath);
/* FIXME: Should be moved to NDK, and respective ACPI header files */
typedef struct _ACPI_BIOS_DATA
{
PHYSICAL_ADDRESS RSDTAddress;
ULONGLONG Count;
BIOS_MEMORY_MAP MemoryMap[1]; /* Count of BIOS memory map entries */
} ACPI_BIOS_DATA, *PACPI_BIOS_DATA;
#include <pshpack1.h>
typedef struct /* Root System Descriptor Pointer */
{
CHAR signature [8]; /* contains "RSD PTR " */
UCHAR checksum; /* to make sum of struct == 0 */
CHAR oem_id [6]; /* OEM identification */
UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
ULONG length; /* XSDT Length in bytes including hdr */
ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
UCHAR extended_checksum; /* Checksum of entire table */
CHAR reserved [3]; /* reserved field must be 0 */
} RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR;
#include <poppack.h>
#endif // defined __WINLDR_H