MyRegisterClass(hInstance);
// Perform application initialization:
- if (!InitInstance (hInstance, nCmdShow))
+ if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_FDEBUG);
// Main message loop:
- while (GetMessage(&msg, NULL, 0, 0))
+ while (GetMessage(&msg, NULL, 0, 0))
{
- if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
+ if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
{
WNDCLASSEX wcex;
- wcex.cbSize = sizeof(WNDCLASSEX);
+ wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
NONCLIENTMETRICS ncm;
HFONT hFont;
- switch (message)
+ switch (message)
{
case WM_CREATE:
break;
case WM_COMMAND:
- wmId = LOWORD(wParam);
+ wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
if (lParam == (LPARAM)hEditWnd && wmEvent == EN_CHANGE)
return TRUE;
case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
GetWindowText(GetDlgItem(hDlg, IDC_BAUTRATE), strBaudRate, MAX_PATH);
}
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
GetWindowText(GetDlgItem(hDlg, IDC_CAPTUREFILENAME), strCaptureFileName, MAX_PATH);
}
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
#define IDC_STATIC -1
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132
// [in] Pointer to a null-terminated string that specifies device-control information.
// The string must have the same form as the mode command's command-line arguments.
//
-// For example, the following string specifies a baud rate of 1200, no parity, 8 data bits, and 1 stop bit:
+// For example, the following string specifies a baud rate of 1200, no parity, 8 data bits, and 1 stop bit:
// "baud=1200 parity=N data=8 stop=1"
//
// The following string specifies a baud rate of 115200, no parity, 8 data bits, and 1 stop bit:
// "115200,n,8,1"
//
-// The device name is ignored if it is included in the string, but it must specify a valid device, as follows:
+// The device name is ignored if it is included in the string, but it must specify a valid device, as follows:
// "COM1: baud=1200 parity=N data=8 stop=1"
//
-// For further information on mode command syntax, refer to the end-user documentation for your operating system.
+// For further information on mode command syntax, refer to the end-user documentation for your operating system.
BOOL Rs232ConfigurePortWin32(TCHAR* DeviceControlString)
{
DCB dcb;
}
// Members
-// ReadIntervalTimeout
-// Specifies the maximum time, in milliseconds, allowed to elapse between the arrival of two characters on the communications line. During a ReadFile operation, the time period begins when the first character is received. If the interval between the arrival of any two characters exceeds this amount, the ReadFile operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used.
-// A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the characters that have already been received, even if no characters have been received.
-//
-// ReadTotalTimeoutMultiplier
-// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is multiplied by the requested number of bytes to be read.
-// ReadTotalTimeoutConstant
-// Specifies the constant, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is added to the product of the ReadTotalTimeoutMultiplier member and the requested number of bytes.
-// A value of zero for both the ReadTotalTimeoutMultiplier and ReadTotalTimeoutConstant members indicates that total time-outs are not used for read operations.
-//
-// WriteTotalTimeoutMultiplier
-// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is multiplied by the number of bytes to be written.
-// WriteTotalTimeoutConstant
-// Specifies the constant, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is added to the product of the WriteTotalTimeoutMultiplier member and the number of bytes to be written.
-// A value of zero for both the WriteTotalTimeoutMultiplier and WriteTotalTimeoutConstant members indicates that total time-outs are not used for write operations.
-//
+// ReadIntervalTimeout
+// Specifies the maximum time, in milliseconds, allowed to elapse between the arrival of two characters on the communications line. During a ReadFile operation, the time period begins when the first character is received. If the interval between the arrival of any two characters exceeds this amount, the ReadFile operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used.
+// A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the characters that have already been received, even if no characters have been received.
+//
+// ReadTotalTimeoutMultiplier
+// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is multiplied by the requested number of bytes to be read.
+// ReadTotalTimeoutConstant
+// Specifies the constant, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is added to the product of the ReadTotalTimeoutMultiplier member and the requested number of bytes.
+// A value of zero for both the ReadTotalTimeoutMultiplier and ReadTotalTimeoutConstant members indicates that total time-outs are not used for read operations.
+//
+// WriteTotalTimeoutMultiplier
+// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is multiplied by the number of bytes to be written.
+// WriteTotalTimeoutConstant
+// Specifies the constant, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is added to the product of the WriteTotalTimeoutMultiplier member and the number of bytes to be written.
+// A value of zero for both the WriteTotalTimeoutMultiplier and WriteTotalTimeoutConstant members indicates that total time-outs are not used for write operations.
+//
// Remarks
-// If an application sets ReadIntervalTimeout and ReadTotalTimeoutMultiplier to MAXDWORD and sets ReadTotalTimeoutConstant to a value greater than zero and less than MAXDWORD, one of the following occurs when the ReadFile function is called:
-//
-// If there are any characters in the input buffer, ReadFile returns immediately with the characters in the buffer.
-// If there are no characters in the input buffer, ReadFile waits until a character arrives and then returns immediately.
-// If no character arrives within the time specified by ReadTotalTimeoutConstant, ReadFile times out.
+// If an application sets ReadIntervalTimeout and ReadTotalTimeoutMultiplier to MAXDWORD and sets ReadTotalTimeoutConstant to a value greater than zero and less than MAXDWORD, one of the following occurs when the ReadFile function is called:
+//
+// If there are any characters in the input buffer, ReadFile returns immediately with the characters in the buffer.
+// If there are no characters in the input buffer, ReadFile waits until a character arrives and then returns immediately.
+// If no character arrives within the time specified by ReadTotalTimeoutConstant, ReadFile times out.
BOOL Rs232SetCommunicationTimeoutsWin32(DWORD ReadIntervalTimeout, DWORD ReadTotalTimeoutMultiplier, DWORD ReadTotalTimeoutConstant, DWORD WriteTotalTimeoutMultiplier, DWORD WriteTotalTimeoutConstant)
{
COMMTIMEOUTS ct;
WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
-
+
/* Stage 1: Coarse calibration */
-
+
WaitFor8254Wraparound();
-
+
delay_count = 1;
-
+
do {
delay_count <<= 1; /* Next delay count to try */
WaitFor8254Wraparound();
-
+
__StallExecutionProcessor(delay_count); /* Do the delay */
-
+
CurCount = Read8254Timer();
} while (CurCount > LATCH / 2);
-
+
delay_count >>= 1; /* Get bottom value for delay */
-
+
/* Stage 2: Fine calibration */
-
+
calib_bit = delay_count; /* Which bit are we going to test */
-
+
for(i=0;i<PRECISION;i++) {
calib_bit >>= 1; /* Next bit to calibrate */
if(!calib_bit) break; /* If we have done all bits, stop */
-
+
delay_count |= calib_bit; /* Set the bit in delay_count */
-
+
WaitFor8254Wraparound();
-
+
__StallExecutionProcessor(delay_count); /* Do the delay */
-
+
CurCount = Read8254Timer();
if (CurCount <= LATCH / 2) /* If a tick has passed, turn the */
delay_count &= ~calib_bit; /* calibrated bit back off */
}
-
+
/* We're finished: Do the finishing touches */
delay_count /= (MILLISEC / 2); /* Calculate delay_count for 1ms */
}
if (ConfigTable->Signature != MP_CT_SIGNATURE)
return NULL;
- DbgPrint((DPRINT_HWDETECT,
+ DbgPrint((DPRINT_HWDETECT,
"MP Configuration Table at: %x\n",
(ULONG)ConfigTable));
CpuEntry = (PMP_PROCESSOR_ENTRY)Ptr;
DbgPrint((DPRINT_HWDETECT, "Processor Entry\n"));
- DbgPrint((DPRINT_HWDETECT,
+ DbgPrint((DPRINT_HWDETECT,
"APIC Id %u APIC Version %u Flags %x Signature %x Feature %x\n",
CpuEntry->LocalApicId,
CpuEntry->LocalApicVersion,
return TRUE;
}
-BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
+BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
{
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR VolumeType;
// interrupt from the AT real-time clock chip which is available on INT 70;
// because newer BIOSes may have much more precise timers available, it is
// not possible to use this function accurately for very short delays unless
- // the precise behavior of the BIOS is known (or found through testing)
+ // the precise behavior of the BIOS is known (or found through testing)
while (msec)
{
msec_this = msec;
-
+
if (msec_this > 4000)
{
msec_this = 4000;
// A search must then be made to find them, FFFFh will also terminate this
// second list. In some cases, only a "stub" VBE may be present, supporting
// only AX=4F00h; this case may be assumed if the list of supported video modes
-// is empty (consisting of a single word of FFFFh)
+// is empty (consisting of a single word of FFFFh)
VOID BiosSetVideoFont8x16(VOID)
{
* CH = feature connector bits
* CL = switch settings
* AH destroyed (at least by Tseng ET4000 BIOS v8.00n)
- *
+ *
* Installation check;EGA
*/
Regs.b.ah = 0x12;
* This function is commonly used to check for the presence of a VGA.
*
* Installation check;VGA
- *
+ *
* Values for display combination code:
* 00h no display
* 01h monochrome adapter w/ monochrome display
* CL = bottom scan line containing cursor (bits 0-4)
* Return:
* Nothing
- *
+ *
* Specify the starting and ending scan lines to be occupied
* by the hardware cursor in text modes.
*
* AMI 386 BIOS and AST Premier 386 BIOS will lock up the
* system if AL is not equal to the current video mode.
- *
+ *
* Bitfields for cursor start and options:
- *
+ *
* Bit(s) Description
* 7 should be zero
* 6,5 cursor blink
*
* Note: While VBE 1.1 and higher will zero out all unused bytes
* of the buffer, v1.0 did not, so applications that want to be
- * backward compatible should clear the buffer before calling
+ * backward compatible should clear the buffer before calling
*/
Regs.w.ax = 0x4F01;
Regs.w.cx = Mode;
* 121h 1600x1200x32K
* 122h 1600x1200x64K
* 81FFh special full-memory access mode
- *
+ *
* Notes: The special mode 81FFh preserves the contents of the video memory and gives
* access to all of the memory; VESA recommends that the special mode be a packed-pixel
* mode. For VBE 2.0+, it is required that the VBE implement the mode, but not place it
PUCHAR Buffer,
ULONG Count)
{
- __asm__ __volatile__ ("cld ; rep ; insb\n\t"
- : "=D" (Buffer), "=c" (Count)
+ __asm__ __volatile__ ("cld ; rep ; insb\n\t"
+ : "=D" (Buffer), "=c" (Count)
: "d" (Port),"0" (Buffer),"1" (Count));
}
ULONG Count)
{
__asm__ __volatile__ ("cld ; rep ; insw"
- : "=D" (Buffer), "=c" (Count)
+ : "=D" (Buffer), "=c" (Count)
: "d" (Port),"0" (Buffer),"1" (Count));
}
ULONG Count)
{
__asm__ __volatile__ ("cld ; rep ; insl"
- : "=D" (Buffer), "=c" (Count)
+ : "=D" (Buffer), "=c" (Count)
: "d" (Port),"0" (Buffer),"1" (Count));
}
#undef READ_PORT_UCHAR
-UCHAR
+UCHAR
STDCALL
READ_PORT_UCHAR (PUCHAR Port)
{
UCHAR Value;
-
+
__asm__("inb %w1, %0\n\t"
: "=a" (Value)
: "d" (Port));
READ_PORT_USHORT (USHORT* Port)
{
USHORT Value;
-
+
__asm__("inw %w1, %0\n\t"
: "=a" (Value)
: "d" (Port));
READ_PORT_ULONG (ULONG* Port)
{
ULONG Value;
-
+
__asm__("inl %w1, %0\n\t"
: "=a" (Value)
: "d" (Port));
}
#undef WRITE_PORT_BUFFER_UCHAR
-VOID
+VOID
STDCALL
WRITE_PORT_BUFFER_UCHAR (PUCHAR Port,
PUCHAR Buffer,
ULONG Count)
{
- __asm__ __volatile__ ("cld ; rep ; outsb"
- : "=S" (Buffer), "=c" (Count)
+ __asm__ __volatile__ ("cld ; rep ; outsb"
+ : "=S" (Buffer), "=c" (Count)
: "d" (Port),"0" (Buffer),"1" (Count));
}
ULONG Count)
{
__asm__ __volatile__ ("cld ; rep ; outsw"
- : "=S" (Buffer), "=c" (Count)
+ : "=S" (Buffer), "=c" (Count)
: "d" (Port),"0" (Buffer),"1" (Count));
}
ULONG* Buffer,
ULONG Count)
{
- __asm__ __volatile__ ("cld ; rep ; outsl"
- : "=S" (Buffer), "=c" (Count)
+ __asm__ __volatile__ ("cld ; rep ; outsl"
+ : "=S" (Buffer), "=c" (Count)
: "d" (Port),"0" (Buffer),"1" (Count));
}
UCHAR Value)
{
__asm__("outb %0, %w1\n\t"
- :
+ :
: "a" (Value),
"d" (Port));
SLOW_DOWN_IO;
USHORT Value)
{
__asm__("outw %0, %w1\n\t"
- :
+ :
: "a" (Value),
"d" (Port));
SLOW_DOWN_IO;
ULONG Value)
{
__asm__("outl %0, %w1\n\t"
- :
+ :
: "a" (Value),
"d" (Port));
SLOW_DOWN_IO;
#define IDEWriteDMAStatus(Address, Data) \
(WRITE_PORT_UCHAR((PUCHAR)((Address) + 2), (Data)))
#define IDEWritePRDTable(Address, Data) \
- (WRITE_PORT_ULONG((PULONG)((Address) + 4), (Data)))
+ (WRITE_PORT_ULONG((PULONG)((Address) + 4), (Data)))
/*
* Data block read and write commands
BOOLEAN AcpiPresent = FALSE;
char BootPath[0x100];
-void le_swap( const void *start_addr_v,
- const void *end_addr_v,
+void le_swap( const void *start_addr_v,
+ const void *end_addr_v,
const void *target_addr_v ) {
- long *start_addr = (long *)ROUND_DOWN((long)start_addr_v,8),
- *end_addr = (long *)ROUND_UP((long)end_addr_v,8),
+ long *start_addr = (long *)ROUND_DOWN((long)start_addr_v,8),
+ *end_addr = (long *)ROUND_UP((long)end_addr_v,8),
*target_addr = (long *)ROUND_DOWN((long)target_addr_v,8);
long tmp;
while( start_addr <= end_addr ) {
void PpcPutChar( int ch ) {
char buf[3];
- if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
+ if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
else { buf[0] = ch; buf[1] = 0; }
buf[2] = 0;
ofw_print_string( buf );
return FALSE;
}
-VOID PpcVideoSetPaletteColor( UCHAR Color,
+VOID PpcVideoSetPaletteColor( UCHAR Color,
UCHAR Red, UCHAR Green, UCHAR Blue ) {
printf( "SetPaletteColor(%x,%x,%x,%x)\n", Color, Red, Green, Blue );
}
-VOID PpcVideoGetPaletteColor( UCHAR Color,
+VOID PpcVideoGetPaletteColor( UCHAR Color,
UCHAR *Red, UCHAR *Green, UCHAR *Blue ) {
printf( "GetPaletteColor(%x)\n", Color);
}
BiosMemoryMap[0].BaseAddress = 0;
BiosMemoryMap[0].Length = 32 * 1024 * 1024; /* Assume 32 meg for now */
- printf( "Returning memory map (%dk total)\n",
+ printf( "Returning memory map (%dk total)\n",
(int)BiosMemoryMap[0].Length / 1024 );
return 1;
return 0;
}
-VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
+VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
PULONG Hour, PULONG Minute, PULONG Second ) {
printf("RTCGeturrentDateTime\n");
}
MachVtbl.VideoSetTextCursorPosition = PpcVideoSetTextCursorPosition;
MachVtbl.VideoHideShowTextCursor = PpcVideoHideShowTextCursor;
MachVtbl.VideoPutChar = PpcVideoPutChar;
- MachVtbl.VideoCopyOffScreenBufferToVRAM =
+ MachVtbl.VideoCopyOffScreenBufferToVRAM =
PpcVideoCopyOffScreenBufferToVRAM;
MachVtbl.VideoIsPaletteFixed = PpcVideoIsPaletteFixed;
MachVtbl.VideoSetPaletteColor = PpcVideoSetPaletteColor;
MachVtbl.HwDetect = PpcHwDetect;
printf( "FreeLDR version [%s]\n", GetFreeLoaderVersionString() );
- BootMain("freeldr-ppc");
+ BootMain("freeldr-ppc");
}
void MachInit(char *CmdLine) {
int len;
printf( "Determining boot device:\n" );
- len = ofw_getprop(chosen_package, "bootpath",
+ len = ofw_getprop(chosen_package, "bootpath",
BootPath, sizeof(BootPath));
printf( "Got %d bytes of path\n", len );
BootPath[len] = 0;
CacheBlock = (PCACHE_BLOCK)RtlListGetNext((PLIST_ITEM)CacheBlock);
}
}
-
+
return NULL;
}
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <freeldr.h>
+#include <freeldr.h>
#include <cmdline.h>
#include <rtl.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <rtl.h>
#include <ui.h>
// They want an extended partition entry so we will need
// to loop through all the extended partitions on the disk
// and return the one they want.
-
+
ExtendedPartitionNumber = PartitionNumber - 5;
// Set the initial relative starting sector to 0
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <drivemap.h>
#include <rtl.h>
BOOL DriveMapIsValidDriveString(PCHAR DriveString)
{
ULONG Index;
-
+
// Now verify that the user has given us appropriate strings
if ((strlen(DriveString) < 3) ||
((DriveString[0] != 'f') && (DriveString[0] != 'F') && (DriveString[0] != 'h') && (DriveString[0] != 'H')) ||
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <rtl.h>
#include <arch.h>
{
return FALSE;
}
-
+
// Copy the data to their buffer
RtlCopyMemory(InodeBuffer, (PVOID)(FILESYSBUFFER + (InodeOffsetInBlock * EXT3_INODE_SIZE(Ext2SuperBlock))), sizeof(EXT2_INODE));
SectorsPerFat = FatBootSector->SectorsPerFat ? FatBootSector->SectorsPerFat : Fat32BootSector->SectorsPerFatBig;
TotalSectors = FatBootSector->TotalSectors ? FatBootSector->TotalSectors : FatBootSector->TotalSectorsBig;
DataSectorCount = TotalSectors - (FatBootSector->ReservedSectors + (FatBootSector->NumberOfFats * SectorsPerFat) + RootDirSectors);
-
-//mjl
+
+//mjl
if (FatBootSector->SectorsPerCluster == 0)
CountOfClusters = 0;
else
}
fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
- if (Cluster & 0x0001)
+ if (Cluster & 0x0001)
fat = fat >> 4; /* Cluster number is ODD */
else
fat = fat & 0x0FFF; /* Cluster number is EVEN */
case FAT16:
case FATX16:
-
+
FatOffset = (Cluster * 2);
ThisFatSecNum = ActiveFatSectorStart + (FatOffset / BytesPerSector);
ThisFatEntOffset = (FatOffset % BytesPerSector);
break;
}
}
-
+
return TRUE;
}
UCHAR BootCodeAndData[448]; // The remainder of the boot sector
USHORT BootSectorMagic; // 0xAA55
-
+
} PACKED FAT_BOOTSECTOR, *PFAT_BOOTSECTOR;
typedef struct _FAT32_BOOTSECTOR
UCHAR BootCodeAndData[420]; // The remainder of the boot sector
USHORT BootSectorMagic; // 0xAA55
-
+
} PACKED FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR;
typedef struct _FATX_BOOTSECTOR
USHORT NumberOfFats; /* Number of FAT tables */
ULONG Unknown; /* Always 0? */
UCHAR Unused[494]; /* Actually size should be 4078 (boot block is 4096 bytes) */
-
+
} PACKED FATX_BOOTSECTOR, *PFATX_BOOTSECTOR;
/*
{
FileName++;
}
-
+
//
// Check file system type and pass off to appropriate handler
//
{
AttrName = (PWCHAR)((PCHAR)AttrRecord + AttrRecord->NameOffset);
if (!RtlCompareMemory(AttrName, Name, NameLength << 1))
- {
+ {
/* Found it, fill up the context and return. */
Context->Record = AttrRecord;
if (AttrRecord->IsNonResident)
if (DataRunOffset != -1)
{
/* Normal run. */
- Context->CacheRunStartLCN =
+ Context->CacheRunStartLCN =
Context->CacheRunLastLCN = DataRunOffset;
}
else
ULONGLONG CurrentOffset;
ULONGLONG ReadLength;
ULONGLONG AlreadyRead;
-
+
if (!Context->Record->IsNonResident)
{
if (Offset > Context->Record->Resident.ValueLength)
/*
* Go to next run in the list.
*/
-
+
if (*DataRun == 0)
break;
DataRun = NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
BOOL NtfsReadMftRecord(ULONG MFTIndex, PNTFS_MFT_RECORD Buffer)
{
ULONGLONG BytesRead;
-
+
BytesRead = NtfsReadAttribute(&NtfsMFTContext, MFTIndex * NtfsMftRecordSize, (PCHAR)Buffer, NtfsMftRecordSize);
if (BytesRead != NtfsMftRecordSize)
return FALSE;
MmFreeMemory(MftRecord);
return FALSE;
}
-
+
IndexRecord = MmAllocateMemory(NtfsIndexRecordSize);
if (IndexRecord == NULL)
{
break;
RecordOffset += IndexBlockSize;
}
-
+
if (RecordOffset >= IndexAllocationSize)
{
break;
while (IndexEntry < IndexEntryEnd &&
!(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
- {
+ {
if (NtfsCompareFileName(FileName, IndexEntry))
{
DbgPrint((DPRINT_FILESYSTEM, "File found\n"));
MmFreeMemory(BitmapData);
}
-
+
MmFreeMemory(IndexRecord);
}
else
#define NTFS_FILE_NAME_POSIX 0
#define NTFS_FILE_NAME_WIN32 1
#define NTFS_FILE_NAME_DOS 2
-#define NTFS_FILE_NAME_WIN32_AND_DOS 3
+#define NTFS_FILE_NAME_WIN32_AND_DOS 3
typedef struct
{
#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
#define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n")
-
+
extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */
VOID BootMain(LPSTR CmdLine);
ULONG Code32Start; // here loaders can put a different
// start address for 32-bit code.
- //
+ //
// 0x1000 = default for zImage
- //
+ //
// 0x100000 = default for big kernel
ULONG RamdiskAddress; // address of loaded ramdisk image
VOID (*ConsPutChar)(int Ch);
BOOL (*ConsKbHit)(VOID);
int (*ConsGetCh)(VOID);
-
+
VOID (*VideoClearScreen)(UCHAR Attr);
VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOL Init);
VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
/* multiboot.h - the header for Multiboot */
/* Copyright (C) 1999 Free Software Foundation, Inc.
-
+
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. */
STDCALL
FrLdrCreateModule(LPSTR ModuleName);
-ULONG_PTR
-STDCALL
-FrLdrLoadModule(FILE *ModuleImage,
- LPSTR ModuleName,
+ULONG_PTR
+STDCALL
+FrLdrLoadModule(FILE *ModuleImage,
+ LPSTR ModuleName,
PULONG ModuleSize);
BOOL
STDCALL
FrLdrLoadKernel(PCHAR szFileName,
INT nPos);
-
+
BOOL
-FrLdrLoadNlsFile(PCHAR szSystemRoot,
+FrLdrLoadNlsFile(PCHAR szSystemRoot,
PCHAR szErrorOut);
-
+
BOOL
-FrLdrLoadDriver(PCHAR szFileName,
+FrLdrLoadDriver(PCHAR szFileName,
INT nPos);
BOOL
LoadSymbolFile(PCHAR szSystemRoot,
PCHAR ModuleName,
INT nPos);
-
+
VOID
-FrLdrLoadBootDrivers(PCHAR szSystemRoot,
+FrLdrLoadBootDrivers(PCHAR szSystemRoot,
INT nPos);
-
+
BOOL
STDCALL
-FrLdrCloseModule(ULONG_PTR ModuleBase,
+FrLdrCloseModule(ULONG_PTR ModuleBase,
ULONG dwModuleSize);
VOID
-STDCALL
+STDCALL
FrLdrStartup(ULONG Magic);
-VOID
-FASTCALL
+VOID
+FASTCALL
FrLdrGetKernelBase(VOID);
-VOID
-FASTCALL
+VOID
+FASTCALL
FrLdrSetupPae(ULONG Magic);
VOID
FrLdrGetPaeMode(VOID);
VOID
-FASTCALL
+FASTCALL
FrLdrSetupPageDirectory(VOID);
VOID
{
struct _LIST_ITEM* ListPrev;
struct _LIST_ITEM* ListNext;
-
+
} LIST_ITEM, *PLIST_ITEM;
VOID RtlListInitializeHead(PLIST_ITEM ListHead); // Initializes a doubly linked list
{
RtlListInsertTail((PLIST_ITEM)IniFileSectionListHead, (PLIST_ITEM)CurrentSection);
}
-
+
CurrentLineNumber++;
continue;
}
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <arch.h>
#include <disk.h>
/* Compile using ret insn that pops args.
This will not work unless you use prototypes at least
- for all functions that can take varying numbers of args. */
+ for all functions that can take varying numbers of args. */
#define TARGET_RTD (target_flags & MASK_RTD)
/* Align doubles to a two word boundary. This breaks compatibility with
/* Define for XFmode or TFmode extended real floating point support.
This will automatically cause REAL_ARITHMETIC to be defined.
-
+
The XFmode is specified by i386 ABI, while TFmode may be faster
due to alignment and simplifications in the address calculations.
*/
and all fundamental data types supported by the hardware
might need to be aligned. No data type wants to be aligned
rounder than this.
-
+
Pentium+ preferrs DFmode values to be aligned to 64 bit boundary
and Pentium Pro XFmode values at 128 bit boundaries. */
/* 1 for registers that have pervasive standard uses
and are not available for the register allocator.
On the 80386, the stack pointer is such, as is the arg pointer.
-
+
The value is an mask - bit 1 is set for fixed registers
for 32bit target, while 2 is set for fixed registers for 64bit.
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
1, 1, 1, 1, 1, 1, 1, 1, \
/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
1, 1, 1, 1, 1, 1, 1, 1}
-
+
/* 1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any
registers that can be used without being saved.
The latter must include the registers where values are returned
and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like.
-
+ Aside from that, you can include as many other registers as you like.
+
The value is an mask - bit 1 is set for call used
for 32bit target, while 2 is set for call used for 64bit.
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
This is ordinarily the length in words of a value of mode MODE
but can be less for certain modes in special long registers.
- Actually there are no two word move instructions for consecutive
+ Actually there are no two word move instructions for consecutive
registers. And only registers 0-3 may have mov byte instructions
applied to them.
*/
#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)
#define LAST_SSE_REG (FIRST_SSE_REG + 7)
-
+
#define FIRST_MMX_REG (LAST_SSE_REG + 1)
#define LAST_MMX_REG (FIRST_MMX_REG + 7)
#define MMX_REGNO_P(N) ((N) >= FIRST_MMX_REG && (N) <= LAST_MMX_REG)
#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP)))
-
+
#define STACK_REG_P(XOP) \
(REG_P (XOP) && \
REGNO (XOP) >= FIRST_STACK_REG && \
ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1)
/* QImode spills from non-QI registers need a scratch. This does not
- happen often -- the only example so far requires an uninitialized
+ happen often -- the only example so far requires an uninitialized
pseudo. */
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
|| ((CLASS) == DIREG))
/* A C statement that adds to CLOBBERS any hard regs the port wishes
- to automatically clobber for all asms.
+ to automatically clobber for all asms.
We do this in the new i386 backend to maintain source compatibility
with the old cc0-based compiler. */
On 386 pushw decrements by exactly 2 no matter what the position was.
On the 386 there is no pushb; we use pushw instead, and this
has the effect of rounding up to 2.
-
+
For 64bit ABI we round up to 8 bytes.
*/
the stack pointer does not matter. The value is tested only in
functions that have frame pointers.
No definition is equivalent to always zero. */
-/* Note on the 386 it might be more efficient not to define this since
+/* Note on the 386 it might be more efficient not to define this since
we have to restore it ourselves from the frame pointer, in order to
use pop */
#define REWRITE_ADDRESS(X) rewrite_address (X)
/* Nonzero if the constant value X is a legitimate general operand
- when generating PIC code. It is given that flag_pic is on and
+ when generating PIC code. It is given that flag_pic is on and
that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
#define LEGITIMATE_PIC_OPERAND_P(X) \
IX86_BUILTIN_RSQRTSS,
IX86_BUILTIN_SQRTPS,
IX86_BUILTIN_SQRTSS,
-
+
IX86_BUILTIN_UNPCKHPS,
IX86_BUILTIN_UNPCKLPS,
precise value of the constant, which is available for examination
in X, and the rtx code of the expression in which it is contained,
found in OUTER_CODE.
-
+
CODE is the expression code--redundant, since it can be obtained
with `GET_CODE (X)'. */
/* Add any extra modes needed to represent the condition code.
For the i386, we need separate modes when floating-point
- equality comparisons are being done.
-
+ equality comparisons are being done.
+
Add CCNO to indicate comparisons against zero that requires
Overflow flag to be unset. Sign bit test is used instead and
thus can be used to form "a&b>0" type of tests.
For float regs, the stack top is sometimes referred to as "%st(0)"
instead of just "%st". PRINT_REG handles this with the "y" code. */
-#undef HI_REGISTER_NAMES
+#undef HI_REGISTER_NAMES
#define HI_REGISTER_NAMES \
{"ax","dx","cx","bx","si","di","bp","sp", \
"st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
/* Before the prologue, RA is at 0(%esp). */
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
-
+
/* After the prologue, RA is at -4(AP) in the current frame. */
#define RETURN_ADDR_RTX(COUNT, FRAME) \
((COUNT) == 0 \
#define JUMP_TABLES_IN_TEXT_SECTION \
(!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA)
-/* A C statement that outputs an address constant appropriate to
+/* A C statement that outputs an address constant appropriate to
for DWARF debugging. */
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, X) \
CM_MEDIUM is model assuming that code fits in the first 31bits of address
space. Size of data is unlimited.
CM_LARGE is model making no assumptions about size of particular sections.
-
+
CM_SMALL_PIC is model for PIC libraries assuming that code+data+got/plt
tables first in 31bits of address space.
*/
redundant computation of new control word by the mode switching pass.
The fldcw instructions are still emitted redundantly, but this is probably
not going to be noticeable problem, as most CPUs do have fast path for
- the sequence.
+ the sequence.
The machinery is to emit simple truncation instructions and split them
before reload to instructions having USEs of two memory locations that
are filled by this code to old and new control word.
-
+
Post-reload pass may be later used to eliminate the redundant fildcw if
needed. */
/* Compile using ret insn that pops args.
This will not work unless you use prototypes at least
- for all functions that can take varying numbers of args. */
+ for all functions that can take varying numbers of args. */
#define TARGET_RTD (target_flags & MASK_RTD)
/* Align doubles to a two word boundary. This breaks compatibility with
/* Define for XFmode or TFmode extended real floating point support.
This will automatically cause REAL_ARITHMETIC to be defined.
-
+
The XFmode is specified by i386 ABI, while TFmode may be faster
due to alignment and simplifications in the address calculations.
*/
and all fundamental data types supported by the hardware
might need to be aligned. No data type wants to be aligned
rounder than this.
-
+
Pentium+ preferrs DFmode values to be aligned to 64 bit boundary
and Pentium Pro XFmode values at 128 bit boundaries. */
/* 1 for registers that have pervasive standard uses
and are not available for the register allocator.
On the 80386, the stack pointer is such, as is the arg pointer.
-
+
The value is an mask - bit 1 is set for fixed registers
for 32bit target, while 2 is set for fixed registers for 64bit.
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
1, 1, 1, 1, 1, 1, 1, 1, \
/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
1, 1, 1, 1, 1, 1, 1, 1}
-
+
/* 1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any
registers that can be used without being saved.
The latter must include the registers where values are returned
and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like.
-
+ Aside from that, you can include as many other registers as you like.
+
The value is an mask - bit 1 is set for call used
for 32bit target, while 2 is set for call used for 64bit.
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
This is ordinarily the length in words of a value of mode MODE
but can be less for certain modes in special long registers.
- Actually there are no two word move instructions for consecutive
+ Actually there are no two word move instructions for consecutive
registers. And only registers 0-3 may have mov byte instructions
applied to them.
*/
#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)
#define LAST_SSE_REG (FIRST_SSE_REG + 7)
-
+
#define FIRST_MMX_REG (LAST_SSE_REG + 1)
#define LAST_MMX_REG (FIRST_MMX_REG + 7)
#define MMX_REGNO_P(N) ((N) >= FIRST_MMX_REG && (N) <= LAST_MMX_REG)
#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP)))
-
+
#define STACK_REG_P(XOP) \
(REG_P (XOP) && \
REGNO (XOP) >= FIRST_STACK_REG && \
ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1)
/* QImode spills from non-QI registers need a scratch. This does not
- happen often -- the only example so far requires an uninitialized
+ happen often -- the only example so far requires an uninitialized
pseudo. */
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
|| ((CLASS) == DIREG))
/* A C statement that adds to CLOBBERS any hard regs the port wishes
- to automatically clobber for all asms.
+ to automatically clobber for all asms.
We do this in the new i386 backend to maintain source compatibility
with the old cc0-based compiler. */
On 386 pushw decrements by exactly 2 no matter what the position was.
On the 386 there is no pushb; we use pushw instead, and this
has the effect of rounding up to 2.
-
+
For 64bit ABI we round up to 8 bytes.
*/
the stack pointer does not matter. The value is tested only in
functions that have frame pointers.
No definition is equivalent to always zero. */
-/* Note on the 386 it might be more efficient not to define this since
+/* Note on the 386 it might be more efficient not to define this since
we have to restore it ourselves from the frame pointer, in order to
use pop */
#define REWRITE_ADDRESS(X) rewrite_address (X)
/* Nonzero if the constant value X is a legitimate general operand
- when generating PIC code. It is given that flag_pic is on and
+ when generating PIC code. It is given that flag_pic is on and
that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
#define LEGITIMATE_PIC_OPERAND_P(X) \
IX86_BUILTIN_RSQRTSS,
IX86_BUILTIN_SQRTPS,
IX86_BUILTIN_SQRTSS,
-
+
IX86_BUILTIN_UNPCKHPS,
IX86_BUILTIN_UNPCKLPS,
precise value of the constant, which is available for examination
in X, and the rtx code of the expression in which it is contained,
found in OUTER_CODE.
-
+
CODE is the expression code--redundant, since it can be obtained
with `GET_CODE (X)'. */
/* Add any extra modes needed to represent the condition code.
For the i386, we need separate modes when floating-point
- equality comparisons are being done.
-
+ equality comparisons are being done.
+
Add CCNO to indicate comparisons against zero that requires
Overflow flag to be unset. Sign bit test is used instead and
thus can be used to form "a&b>0" type of tests.
For float regs, the stack top is sometimes referred to as "%st(0)"
instead of just "%st". PRINT_REG handles this with the "y" code. */
-#undef HI_REGISTER_NAMES
+#undef HI_REGISTER_NAMES
#define HI_REGISTER_NAMES \
{"ax","dx","cx","bx","si","di","bp","sp", \
"st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
/* Before the prologue, RA is at 0(%esp). */
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
-
+
/* After the prologue, RA is at -4(AP) in the current frame. */
#define RETURN_ADDR_RTX(COUNT, FRAME) \
((COUNT) == 0 \
#define JUMP_TABLES_IN_TEXT_SECTION \
(!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA)
-/* A C statement that outputs an address constant appropriate to
+/* A C statement that outputs an address constant appropriate to
for DWARF debugging. */
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, X) \
CM_MEDIUM is model assuming that code fits in the first 31bits of address
space. Size of data is unlimited.
CM_LARGE is model making no assumptions about size of particular sections.
-
+
CM_SMALL_PIC is model for PIC libraries assuming that code+data+got/plt
tables first in 31bits of address space.
*/
redundant computation of new control word by the mode switching pass.
The fldcw instructions are still emitted redundantly, but this is probably
not going to be noticeable problem, as most CPUs do have fast path for
- the sequence.
+ the sequence.
The machinery is to emit simple truncation instructions and split them
before reload to instructions having USEs of two memory locations that
are filled by this code to old and new control word.
-
+
Post-reload pass may be later used to eliminate the redundant fildcw if
needed. */
return MemoryTypeArray[Index].TypeString;
}
}
-
+
return MemoryTypeArray[0].TypeString;
}
#endif
#define PDE_SHIFT 20
#define PDE_SHIFT_PAE 18
-
+
/* Converts a Relative Address read from the Kernel into a Physical Address */
#define RaToPa(p) \
(ULONG_PTR)((ULONG_PTR)p + KERNEL_BASE_PHYS)
-
+
/* Converts a Phsyical Address Pointer into a Page Frame Number */
#define PaPtrToPfn(p) \
(((ULONG_PTR)&p) >> PFN_SHIFT)
-
+
/* Converts a Phsyical Address into a Page Frame Number */
#define PaToPfn(p) \
((p) >> PFN_SHIFT)
#define HYPERSPACE_BASE 0xF0800000
#define APIC_BASE 0xFEC00000
#define KPCR_BASE 0xFF000000
-
+
#define LowMemPageTableIndex 0
#define StartupPageTableIndex (STARTUP_BASE >> 20) / sizeof(HARDWARE_PTE_X86)
#define HyperspacePageTableIndex (HYPERSPACE_BASE >> 20) / sizeof(HARDWARE_PTE_X86)
/* FUNCTIONS *****************************************************************/
/*++
- * FrLdrStartup
+ * FrLdrStartup
* INTERNAL
*
* Prepares the system for loading the Kernel.
VOID
STDCALL
FrLdrStartup(ULONG Magic)
-{
+{
/* Disable Interrupts */
Ke386DisableInterrupts();
-
+
/* Re-initalize EFLAGS */
Ke386EraseFlags();
-
+
/* Get the PAE Mode */
FrLdrGetPaeMode();
-
+
/* Initialize the page directory */
FrLdrSetupPageDirectory();
-
+
/* Initialize Paging, Write-Protection and Load NTOSKRNL */
FrLdrSetupPae(Magic);
}
/*++
- * FrLdrSetupPae
+ * FrLdrSetupPae
* INTERNAL
*
* Configures PAE on a MP System, and sets the PDBR if it's supported, or if
if (PaeModeEnabled)
{
PageDirectoryBaseAddress = (ULONG_PTR)&startup_pagedirectorytable_pae;
-
+
/* Enable PAE */
Ke386SetCr4(Ke386GetCr4() | X86_CR4_PAE);
- }
-
+ }
+
/* Set the PDBR */
Ke386SetPageTableDirectory(PageDirectoryBaseAddress);
-
+
/* Enable Paging and Write Protect*/
Ke386SetCr0(Ke386GetCr0() | X86_CR0_PG | X86_CR0_WP);
-
+
/* Jump to Kernel */
PagedJump = (ASMCODE)KernelEntryPoint;
PagedJump(Magic, &LoaderBlock);
}
/*++
- * FrLdrGetKernelBase
+ * FrLdrGetKernelBase
* INTERNAL
*
* Gets the Kernel Base to use.
FrLdrGetKernelBase(VOID)
{
PCHAR p;
-
+
/* Read Command Line */
p = (PCHAR)LoaderBlock.CommandLine;
while ((p = strchr(p, '/')) != NULL) {
-
+
/* Find "/3GB" */
if (!strnicmp(p + 1, "3GB", 3)) {
-
+
/* Make sure there's nothing following it */
if (p[4] == ' ' || p[4] == 0) {
-
+
/* Use 3GB */
KernelBase = 0xC0000000;
}
p++;
}
-
+
/* Set KernelBase */
LoaderBlock.KernelBase = KernelBase;
}
/*++
- * FrLdrGetPaeMode
+ * FrLdrGetPaeMode
* INTERNAL
*
* Determines whether PAE mode shoudl be enabled or not.
}
/*++
- * FrLdrSetupPageDirectory
+ * FrLdrSetupPageDirectory
* INTERNAL
*
* Sets up the ReactOS Startup Page Directory.
ULONG i;
if (PaeModeEnabled) {
-
+
/* Get the Kernel Table Index */
KernelPageTableIndex = (KernelBase >> 21);
PageDirPae->Pde[KernelPageTableIndex + i].Write = 1;
PageDirPae->Pde[KernelPageTableIndex + i].PageFrameNumber = PaPtrToPfn(kernel_pagetable_pae) + i;
}
-
+
/* Set up the Startup PDE */
for (i = 0; i < 4; i++)
{
PageDirPae->Pde[StartupPageTableIndexPae + i].Write = 1;
PageDirPae->Pde[StartupPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(startup_pagedirectory_pae) + i;
}
-
+
/* Set up the Hyperspace PDE */
for (i = 0; i < 2; i++)
{
PageDirPae->Pde[HyperspacePageTableIndexPae + i].Write = 1;
PageDirPae->Pde[HyperspacePageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable_pae) + i;
}
-
- /* Set up the Apic PDE */
+
+ /* Set up the Apic PDE */
for (i = 0; i < 2; i++)
{
PageDirPae->Pde[ApicPageTableIndexPae + i].Valid = 1;
PageDirPae->Pde[ApicPageTableIndexPae + i].Write = 1;
PageDirPae->Pde[ApicPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(apic_pagetable_pae) + i;
}
-
+
/* Set up the KPCR PDE */
PageDirPae->Pde[KpcrPageTableIndexPae].Valid = 1;
PageDirPae->Pde[KpcrPageTableIndexPae].Write = 1;
PageDirPae->Pde[KpcrPageTableIndexPae].PageFrameNumber = PaPtrToPfn(kpcr_pagetable_pae);
-
+
/* Set up Low Memory PTEs */
PageDirPae = (PPAGE_DIRECTORY_X64)&lowmem_pagetable_pae;
for (i=0; i<1024; i++) {
-
+
PageDirPae->Pde[i].Valid = 1;
PageDirPae->Pde[i].Write = 1;
PageDirPae->Pde[i].Owner = 1;
PageDirPae->Pde[i].PageFrameNumber = i;
}
-
+
/* Set up Kernel PTEs */
PageDirPae = (PPAGE_DIRECTORY_X64)&kernel_pagetable_pae;
for (i=0; i<1536; i++) {
-
+
PageDirPae->Pde[i].Valid = 1;
PageDirPae->Pde[i].Write = 1;
PageDirPae->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS) + i;
}
-
+
/* Set up APIC PTEs */
PageDirPae = (PPAGE_DIRECTORY_X64)&apic_pagetable_pae;
PageDirPae->Pde[0].Valid = 1;
PageDirPae->Pde[0x200].CacheDisable = 1;
PageDirPae->Pde[0x200].WriteThrough = 1;
PageDirPae->Pde[0x200].PageFrameNumber = PaToPfn(APIC_BASE + KERNEL_BASE_PHYS);
-
+
/* Set up KPCR PTEs */
PageDirPae = (PPAGE_DIRECTORY_X64)&kpcr_pagetable_pae;
PageDirPae->Pde[0].Valid = 1;
PageDirPae->Pde[0].Write = 1;
- PageDirPae->Pde[0].PageFrameNumber = 1;
-
+ PageDirPae->Pde[0].PageFrameNumber = 1;
+
} else {
-
+
/* Get the Kernel Table Index */
KernelPageTableIndex = (KernelBase >> PDE_SHIFT) / sizeof(HARDWARE_PTE_X86);
-
+
/* Get the Startup Page Directory */
PageDir = (PPAGE_DIRECTORY_X86)&startup_pagedirectory;
-
+
/* Set up the Low Memory PDE */
PageDir->Pde[LowMemPageTableIndex].Valid = 1;
PageDir->Pde[LowMemPageTableIndex].Write = 1;
PageDir->Pde[LowMemPageTableIndex].PageFrameNumber = PaPtrToPfn(lowmem_pagetable);
-
+
/* Set up the Kernel PDEs */
PageDir->Pde[KernelPageTableIndex].Valid = 1;
PageDir->Pde[KernelPageTableIndex].Write = 1;
PageDir->Pde[KernelPageTableIndex + 1].Valid = 1;
PageDir->Pde[KernelPageTableIndex + 1].Write = 1;
PageDir->Pde[KernelPageTableIndex + 1].PageFrameNumber = PaPtrToPfn(kernel_pagetable + 4096);
-
+
/* Set up the Startup PDE */
PageDir->Pde[StartupPageTableIndex].Valid = 1;
PageDir->Pde[StartupPageTableIndex].Write = 1;
PageDir->Pde[StartupPageTableIndex].PageFrameNumber = PaPtrToPfn(startup_pagedirectory);
-
+
/* Set up the Hyperspace PDE */
PageDir->Pde[HyperspacePageTableIndex].Valid = 1;
PageDir->Pde[HyperspacePageTableIndex].Write = 1;
PageDir->Pde[HyperspacePageTableIndex].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable);
-
- /* Set up the Apic PDE */
+
+ /* Set up the Apic PDE */
PageDir->Pde[ApicPageTableIndex].Valid = 1;
PageDir->Pde[ApicPageTableIndex].Write = 1;
PageDir->Pde[ApicPageTableIndex].PageFrameNumber = PaPtrToPfn(apic_pagetable);
-
+
/* Set up the KPCR PDE */
PageDir->Pde[KpcrPageTableIndex].Valid = 1;
PageDir->Pde[KpcrPageTableIndex].Write = 1;
PageDir->Pde[KpcrPageTableIndex].PageFrameNumber = PaPtrToPfn(kpcr_pagetable);
-
+
/* Set up Low Memory PTEs */
PageDir = (PPAGE_DIRECTORY_X86)&lowmem_pagetable;
for (i=0; i<1024; i++) {
-
+
PageDir->Pde[i].Valid = 1;
PageDir->Pde[i].Write = 1;
PageDir->Pde[i].Owner = 1;
PageDir->Pde[i].PageFrameNumber = PaToPfn(i * PAGE_SIZE);
}
-
+
/* Set up Kernel PTEs */
PageDir = (PPAGE_DIRECTORY_X86)&kernel_pagetable;
for (i=0; i<1536; i++) {
-
+
PageDir->Pde[i].Valid = 1;
PageDir->Pde[i].Write = 1;
PageDir->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS + i * PAGE_SIZE);
}
-
+
/* Set up APIC PTEs */
PageDir = (PPAGE_DIRECTORY_X86)&apic_pagetable;
PageDir->Pde[0].Valid = 1;
PageDir->Pde[0x200].CacheDisable = 1;
PageDir->Pde[0x200].WriteThrough = 1;
PageDir->Pde[0x200].PageFrameNumber = PaToPfn(APIC_BASE + KERNEL_BASE_PHYS);
-
+
/* Set up KPCR PTEs */
PageDir = (PPAGE_DIRECTORY_X86)&kpcr_pagetable;
PageDir->Pde[0].Valid = 1;
PageDir->Pde[0].Write = 1;
- PageDir->Pde[0].PageFrameNumber = 1;
+ PageDir->Pde[0].PageFrameNumber = 1;
}
return;
}
/*++
- * FrLdrMapKernel
+ * FrLdrMapKernel
* INTERNAL
*
* Maps the Kernel into memory, does PE Section Mapping, initalizes the
/* Allocate 1024 bytes for PE Header */
ImageHeader = (PIMAGE_DOS_HEADER)MmAllocateMemory(1024);
-
+
/* Make sure it was succesful */
if (ImageHeader == NULL) {
-
+
return FALSE;
}
/* Now read the MZ header to get the offset to the PE Header */
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)ImageHeader + ImageHeader->e_lfanew);
-
+
/* Get Kernel Base */
- KernelBase = NtHeader->OptionalHeader.ImageBase;
+ KernelBase = NtHeader->OptionalHeader.ImageBase;
FrLdrGetKernelBase();
-
+
/* Save Entrypoint */
KernelEntry = RaToPa(NtHeader->OptionalHeader.AddressOfEntryPoint);
-
+
/* Save the Image Size */
ImageSize = NtHeader->OptionalHeader.SizeOfImage;
-
+
/* Free the Header */
MmFreeMemory(ImageHeader);
/* Load the file image */
FsReadFile(KernelImage, ImageSize, NULL, (PVOID)KERNEL_BASE_PHYS);
-
+
/* Reload the NT Header */
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)KERNEL_BASE_PHYS + ImageHeader->e_lfanew);
-
+
/* Load the first section */
Section = IMAGE_FIRST_SECTION(NtHeader);
SectionCount = NtHeader->FileHeader.NumberOfSections - 1;
-
+
/* Now go to the last section */
Section += SectionCount;
-
- /* Walk each section backwards */
+
+ /* Walk each section backwards */
for (i=SectionCount; i >= 0; i--, Section--) {
-
- /* Get the disk location and the memory location, and the size */
+
+ /* Get the disk location and the memory location, and the size */
SourceSection = RaToPa(Section->PointerToRawData);
TargetSection = RaToPa(Section->VirtualAddress);
SectionSize = Section->SizeOfRawData;
-
+
/* If the section is already mapped correctly, go to the next */
if (SourceSection == TargetSection) continue;
-
+
/* Load it into memory */
memmove((PVOID)TargetSection, (PVOID)SourceSection, SectionSize);
-
+
/* Check for unitilizated data */
if (Section->SizeOfRawData < Section->Misc.VirtualSize) {
-
+
/* Zero it out */
- memset((PVOID)RaToPa(Section->VirtualAddress + Section->SizeOfRawData),
+ memset((PVOID)RaToPa(Section->VirtualAddress + Section->SizeOfRawData),
0,
Section->Misc.VirtualSize - Section->SizeOfRawData);
}
}
-
+
/* Get the Relocation Data Directory */
RelocationDDir = &NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
-
+
/* Get the Relocation Section Start and End*/
RelocationDir = (PIMAGE_BASE_RELOCATION)(KERNEL_BASE_PHYS + RelocationDDir->VirtualAddress);
RelocationEnd = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDDir->Size);
-
+
/* Calculate Difference between Real Base and Compiled Base*/
- Delta = KernelBase - NtHeader->OptionalHeader.ImageBase;;
-
+ Delta = KernelBase - NtHeader->OptionalHeader.ImageBase;
+
/* Determine how far we shoudl relocate */
MaxAddress = KERNEL_BASE_PHYS + ImageSize;
-
+
/* Relocate until we've processed all the blocks */
while (RelocationDir < RelocationEnd && RelocationDir->SizeOfBlock > 0) {
-
+
/* See how many Relocation Blocks we have */
Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(USHORT);
-
+
/* Calculate the Address of this Directory */
Address = KERNEL_BASE_PHYS + RelocationDir->VirtualAddress;
-
+
/* Calculate the Offset of the Type */
TypeOffset = (PUSHORT)(RelocationDir + 1);
for (i = 0; i < Count; i++) {
-
+
ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF));
/* Don't relocate after the end of the loaded driver */
if ((ULONG_PTR)ShortPtr >= MaxAddress) break;
switch (*TypeOffset >> 12) {
-
+
case IMAGE_REL_BASED_ABSOLUTE:
break;
*LongPtr += Delta;
break;
}
-
+
TypeOffset++;
}
-
+
/* Move to the next Relocation Table */
RelocationDir = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDir->SizeOfBlock);
}
-
+
/* Increase the next Load Base */
NextModuleBase = ROUND_UP(KERNEL_BASE_PHYS + ImageSize, PAGE_SIZE);
ULONG_PTR
STDCALL
-FrLdrLoadModule(FILE *ModuleImage,
- LPSTR ModuleName,
+FrLdrLoadModule(FILE *ModuleImage,
+ LPSTR ModuleName,
PULONG ModuleSize)
{
ULONG LocalModuleSize;
/* Get current module data structure and module name string array */
ModuleData = &multiboot_modules[LoaderBlock.ModsCount];
-
+
/* Get only the Module Name */
do {
-
+
TempName = strchr(ModuleName, '\\');
-
+
if(TempName) {
ModuleName = TempName + 1;
}
/* Get Module Size */
LocalModuleSize = FsGetFileSize(ModuleImage);
-
+
/* Fill out Module Data Structure */
ModuleData->ModuleStart = NextModuleBase;
ModuleData->ModuleEnd = NextModuleBase + LocalModuleSize;
-
+
/* Save name */
strcpy(NameBuffer, ModuleName);
ModuleData->ModuleName = NameBuffer;
/* Set up the structure */
ModuleData->ModuleStart = NextModuleBase;
ModuleData->ModuleEnd = -1;
-
+
/* Copy the name */
strcpy(NameBuffer, ModuleName);
ModuleData->ModuleName = NameBuffer;
BOOL
STDCALL
-FrLdrCloseModule(ULONG_PTR ModuleBase,
+FrLdrCloseModule(ULONG_PTR ModuleBase,
ULONG ModuleSize)
{
PFRLDR_MODULE ModuleData = CurrentModule;
/* Make sure a module is opened */
if (ModuleData) {
-
+
/* Make sure this is the right module and that it hasn't been closed */
if ((ModuleBase == ModuleData->ModuleStart) && (ModuleData->ModuleEnd == -1)) {
-
+
/* Close the Module */
ModuleData->ModuleEnd = ModuleData->ModuleStart + ModuleSize;
/* Set the next Module Base and increase the number of modules */
NextModuleBase = ROUND_UP(ModuleData->ModuleEnd, PAGE_SIZE);
LoaderBlock.ModsCount++;
-
+
/* Close the currently opened module */
CurrentModule = NULL;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <rtl.h>
#include <ui.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <inifile.h>
#include <oslist.h>
CHAR SettingValue[260];
ULONG OperatingSystemCount = 0;
ULONG SectionSettingCount;
-
+
//
// Loop through and count the operating systems
//
//
OperatingSystemSectionNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount);
OperatingSystemDisplayNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount);
-
+
//
// If either allocation failed then return FALSE
//
ULONG NewHashSize;
BOOL Status;
- NewHashSize = sizeof(HASH_TABLE_CELL) +
+ NewHashSize = sizeof(HASH_TABLE_CELL) +
(SubKeyCount * sizeof(HASH_RECORD));
Status = CmiAllocateCell (Hive,
NewHashSize,
/* Extract Kernel filename without path */
szShortName = strrchr(szFileName, '\\');
if (szShortName == NULL) {
-
+
/* No path, leave it alone */
szShortName = szFileName;
-
+
} else {
-
+
/* Skip the path */
szShortName = szShortName + 1;
}
/* Open the Kernel */
FilePointer = FsOpenFile(szFileName);
-
+
/* Make sure it worked */
if (FilePointer == NULL) {
-
+
/* Return failure on the short name */
strcpy(szBuffer, szShortName);
strcat(szBuffer, " not found.");
FreeldrReadFile(PVOID FileContext, PVOID Buffer, ULONG Size)
{
ULONG BytesRead;
-
+
return FsReadFile((PFILE) FileContext, (ULONG) Size, &BytesRead, Buffer)
&& Size == BytesRead;
}
RosSymDelete(RosSymInfo);
return TRUE;
}
-
+
BOOL
-FrLdrLoadNlsFile(PCHAR szFileName,
+FrLdrLoadNlsFile(PCHAR szFileName,
PCHAR szModuleName)
{
PFILE FilePointer;
/* Open the Driver */
FilePointer = FsOpenFile(szFileName);
-
+
/* Make sure we did */
if (FilePointer == NULL) {
-
+
/* Fail if file wasn't opened */
strcpy(value, szFileName);
strcat(value, " not found.");
strcpy(value, "Reading ");
p = strrchr(szFileName, '\\');
if (p == NULL) {
-
+
strcat(value, szFileName);
-
+
} else {
-
+
strcat(value, p + 1);
}
UiDrawStatusText(value);
}
BOOL
-FrLdrLoadNlsFiles(PCHAR szSystemRoot,
+FrLdrLoadNlsFiles(PCHAR szSystemRoot,
PCHAR szErrorOut)
{
LONG rc = ERROR_SUCCESS;
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage",
&hKey);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "Couldn't open CodePage registry key");
return(FALSE);
}
-
+
/* get ANSI codepage */
BufferSize = 80;
rc = RegQueryValue(hKey, "ACP", NULL, (PUCHAR)szIdBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "Couldn't get ACP NLS setting");
return(FALSE);
}
BufferSize = 80;
rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "ACP NLS Setting exists, but isn't readable");
return(FALSE);
}
strcat(szFileName, szNameBuffer);
DbgPrint((DPRINT_REACTOS, "ANSI file: %s\n", szFileName));
if (!FrLdrLoadNlsFile(szFileName, "ansi.nls")) {
-
+
strcpy(szErrorOut, "Couldn't load ansi.nls");
return(FALSE);
}
BufferSize = 80;
rc = RegQueryValue(hKey, "OEMCP", NULL, (PUCHAR)szIdBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "Couldn't get OEMCP NLS setting");
return(FALSE);
}
BufferSize = 80;
rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "OEMCP NLS setting exists, but isn't readable");
return(FALSE);
}
strcat(szFileName, szNameBuffer);
DbgPrint((DPRINT_REACTOS, "Oem file: %s\n", szFileName));
if (!FrLdrLoadNlsFile(szFileName, "oem.nls")) {
-
+
strcpy(szErrorOut, "Couldn't load oem.nls");
return(FALSE);
}
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language",
&hKey);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "Couldn't open Language registry key");
return(FALSE);
}
BufferSize = 80;
rc = RegQueryValue(hKey, "Default", NULL, (PUCHAR)szIdBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "Couldn't get Language Default setting");
return(FALSE);
}
BufferSize = 80;
rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
-
+
strcpy(szErrorOut, "Language Default setting exists, but isn't readable");
return(FALSE);
}
strcat(szFileName, szNameBuffer);
DbgPrint((DPRINT_REACTOS, "Casemap file: %s\n", szFileName));
if (!FrLdrLoadNlsFile(szFileName, "casemap.nls")) {
-
+
strcpy(szErrorOut, "casemap.nls");
return(FALSE);
}
}
BOOL
-FrLdrLoadDriver(PCHAR szFileName,
+FrLdrLoadDriver(PCHAR szFileName,
INT nPos)
{
PFILE FilePointer;
/* Open the Driver */
FilePointer = FsOpenFile(szFileName);
-
+
/* Make sure we did */
if (FilePointer == NULL) {
-
+
/* Fail if file wasn't opened */
strcpy(value, szFileName);
strcat(value, " not found.");
strcpy(value, "Reading ");
p = strrchr(szFileName, '\\');
if (p == NULL) {
-
+
strcat(value, szFileName);
-
+
} else {
-
+
strcat(value, p + 1);
-
+
}
UiDrawStatusText(value);
}
VOID
-FrLdrLoadBootDrivers(PCHAR szSystemRoot,
+FrLdrLoadBootDrivers(PCHAR szSystemRoot,
INT nPos)
{
LONG rc = 0;
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\ServiceGroupOrder",
&hGroupKey);
if (rc != ERROR_SUCCESS) {
-
+
DbgPrint((DPRINT_REACTOS, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc));
return;
}
-
+
/* get 'group order list' key */
rc = RegOpenKey(NULL,
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\GroupOrderList",
&hOrderKey);
if (rc != ERROR_SUCCESS) {
-
+
DbgPrint((DPRINT_REACTOS, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc));
return;
}
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services",
&hServiceKey);
if (rc != ERROR_SUCCESS) {
-
+
DbgPrint((DPRINT_REACTOS, "Failed to open the 'Services' key (rc %d)\n", (int)rc));
return;
}
BufferSize = sizeof(OrderList);
rc = RegQueryValue(hOrderKey, GroupName, NULL, (PUCHAR)OrderList, &BufferSize);
if (rc != ERROR_SUCCESS) OrderList[0] = 0;
-
+
/* enumerate all drivers */
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
-
+
Index = 0;
-
+
while (TRUE) {
-
+
/* Get the Driver's Name */
ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
DbgPrint((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
-
+
/* Makre sure it's valid, and check if we're done */
if (rc == ERROR_NO_MORE_ITEMS) break;
if (rc != ERROR_SUCCESS) return;
DbgPrint((DPRINT_REACTOS, " Group: '%s' \n", DriverGroup));
/* Make sure it should be started */
- if ((StartValue == 0) &&
- (TagValue == OrderList[TagIndex]) &&
+ if ((StartValue == 0) &&
+ (TagValue == OrderList[TagIndex]) &&
(stricmp(DriverGroup, GroupName) == 0)) {
/* Get the Driver's Location */
ValueSize = 256;
rc = RegQueryValue(hDriverKey, "ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
-
+
/* Write the whole path if it suceeded, else prepare to fail */
if (rc != ERROR_SUCCESS) {
DbgPrint((DPRINT_REACTOS, " ImagePath: not found\n"));
strcpy(ImagePath, TempImagePath);
DbgPrint((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
}
-
+
DbgPrint((DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath));
-
+
/* Update the position if needed */
if (nPos < 100) nPos += 5;
-
+
FrLdrLoadDriver(ImagePath, nPos);
-
+
} else {
-
+
DbgPrint((DPRINT_REACTOS, " Skipping driver '%s' with Start %d, Tag %d and Group '%s' (Current Tag %d, current group '%s')\n",
ServiceName, StartValue, TagValue, DriverGroup, OrderList[TagIndex], GroupName));
}
-
+
Index++;
}
- }
+ }
Index = 0;
while (TRUE) {
-
+
/* Get the Driver's Name */
ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
-
+
DbgPrint((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
if (rc == ERROR_NO_MORE_ITEMS) break;
if (rc != ERROR_SUCCESS) return;
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
if (TagValue == OrderList[TagIndex]) break;
}
-
- if ((StartValue == 0) &&
- (TagIndex > OrderList[0]) &&
+
+ if ((StartValue == 0) &&
+ (TagIndex > OrderList[0]) &&
(stricmp(DriverGroup, GroupName) == 0)) {
-
+
ValueSize = 256;
rc = RegQueryValue(hDriverKey, "ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
if (rc != ERROR_SUCCESS) {
DbgPrint((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
}
DbgPrint((DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath));
-
+
if (nPos < 100) nPos += 5;
-
- FrLdrLoadDriver(ImagePath, nPos);
-
+
+ FrLdrLoadDriver(ImagePath, nPos);
+
} else {
-
+
DbgPrint((DPRINT_REACTOS, " Skipping driver '%s' with Start %d, Tag %d and Group '%s' (Current group '%s')\n",
ServiceName, StartValue, TagValue, DriverGroup, GroupName));
}
-
+
Index++;
}
ULONG_PTR Base;
ULONG Size;
-
+
extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd;
extern BOOLEAN AcpiPresent;
{
LoaderBlock.MemHigher = (multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low) / 1024 - 1024;
}
- DbgPrint((DPRINT_REACTOS, "start: %x\t size: %x\t type %d\n",
- multiboot_memory_map[i].base_addr_low,
+ DbgPrint((DPRINT_REACTOS, "start: %x\t size: %x\t type %d\n",
+ multiboot_memory_map[i].base_addr_low,
multiboot_memory_map[i].length_low,
multiboot_memory_map[i].type));
}
}
if (!FrLdrLoadKernel(szKernelName, 5)) return;
-
+
/*
* Find the HAL image name
* and try to load the kernel off the disk
HINF InfHandle;
ULONG ErrorLine;
INFCONTEXT InfContext;
-
+
extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd;
LoaderBlock.MemHigher = (multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low) / 1024 - 1024;
}
#if 0
- printf("start: %x\t size: %x\t type %d\n",
- multiboot_memory_map[i].base_addr_low,
+ printf("start: %x\t size: %x\t type %d\n",
+ multiboot_memory_map[i].base_addr_low,
multiboot_memory_map[i].length_low,
multiboot_memory_map[i].type);
#endif
"rep\t\n" \
"stosb\t\n" \
".L1:\n\t"
- :
+ :
: "D" (src), "c" (count), "a" (val));
return src;
}
{
*convert_to_ascii(str, c, va_arg(ap, unsigned long)) = 0;
}
-
+
ptr = str;
while (*ptr)
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <ui.h>
#include "gui.h"
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <ui.h>
#include "tui.h"
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <rtl.h>
#include <ui.h>
{
*SelectedMenuItem = MenuInformation.SelectedMenuItem;
}
-
+
return TRUE;
}
switch (KeyEvent)
{
case KEY_UP:
-
+
if (MenuInfo->SelectedMenuItem > 0)
{
MenuInfo->SelectedMenuItem--;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <ui.h>
#include "tui.h"
UserInterfaceUp = FALSE;
return TRUE;
}
-
+
DbgPrint((DPRINT_UI, "Initializing User Interface.\n"));
DbgPrint((DPRINT_UI, "Reading in UI settings from [Display] section.\n"));
// Draw the backdrop and fade it in if special effects are enabled
UiFadeInBackdrop();
-
+
UserInterfaceUp = TRUE;
DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n"));
VOID UiDrawBackdrop(VOID)
{
if (!UserInterfaceUp) return;
-
+
if (VideoTextMode == UiDisplayMode)
{
TuiDrawBackdrop();
VOID UiDrawStatusText(PCHAR StatusText)
{
if (!UserInterfaceUp) return;
-
+
if (VideoTextMode == UiDisplayMode)
{
TuiDrawStatusText(StatusText);
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
{
if (!UserInterfaceUp) return;
-
+
if (VideoTextMode == UiDisplayMode)
{
TuiDrawProgressBarCenter(Position, Range, ProgressText);
for (Idx=0; Idx<IniGetNumSectionItems(SectionId); Idx++)
{
IniReadSettingByNumber(SectionId, Idx, SettingName, 79, SettingValue, 79);
-
+
if (stricmp(SettingName, "MessageBox") == 0)
{
// Get the real length of the MessageBox text
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <version.h>
#include <rtl.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <video.h>
#include <comm.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <video.h>
#include <machine.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <video.h>
#include <machine.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <video.h>
#include <portio.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
#include <video.h>
#include <portio.h>
//unsigned short NumberOfHeads;
//unsigned long Reserved1;
//unsigned long Reserved2;
-
+
unsigned long Ext2VolumeStartSector; // Start sector of the ext2 volume
unsigned long Ext2BlockSize; // Block size in sectors
unsigned long Ext2BlockSizeInBytes; // Block size in bytes
_tprintf(_T("SetFilePointer() failed. Error code %ld.\n"), GetLastError());
return FALSE;
}
-
+
bRetVal = ReadFile(hDiskVolume, SectorBuffer, 512, &dwNumberOfBytesRead, NULL);
if (!bRetVal || (dwNumberOfBytesRead != 512))
{
_tprintf(_T("SetFilePointer() failed. Error code %ld.\n"), GetLastError());
return FALSE;
}
-
+
bRetVal = WriteFile(hDiskVolume, SectorBuffer, 512, &dwNumberOfBytesWritten, NULL);
if (!bRetVal || (dwNumberOfBytesWritten != 512))
{
void patch_image(char *filename)
{
int i,size;
-
+
view_only = 0;
f = open(filename, O_RDWR | O_BINARY);
if (f < 0) {
perror(filename);
return;
}
- view_only = 1;
+ view_only = 1;
}
lseek(f, search_base, SEEK_SET);
char filename[256];
char buf1[256];
char file2[256];
-
+
if (argc != 1) { /* If they specify names, patch them, exit */
for(i=1; i<argc; i++)
patch_image(argv[i]);
strcpy(file2,filename);
strcat(filename,"\\system32\\ntvdm.exe");
strcat(file2,"\\system32\\dllcache\\ntvdm.exe");
-
+
sprintf(buf1,"copy %s %s\\system32\\ntvdm.ori",filename,getenv("SYSTEMROOT"));
printf("%s\n",buf1);
system(buf1);
-
+
patch_image(file2);
patch_image(filename);
return 0;