mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Added system hive support.
Started hardware detection. svn path=/trunk/; revision=2396
This commit is contained in:
parent
7a1bc8eaca
commit
16e5929c1c
12 changed files with 258 additions and 354 deletions
|
@ -41,3 +41,4 @@ install:
|
|||
|
||||
clean:
|
||||
$(RM) *.bin
|
||||
$(MAKE) -C freeldr clean
|
||||
|
|
|
@ -25,16 +25,16 @@ export RM = cmd /C del
|
|||
export CP = cmd /C copy
|
||||
|
||||
#FLAGS = -Wall -nostdinc -fno-builtin
|
||||
FLAGS = -Wall -fno-builtin -DDEBUG
|
||||
FLAGS = -Wall -fno-builtin -DDEBUG -O3
|
||||
#FLAGS = -Wall -fno-builtin
|
||||
|
||||
# asmcode.o has to be first in the link line because it contains the startup code
|
||||
OBJS = asmcode.a asmcode.o mb.o boot.o freeldr.o stdlib.o fs.a fs.o fat.o \
|
||||
reactos.o tui.o menu.o miscboot.o options.o linux.o multiboot.o arcname.o \
|
||||
mem.o memory.o debug.o parseini.o
|
||||
#OBJS = asmcode.a asmcode.o mb.o boot.o freeldr.o stdlib.o fs.a fs.o fat.o \
|
||||
# reactos.o tui.o menu.o miscboot.o options.o linux.o multiboot.o arcname.o \
|
||||
# mem.o memory.o debug.o parseini.o registry.o import.o
|
||||
ASM_OBJS = asmcode.o mb.o boot.o mem.o
|
||||
C_OBJS = freeldr.o stdlib.o fs.a reactos.o tui.o menu.o miscboot.o options.o linux.o \
|
||||
multiboot.o
|
||||
C_OBJS = freeldr.o stdlib.o fs.a tui.o menu.o miscboot.o options.o linux.o multiboot.o \
|
||||
reactos/reactos.o reactos/registry.o reactos/reghive.o reactos/hwdetect.o
|
||||
C_OBJS2 = arcname.o memory.o debug.o parseini.o rs232.o portio.o oslist.o
|
||||
|
||||
.PHONY : clean
|
||||
|
@ -42,9 +42,12 @@ C_OBJS2 = arcname.o memory.o debug.o parseini.o rs232.o portio.o oslist.o
|
|||
all: freeldr.sys
|
||||
|
||||
freeldr.sys: asmcode.a c_code.a
|
||||
$(LD) -N -Ttext=0x8000 --oformat=binary -o f.sys asmcode.a c_code.a
|
||||
$(LD) -N -Ttext=0x8000 --oformat=binary -s -o f.sys asmcode.a c_code.a
|
||||
../bootsect/stubit ../bootsect/fatstub.bin f.sys freeldr.sys
|
||||
|
||||
freeldr.exe: asmcode.a c_code.a
|
||||
$(LD) -o freeldr.exe asmcode.a c_code.a
|
||||
|
||||
asmcode.a: $(ASM_OBJS)
|
||||
$(LD) -r -o asmcode.a $(ASM_OBJS)
|
||||
|
||||
|
@ -60,7 +63,7 @@ c_code2.a: $(C_OBJS2)
|
|||
asmcode.o: asmcode.S asmcode.h Makefile
|
||||
$(CC) $(FLAGS) -o asmcode.o -c asmcode.S
|
||||
|
||||
freeldr.o: freeldr.c freeldr.h stdlib.h fs.h reactos.h tui.h asmcode.h menu.h miscboot.h Makefile
|
||||
freeldr.o: freeldr.c freeldr.h stdlib.h fs.h reactos/reactos.h tui.h asmcode.h menu.h miscboot.h Makefile
|
||||
$(CC) $(FLAGS) -o freeldr.o -c freeldr.c
|
||||
|
||||
stdlib.o: stdlib.c freeldr.h stdlib.h Makefile
|
||||
|
@ -75,8 +78,8 @@ fs.o: fs.c freeldr.h fs.h stdlib.h tui.h asmcode.h Makefile
|
|||
fat.o: fat.c fat.h freeldr.h fs.h stdlib.h tui.h Makefile
|
||||
$(CC) $(FLAGS) -o fat.o -c fat.c
|
||||
|
||||
reactos.o: reactos.c freeldr.h reactos.h stdlib.h fs.h tui.h multiboot.h Makefile
|
||||
$(CC) $(FLAGS) -o reactos.o -c reactos.c
|
||||
reactos/reactos.o: reactos/reactos.c freeldr.h reactos/reactos.h reactos/registry.h reactos/hwdetect.h stdlib.h fs.h tui.h multiboot.h Makefile
|
||||
$(CC) $(FLAGS) -o reactos/reactos.o -c reactos/reactos.c
|
||||
|
||||
multiboot.o: multiboot.c freeldr.h stdlib.h fs.h multiboot.h tui.h Makefile
|
||||
$(CC) $(FLAGS) -o multiboot.o -c multiboot.c
|
||||
|
@ -126,7 +129,16 @@ portio.o: portio.c portio.h Makefile
|
|||
oslist.o: oslist.c oslist.h Makefile
|
||||
$(CC) $(FLAGS) -o oslist.o -c oslist.c
|
||||
|
||||
reactos/registry.o: reactos/registry.c freeldr.h memory.h reactos/registry.h stdlib.h Makefile
|
||||
$(CC) $(FLAGS) -o reactos/registry.o -c reactos/registry.c
|
||||
|
||||
reactos/reghive.o: reactos/reghive.c freeldr.h reactos/registry.h stdlib.h memory.h Makefile
|
||||
$(CC) $(FLAGS) -o reactos/reghive.o -c reactos/reghive.c
|
||||
|
||||
reactos/hwdetect.o: reactos/hwdetect.c freeldr.h reactos/hwdetect.h Makefile
|
||||
$(CC) $(FLAGS) -o reactos/hwdetect.o -c reactos/hwdetect.c
|
||||
|
||||
clean:
|
||||
$(RM) *.o
|
||||
$(RM) *.a
|
||||
$(RM) freeldr.sys
|
||||
$(RM) *.sys
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "freeldr.h"
|
||||
#include "stdlib.h"
|
||||
#include "fs.h"
|
||||
#include "reactos.h"
|
||||
#include "reactos/reactos.h"
|
||||
#include "tui.h"
|
||||
#include "asmcode.h"
|
||||
#include "menu.h"
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "parseini.h"
|
||||
|
||||
unsigned long next_module_load_base = 0;
|
||||
module_t* pOpenModule = NULL;
|
||||
|
||||
|
||||
BOOL MultiBootLoadKernel(FILE *KernelImage)
|
||||
{
|
||||
|
@ -115,6 +117,7 @@ BOOL MultiBootLoadKernel(FILE *KernelImage)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName)
|
||||
{
|
||||
DWORD dwModuleSize;
|
||||
|
@ -150,6 +153,46 @@ BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, PULONG ModuleSize)
|
||||
{
|
||||
DWORD dwModuleSize;
|
||||
module_t* pModule;
|
||||
char* ModuleNameString;
|
||||
char * TempName;
|
||||
|
||||
/*
|
||||
* Get current module data structure and module name string array
|
||||
*/
|
||||
pModule = &multiboot_modules[mb_info.mods_count];
|
||||
do {
|
||||
TempName = strchr( ModuleName, '\\' );
|
||||
if( TempName )
|
||||
ModuleName = TempName + 1;
|
||||
} while( TempName );
|
||||
|
||||
ModuleNameString = multiboot_module_strings[mb_info.mods_count];
|
||||
|
||||
dwModuleSize = GetFileSize(ModuleImage);
|
||||
pModule->mod_start = next_module_load_base;
|
||||
pModule->mod_end = next_module_load_base + dwModuleSize;
|
||||
strcpy(ModuleNameString, ModuleName);
|
||||
pModule->string = (unsigned long)ModuleNameString;
|
||||
|
||||
/*
|
||||
* Load the file image
|
||||
*/
|
||||
ReadFile(ModuleImage, dwModuleSize, NULL, (void*)next_module_load_base);
|
||||
|
||||
next_module_load_base = ROUND_UP(pModule->mod_end, /*PAGE_SIZE*/4096);
|
||||
mb_info.mods_count++;
|
||||
|
||||
if (ModuleSize != NULL)
|
||||
*ModuleSize = dwModuleSize;
|
||||
|
||||
return((PVOID)pModule->mod_start);
|
||||
}
|
||||
|
||||
int GetBootPartition(char *OperatingSystemName)
|
||||
{
|
||||
|
@ -167,3 +210,48 @@ int GetBootPartition(char *OperatingSystemName)
|
|||
|
||||
return BootPartitionNumber;
|
||||
}
|
||||
|
||||
|
||||
PVOID MultiBootCreateModule(char *ModuleName)
|
||||
{
|
||||
module_t* pModule;
|
||||
char* ModuleNameString;
|
||||
|
||||
/*
|
||||
* Get current module data structure and module name string array
|
||||
*/
|
||||
pModule = &multiboot_modules[mb_info.mods_count];
|
||||
|
||||
ModuleNameString = multiboot_module_strings[mb_info.mods_count];
|
||||
|
||||
pModule->mod_start = next_module_load_base;
|
||||
pModule->mod_end = -1;
|
||||
strcpy(ModuleNameString, ModuleName);
|
||||
pModule->string = (unsigned long)ModuleNameString;
|
||||
|
||||
pOpenModule = pModule;
|
||||
|
||||
return((PVOID)pModule->mod_start);
|
||||
}
|
||||
|
||||
|
||||
BOOL MultiBootCloseModule(PVOID ModuleBase, DWORD dwModuleSize)
|
||||
{
|
||||
module_t* pModule;
|
||||
|
||||
if ((pOpenModule != NULL) &&
|
||||
((module_t*)ModuleBase == pOpenModule->mod_start) &&
|
||||
(pOpenModule->mod_end == -1))
|
||||
{
|
||||
pModule = pOpenModule;
|
||||
pModule->mod_end = pModule->mod_start + dwModuleSize;
|
||||
|
||||
next_module_load_base = ROUND_UP(pModule->mod_end, /*PAGE_SIZE*/4096);
|
||||
mb_info.mods_count++;
|
||||
pOpenModule = NULL;
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
|
@ -145,9 +145,13 @@ void boot_reactos(void);
|
|||
#include "fs.h" // Included FILE structure definition
|
||||
|
||||
BOOL MultiBootLoadKernel(FILE *KernelImage);
|
||||
BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName);
|
||||
int GetBootPartition(char *OperatingSystemName);
|
||||
//BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName);
|
||||
PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, PULONG ModuleSize);
|
||||
|
||||
int GetBootPartition(char *OperatingSystemName);
|
||||
|
||||
PVOID MultiBootCreateModule(char *ModuleName);
|
||||
BOOL MultiBootCloseModule(PVOID ModuleBase, DWORD dwModuleSize);
|
||||
|
||||
#endif /* ! ASM */
|
||||
|
||||
|
|
|
@ -1,333 +0,0 @@
|
|||
/*
|
||||
* FreeLoader
|
||||
* Copyright (C) 1999, 2000, 2001 Brian Palmer <brianp@sginet.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "freeldr.h"
|
||||
#include "asmcode.h"
|
||||
#include "reactos.h"
|
||||
#include "stdlib.h"
|
||||
#include "fs.h"
|
||||
#include "tui.h"
|
||||
#include "multiboot.h"
|
||||
#include "arcname.h"
|
||||
#include "memory.h"
|
||||
#include "parseini.h"
|
||||
|
||||
BOOL LoadReactOSKernel(PUCHAR OperatingSystemName);
|
||||
BOOL LoadReactOSDrivers(PUCHAR OperatingSystemName);
|
||||
|
||||
void LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
{
|
||||
PFILE FilePointer;
|
||||
char name[1024];
|
||||
char value[1024];
|
||||
char szFileName[1024];
|
||||
char szBootPath[256];
|
||||
int i;
|
||||
int nNumDriverFiles=0;
|
||||
int nNumFilesLoaded=0;
|
||||
char MsgBuffer[256];
|
||||
ULONG SectionId;
|
||||
|
||||
//
|
||||
// Open the operating system section
|
||||
// specified in the .ini file
|
||||
//
|
||||
if (!OpenSection(OperatingSystemName, &SectionId))
|
||||
{
|
||||
sprintf(MsgBuffer,"Operating System section '%s' not found in freeldr.ini", OperatingSystemName);
|
||||
MessageBox(MsgBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup multiboot information structure
|
||||
*/
|
||||
mb_info.flags = MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES;
|
||||
mb_info.mem_lower = GetConventionalMemorySize();
|
||||
mb_info.mem_upper = GetExtendedMemorySize();
|
||||
mb_info.boot_device = 0xffffffff;
|
||||
mb_info.cmdline = (unsigned long)multiboot_kernel_cmdline;
|
||||
mb_info.mods_count = 0;
|
||||
mb_info.mods_addr = (unsigned long)multiboot_modules;
|
||||
mb_info.mmap_length = GetBiosMemoryMap(&multiboot_memory_map);
|
||||
if (mb_info.mmap_length)
|
||||
{
|
||||
mb_info.mmap_addr = (unsigned long)&multiboot_memory_map;
|
||||
mb_info.flags |= MB_INFO_FLAG_MEMORY_MAP;
|
||||
//printf("memory map length: %d\n", mb_info.mmap_length);
|
||||
//printf("dumping memory map:\n");
|
||||
//for (i=0; i<(mb_info.mmap_length / 4); i++)
|
||||
//{
|
||||
// printf("0x%x\n", ((unsigned long *)&multiboot_memory_map)[i]);
|
||||
//}
|
||||
//getch();
|
||||
}
|
||||
//printf("low_mem = %d\n", mb_info.mem_lower);
|
||||
//printf("high_mem = %d\n", mb_info.mem_upper);
|
||||
|
||||
/*
|
||||
* Make sure the system path is set in the .ini file
|
||||
*/
|
||||
if (!ReadSectionSettingByName(SectionId, "SystemPath", value, 1024))
|
||||
{
|
||||
MessageBox("System path not specified for selected operating system.");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify system path
|
||||
*/
|
||||
if (!DissectArcPath(value, szBootPath, &BootDrive, &BootPartition))
|
||||
{
|
||||
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
|
||||
MessageBox(MsgBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
/* set boot drive and partition */
|
||||
((char *)(&mb_info.boot_device))[0] = (char)BootDrive;
|
||||
((char *)(&mb_info.boot_device))[1] = (char)BootPartition;
|
||||
|
||||
/* copy ARC path into kernel command line */
|
||||
strcpy(multiboot_kernel_cmdline, value);
|
||||
|
||||
/*
|
||||
* Read the optional kernel parameters (if any)
|
||||
*/
|
||||
if (ReadSectionSettingByName(SectionId, "Options", value, 1024))
|
||||
{
|
||||
strcat(multiboot_kernel_cmdline, " ");
|
||||
strcat(multiboot_kernel_cmdline, value);
|
||||
}
|
||||
|
||||
/* append a backslash */
|
||||
if ((strlen(szBootPath)==0) ||
|
||||
szBootPath[strlen(szBootPath)] != '\\')
|
||||
strcat(szBootPath, "\\");
|
||||
|
||||
/*
|
||||
* Find the kernel image name
|
||||
*/
|
||||
if(!ReadSectionSettingByName(SectionId, "Kernel", value, 1024))
|
||||
{
|
||||
MessageBox("Kernel image file not specified for selected operating system.");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the hal image name
|
||||
*/
|
||||
if(!ReadSectionSettingByName(SectionId, "Hal", value, 1024))
|
||||
{
|
||||
MessageBox("HAL image file not specified for selected operating system.");
|
||||
return;
|
||||
}
|
||||
|
||||
DrawBackdrop();
|
||||
|
||||
DrawStatusText(" Loading...");
|
||||
DrawProgressBar(0);
|
||||
|
||||
/*
|
||||
* Try to open boot drive
|
||||
*/
|
||||
if (!OpenDiskDrive(BootDrive, BootPartition))
|
||||
{
|
||||
MessageBox("Failed to open boot drive.");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the ini file and count the kernel, hal and drivers
|
||||
*/
|
||||
for (i=1; i<=GetNumSectionItems(SectionId); i++)
|
||||
{
|
||||
/*
|
||||
* Read the setting and check if it's a driver
|
||||
*/
|
||||
ReadSectionSettingByNumber(SectionId, i, name, 1024, value, 1024);
|
||||
if ((stricmp(name, "Kernel") == 0) ||
|
||||
(stricmp(name, "Hal") == 0) ||
|
||||
(stricmp(name, "Driver") == 0))
|
||||
nNumDriverFiles++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the kernel image name
|
||||
* and try to load the kernel off the disk
|
||||
*/
|
||||
if(ReadSectionSettingByName(SectionId, "Kernel", value, 1024))
|
||||
{
|
||||
/*
|
||||
* Set the name and try to open the PE image
|
||||
*/
|
||||
//strcpy(szFileName, szBootPath);
|
||||
//strcat(szFileName, value);
|
||||
strcpy(szFileName, value);
|
||||
|
||||
FilePointer = OpenFile(szFileName);
|
||||
if (FilePointer == NULL)
|
||||
{
|
||||
strcat(value, " not found.");
|
||||
MessageBox(value);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the status bar with the current file
|
||||
*/
|
||||
strcpy(name, " Reading ");
|
||||
strcat(name, value);
|
||||
while (strlen(name) < 80)
|
||||
strcat(name, " ");
|
||||
DrawStatusText(name);
|
||||
|
||||
/*
|
||||
* Load the kernel image
|
||||
*/
|
||||
MultiBootLoadKernel(FilePointer);
|
||||
|
||||
nNumFilesLoaded++;
|
||||
DrawProgressBar((nNumFilesLoaded * 100) / nNumDriverFiles);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the HAL image name
|
||||
* and try to load the kernel off the disk
|
||||
*/
|
||||
if(ReadSectionSettingByName(SectionId, "Hal", value, 1024))
|
||||
{
|
||||
/*
|
||||
* Set the name and try to open the PE image
|
||||
*/
|
||||
//strcpy(szFileName, szBootPath);
|
||||
//strcat(szFileName, value);
|
||||
strcpy(szFileName, value);
|
||||
|
||||
FilePointer = OpenFile(szFileName);
|
||||
if (FilePointer == NULL)
|
||||
{
|
||||
strcat(value, " not found.");
|
||||
MessageBox(value);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the status bar with the current file
|
||||
*/
|
||||
strcpy(name, " Reading ");
|
||||
strcat(name, value);
|
||||
while (strlen(name) < 80)
|
||||
strcat(name, " ");
|
||||
DrawStatusText(name);
|
||||
|
||||
/*
|
||||
* Load the HAL image
|
||||
*/
|
||||
MultiBootLoadModule(FilePointer, szFileName);
|
||||
|
||||
nNumFilesLoaded++;
|
||||
DrawProgressBar((nNumFilesLoaded * 100) / nNumDriverFiles);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the ini file and load the kernel and
|
||||
* load all the drivers specified
|
||||
*/
|
||||
for (i=1; i<=GetNumSectionItems(SectionId); i++)
|
||||
{
|
||||
/*
|
||||
* Read the setting and check if it's a driver
|
||||
*/
|
||||
ReadSectionSettingByNumber(SectionId, i, name, 1024, value, 1024);
|
||||
if (stricmp(name, "Driver") == 0)
|
||||
{
|
||||
/*
|
||||
* Set the name and try to open the PE image
|
||||
*/
|
||||
//strcpy(szFileName, szBootPath);
|
||||
//strcat(szFileName, value);
|
||||
strcpy(szFileName, value);
|
||||
|
||||
FilePointer = OpenFile(szFileName);
|
||||
if (FilePointer == NULL)
|
||||
{
|
||||
strcat(value, " not found.");
|
||||
MessageBox(value);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the status bar with the current file
|
||||
*/
|
||||
strcpy(name, " Reading ");
|
||||
strcat(name, value);
|
||||
while (strlen(name) < 80)
|
||||
strcat(name, " ");
|
||||
DrawStatusText(name);
|
||||
|
||||
/*
|
||||
* Load the driver
|
||||
*/
|
||||
MultiBootLoadModule(FilePointer, szFileName);
|
||||
|
||||
|
||||
nNumFilesLoaded++;
|
||||
DrawProgressBar((nNumFilesLoaded * 100) / nNumDriverFiles);
|
||||
}
|
||||
else if (stricmp(name, "MessageBox") == 0)
|
||||
{
|
||||
DrawStatusText(" Press ENTER to continue");
|
||||
MessageBox(value);
|
||||
}
|
||||
else if (stricmp(name, "MessageLine") == 0)
|
||||
MessageLine(value);
|
||||
else if (stricmp(name, "ReOpenBootDrive") == 0)
|
||||
{
|
||||
if (!OpenDiskDrive(BootDrive, BootPartition))
|
||||
{
|
||||
MessageBox("Failed to open boot drive.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the screen and redraw the backdrop and status bar
|
||||
*/
|
||||
DrawBackdrop();
|
||||
DrawStatusText(" Press any key to boot");
|
||||
|
||||
/*
|
||||
* Wait for user
|
||||
*/
|
||||
strcpy(name, "Kernel and Drivers loaded.\nPress any key to boot ");
|
||||
strcat(name, OperatingSystemName);
|
||||
strcat(name, ".");
|
||||
//MessageBox(name);
|
||||
|
||||
RestoreScreen(ScreenBuffer);
|
||||
|
||||
/*
|
||||
* Now boot the kernel
|
||||
*/
|
||||
stop_floppy();
|
||||
boot_reactos();
|
||||
}
|
||||
|
|
@ -19,9 +19,21 @@
|
|||
*/
|
||||
|
||||
#include "../freeldr.h"
|
||||
#include "../stdlib.h"
|
||||
|
||||
//#define NDEBUG
|
||||
|
||||
VOID
|
||||
DetectHardware(VOID)
|
||||
{
|
||||
|
||||
#ifndef NDEBUG
|
||||
printf("DetectHardware() called\n");
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
printf("DetectHardware() done\n");
|
||||
#endif
|
||||
//for(;;);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* FreeLoader
|
||||
*
|
||||
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -17,11 +18,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ROSBOOT_H
|
||||
#define __ROSBOOT_H
|
||||
#ifndef __HWDETECT_H
|
||||
#define __HWDETECT_H
|
||||
|
||||
VOID DetectHardware(VOID);
|
||||
|
||||
void LoadAndBootReactOS(PUCHAR OperatingSystemName);
|
||||
|
||||
|
||||
#endif // defined __ROSBOOT_H
|
||||
#endif /* __HWDETECT_H */
|
|
@ -30,6 +30,7 @@
|
|||
#include "../parseini.h"
|
||||
|
||||
#include "registry.h"
|
||||
#include "hwdetect.h"
|
||||
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -485,7 +486,7 @@ void LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
|||
/*
|
||||
* retrieve hardware information and create the hardware hive
|
||||
*/
|
||||
// DetectHardware();
|
||||
DetectHardware();
|
||||
// Base = MultiBootCreateModule(HARDWARE.HIV);
|
||||
// RegExportHardwareHive(Base, &Size);
|
||||
// MultiBootCloseModule(Base, Size);
|
||||
|
|
|
@ -507,4 +507,65 @@ RegImportHive(PCHAR ChunkBase,
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static PCHAR
|
||||
bprintf(char *buffer, char *format, ... )
|
||||
{
|
||||
int *dataptr = (int *) &format;
|
||||
char c, *ptr, str[16];
|
||||
char *p = buffer;
|
||||
|
||||
dataptr++;
|
||||
|
||||
while ((c = *(format++)))
|
||||
{
|
||||
if (c != '%')
|
||||
{
|
||||
*p = c;
|
||||
p++;
|
||||
}
|
||||
else
|
||||
switch (c = *(format++))
|
||||
{
|
||||
case 'd': case 'u': case 'x':
|
||||
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
|
||||
|
||||
ptr = str;
|
||||
|
||||
while (*ptr)
|
||||
{
|
||||
*p = *(ptr++);
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
*p = (*(dataptr++))&0xff;
|
||||
p++;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
ptr = (char *)(*(dataptr++));
|
||||
|
||||
while ((c = *(ptr++)))
|
||||
{
|
||||
*p = c;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(p);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
RegExportHive(PCHAR ChunkBase, PULONG ChunkSize)
|
||||
{
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -292,6 +292,21 @@ char *strchr(const char *s, int c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *strrchr(const char *s, int c)
|
||||
{
|
||||
char cc = c;
|
||||
const char *sp=(char *)0;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
sp = s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
sp = s;
|
||||
return (char *)sp;
|
||||
}
|
||||
|
||||
int strcmp(const char *string1, const char *string2)
|
||||
{
|
||||
while(*string1 == *string2)
|
||||
|
@ -335,6 +350,21 @@ int _strnicmp(const char *string1, const char *string2, size_t length)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int strncmp(const char *string1, const char *string2, size_t length)
|
||||
{
|
||||
if (length == 0)
|
||||
return 0;
|
||||
do
|
||||
{
|
||||
if (*string1 != *string2++)
|
||||
return *(unsigned const char *)string1 - *(unsigned const char *)--string2;
|
||||
if (*string1++ == 0)
|
||||
break;
|
||||
}
|
||||
while (--length != 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *fgets(char *string, int n, PFILE stream)
|
||||
{
|
||||
int i;
|
||||
|
@ -389,3 +419,18 @@ int atoi(char *string)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
int isspace(int c)
|
||||
{
|
||||
return(c == ' ' || (c >= 0x09 && c <= 0x0D));
|
||||
}
|
||||
|
||||
int isdigit(int c)
|
||||
{
|
||||
return(c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
int isxdigit(int c)
|
||||
{
|
||||
return((c >= '0' && c <= '9')||(c >= 'a' && c <= 'f')||(c >= 'A' && c <= 'F'));
|
||||
}
|
||||
|
|
|
@ -43,8 +43,10 @@ char *strcpy(char *dest, char *src);
|
|||
char *strncpy(char *dest, char *src, size_t count);
|
||||
char *strcat(char *dest, char *src);
|
||||
char *strchr(const char *s, int c);
|
||||
char *strrchr(const char *s, int c);
|
||||
int strcmp(const char *string1, const char *string2);
|
||||
int stricmp(const char *string1, const char *string2);
|
||||
int strncmp(const char *string1, const char *string2, size_t length);
|
||||
int _strnicmp(const char *string1, const char *string2, size_t length);
|
||||
char *itoa(int value, char *string, int radix);
|
||||
int toupper(int c);
|
||||
|
@ -57,6 +59,10 @@ int atoi(char *string);
|
|||
|
||||
#define ZeroMemory(Destination, Length) memset(Destination, 0, Length)
|
||||
|
||||
int isspace(int c);
|
||||
int isdigit(int c);
|
||||
int isxdigit(int c);
|
||||
|
||||
|
||||
void print(char *str);
|
||||
void printf(char *fmt, ...);
|
||||
|
@ -75,5 +81,13 @@ int get_heads(int drive); // Implemented in asmcode.S
|
|||
int get_cylinders(int drive); // Implemented in asmcode.S
|
||||
int get_sectors(int drive); // Implemented in asmcode.S
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
#endif // defined __STDLIB_H
|
Loading…
Reference in a new issue