Merge 14551:14980 from trunk

svn path=/branches/xmlbuildsystem/; revision=15017
This commit is contained in:
Casper Hornstrup 2005-05-05 19:15:25 +00:00
commit 1fef01891c
881 changed files with 65277 additions and 32781 deletions

View file

@ -33,7 +33,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <winsock2.h>
#include "unistd.h"
@ -52,14 +51,14 @@ netfinger(char *name)
struct hostent *hp, def;
struct servent *sp;
struct sockaddr_in sin;
int s;
SOCKET s;
char *alist[1], *host;
/* If this is a local request */
if (!(host = rindex(name, '@')))
return;
*host++ = 0;
*host++ = '\0';
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
def.h_name = host;
def.h_addr_list = alist;
@ -80,7 +79,7 @@ netfinger(char *name)
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
sin.sin_port = sp->s_port;
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) {
perror("finger: socket");
return;
}

View file

@ -235,7 +235,7 @@ char *getpass (const char * prompt)
static char input[256];
HANDLE in;
HANDLE err;
int count;
DWORD count;
in = GetStdHandle (STD_INPUT_HANDLE);
err = GetStdHandle (STD_ERROR_HANDLE);

View file

@ -97,7 +97,7 @@ uid_t getuid();
sig_t lostpeer();
off_t restart_point = 0;
int cin, cout;
SOCKET cin, cout;
int dataconn(char *mode);
int command(char *fmt, ...);
@ -113,7 +113,8 @@ void psabort(int sig);
char *hookup(char *host, int port)
{
register struct hostent *hp = 0;
int s,len;
int len;
SOCKET s;
static char hostnamebuf[80];
bzero((char *)&hisctladdr, sizeof (hisctladdr));
@ -136,7 +137,7 @@ char *hookup(char *host, int port)
}
hostname = hostnamebuf;
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
if (s < 0) {
if (s == INVALID_SOCKET) {
perror("ftp: socket");
code = -1;
return (0);
@ -1327,8 +1328,8 @@ void pswitch(int flag)
char name[MAXHOSTNAMELEN];
struct sockaddr_in mctl;
struct sockaddr_in hctl;
FILE *in;
FILE *out;
SOCKET in;
SOCKET out;
int tpe;
int cpnd;
int sunqe;
@ -1371,10 +1372,10 @@ void pswitch(int flag)
hisctladdr = op->hctl;
ip->mctl = myctladdr;
myctladdr = op->mctl;
(int) ip->in = cin; // What the hell am I looking at...?
cin = (int) op->in;
(int) ip->out = cout; // Same again...
cout = (int) op->out;
ip->in = cin;
cin = op->in;
ip->out = cout;
cout = op->out;
ip->tpe = type;
type = op->tpe;
if (!type)

View file

@ -110,8 +110,8 @@ int main()
DWORD r;
ANSI_STRING astring;
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
PSYSTEM_PROCESSES SystemProcesses = NULL;
PSYSTEM_PROCESSES CurrentProcess;
PSYSTEM_PROCESS_INFORMATION SystemProcesses = NULL;
PSYSTEM_PROCESS_INFORMATION CurrentProcess;
ULONG BufferSize, ReturnSize;
NTSTATUS Status;
char buf[256];
@ -140,7 +140,7 @@ int main()
/* For every process print the information. */
CurrentProcess = SystemProcesses;
while (CurrentProcess->NextEntryDelta != 0)
while (CurrentProcess->NextEntryOffset != 0)
{
int hour, hour1, thour, thour1;
unsigned char minute, minute1, tmin, tmin1;
@ -159,53 +159,53 @@ int main()
minute1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
seconds1 = (ptime.QuadPart / 10000000LL) % 60LL;
RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ProcessName, TRUE);
RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ImageName, TRUE);
wsprintf(buf,"P%8d %8d %3d:%02d:%02d %3d:%02d:%02d ProcName: %s\n",
CurrentProcess->ProcessId, CurrentProcess->InheritedFromProcessId,
CurrentProcess->UniqueProcessId, CurrentProcess->InheritedFromUniqueProcessId,
hour, minute, seconds, hour1, minute1, seconds1,
astring.Buffer);
WriteFile(stdout, buf, lstrlen(buf), &r, NULL);
RtlFreeAnsiString(&astring);
for (ti = 0; ti < CurrentProcess->ThreadCount; ti++)
for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++)
{
struct status *statt;
struct waitres *waitt;
char szWindowName[30] = {" "};
ptime = CurrentProcess->Threads[ti].KernelTime;
ptime = CurrentProcess->TH[ti].KernelTime;
thour = (ptime.QuadPart / (10000000LL * 3600LL));
tmin = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
tsec = (ptime.QuadPart / 10000000LL) % 60LL;
ptime = CurrentProcess->Threads[ti].UserTime;
ptime = CurrentProcess->TH[ti].UserTime;
thour1 = (ptime.QuadPart / (10000000LL * 3600LL));
tmin1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
tsec1 = (ptime.QuadPart / 10000000LL) % 60LL;
statt = thread_stat;
while (statt->state != CurrentProcess->Threads[ti].State && statt->state >= 0)
while (statt->state != CurrentProcess->TH[ti].ThreadState && statt->state >= 0)
statt++;
waitt = waitreason;
while (waitt->state != CurrentProcess->Threads[ti].WaitReason && waitt->state >= 0)
while (waitt->state != CurrentProcess->TH[ti].WaitReason && waitt->state >= 0)
waitt++;
wsprintf (buf1,
"t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n",
CurrentProcess->Threads[ti].ClientId.UniqueThread,
CurrentProcess->TH[ti].ClientId.UniqueThread,
thour, tmin, tsec, thour1, tmin1, tsec1,
statt->desc , waitt->desc);
WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL);
EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread,
EnumThreadWindows((DWORD)CurrentProcess->TH[ti].ClientId.UniqueThread,
(ENUMWINDOWSPROC) EnumThreadProc,
(LPARAM)(LPTSTR) szWindowName );
}
CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess +
CurrentProcess->NextEntryDelta);
CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess +
CurrentProcess->NextEntryOffset);
}
return (0);
}

View file

@ -51,8 +51,7 @@
; [OS-General] Section Commands:
;
; BootType - sets the boot type: ReactOS, Linux, BootSector, Partition, Drive
; BootDrive - sets the boot drive: 0 - first floppy, 1 - second floppy, 0x80 - first hard disk, 0x81 - second hard disk
; BootPartition - sets the boot partition
; BootPath - ARC path e.g. multi(0)disk(0)rdisk(x)partition(y)
; DriveMap - maps a BIOS drive number to another (i.e. DriveMap=hd1,hd0 maps harddisk1 to harddisk0 or DriveMap=fd1,fd0)
; [BootSector OSType] Section Commands:
@ -134,8 +133,7 @@ Hal=\reactos\HAL.DLL
[Linux]
BootType=Linux
BootDrive=hd1
BootPartition=1
BootPath=multi(0)disk(0)rdisk(1)partition(1)
Kernel=/vmlinuz
Initrd=/initrd.img
CommandLine="root=/dev/sdb1"
@ -146,13 +144,11 @@ BootDrive=fd0
[MSWinders]
BootType=Partition
BootDrive=hd0
BootPartition=1
BootPath=multi(0)disk(0)rdisk(0)partition(1)
;DriveMap=hd1,hd0
;DriveMap=hd2,hd0
;DriveMap=hd3,hd0
[DriveD]
BootType=Partition
BootDrive=hd1
BootPartition=1
BootPath=multi(0)disk(0)rdisk(1)partition(1)

View file

@ -20,6 +20,7 @@
PATH_TO_TOP = ../..
include rules.mak
include $(PATH_TO_TOP)/config
all:
$(MAKE) -C tools

View file

@ -27,8 +27,8 @@ freeldr.o: $(FREELDR)
rm freeldr.tmp
ofwldr: $(OBJS)
mppcw32-ld --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf
mppcw32-objcopy $(SECTIONS) -O aixcoff-rs6000 $@.elf $@
$(LD) -melf32ppc --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf
$(OBJCOPY) $(SECTIONS) -O aixcoff-rs6000 $@.elf $@
$(TOOLS)/hack-coff $@
clean:

View file

@ -89,9 +89,6 @@ main:
mov es,ax ; Make ES correct
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
jne GetDriveParameters
mov [BYTE bp+BootDrive],dl ; Save the boot drive

View file

@ -47,10 +47,10 @@ EXTERN(RealEntryPoint)
.code32
/* Store the boot drive */
movb %dl,(_BootDrive)
movb %dl,(_i386BootDrive)
/* Store the boot partition */
movb %dh,(_BootPartition)
movb %dh,(_i386BootPartition)
/* GO! */
xorl %eax,%eax
@ -275,9 +275,11 @@ EXTERN(_DisableA20)
* other boot loaders like Grub
*/
#define MB_INFO_SIZE 90
#define MB_INFO_FLAGS_OFFSET 0
#define MB_INFO_BOOT_DEVICE_OFFSET 12
#define MB_INFO_COMMAND_LINE_OFFSET 16
#define CMDLINE_SIZE 256
/*
* We want to execute at 0x8000 (to be compatible with bootsector
@ -285,7 +287,6 @@ EXTERN(_DisableA20)
* above 1MB. So we let Grub load us there and then relocate
* ourself to 0x8000
*/
#define CMDLINE_BASE 0x7000
#define FREELDR_BASE 0x8000
#define INITIAL_BASE 0x200000
@ -328,6 +329,31 @@ mb1:
movw %dx,%ds
movw %dx,%es
/* Check for valid multiboot signature */
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
jne mbfail
/* Store multiboot info in a safe place */
movl %ebx,%esi
movl $(mb_info + INITIAL_BASE - FREELDR_BASE),%edi
movl $MB_INFO_SIZE,%ecx
rep movsb
/* Save commandline */
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
jz mb3
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
movl $(cmdline + INITIAL_BASE - FREELDR_BASE),%edi
movl $CMDLINE_SIZE,%ecx
mb2: lodsb
stosb
testb %al,%al
jz mb3
dec %ecx
jnz mb2
mb3:
/* Copy to low mem */
movl $INITIAL_BASE,%esi
movl $FREELDR_BASE,%edi
@ -342,8 +368,8 @@ mb1:
/* Clear prefetch queue & correct CS,
* jump to low mem */
ljmp $PMODE_CS, $mb2
mb2:
ljmp $PMODE_CS, $mb4
mb4:
/* Reload segment selectors */
movw $PMODE_DS,%dx
movw %dx,%ds
@ -353,39 +379,28 @@ mb2:
movw %dx,%ss
movl $STACK32ADDR,%esp
/* Check for valid multiboot signature */
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
jne mbfail
movl $mb_info,%ebx
/* See if the boot device was passed in */
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
testl $MB_INFO_FLAG_BOOT_DEVICE,%edx
jz mb3
jz mb5
/* Retrieve boot device info */
movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax
shrl $16,%eax
incb %al
movb %al,_BootPartition
movb %ah,_BootDrive
jmp mb4
mb3: /* No boot device known, assume first partition of first harddisk */
movb $0x80,_BootDrive
movb $1,_BootPartition
mb4:
/* Check for a command line */
xorl %eax,%eax
testl $MB_INFO_FLAG_COMMAND_LINE,%edx
jz mb6
/* Copy command line to low mem*/
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
movl $CMDLINE_BASE,%edi
mb5: lodsb
stosb
testb %al,%al
jnz mb5
movl $CMDLINE_BASE,%eax
movb %al,_i386BootPartition
movb %ah,_i386BootDrive
jmp mb6
mb5: /* No boot device known, assume first partition of first harddisk */
movb $0x80,_i386BootDrive
movb $1,_i386BootPartition
mb6:
/* Check for command line */
mov $cmdline,%eax
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
jnz mb7
xorl %eax,%eax
mb7:
/* GO! */
pushl %eax
@ -462,8 +477,14 @@ rmode_idtptr:
.word 0x3ff /* Limit */
.long 0 /* Base Address */
EXTERN(_BootDrive)
EXTERN(_i386BootDrive)
.long 0
EXTERN(_BootPartition)
EXTERN(_i386BootPartition)
.long 0
mb_info:
.fill MB_INFO_SIZE, 1, 0
cmdline:
.fill CMDLINE_SIZE, 1, 0

View file

@ -27,7 +27,7 @@
#include "rtl.h"
VOID
MachInit(VOID)
MachInit(char *CmdLine)
{
ULONG PciId;
@ -39,11 +39,11 @@ MachInit(VOID)
PciId = READ_PORT_ULONG((ULONG*) 0xcfc);
if (0x02a510de == PciId)
{
XboxMachInit();
XboxMachInit(CmdLine);
}
else
{
PcMachInit();
PcMachInit(CmdLine);
}
HalpCalibrateStallExecution();

View file

@ -31,7 +31,7 @@ EXTERN(_ChainLoadBiosBootSectorCode)
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
movb (_i386BootDrive),%dl
/* Load segment registers */
cli

View file

@ -101,9 +101,9 @@ typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
typedef struct _CM_PNP_BIOS_DEVICE_NODE
{
USHORT Size;
UCHAR Node;
CHAR Node;
ULONG ProductId;
UCHAR DeviceType[3];
CHAR DeviceType[3];
USHORT DeviceAttributes;
} __attribute__((packed)) CM_PNP_BIOS_DEVICE_NODE, *PCM_PNP_BIOS_DEVICE_NODE;
@ -258,7 +258,7 @@ SetComponentInformation(FRLDRHKEY ComponentKey,
Error = RegSetValue(ComponentKey,
"Component Information",
REG_BINARY,
(PUCHAR)&CompInfo,
(PCHAR)&CompInfo,
sizeof(CM_COMPONENT_INFORMATION));
if (Error != ERROR_SUCCESS)
{
@ -287,7 +287,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
LONG Error;
InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported();
if (InstData == NULL || strncmp(InstData->Signature, "$PnP", 4))
if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
{
DbgPrint((DPRINT_HWDETECT, "PnP-BIOS not supported\n"));
return;
@ -335,7 +335,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BusKey,
"Identifier",
REG_SZ,
(PUCHAR)"PNP BIOS",
"PNP BIOS",
9);
if (Error != ERROR_SUCCESS)
{
@ -413,7 +413,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BusKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -495,7 +495,7 @@ SetHarddiskConfigurationData(FRLDRHKEY DiskKey,
Error = RegSetValue(DiskKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -516,7 +516,7 @@ SetHarddiskIdentifier(FRLDRHKEY DiskKey,
ULONG i;
ULONG Checksum;
ULONG Signature;
char Identifier[20];
CHAR Identifier[20];
LONG Error;
/* Read the MBR */
@ -568,7 +568,7 @@ SetHarddiskIdentifier(FRLDRHKEY DiskKey,
Error = RegSetValue(DiskKey,
"Identifier",
REG_SZ,
(PUCHAR) Identifier,
Identifier,
20);
if (Error != ERROR_SUCCESS)
{
@ -673,7 +673,7 @@ DetectBiosDisks(FRLDRHKEY SystemKey,
Error = RegSetValue(SystemKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -829,7 +829,7 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey)
Error = RegSetValue(PeripheralKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -845,7 +845,7 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey)
Error = RegSetValue(PeripheralKey,
"Identifier",
REG_SZ,
(PUCHAR)Identifier,
(PCHAR)Identifier,
strlen(Identifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -939,7 +939,7 @@ DetectBiosFloppyController(FRLDRHKEY SystemKey,
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -1280,7 +1280,7 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey,
Error = RegSetValue(PeripheralKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR)&FullResourceDescriptor,
(PCHAR)&FullResourceDescriptor,
sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
if (Error != ERROR_SUCCESS)
@ -1294,7 +1294,7 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey,
Error = RegSetValue(PeripheralKey,
"Identifier",
REG_SZ,
(PUCHAR)Identifier,
Identifier,
strlen(Identifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -1409,7 +1409,7 @@ DetectSerialPorts(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -1426,7 +1426,7 @@ DetectSerialPorts(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Identifier",
REG_SZ,
(PUCHAR)Buffer,
Buffer,
strlen(Buffer) + 1);
if (Error != ERROR_SUCCESS)
{
@ -1542,7 +1542,7 @@ DetectParallelPorts(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -1559,7 +1559,7 @@ DetectParallelPorts(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Identifier",
REG_SZ,
(PUCHAR)Buffer,
Buffer,
strlen(Buffer) + 1);
if (Error != ERROR_SUCCESS)
{
@ -1702,7 +1702,7 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
Error = RegSetValue(PeripheralKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR)FullResourceDescriptor,
(PCHAR)FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -1718,7 +1718,7 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
Error = RegSetValue(ControllerKey,
"Identifier",
REG_SZ,
(PUCHAR)Buffer,
Buffer,
strlen(Buffer) + 1);
if (Error != ERROR_SUCCESS)
{
@ -1804,7 +1804,7 @@ DetectKeyboardController(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR)FullResourceDescriptor,
(PCHAR)FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -1972,7 +1972,7 @@ DetectPS2Mouse(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR)&FullResourceDescriptor,
(PCHAR)&FullResourceDescriptor,
sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
if (Error != ERROR_SUCCESS)
{
@ -2014,7 +2014,7 @@ DetectPS2Mouse(FRLDRHKEY BusKey)
Error = RegSetValue(PeripheralKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR)&FullResourceDescriptor,
(PCHAR)&FullResourceDescriptor,
sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
if (Error != ERROR_SUCCESS)
@ -2029,7 +2029,7 @@ DetectPS2Mouse(FRLDRHKEY BusKey)
Error = RegSetValue(PeripheralKey,
"Identifier",
REG_SZ,
(PUCHAR)"MICROSOFT PS2 MOUSE",
"MICROSOFT PS2 MOUSE",
20);
if (Error != ERROR_SUCCESS)
{
@ -2098,7 +2098,7 @@ DetectDisplayController(FRLDRHKEY BusKey)
Error = RegSetValue(ControllerKey,
"Identifier",
REG_SZ,
(PUCHAR)Buffer,
Buffer,
strlen(Buffer) + 1);
if (Error != ERROR_SUCCESS)
{
@ -2146,7 +2146,7 @@ DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BusKey,
"Identifier",
REG_SZ,
(PUCHAR)"ISA",
"ISA",
4);
if (Error != ERROR_SUCCESS)
{
@ -2175,7 +2175,7 @@ DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BusKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)

View file

@ -92,7 +92,7 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BiosKey,
"Identifier",
REG_SZ,
(PUCHAR)"ACPI BIOS",
"ACPI BIOS",
10);
if (Error != ERROR_SUCCESS)
{

View file

@ -95,7 +95,7 @@ DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BiosKey,
"Identifier",
REG_SZ,
(PUCHAR)"APM",
"APM",
4);
if (Error != ERROR_SUCCESS)
{

View file

@ -111,8 +111,8 @@ static VOID
DetectCPU(FRLDRHKEY CpuKey,
FRLDRHKEY FpuKey)
{
char VendorIdentifier[13];
char Identifier[64];
CHAR VendorIdentifier[13];
CHAR Identifier[64];
ULONG FeatureSet;
FRLDRHKEY CpuInstKey;
FRLDRHKEY FpuInstKey;
@ -195,7 +195,7 @@ DetectCPU(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"FeatureSet",
REG_DWORD,
(PUCHAR)&FeatureSet,
(PCHAR)&FeatureSet,
sizeof(ULONG));
if (Error != ERROR_SUCCESS)
{
@ -208,7 +208,7 @@ DetectCPU(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"Identifier",
REG_SZ,
(PUCHAR)Identifier,
Identifier,
strlen(Identifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -218,7 +218,7 @@ DetectCPU(FRLDRHKEY CpuKey,
Error = RegSetValue(FpuInstKey,
"Identifier",
REG_SZ,
(PUCHAR)Identifier,
Identifier,
strlen(Identifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -231,7 +231,7 @@ DetectCPU(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"VendorIdentifier",
REG_SZ,
(PUCHAR)VendorIdentifier,
VendorIdentifier,
strlen(VendorIdentifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -250,7 +250,7 @@ DetectCPU(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"~MHz",
REG_DWORD,
(PUCHAR)&CpuSpeed,
(PCHAR)&CpuSpeed,
sizeof(ULONG));
if (Error != ERROR_SUCCESS)
{
@ -339,7 +339,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"FeatureSet",
REG_DWORD,
(PUCHAR)&FeatureSet,
(PCHAR)&FeatureSet,
sizeof(ULONG));
if (Error != ERROR_SUCCESS)
{
@ -352,7 +352,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"Identifier",
REG_SZ,
(PUCHAR)Identifier,
Identifier,
strlen(Identifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -362,7 +362,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey,
Error = RegSetValue(FpuInstKey,
"Identifier",
REG_SZ,
(PUCHAR)Identifier,
Identifier,
strlen(Identifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -375,7 +375,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"VendorIdentifier",
REG_SZ,
(PUCHAR)VendorIdentifier,
VendorIdentifier,
strlen(VendorIdentifier) + 1);
if (Error != ERROR_SUCCESS)
{
@ -394,7 +394,7 @@ SetMpsProcessor(FRLDRHKEY CpuKey,
Error = RegSetValue(CpuInstKey,
"~MHz",
REG_DWORD,
(PUCHAR)&CpuSpeed,
(PCHAR)&CpuSpeed,
sizeof(ULONG));
if (Error != ERROR_SUCCESS)
{

View file

@ -178,7 +178,7 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
Error = RegSetValue(TableKey,
"Identifier",
REG_SZ,
(PUCHAR)"PCI Real-mode IRQ Routing Table",
"PCI Real-mode IRQ Routing Table",
32);
if (Error != ERROR_SUCCESS)
{
@ -216,7 +216,7 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
Error = RegSetValue(TableKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)
@ -272,7 +272,7 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BiosKey,
"Identifier",
REG_SZ,
(PUCHAR)"PCI BIOS",
"PCI BIOS",
9);
if (Error != ERROR_SUCCESS)
{
@ -301,7 +301,7 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BiosKey,
"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PUCHAR) FullResourceDescriptor,
(PCHAR) FullResourceDescriptor,
Size);
MmFreeMemory(FullResourceDescriptor);
if (Error != ERROR_SUCCESS)

View file

@ -0,0 +1,40 @@
/*
* FreeLoader
*
* Copyright (C) 2003 Eric Kohl
*
* 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 __I386_I386_H_
#define __I386_I386_H_
extern ULONG i386BootDrive;
extern ULONG i386BootPartition;
extern BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector,
PULONGLONG SectorCount, int *FsType);
extern BOOL i386DiskGetSystemVolume(char *SystemPath, char *RemainingPath,
PULONG Device, PULONG DriveNumber,
PULONGLONG StartSector,
PULONGLONG SectorCount, int *FsType);
extern BOOL i386DiskGetBootPath(char *BootPath, unsigned Size);
extern VOID i386DiskGetBootDevice(PULONG BootDevice);
extern BOOL i386DiskBootingFromFloppy(VOID);
#endif /* __I386_I386_H_ */
/* EOF */

View file

@ -19,6 +19,8 @@
#include "freeldr.h"
#include "debug.h"
#include "i386.h"
#include "fsrec.h"
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
@ -166,4 +168,244 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff
return TRUE;
}
#endif // defined __i386__
BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
{
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR VolumeType;
DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", i386BootDrive, i386BootPartition));
// Check and see if it is a floppy drive
// If so then just assume FAT12 file system type
if (DiskIsDriveRemovable(i386BootDrive))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
*DriveNumber = i386BootDrive;
*StartSector = 0;
*SectorCount = 2 * 80 * 18; /* FIXME hardcoded for 1.44 Mb */
*FsType = FS_FAT;
return TRUE;
}
// Check for ISO9660 file system type
if (i386BootDrive >= 0x80 && FsRecIsIso9660(i386BootDrive))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
*DriveNumber = i386BootDrive;
*StartSector = 0;
*SectorCount = 0;
*FsType = FS_ISO9660;
return TRUE;
}
// Get the requested partition entry
if (i386BootPartition == 0)
{
// Partition requested was zero which means the boot partition
if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
{
return FALSE;
}
}
else
{
// Get requested partition
if (! MachDiskGetPartitionEntry(i386BootDrive, i386BootPartition, &PartitionTableEntry))
{
return FALSE;
}
}
// Check for valid partition
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
{
return FALSE;
}
// Try to recognize the file system
if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
{
return FALSE;
}
*DriveNumber = i386BootDrive;
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
//switch (PartitionTableEntry.SystemIndicator)
switch (VolumeType)
{
case PARTITION_FAT_12:
case PARTITION_FAT_16:
case PARTITION_HUGE:
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
*FsType = FS_FAT;
return TRUE;
case PARTITION_EXT2:
*FsType = FS_EXT2;
return TRUE;
case PARTITION_NTFS:
*FsType = FS_NTFS;
return TRUE;
default:
*FsType = 0;
return FALSE;
}
return TRUE;
}
VOID
i386DiskGetBootDevice(PULONG BootDevice)
{
((char *)BootDevice)[0] = (char)i386BootDrive;
((char *)BootDevice)[1] = (char)i386BootPartition;
}
BOOL
i386DiskBootingFromFloppy(VOID)
{
return i386BootDrive < 0x80;
}
#define IsRecognizedPartition(P) \
((P) == PARTITION_FAT_12 || \
(P) == PARTITION_FAT_16 || \
(P) == PARTITION_HUGE || \
(P) == PARTITION_IFS || \
(P) == PARTITION_EXT2 || \
(P) == PARTITION_FAT32 || \
(P) == PARTITION_FAT32_XINT13 || \
(P) == PARTITION_XINT13)
BOOL i386DiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
PULONG Device,
PULONG DriveNumber,
PULONGLONG StartSector,
PULONGLONG SectorCount,
int *FsType)
{
ULONG PartitionNumber;
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR VolumeType;
CHAR BootPath[256];
unsigned i, RosPartition;
/*
* Verify system path
*/
if (!DissectArcPath(SystemPath, BootPath, DriveNumber, &PartitionNumber))
{
return FALSE;
}
if (NULL != RemainingPath)
{
strcpy(RemainingPath, BootPath);
}
/* 0xff -> no partition table present, use whole device */
if (0xff == PartitionNumber)
{
PartitionTableEntry.SectorCountBeforePartition = 0;
i = 0xff;
}
else
{
/* recalculate the boot partition for freeldr */
i = 0;
RosPartition = 0;
while (1)
{
if (!MachDiskGetPartitionEntry(*DriveNumber, ++i, &PartitionTableEntry))
{
return FALSE;
}
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
{
if (++RosPartition == PartitionNumber)
{
break;
}
}
}
}
/* Check for ISO9660 file system type */
if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
if (NULL != Device)
{
((char *)Device)[0] = (char)(*DriveNumber);
((char *)Device)[1] = (char)i;
}
*StartSector = 0;
*SectorCount = 0;
*FsType = FS_ISO9660;
return TRUE;
}
if (!FsRecognizeVolume(*DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
{
return FALSE;
}
if (NULL != Device)
{
((char *)Device)[0] = (char)(*DriveNumber);
((char *)Device)[1] = (char)i;
}
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
switch (VolumeType)
{
case PARTITION_FAT_12:
case PARTITION_FAT_16:
case PARTITION_HUGE:
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
*FsType = FS_FAT;
return TRUE;
case PARTITION_EXT2:
*FsType = FS_EXT2;
return TRUE;
case PARTITION_NTFS:
*FsType = FS_NTFS;
return TRUE;
default:
*FsType = 0;
return FALSE;
}
return FALSE;
}
BOOL
i386DiskGetBootPath(char *BootPath, unsigned Size)
{
static char Path[] = "multi(0)disk(0)";
char Device[4];
itoa(i386BootDrive, Device, 10);
if (Size <= sizeof(Path) + 6 + strlen(Device))
{
return FALSE;
}
strcpy(BootPath, Path);
strcat(BootPath, MachDiskBootingFromFloppy() ? "fdisk" : "cdrom");
strcat(strcat(strcat(BootPath, "("), Device), ")");
return TRUE;
}
#endif /* defined __i386__ */
/* EOF */

View file

@ -30,7 +30,7 @@ EXTERN(_BootNewLinuxKernel)
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
movb (_i386BootDrive),%dl
/* Load segment registers */
cli
@ -66,7 +66,7 @@ EXTERN(_BootOldLinuxKernel)
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
movb (_i386BootDrive),%dl
/* Load segment registers */
cli

View file

@ -23,9 +23,10 @@
#include "machine.h"
#include "machpc.h"
#include "rtl.h"
#include "i386.h"
VOID
PcMachInit(VOID)
PcMachInit(char *CmdLine)
{
EnableA20();
@ -48,6 +49,11 @@ PcMachInit(VOID)
MachVtbl.VideoSync = PcVideoSync;
MachVtbl.VideoPrepareForReactOS = PcVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume;
MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume;
MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;

View file

@ -26,7 +26,7 @@
#include "mm.h"
#endif
VOID PcMachInit(VOID);
VOID PcMachInit(char *CmdLine);
VOID PcConsPutChar(int Ch);
BOOL PcConsKbHit();

View file

@ -21,9 +21,10 @@
#include "mm.h"
#include "machine.h"
#include "machxbox.h"
#include "i386.h"
VOID
XboxMachInit(VOID)
XboxMachInit(char *CmdLine)
{
/* Initialize our stuff */
XboxMemInit();
@ -46,6 +47,11 @@ XboxMachInit(VOID)
MachVtbl.VideoSync = XboxVideoSync;
MachVtbl.VideoPrepareForReactOS = XboxVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = XboxMemGetMemoryMap;
MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume;
MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume;
MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;

View file

@ -26,7 +26,7 @@
UCHAR XboxFont8x16[256 * 16];
VOID XboxMachInit(VOID);
VOID XboxMachInit(char *CmdLine);
VOID XboxConsPutChar(int Ch);
BOOL XboxConsKbHit();

View file

@ -279,7 +279,7 @@ void PpcInit( of_proxy the_ofproxy ) {
BootMain("freeldr-ppc");
}
void MachInit() {
void MachInit(char *CmdLine) {
int len;
printf( "Determining boot device:\n" );
len = ofw_getprop(chosen_package, "bootpath",

View file

@ -39,16 +39,23 @@
VOID RunLoader(VOID)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
CHAR SettingName[80];
CHAR SettingValue[80];
ULONG SectionId;
ULONG OperatingSystemCount;
PUCHAR *OperatingSystemSectionNames;
PUCHAR *OperatingSystemDisplayNames;
PCHAR *OperatingSystemSectionNames;
PCHAR *OperatingSystemDisplayNames;
ULONG DefaultOperatingSystem;
LONG TimeOut;
ULONG SelectedOperatingSystem;
if (!FsOpenBootVolume())
{
printf("Error opening boot partition for file access.\n");
MachConsGetCh();
return;
}
if (!IniFileInitialize())
{
printf("Press any key to reboot.\n");
@ -159,10 +166,10 @@ reboot:
return;
}
ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount)
ULONG GetDefaultOperatingSystem(PCHAR OperatingSystemList[], ULONG OperatingSystemCount)
{
UCHAR DefaultOSText[80];
char* DefaultOSName;
CHAR DefaultOSText[80];
PCHAR DefaultOSName;
ULONG SectionId;
ULONG DefaultOS = 0;
ULONG Idx;
@ -198,7 +205,7 @@ ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingS
LONG GetTimeOut(VOID)
{
UCHAR TimeOutText[20];
CHAR TimeOutText[20];
LONG TimeOut;
ULONG SectionId;

View file

@ -32,20 +32,20 @@
#include <machine.h>
UCHAR BootDrivePrompt[] = "Enter the boot drive.\n\nExamples:\nfd0 - first floppy drive\nhd0 - first hard drive\nhd1 - second hard drive\ncd0 - first CD-ROM drive.\n\nBIOS drive numbers may also be used:\n0 - first floppy drive\n0x80 - first hard drive\n0x81 - second hard drive";
UCHAR BootPartitionPrompt[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition.";
UCHAR BootSectorFilePrompt[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos";
UCHAR LinuxKernelPrompt[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18";
UCHAR LinuxInitrdPrompt[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk.";
UCHAR LinuxCommandLinePrompt[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init";
UCHAR ReactOSSystemPathPrompt[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS";
UCHAR ReactOSOptionsPrompt[] = "Enter the options you want passed to the kernel.\n\nExamples:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n/FASTDETECT /SOS /NOGUIBOOT\n/BASEVIDEO /MAXMEM=64\n/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL";
CHAR BootDrivePrompt[] = "Enter the boot drive.\n\nExamples:\nfd0 - first floppy drive\nhd0 - first hard drive\nhd1 - second hard drive\ncd0 - first CD-ROM drive.\n\nBIOS drive numbers may also be used:\n0 - first floppy drive\n0x80 - first hard drive\n0x81 - second hard drive";
CHAR BootPartitionPrompt[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition.";
CHAR BootSectorFilePrompt[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos";
CHAR LinuxKernelPrompt[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18";
CHAR LinuxInitrdPrompt[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk.";
CHAR LinuxCommandLinePrompt[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init";
CHAR ReactOSSystemPathPrompt[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS";
CHAR ReactOSOptionsPrompt[] = "Enter the options you want passed to the kernel.\n\nExamples:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n/FASTDETECT /SOS /NOGUIBOOT\n/BASEVIDEO /MAXMEM=64\n/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL";
UCHAR CustomBootPrompt[] = "Press ENTER to boot your custom boot setup.";
CHAR CustomBootPrompt[] = "Press ENTER to boot your custom boot setup.";
VOID OptionMenuCustomBoot(VOID)
{
PUCHAR CustomBootMenuList[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" };
PCHAR CustomBootMenuList[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" };
ULONG CustomBootMenuCount = sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]);
ULONG SelectedMenuItem;
@ -77,8 +77,8 @@ VOID OptionMenuCustomBoot(VOID)
VOID OptionMenuCustomBootDisk(VOID)
{
UCHAR SectionName[100];
UCHAR BootDriveString[20];
CHAR SectionName[100];
CHAR BootDriveString[20];
ULONG SectionId;
ULONG Year, Month, Day, Hour, Minute, Second;
@ -119,9 +119,9 @@ VOID OptionMenuCustomBootDisk(VOID)
VOID OptionMenuCustomBootPartition(VOID)
{
UCHAR SectionName[100];
UCHAR BootDriveString[20];
UCHAR BootPartitionString[20];
CHAR SectionName[100];
CHAR BootDriveString[20];
CHAR BootPartitionString[20];
ULONG SectionId;
ULONG Year, Month, Day, Hour, Minute, Second;
@ -174,10 +174,10 @@ VOID OptionMenuCustomBootPartition(VOID)
VOID OptionMenuCustomBootBootSectorFile(VOID)
{
UCHAR SectionName[100];
UCHAR BootDriveString[20];
UCHAR BootPartitionString[20];
UCHAR BootSectorFileString[200];
CHAR SectionName[100];
CHAR BootDriveString[20];
CHAR BootPartitionString[20];
CHAR BootSectorFileString[200];
ULONG SectionId;
ULONG Year, Month, Day, Hour, Minute, Second;
@ -242,12 +242,12 @@ VOID OptionMenuCustomBootBootSectorFile(VOID)
VOID OptionMenuCustomBootReactOS(VOID)
{
UCHAR SectionName[100];
UCHAR BootDriveString[20];
UCHAR BootPartitionString[20];
UCHAR ReactOSSystemPath[200];
UCHAR ReactOSARCPath[200];
UCHAR ReactOSOptions[200];
CHAR SectionName[100];
CHAR BootDriveString[20];
CHAR BootPartitionString[20];
CHAR ReactOSSystemPath[200];
CHAR ReactOSARCPath[200];
CHAR ReactOSOptions[200];
ULONG SectionId;
ULONG Year, Month, Day, Hour, Minute, Second;
@ -315,12 +315,12 @@ VOID OptionMenuCustomBootReactOS(VOID)
VOID OptionMenuCustomBootLinux(VOID)
{
UCHAR SectionName[100];
UCHAR BootDriveString[20];
UCHAR BootPartitionString[20];
UCHAR LinuxKernelString[200];
UCHAR LinuxInitrdString[200];
UCHAR LinuxCommandLineString[200];
CHAR SectionName[100];
CHAR BootDriveString[20];
CHAR BootPartitionString[20];
CHAR LinuxKernelString[200];
CHAR LinuxInitrdString[200];
CHAR LinuxCommandLineString[200];
ULONG SectionId;
ULONG Year, Month, Day, Hour, Minute, Second;

View file

@ -39,9 +39,9 @@ VOID DiskReportError (BOOL bError)
bReportError = bError;
}
VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode)
VOID DiskError(PCHAR ErrorString, ULONG ErrorCode)
{
UCHAR ErrorCodeString[200];
CHAR ErrorCodeString[200];
if (bReportError == FALSE)
return;
@ -53,7 +53,7 @@ VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode)
UiMessageBox(ErrorCodeString);
}
PUCHAR DiskGetErrorCodeString(ULONG ErrorCode)
PCHAR DiskGetErrorCodeString(ULONG ErrorCode)
{
switch (ErrorCode)
{

View file

@ -29,6 +29,7 @@
BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{
ULONG BootablePartitionCount = 0;
ULONG ActivePartition = 0;
MASTER_BOOT_RECORD MasterBootRecord;
// Read master boot record
@ -41,22 +42,22 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
if (MasterBootRecord.PartitionTable[0].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 0;
ActivePartition = 0;
}
if (MasterBootRecord.PartitionTable[1].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 1;
ActivePartition = 1;
}
if (MasterBootRecord.PartitionTable[2].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 2;
ActivePartition = 2;
}
if (MasterBootRecord.PartitionTable[3].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 3;
ActivePartition = 3;
}
// Make sure there was only one bootable partition
@ -72,7 +73,7 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
}
// Copy the partition table entry
RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[BootPartition], sizeof(PARTITION_TABLE_ENTRY));
RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[ActivePartition], sizeof(PARTITION_TABLE_ENTRY));
return TRUE;
}

View file

@ -30,13 +30,13 @@ ULONG OldInt13HandlerAddress = 0; // Address of BIOS int 13h handler
ULONG DriveMapHandlerAddress = 0; // Linear address of our drive map handler
ULONG DriveMapHandlerSegOff = 0; // Segment:offset style address of our drive map handler
VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
VOID DriveMapMapDrivesInSection(PCHAR SectionName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
UCHAR ErrorText[260];
UCHAR Drive1[80];
UCHAR Drive2[80];
CHAR SettingName[80];
CHAR SettingValue[80];
CHAR ErrorText[260];
CHAR Drive1[80];
CHAR Drive2[80];
ULONG SectionId;
ULONG SectionItemCount;
ULONG Index;
@ -117,7 +117,7 @@ VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
}
}
BOOL DriveMapIsValidDriveString(PUCHAR DriveString)
BOOL DriveMapIsValidDriveString(PCHAR DriveString)
{
ULONG Index;
@ -147,7 +147,7 @@ BOOL DriveMapIsValidDriveString(PUCHAR DriveString)
return TRUE;
}
ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
ULONG DriveMapGetBiosDriveNumber(PCHAR DeviceName)
{
ULONG BiosDriveNumber = 0;

View file

@ -31,7 +31,7 @@ VOID BootMain(char *CmdLine)
{
CmdLineParse(CmdLine);
MachInit();
MachInit(CmdLine);
DebugInit();

View file

@ -87,12 +87,12 @@ BOOL Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector)
* Tries to open the file 'name' and returns true or false
* for success and failure respectively
*/
FILE* Ext2OpenFile(PUCHAR FileName)
FILE* Ext2OpenFile(PCHAR FileName)
{
EXT2_FILE_INFO TempExt2FileInfo;
PEXT2_FILE_INFO FileHandle;
UCHAR SymLinkPath[EXT3_NAME_LEN];
UCHAR FullPath[EXT3_NAME_LEN * 2];
CHAR SymLinkPath[EXT3_NAME_LEN];
CHAR FullPath[EXT3_NAME_LEN * 2];
ULONG Index;
DbgPrint((DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName));
@ -190,11 +190,11 @@ FILE* Ext2OpenFile(PUCHAR FileName)
* with info describing the file, etc. returns true
* if the file exists or false otherwise
*/
BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
BOOL Ext2LookupFile(PCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
{
int i;
ULONG NumberOfPathParts;
UCHAR PathPart[261];
CHAR PathPart[261];
PVOID DirectoryBuffer;
ULONG DirectoryInode = EXT3_ROOT_INO;
EXT2_INODE InodeData;
@ -289,7 +289,7 @@ BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
return TRUE;
}
BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry)
BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry)
{
ULONG CurrentOffset;
PEXT2_DIR_ENTRY CurrentDirectoryEntry;
@ -839,7 +839,7 @@ BOOL Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePoi
BOOL Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer)
{
UCHAR ErrorString[80];
CHAR ErrorString[80];
DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer));
@ -913,7 +913,7 @@ BOOL Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
ULONG InodeGroupNumber;
ULONG InodeBlockNumber;
ULONG InodeOffsetInBlock;
UCHAR ErrorString[80];
CHAR ErrorString[80];
EXT2_GROUP_DESC GroupDescriptor;
DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadInode() Inode = %d\n", Inode));

View file

@ -558,7 +558,7 @@ struct ext3_dir_entry {
ULONG inode; /* Inode number */
USHORT rec_len; /* Directory entry length */
USHORT name_len; /* Name length */
char name[EXT3_NAME_LEN]; /* File name */
CHAR name[EXT3_NAME_LEN]; /* File name */
};
/*
@ -572,7 +572,7 @@ struct ext3_dir_entry_2 {
USHORT rec_len; /* Directory entry length */
UCHAR name_len; /* Name length */
UCHAR file_type;
char name[EXT3_NAME_LEN]; /* File name */
CHAR name[EXT3_NAME_LEN]; /* File name */
};
/*
@ -667,9 +667,9 @@ typedef struct
BOOL Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector);
FILE* Ext2OpenFile(PUCHAR FileName);
BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
FILE* Ext2OpenFile(PCHAR FileName);
BOOL Ext2LookupFile(PCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer);
ULONGLONG Ext2GetFileSize(FILE *FileHandle);
VOID Ext2SetFilePointer(FILE *FileHandle, ULONGLONG NewFilePointer);

View file

@ -405,22 +405,22 @@ PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG *DirectorySize, BOOL
return DirectoryBuffer;
}
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
{
ULONG EntryCount;
ULONG CurrentEntry;
PDIRENTRY DirEntry;
PLFN_DIRENTRY LfnDirEntry;
UCHAR LfnNameBuffer[265];
UCHAR ShortNameBuffer[20];
CHAR LfnNameBuffer[265];
CHAR ShortNameBuffer[20];
ULONG StartCluster;
EntryCount = DirectorySize / sizeof(DIRENTRY);
DbgPrint((DPRINT_FILESYSTEM, "FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName));
memset(ShortNameBuffer, 0, 13 * sizeof(UCHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(UCHAR));
memset(ShortNameBuffer, 0, 13 * sizeof(CHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(CHAR));
DirEntry = (PDIRENTRY) DirectoryBuffer;
for (CurrentEntry=0; CurrentEntry<EntryCount; CurrentEntry++, DirEntry++)
@ -436,7 +436,7 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize,
// entries after this one are unused. If this is the
// last entry then we didn't find the file in this directory.
//
if (DirEntry->FileName[0] == 0x00)
if (DirEntry->FileName[0] == '\0')
{
return FALSE;
}
@ -444,10 +444,10 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize,
//
// Check if this is a deleted entry or not
//
if (DirEntry->FileName[0] == 0xE5)
if (DirEntry->FileName[0] == '\xE5')
{
memset(ShortNameBuffer, 0, 13 * sizeof(UCHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(UCHAR));
memset(ShortNameBuffer, 0, 13 * sizeof(CHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(CHAR));
continue;
}
@ -616,7 +616,7 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize,
return FALSE;
}
BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
{
ULONG EntryCount;
ULONG CurrentEntry;
@ -687,11 +687,11 @@ BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize
* with info describing the file, etc. returns true
* if the file exists or false otherwise
*/
BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
BOOL FatLookupFile(PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
{
int i;
ULONG NumberOfPathParts;
UCHAR PathPart[261];
CHAR PathPart[261];
PVOID DirectoryBuffer;
ULONG DirectoryStartCluster = 0;
ULONG DirectorySize;
@ -777,7 +777,7 @@ BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
* is in the form of "FILE EXT" and puts it in Buffer
* in the form of "file.ext"
*/
void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry)
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry)
{
ULONG Idx;
@ -915,7 +915,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
* Tries to open the file 'name' and returns true or false
* for success and failure respectively
*/
FILE* FatOpenFile(PUCHAR FileName)
FILE* FatOpenFile(PCHAR FileName)
{
FAT_FILE_INFO TempFatFileInfo;
PFAT_FILE_INFO FileHandle;

View file

@ -23,7 +23,7 @@
typedef struct _FAT_BOOTSECTOR
{
UCHAR JumpBoot[3]; // Jump instruction to boot code
UCHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes
CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes
USHORT BytesPerSector; // Bytes per sector
UCHAR SectorsPerCluster; // Number of sectors in a cluster
USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector)
@ -40,8 +40,8 @@ typedef struct _FAT_BOOTSECTOR
UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
ULONG VolumeSerialNumber; // Volume serial number
UCHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
UCHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT "
CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
CHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT "
UCHAR BootCodeAndData[448]; // The remainder of the boot sector
@ -52,7 +52,7 @@ typedef struct _FAT_BOOTSECTOR
typedef struct _FAT32_BOOTSECTOR
{
UCHAR JumpBoot[3]; // Jump instruction to boot code
UCHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes
CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes
USHORT BytesPerSector; // Bytes per sector
UCHAR SectorsPerCluster; // Number of sectors in a cluster
USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector)
@ -76,8 +76,8 @@ typedef struct _FAT32_BOOTSECTOR
UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
ULONG VolumeSerialNumber; // Volume serial number
UCHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
UCHAR FileSystemType[8]; // Always set to the string "FAT32 "
CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
CHAR FileSystemType[8]; // Always set to the string "FAT32 "
UCHAR BootCodeAndData[420]; // The remainder of the boot sector
@ -87,7 +87,7 @@ typedef struct _FAT32_BOOTSECTOR
typedef struct _FATX_BOOTSECTOR
{
UCHAR FileSystemType[4]; /* String "FATX" */
CHAR FileSystemType[4]; /* String "FATX" */
ULONG VolumeSerialNumber; /* Volume serial number */
ULONG SectorsPerCluster; /* Number of sectors in a cluster */
USHORT NumberOfFats; /* Number of FAT tables */
@ -101,7 +101,7 @@ typedef struct _FATX_BOOTSECTOR
*/
typedef struct //_DIRENTRY
{
UCHAR FileName[11]; /* Filename + extension */
CHAR FileName[11]; /* Filename + extension */
UCHAR Attr; /* File attributes */
UCHAR ReservedNT; /* Reserved for use by Windows NT */
UCHAR TimeInTenths; /* Millisecond stamp at file creation */
@ -131,7 +131,7 @@ typedef struct
{
UCHAR FileNameSize; /* Size of filename (max 42) */
UCHAR Attr; /* File attributes */
UCHAR FileName[42]; /* Filename in ASCII, padded with 0xff (not zero-terminated) */
CHAR FileName[42]; /* Filename in ASCII, padded with 0xff (not zero-terminated) */
ULONG StartCluster; /* Starting cluster number */
ULONG Size; /* File size */
USHORT Time; /* Time last modified */
@ -155,11 +155,11 @@ typedef struct
BOOL FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector, ULONG PartitionSectorCount);
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount);
PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOL RootDirectory);
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry);
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
BOOL FatLookupFile(PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry);
BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer);
FILE* FatOpenFile(PUCHAR FileName);
FILE* FatOpenFile(PCHAR FileName);
ULONG FatCountClustersInChain(ULONG StartCluster);
ULONG* FatGetClusterChainArray(ULONG StartCluster);
BOOL FatReadCluster(ULONG ClusterNumber, PVOID Buffer);

View file

@ -42,7 +42,7 @@ ULONG FsType = 0; // Type of filesystem on boot device, set by FsOpenVolume()
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////
VOID FileSystemError(PUCHAR ErrorString)
VOID FileSystemError(PCHAR ErrorString)
{
DbgPrint((DPRINT_FILESYSTEM, "%s\n", ErrorString));
@ -51,111 +51,79 @@ VOID FileSystemError(PUCHAR ErrorString)
/*
*
* BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
* BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type);
*
* This function is called to open a disk volume for file access.
* It must be called before any of the file functions will work.
* It takes two parameters:
*
* Drive: The BIOS drive number of the disk to open
* Partition: This is zero for floppy drives.
* If the disk is a hard disk then this specifies
* The partition number to open (1 - 4)
* If it is zero then it opens the active (bootable) partition
*
*/
BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber)
static BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type)
{
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR ErrorText[80];
UCHAR VolumeType;
CHAR ErrorText[80];
DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", DriveNumber, PartitionNumber));
FsType = Type;
// Check and see if it is a floppy drive
// If so then just assume FAT12 file system type
if (DiskIsDriveRemovable(DriveNumber))
switch (FsType)
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
FsType = FS_FAT;
return FatOpenVolume(DriveNumber, 0, 0);
}
// Check for ISO9660 file system type
if (DriveNumber >= 0x80 && FsRecIsIso9660(DriveNumber))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
FsType = FS_ISO9660;
case FS_FAT:
return FatOpenVolume(DriveNumber, StartSector, SectorCount);
case FS_EXT2:
return Ext2OpenVolume(DriveNumber, StartSector);
case FS_NTFS:
return NtfsOpenVolume(DriveNumber, StartSector);
case FS_ISO9660:
return IsoOpenVolume(DriveNumber);
}
// Set the boot partition
BootPartition = PartitionNumber;
// Get the requested partition entry
if (PartitionNumber == 0)
{
// Partition requested was zero which means the boot partition
if (DiskGetActivePartitionEntry(DriveNumber, &PartitionTableEntry) == FALSE)
{
FileSystemError("No active partition.");
return FALSE;
}
}
else
{
// Get requested partition
if (MachDiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
{
FileSystemError("Partition not found.");
return FALSE;
}
}
// Check for valid partition
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
{
FileSystemError("Invalid partition.");
return FALSE;
}
// Try to recognize the file system
if (!FsRecognizeVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
{
FileSystemError("Unrecognized file system.");
return FALSE;
}
//switch (PartitionTableEntry.SystemIndicator)
switch (VolumeType)
{
case PARTITION_FAT_12:
case PARTITION_FAT_16:
case PARTITION_HUGE:
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
FsType = FS_FAT;
return FatOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, PartitionTableEntry.PartitionSectorCount);
case PARTITION_EXT2:
FsType = FS_EXT2;
return Ext2OpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
case PARTITION_NTFS:
FsType = FS_NTFS;
return NtfsOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
default:
FsType = 0;
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", VolumeType);
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", Type);
FileSystemError(ErrorText);
}
return FALSE;
}
/*
*
* BOOL FsOpenBootVolume()
*
* This function is called to open the boot disk volume for file access.
* It must be called before any of the file functions will work.
*/
BOOL FsOpenBootVolume()
{
ULONG DriveNumber;
ULONGLONG StartSector;
ULONGLONG SectorCount;
int Type;
if (! MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type))
{
FileSystemError("Unable to locate boot partition\n");
return FALSE;
}
return TRUE;
return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
}
PFILE FsOpenFile(PUCHAR FileName)
BOOL FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device)
{
ULONG DriveNumber;
ULONGLONG StartSector;
ULONGLONG SectorCount;
int Type;
if (! MachDiskGetSystemVolume(SystemPath, RemainingPath, Device,
&DriveNumber, &StartSector, &SectorCount,
&Type))
{
FileSystemError("Unable to locate system partition\n");
return FALSE;
}
return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
}
PFILE FsOpenFile(PCHAR FileName)
{
PFILE FileHandle = NULL;
@ -369,7 +337,7 @@ BOOL FsIsEndOfFile(PFILE FileHandle)
* This function parses a path in the form of dir1\dir2\file1.ext
* and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext)
*/
ULONG FsGetNumPathParts(PUCHAR Path)
ULONG FsGetNumPathParts(PCHAR Path)
{
ULONG i;
ULONG num;
@ -394,7 +362,7 @@ ULONG FsGetNumPathParts(PUCHAR Path)
* and puts the first name of the path (e.g. "dir1") in buffer
* compatible with the MSDOS directory structure
*/
VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCHAR Path)
{
ULONG i;

View file

@ -65,12 +65,12 @@ BOOL IsoOpenVolume(ULONG DriveNumber)
}
static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryLength, PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryLength, PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
PDIR_RECORD Record;
ULONG Offset;
ULONG i;
UCHAR Name[32];
CHAR Name[32];
DbgPrint((DPRINT_FILESYSTEM, "IsoSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectoryLength = %d FileName = %s\n", DirectoryBuffer, DirectoryLength, FileName));
@ -180,11 +180,11 @@ static PVOID IsoBufferDirectory(ULONG DirectoryStartSector, ULONG DirectoryLengt
* with info describing the file, etc. returns true
* if the file exists or false otherwise
*/
static BOOL IsoLookupFile(PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
static BOOL IsoLookupFile(PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
int i;
ULONG NumberOfPathParts;
UCHAR PathPart[261];
CHAR PathPart[261];
PVOID DirectoryBuffer;
ULONG DirectorySector;
ULONG DirectoryLength;
@ -263,7 +263,7 @@ static BOOL IsoLookupFile(PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
* Tries to open the file 'name' and returns true or false
* for success and failure respectively
*/
FILE* IsoOpenFile(PUCHAR FileName)
FILE* IsoOpenFile(PCHAR FileName)
{
ISO_FILE_INFO TempFileInfo;
PISO_FILE_INFO FileHandle;

View file

@ -65,11 +65,11 @@ typedef struct _VD_HEADER VD_HEADER, *PVD_HEADER;
struct _PVD
{
UCHAR VdType; // 1
UCHAR StandardId[5]; // 2-6
CHAR StandardId[5]; // 2-6
UCHAR VdVersion; // 7
UCHAR unused0; // 8
UCHAR SystemId[32]; // 9-40
UCHAR VolumeId[32]; // 41-72
CHAR SystemId[32]; // 9-40
CHAR VolumeId[32]; // 41-72
UCHAR unused1[8]; // 73-80
ULONG VolumeSpaceSizeL; // 81-84
ULONG VolumeSpaceSizeM; // 85-88
@ -84,8 +84,8 @@ struct _PVD
ULONG MPathTablePos; // 149-152
ULONG MOptPathTablePos; // 153-156
DIR_RECORD RootDirRecord; // 157-190
UCHAR VolumeSetIdentifier[128]; // 191-318
UCHAR PublisherIdentifier[128]; // 319-446
CHAR VolumeSetIdentifier[128]; // 191-318
CHAR PublisherIdentifier[128]; // 319-446
/* more data ... */
@ -106,7 +106,7 @@ typedef struct
BOOL IsoOpenVolume(ULONG DriveNumber);
FILE* IsoOpenFile(PUCHAR FileName);
FILE* IsoOpenFile(PCHAR FileName);
BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);
ULONG IsoGetFileSize(FILE *FileHandle);
VOID IsoSetFilePointer(FILE *FileHandle, ULONG NewFilePointer);

View file

@ -563,10 +563,10 @@ BOOL NtfsFindMftRecord(ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex)
return FALSE;
}
BOOL NtfsLookupFile(PUCHAR FileName, PNTFS_MFT_RECORD MftRecord, PNTFS_ATTR_CONTEXT DataContext)
BOOL NtfsLookupFile(PCHAR FileName, PNTFS_MFT_RECORD MftRecord, PNTFS_ATTR_CONTEXT DataContext)
{
ULONG NumberOfPathParts;
UCHAR PathPart[261];
CHAR PathPart[261];
ULONG CurrentMFTIndex;
UCHAR i;
@ -680,7 +680,7 @@ BOOL NtfsOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector)
return TRUE;
}
FILE* NtfsOpenFile(PUCHAR FileName)
FILE* NtfsOpenFile(PCHAR FileName)
{
PNTFS_FILE_HANDLE FileHandle;
PNTFS_MFT_RECORD MftRecord;

View file

@ -62,7 +62,7 @@
typedef struct
{
UCHAR JumpBoot[3]; // Jump to the boot loader routine
UCHAR SystemId[8]; // System Id ("NTFS ")
CHAR SystemId[8]; // System Id ("NTFS ")
USHORT BytesPerSector; // Bytes per sector
UCHAR SectorsPerCluster; // Number of sectors in a cluster
UCHAR Unused1[7];
@ -219,7 +219,7 @@ typedef struct
} PACKED NTFS_FILE_HANDLE, *PNTFS_FILE_HANDLE;
BOOL NtfsOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector);
FILE* NtfsOpenFile(PUCHAR FileName);
FILE* NtfsOpenFile(PCHAR FileName);
BOOL NtfsReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);
ULONG NtfsGetFileSize(FILE *FileHandle);
VOID NtfsSetFilePointer(FILE *FileHandle, ULONG NewFilePointer);

View file

@ -21,7 +21,7 @@
#define __BOOTMGR_H
ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount);
ULONG GetDefaultOperatingSystem(PCHAR OperatingSystemList[], ULONG OperatingSystemCount);
LONG GetTimeOut(VOID);
BOOL MainBootMenuKeyPressFilter(ULONG KeyPress);

View file

@ -119,8 +119,8 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff
//
///////////////////////////////////////////////////////////////////////////////////////
VOID DiskReportError (BOOL bError);
VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode);
PUCHAR DiskGetErrorCodeString(ULONG ErrorCode);
VOID DiskError(PCHAR ErrorString, ULONG ErrorCode);
PCHAR DiskGetErrorCodeString(ULONG ErrorCode);
BOOL DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c
BOOL DiskIsDriveRemovable(ULONG DriveNumber);
VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c

View file

@ -25,13 +25,13 @@ typedef struct
{
UCHAR DriveMapCount; // Count of drives currently mapped
UCHAR DriveMap[8]; // Map of BIOS drives
CHAR DriveMap[8]; // Map of BIOS drives
} PACKED DRIVE_MAP_LIST, *PDRIVE_MAP_LIST;
VOID DriveMapMapDrivesInSection(PUCHAR SectionName);
BOOL DriveMapIsValidDriveString(PUCHAR DriveString); // Checks the drive string ("hd0") for validity
ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0')
VOID DriveMapMapDrivesInSection(PCHAR SectionName);
BOOL DriveMapIsValidDriveString(PCHAR DriveString); // Checks the drive string ("hd0") for validity
ULONG DriveMapGetBiosDriveNumber(PCHAR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0')
VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap); // Installs the int 13h handler for the drive mapper
VOID DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler

View file

@ -38,8 +38,6 @@
#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
#define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n")
extern ULONG BootDrive; /* BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. */
extern ULONG BootPartition; /* Boot Partition, 1-4 */
extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */
VOID BootMain(LPSTR CmdLine);

View file

@ -32,16 +32,17 @@
#define FILE VOID
#define PFILE FILE *
VOID FileSystemError(PUCHAR ErrorString);
BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
PFILE FsOpenFile(PUCHAR FileName);
VOID FileSystemError(PCHAR ErrorString);
BOOL FsOpenBootVolume();
BOOL FsOpenSystemVolume(PCHAR SystemPath, PCHAR RemainingPath, PULONG BootDevice);
PFILE FsOpenFile(PCHAR FileName);
VOID FsCloseFile(PFILE FileHandle);
BOOL FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);
ULONG FsGetFileSize(PFILE FileHandle);
VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer);
ULONG FsGetFilePointer(PFILE FileHandle);
BOOL FsIsEndOfFile(PFILE FileHandle);
ULONG FsGetNumPathParts(PUCHAR Path);
VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path);
ULONG FsGetNumPathParts(PCHAR Path);
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCHAR Path);
#endif // #defined __FS_H

View file

@ -22,14 +22,14 @@
BOOL IniFileInitialize(VOID);
BOOL IniOpenSection(PUCHAR SectionName, ULONG* SectionId);
BOOL IniOpenSection(PCHAR SectionName, ULONG* SectionId);
ULONG IniGetNumSectionItems(ULONG SectionId);
ULONG IniGetSectionSettingNameSize(ULONG SectionId, ULONG SettingIndex);
ULONG IniGetSectionSettingValueSize(ULONG SectionId, ULONG SettingIndex);
BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR SettingName, ULONG NameSize, PUCHAR SettingValue, ULONG ValueSize);
BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, ULONG BufferSize);
BOOL IniAddSection(PUCHAR SectionName, ULONG* SectionId);
BOOL IniAddSettingValueToSection(ULONG SectionId, PUCHAR SettingName, PUCHAR SettingValue);
BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize);
BOOL IniReadSettingByName(ULONG SectionId, PCHAR SettingName, PCHAR Buffer, ULONG BufferSize);
BOOL IniAddSection(PCHAR SectionName, ULONG* SectionId);
BOOL IniAddSettingValueToSection(ULONG SectionId, PCHAR SettingName, PCHAR SettingValue);
#endif // defined __PARSEINI_H

View file

@ -127,9 +127,9 @@ typedef struct
VOID BootNewLinuxKernel(VOID); // Implemented in linux.S
VOID BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S
VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description);
VOID LoadAndBootLinux(PCHAR OperatingSystemName, PCHAR Description);
BOOL LinuxParseIniSection(PUCHAR OperatingSystemName);
BOOL LinuxParseIniSection(PCHAR OperatingSystemName);
BOOL LinuxReadBootSector(PFILE LinuxKernelFile);
BOOL LinuxReadSetupSector(PFILE LinuxKernelFile);
BOOL LinuxReadKernel(PFILE LinuxKernelFile);

View file

@ -56,6 +56,11 @@ typedef struct tagMACHVTBL
ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
BOOL (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
BOOL (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
BOOL (*DiskGetBootPath)(char *BootPath, unsigned Size);
VOID (*DiskGetBootDevice)(PULONG BootDevice);
BOOL (*DiskBootingFromFloppy)(VOID);
BOOL (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOL (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
@ -66,7 +71,7 @@ typedef struct tagMACHVTBL
VOID (*HwDetect)(VOID);
} MACHVTBL, *PMACHVTBL;
VOID MachInit(VOID);
VOID MachInit(char *CmdLine);
extern MACHVTBL MachVtbl;
@ -87,6 +92,11 @@ extern MACHVTBL MachVtbl;
#define MachVideoSync() MachVtbl.VideoSync()
#define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS()
#define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
#define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType))
#define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType))
#define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
#define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice)
#define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy()
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
#define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
#define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))

View file

@ -20,8 +20,8 @@
#ifndef __BOOT_H
#define __BOOT_H
VOID LoadAndBootBootSector(PUCHAR OperatingSystemName);
VOID LoadAndBootPartition(PUCHAR OperatingSystemName);
VOID LoadAndBootDrive(PUCHAR OperatingSystemName);
VOID LoadAndBootBootSector(PCHAR OperatingSystemName);
VOID LoadAndBootPartition(PCHAR OperatingSystemName);
VOID LoadAndBootDrive(PCHAR OperatingSystemName);
#endif // defined __BOOT_H

View file

@ -210,7 +210,7 @@ FASTCALL
FrLdrSetupPageDirectory(VOID);
VOID
LoadAndBootReactOS(PUCHAR OperatingSystemName);
LoadAndBootReactOS(PCHAR OperatingSystemName);
VOID FASTCALL AsmCode(VOID);
typedef VOID (FASTCALL *ASMCODE)(ULONG Magic,

View file

@ -20,9 +20,9 @@
#ifndef __OSLIST_H
#define __OSLIST_H
BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer);
BOOL InitOperatingSystemList(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer);
ULONG CountOperatingSystems(ULONG SectionId);
BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG OperatingSystemCount);
BOOL RemoveQuotes(PUCHAR QuotedString);
BOOL AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG OperatingSystemCount);
BOOL RemoveQuotes(PCHAR QuotedString);
#endif // #defined __OSLIST_H

View file

@ -26,7 +26,7 @@
// ReactOS Loading Functions
//
///////////////////////////////////////////////////////////////////////////////////////
VOID LoadAndBootReactOS(PUCHAR OperatingSystemName);
VOID LoadAndBootReactOS(PCHAR OperatingSystemName);
///////////////////////////////////////////////////////////////////////////////////////
//
@ -40,9 +40,9 @@ VOID ReactOSRunSetupLoader(VOID);
// ARC Path Functions
//
///////////////////////////////////////////////////////////////////////////////////////
BOOL DissectArcPath(LPSTR ArcPath, LPSTR BootPath, PULONG BootDrive, PULONG BootPartition);
VOID ConstructArcPath(PUCHAR ArcPath, PUCHAR SystemFolder, ULONG Disk, ULONG Partition);
ULONG ConvertArcNameToBiosDriveNumber(PUCHAR ArcPath);
BOOL DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition);
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition);
ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath);
#endif // defined __REACTOS_H

View file

@ -41,13 +41,13 @@ extern UCHAR UiSelectedTextBgColor; // Selected text background color
extern UCHAR UiEditBoxTextColor; // Edit box text color
extern UCHAR UiEditBoxBgColor; // Edit box text background color
extern UCHAR UiTitleBoxTitleText[260]; // Title box's title text
extern CHAR UiTitleBoxTitleText[260]; // Title box's title text
extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed
extern BOOL UiUseSpecialEffects; // Tells us if we should use fade effects
extern UCHAR UiMonthNames[12][15];
extern CHAR UiMonthNames[12][15];
///////////////////////////////////////////////////////////////////////////////////////
//
@ -55,28 +55,28 @@ extern UCHAR UiMonthNames[12][15];
//
///////////////////////////////////////////////////////////////////////////////////////
BOOL UiInitialize(BOOLEAN ShowGui); // Initialize User-Interface
VOID UiUnInitialize(PUCHAR BootText); // Un-initialize User-Interface
VOID UiUnInitialize(PCHAR BootText); // Un-initialize User-Interface
VOID UiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID UiDrawStatusText(PUCHAR StatusText); // Draws text at the very bottom line on the screen
VOID UiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID UiDrawStatusText(PCHAR StatusText); // Draws text at the very bottom line on the screen
VOID UiUpdateDateTime(VOID); // Updates the date and time
VOID UiInfoBox(PUCHAR MessageText); // Displays a info box on the screen
VOID UiMessageBox(PUCHAR MessageText); // Displays a message box on the screen with an ok button
VOID UiMessageBoxCritical(PUCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PUCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiShowMessageBoxesInSection(PUCHAR SectionName); // Displays all the message boxes in a given section
VOID UiEscapeString(PUCHAR String); // Processes a string and changes all occurances of "\n" to '\n'
BOOL UiEditBox(PUCHAR MessageText, PUCHAR EditTextBuffer, ULONG Length);
VOID UiInfoBox(PCHAR MessageText); // Displays a info box on the screen
VOID UiMessageBox(PCHAR MessageText); // Displays a message box on the screen with an ok button
VOID UiMessageBoxCritical(PCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiShowMessageBoxesInSection(PCHAR SectionName); // Displays all the message boxes in a given section
VOID UiEscapeString(PCHAR String); // Processes a string and changes all occurances of "\n" to '\n'
BOOL UiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length);
UCHAR UiTextToColor(PUCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR UiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
UCHAR UiTextToColor(PCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR UiTextToFillStyle(PCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars); // Truncates a string to MaxChars by adding an ellipsis on the end '...'
VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars); // Truncates a string to MaxChars by adding an ellipsis on the end '...'
VOID UiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in
VOID UiFadeOut(VOID); // Fades the screen out
@ -88,7 +88,7 @@ VOID UiFadeOut(VOID); // Fades the screen out
///////////////////////////////////////////////////////////////////////////////////////
typedef BOOL (*UiMenuKeyPressFilterCallback)(ULONG KeyPress);
BOOL UiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
BOOL UiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);

View file

@ -41,7 +41,7 @@
#ifndef ASM
PUCHAR GetFreeLoaderVersionString(VOID);
PCHAR GetFreeLoaderVersionString(VOID);
#endif // ASM

View file

@ -34,8 +34,8 @@
typedef struct
{
LIST_ITEM ListEntry;
PUCHAR ItemName;
PUCHAR ItemValue;
PCHAR ItemName;
PCHAR ItemValue;
} INI_SECTION_ITEM, *PINI_SECTION_ITEM;
@ -47,7 +47,7 @@ typedef struct
typedef struct
{
LIST_ITEM ListEntry;
PUCHAR SectionName;
PCHAR SectionName;
ULONG SectionItemCount;
PINI_SECTION_ITEM SectionItemList;
@ -57,20 +57,20 @@ extern PINI_SECTION IniFileSectionListHead;
extern ULONG IniFileSectionCount;
extern ULONG IniFileSettingCount;
PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber);
PFILE IniOpenIniFile();
BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize);
ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);
ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset);
BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength);
BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength);
BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength);
ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength);
VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG LineLength);
BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength);
ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength);
ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength);
VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG LineLength);
VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, ULONG LineLength);
BOOL IniParseFile(PCHAR IniFileData, ULONG IniFileSize);
ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);
ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset);
BOOL IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength);
BOOL IniIsCommentLine(PCHAR LineOfText, ULONG TextLength);
BOOL IniIsSectionName(PCHAR LineOfText, ULONG TextLength);
ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength);
VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength);
BOOL IniIsSetting(PCHAR LineOfText, ULONG TextLength);
ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength);
ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength);
VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength);
VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength);
#endif // defined __INI_H

View file

@ -28,27 +28,12 @@
BOOL IniFileInitialize(VOID)
{
PFILE Freeldr_Ini; // File handle for freeldr.ini
PUCHAR FreeLoaderIniFileData;
PCHAR FreeLoaderIniFileData;
ULONG FreeLoaderIniFileSize;
BOOL Success;
// Open freeldr.ini
// BootDrive & BootPartition are passed
// in from the boot sector code in the
// DL & DH registers.
Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition);
// If we couldn't open freeldr.ini on the partition
// they specified in the boot sector then try
// opening the active (boot) partition.
if ((Freeldr_Ini == NULL) && (BootPartition != 0))
{
BootPartition = 0;
Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition);
return FALSE;
}
Freeldr_Ini = IniOpenIniFile();
if (Freeldr_Ini == NULL)
{
@ -87,24 +72,10 @@ BOOL IniFileInitialize(VOID)
return Success;
}
PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber)
PFILE IniOpenIniFile()
{
PFILE IniFileHandle; // File handle for freeldr.ini
if (!FsOpenVolume(BootDriveNumber, BootPartitionNumber))
{
if (BootPartitionNumber == 0)
{
printf("Error opening active (bootable) partition on boot drive 0x%x for file access.\n", BootDriveNumber);
}
else
{
printf("Error opening partition %d on boot drive 0x%x for file access.\n", BootPartitionNumber, BootDriveNumber);
}
return NULL;
}
// Try to open freeldr.ini
IniFileHandle = FsOpenFile("freeldr.ini");

View file

@ -24,7 +24,7 @@
#include <debug.h>
#include <mm.h>
BOOL IniOpenSection(PUCHAR SectionName, ULONG* SectionId)
BOOL IniOpenSection(PCHAR SectionName, ULONG* SectionId)
{
PINI_SECTION Section;
@ -81,7 +81,7 @@ ULONG IniGetSectionSettingValueSize(ULONG SectionId, ULONG SettingIndex)
return (strlen(Section->SectionItemList[SettingIndex].ItemValue) + 1);
}
BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR SettingName, ULONG NameSize, PUCHAR SettingValue, ULONG ValueSize)
BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
PINI_SECTION_ITEM SectionItem;
@ -131,7 +131,7 @@ BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR Setting
return FALSE;
}
BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, ULONG BufferSize)
BOOL IniReadSettingByName(ULONG SectionId, PCHAR SettingName, PCHAR Buffer, ULONG BufferSize)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
PINI_SECTION_ITEM SectionItem;
@ -163,7 +163,7 @@ BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, UL
return FALSE;
}
BOOL IniAddSection(PUCHAR SectionName, ULONG* SectionId)
BOOL IniAddSection(PCHAR SectionName, ULONG* SectionId)
{
PINI_SECTION Section;
@ -203,7 +203,7 @@ BOOL IniAddSection(PUCHAR SectionName, ULONG* SectionId)
return TRUE;
}
BOOL IniAddSettingValueToSection(ULONG SectionId, PUCHAR SettingName, PUCHAR SettingValue)
BOOL IniAddSettingValueToSection(ULONG SectionId, PCHAR SettingName, PCHAR SettingValue)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
PINI_SECTION_ITEM SectionItem;

View file

@ -30,11 +30,11 @@ ULONG IniFileSectionCount = 0;
ULONG IniFileSettingCount = 0;
BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize)
BOOL IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
{
ULONG CurrentOffset;
ULONG CurrentLineNumber;
PUCHAR IniFileLine;
PCHAR IniFileLine;
ULONG IniFileLineSize;
ULONG LineLength;
PINI_SECTION CurrentSection = NULL;
@ -189,7 +189,7 @@ BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize)
return TRUE;
}
ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
{
ULONG Idx;
ULONG LineCharCount = 0;
@ -216,7 +216,7 @@ ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOff
return LineCharCount;
}
ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
{
ULONG Idx;
@ -252,7 +252,7 @@ ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG
return CurrentOffset;
}
BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength)
{
ULONG Idx;
@ -275,7 +275,7 @@ BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength)
return TRUE;
}
BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsCommentLine(PCHAR LineOfText, ULONG TextLength)
{
ULONG Idx;
@ -301,7 +301,7 @@ BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength)
return FALSE;
}
BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsSectionName(PCHAR LineOfText, ULONG TextLength)
{
ULONG Idx;
@ -327,7 +327,7 @@ BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength)
return FALSE;
}
ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength)
ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength)
{
ULONG Idx;
ULONG NameSize;
@ -368,7 +368,7 @@ ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength)
return NameSize;
}
VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG LineLength)
VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength)
{
ULONG Idx;
ULONG DestIdx;
@ -408,7 +408,7 @@ VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG Lin
SectionName[DestIdx] = '\0';
}
BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsSetting(PCHAR LineOfText, ULONG TextLength)
{
ULONG Idx;
@ -424,7 +424,7 @@ BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength)
return FALSE;
}
ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength)
ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength)
{
ULONG Idx;
ULONG NameSize;
@ -462,7 +462,7 @@ ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength)
return NameSize;
}
ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength)
ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength)
{
ULONG Idx;
ULONG ValueSize;
@ -515,7 +515,7 @@ ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength)
return ValueSize;
}
VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG LineLength)
VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength)
{
ULONG Idx;
ULONG DestIdx;
@ -552,7 +552,7 @@ VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG Lin
SettingName[DestIdx] = '\0';
}
VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, ULONG LineLength)
VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength)
{
ULONG Idx;
ULONG DestIdx;

View file

@ -44,20 +44,21 @@ ULONG SetupSectorSize = 0;
BOOL NewStyleLinuxKernel = FALSE;
ULONG LinuxKernelSize = 0;
ULONG LinuxInitrdSize = 0;
UCHAR LinuxKernelName[260];
UCHAR LinuxInitrdName[260];
CHAR LinuxKernelName[260];
CHAR LinuxInitrdName[260];
BOOL LinuxHasInitrd = FALSE;
UCHAR LinuxCommandLine[260] = "";
CHAR LinuxCommandLine[260] = "";
ULONG LinuxCommandLineSize = 0;
PVOID LinuxKernelLoadAddress = NULL;
PVOID LinuxInitrdLoadAddress = NULL;
UCHAR LinuxBootDescription[80];
CHAR LinuxBootDescription[80];
CHAR LinuxBootPath[260] = "";
VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description)
VOID LoadAndBootLinux(PCHAR OperatingSystemName, PCHAR Description)
{
PFILE LinuxKernel = NULL;
PFILE LinuxInitrdFile = NULL;
UCHAR TempString[260];
CHAR TempString[260];
UiDrawBackdrop();
@ -80,7 +81,7 @@ VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description)
}
// Open the boot volume
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL))
{
UiMessageBox("Failed to open boot drive.");
goto LinuxBootFailed;
@ -223,10 +224,9 @@ LinuxBootFailed:
LinuxCommandLineSize = 0;
}
BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
BOOL LinuxParseIniSection(PCHAR OperatingSystemName)
{
UCHAR SettingName[260];
UCHAR SettingValue[260];
CHAR SettingName[260];
ULONG SectionId;
// Find all the message box settings and run them
@ -240,20 +240,12 @@ BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
return FALSE;
}
if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 260))
if (!IniReadSettingByName(SectionId, "BootPath", LinuxBootPath, 260))
{
UiMessageBox("Boot drive not specified for selected OS!");
UiMessageBox("Boot path not specified for selected OS!");
return FALSE;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
BootPartition = 0;
if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 260))
{
BootPartition = atoi(SettingValue);
}
// Get the kernel name
if (!IniReadSettingByName(SectionId, "Kernel", LinuxKernelName, 260))
{
@ -383,7 +375,7 @@ BOOL LinuxReadSetupSector(PFILE LinuxKernelFile)
BOOL LinuxReadKernel(PFILE LinuxKernelFile)
{
ULONG BytesLoaded;
UCHAR StatusText[260];
CHAR StatusText[260];
PVOID LoadAddress;
sprintf(StatusText, "Loading %s", LinuxKernelName);
@ -456,7 +448,7 @@ BOOL LinuxCheckKernelVersion(VOID)
BOOL LinuxReadInitrd(PFILE LinuxInitrdFile)
{
ULONG BytesLoaded;
UCHAR StatusText[260];
CHAR StatusText[260];
sprintf(StatusText, "Loading %s", LinuxInitrdName);
UiDrawStatusText(StatusText);

View file

@ -37,6 +37,11 @@
#undef MachVideoSync
#undef MachVideoPrepareForReactOS
#undef MachGetMemoryMap
#undef MachDiskGetBootVolume
#undef MachDiskGetSystemVolume
#undef MachDiskGetBootPath
#undef MachDiskGetBootDevice
#undef MachDiskBootingFromFloppy
#undef MachDiskReadLogicalSectors
#undef MachDiskGetPartitionEntry
#undef MachDiskGetDriveGeometry
@ -148,6 +153,44 @@ MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
}
BOOL
MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
{
return MachVtbl.DiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType);
}
BOOL
MachDiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
PULONG Device,
PULONG DriveNumber,
PULONGLONG StartSector,
PULONGLONG SectorCount,
int *FsType)
{
return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device,
DriveNumber, StartSector, SectorCount,
FsType);
}
BOOL
MachDiskGetBootPath(char *BootPath, unsigned Size)
{
return MachVtbl.DiskGetBootPath(BootPath, Size);
}
VOID
MachDiskGetBootDevice(PULONG BootDevice)
{
MachVtbl.DiskGetBootDevice(BootDevice);
}
BOOL
MachDiskBootingFromFloppy()
{
return MachVtbl.DiskBootingFromFloppy();
}
BOOL
MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{

View file

@ -29,13 +29,12 @@
#include <drivemap.h>
#include <machine.h>
VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
VOID LoadAndBootBootSector(PCHAR OperatingSystemName)
{
PFILE FilePointer;
UCHAR SettingName[80];
UCHAR SettingValue[80];
CHAR SettingName[80];
ULONG SectionId;
UCHAR FileName[260];
CHAR FileName[260];
ULONG BytesRead;
// Find all the message box settings and run them
@ -49,27 +48,13 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
return;
}
if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 80))
{
UiMessageBox("Boot drive not specified for selected OS!");
return;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
BootPartition = 0;
if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80))
{
BootPartition = atoi(SettingValue);
}
if (!IniReadSettingByName(SectionId, "BootSectorFile", FileName, 260))
{
UiMessageBox("Boot sector file not specified for selected OS!");
return;
}
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenSystemVolume(FileName, FileName, NULL))
{
UiMessageBox("Failed to open boot drive.");
return;
@ -109,12 +94,14 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
ChainLoadBiosBootSectorCode();
}
VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
VOID LoadAndBootPartition(PCHAR OperatingSystemName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
CHAR SettingName[80];
CHAR SettingValue[80];
ULONG SectionId;
PARTITION_TABLE_ENTRY PartitionTableEntry;
ULONG DriveNumber;
ULONG PartitionNumber;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@ -134,7 +121,7 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
return;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
DriveNumber = DriveMapGetBiosDriveNumber(SettingValue);
// Read the boot partition
if (!IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80))
@ -143,17 +130,17 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
return;
}
BootPartition = atoi(SettingValue);
PartitionNumber = atoi(SettingValue);
// Get the partition table entry
if (!DiskGetPartitionEntry(BootDrive, BootPartition, &PartitionTableEntry))
if (!DiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry))
{
return;
}
// Now try to read the partition boot sector
// If this fails then abort
if (!MachDiskReadLogicalSectors(BootDrive, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00))
if (!MachDiskReadLogicalSectors(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00))
{
return;
}
@ -178,11 +165,12 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
ChainLoadBiosBootSectorCode();
}
VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
VOID LoadAndBootDrive(PCHAR OperatingSystemName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
CHAR SettingName[80];
CHAR SettingValue[80];
ULONG SectionId;
ULONG DriveNumber;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@ -201,11 +189,11 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
return;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
DriveNumber = DriveMapGetBiosDriveNumber(SettingValue);
// Now try to read the boot sector (or mbr)
// If this fails then abort
if (!MachDiskReadLogicalSectors(BootDrive, 0, 1, (PVOID)0x7C00))
if (!MachDiskReadLogicalSectors(DriveNumber, 0, 1, (PVOID)0x7C00))
{
return;
}

View file

@ -27,7 +27,7 @@
#include <arch.h>
PUCHAR OptionsMenuList[] =
PCHAR OptionsMenuList[] =
{
"Safe Mode",
"Safe Mode with Networking",

View file

@ -24,18 +24,18 @@
#include <mm.h>
#include <ui.h>
BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer)
BOOL InitOperatingSystemList(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer)
{
ULONG Idx;
ULONG CurrentOperatingSystemIndex;
UCHAR SettingName[260];
UCHAR SettingValue[260];
CHAR SettingName[260];
CHAR SettingValue[260];
ULONG OperatingSystemCount;
ULONG SectionId;
ULONG OperatingSystemSectionId;
ULONG SectionSettingCount;
PUCHAR *OperatingSystemSectionNames;
PUCHAR *OperatingSystemDisplayNames;
PCHAR *OperatingSystemSectionNames;
PCHAR *OperatingSystemDisplayNames;
//
// Open the [FreeLoader] section
@ -88,8 +88,8 @@ BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNames
ULONG CountOperatingSystems(ULONG SectionId)
{
ULONG Idx;
UCHAR SettingName[260];
UCHAR SettingValue[260];
CHAR SettingName[260];
CHAR SettingValue[260];
ULONG OperatingSystemCount = 0;
ULONG SectionSettingCount;
@ -115,17 +115,17 @@ ULONG CountOperatingSystems(ULONG SectionId)
return OperatingSystemCount;
}
BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG OperatingSystemCount)
BOOL AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG OperatingSystemCount)
{
ULONG Idx;
PUCHAR *OperatingSystemSectionNames = NULL;
PUCHAR *OperatingSystemDisplayNames = NULL;
PCHAR *OperatingSystemSectionNames = NULL;
PCHAR *OperatingSystemDisplayNames = NULL;
//
// Allocate memory to hold operating system list arrays
//
OperatingSystemSectionNames = (PUCHAR*) MmAllocateMemory( sizeof(PUCHAR) * OperatingSystemCount);
OperatingSystemDisplayNames = (PUCHAR*) MmAllocateMemory( sizeof(PUCHAR) * OperatingSystemCount);
OperatingSystemSectionNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount);
OperatingSystemDisplayNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount);
//
// If either allocation failed then return FALSE
@ -148,16 +148,16 @@ BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPoint
//
// Clear our newly allocated memory
//
memset(OperatingSystemSectionNames, 0, sizeof(PUCHAR) * OperatingSystemCount);
memset(OperatingSystemDisplayNames, 0, sizeof(PUCHAR) * OperatingSystemCount);
memset(OperatingSystemSectionNames, 0, sizeof(PCHAR) * OperatingSystemCount);
memset(OperatingSystemDisplayNames, 0, sizeof(PCHAR) * OperatingSystemCount);
//
// Loop through each array element and allocate it's string memory
//
for (Idx=0; Idx<OperatingSystemCount; Idx++)
{
OperatingSystemSectionNames[Idx] = (PUCHAR) MmAllocateMemory(80);
OperatingSystemDisplayNames[Idx] = (PUCHAR) MmAllocateMemory(80);
OperatingSystemSectionNames[Idx] = MmAllocateMemory(80);
OperatingSystemDisplayNames[Idx] = MmAllocateMemory(80);
//
// If it failed then jump to the cleanup code
@ -200,9 +200,9 @@ AllocateListMemoryFailed:
return FALSE;
}
BOOL RemoveQuotes(PUCHAR QuotedString)
BOOL RemoveQuotes(PCHAR QuotedString)
{
UCHAR TempString[200];
CHAR TempString[200];
//
// If this string is not quoted then return FALSE

View file

@ -23,7 +23,7 @@
#include <rtl.h>
BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* BootPartition)
BOOL DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition)
{
char *p;
@ -43,7 +43,21 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* Boot
if (p == NULL)
return FALSE;
p++;
*BootPartition = 0;
*BootPartition = 0xff;
}
else if (strnicmp(p, "cdrom(", 6) == 0)
{
/*
* cdrom path:
* multi(0)disk(0)cdrom(x)\path
*/
p = p + 6;
*BootDrive = atoi(p);
p = strchr(p, ')');
if (p == NULL)
return FALSE;
p++;
*BootPartition = 0xff;
}
else if (strnicmp(p, "rdisk(", 6) == 0)
{
@ -73,7 +87,7 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* Boot
return TRUE;
}
void ConstructArcPath(PUCHAR ArcPath, PUCHAR SystemFolder, ULONG Disk, ULONG Partition)
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition)
{
char tmp[50];
@ -109,7 +123,7 @@ void ConstructArcPath(PUCHAR ArcPath, PUCHAR SystemFolder, ULONG Disk, ULONG Par
}
}
ULONG ConvertArcNameToBiosDriveNumber(PUCHAR ArcPath)
ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath)
{
char * p;
ULONG DriveNumber = 0;

View file

@ -178,7 +178,7 @@ typedef struct _KEY_CELL
USHORT ClassSize;
/* Name of key (not zero terminated) */
UCHAR Name[0];
CHAR Name[0];
} __attribute__((packed)) KEY_CELL, *PKEY_CELL;
@ -223,7 +223,7 @@ typedef struct _VALUE_CELL
ULONG DataType;
USHORT Flags;
USHORT Unused1;
UCHAR Name[0]; /* warning : not zero terminated */
CHAR Name[0]; /* warning : not zero terminated */
} __attribute__((packed)) VALUE_CELL, *PVALUE_CELL;
/* VALUE_CELL.Flags constants */
@ -237,7 +237,7 @@ typedef struct _VALUE_CELL
typedef struct _DATA_CELL
{
LONG CellSize;
UCHAR Data[0];
CHAR Data[0];
} __attribute__((packed)) DATA_CELL, *PDATA_CELL;
@ -1018,7 +1018,7 @@ CmiExportValue (PREGISTRY_HIVE Hive,
ULONG SrcDataSize;
ULONG DstDataSize;
ULONG DataType;
PUCHAR Data;
PCHAR Data;
BOOL Expand = FALSE;
DbgPrint((DPRINT_REGISTRY, "CmiExportValue('%s') called\n",
@ -1398,7 +1398,7 @@ RegImportValue (PHBIN RootBin,
Error = RegSetValue(Key,
cName,
ValueCell->DataType,
(PUCHAR)&ValueCell->DataOffset,
(PCHAR)&ValueCell->DataOffset,
DataSize);
if (Error != ERROR_SUCCESS)
{
@ -1441,7 +1441,7 @@ RegImportValue (PHBIN RootBin,
Error = RegSetValue (Key,
cName,
ValueCell->DataType,
(PUCHAR)DataCell->Data,
DataCell->Data,
DataSize);
}
if (Error != ERROR_SUCCESS)

View file

@ -15,16 +15,6 @@
#define NDEBUG
#include <debug.h>
#define IsRecognizedPartition(P) \
((P) == PARTITION_FAT_12 || \
(P) == PARTITION_FAT_16 || \
(P) == PARTITION_HUGE || \
(P) == PARTITION_IFS || \
(P) == PARTITION_EXT2 || \
(P) == PARTITION_FAT32 || \
(P) == PARTITION_FAT32_XINT13 || \
(P) == PARTITION_XINT13)
BOOL
STDCALL
FrLdrLoadKernel(PCHAR szFileName,
@ -353,11 +343,11 @@ FrLdrLoadBootDrivers(PCHAR szSystemRoot,
ULONG ValueType;
ULONG StartValue;
ULONG TagValue;
UCHAR DriverGroup[256];
CHAR DriverGroup[256];
ULONG DriverGroupSize;
UCHAR ImagePath[256];
UCHAR TempImagePath[256];
CHAR ImagePath[256];
CHAR TempImagePath[256];
/* get 'service group order' key */
rc = RegOpenKey(NULL,
@ -559,11 +549,12 @@ FrLdrLoadBootDrivers(PCHAR szSystemRoot,
}
VOID
LoadAndBootReactOS(PUCHAR OperatingSystemName)
LoadAndBootReactOS(PCHAR OperatingSystemName)
{
PFILE FilePointer;
CHAR name[1024];
CHAR value[1024];
CHAR SystemPath[1024];
CHAR szKernelName[1024];
CHAR szHalName[1024];
CHAR szFileName[1024];
@ -575,9 +566,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
ULONG_PTR Base;
ULONG Size;
PARTITION_TABLE_ENTRY PartitionTableEntry;
ULONG rosPartition;
extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd;
extern BOOLEAN AcpiPresent;
@ -645,7 +633,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
/*
* Make sure the system path is set in the .ini file
*/
if (!IniReadSettingByName(SectionId, "SystemPath", value, 1024))
if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath)))
{
UiMessageBox("System path not specified for selected operating system.");
return;
@ -654,62 +642,20 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
/*
* Special case for Live CD.
*/
if (!stricmp(value, "LiveCD"))
if (!stricmp(SystemPath, "LiveCD"))
{
strcpy(szBootPath, "\\reactos");
/* Set kernel command line */
sprintf(multiboot_kernel_cmdline,
"multi(0)disk(0)cdrom(%u)\\reactos /MININT",
(unsigned int)BootDrive);
/* Normalize */
MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
strcat(SystemPath, "\\reactos");
strcat(strcpy(multiboot_kernel_cmdline, SystemPath),
" /MININT");
}
else
{
/*
* Verify system path
*/
if (!DissectArcPath(value, szBootPath, &BootDrive, &BootPartition))
{
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
UiMessageBox(MsgBuffer);
return;
/* copy system path into kernel command line */
strcpy(multiboot_kernel_cmdline, SystemPath);
}
/* recalculate the boot partition for freeldr */
i = 0;
rosPartition = 0;
while (1)
{
if (!MachDiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
{
BootPartition = 0;
break;
}
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
{
if (++rosPartition == BootPartition)
{
BootPartition = i;
break;
}
}
}
if (BootPartition == 0)
{
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
UiMessageBox(MsgBuffer);
return;
}
/* copy ARC path into kernel command line */
strcpy(multiboot_kernel_cmdline, value);
}
/* Set boot drive and partition */
((LPSTR )(&LoaderBlock.BootDevice))[0] = (CHAR)BootDrive;
((LPSTR )(&LoaderBlock.BootDevice))[1] = (CHAR)BootPartition;
/*
* Read the optional kernel parameters (if any)
*/
@ -719,13 +665,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
strcat(multiboot_kernel_cmdline, value);
}
/* append a backslash */
if ((strlen(szBootPath)==0) ||
szBootPath[strlen(szBootPath)] != '\\')
strcat(szBootPath, "\\");
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
UiDrawBackdrop();
UiDrawStatusText("Detecting Hardware...");
@ -741,14 +680,21 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
/*
* Try to open boot drive
* Try to open system drive
*/
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
{
UiMessageBox("Failed to open boot drive.");
return;
}
/* append a backslash */
if ((strlen(szBootPath)==0) ||
szBootPath[strlen(szBootPath)] != '\\')
strcat(szBootPath, "\\");
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
/*
* Find the kernel image name
* and try to load the kernel off the disk

View file

@ -47,7 +47,7 @@ RegInitializeRegistry (VOID)
RootKey->ValueCount = 0;
RootKey->NameSize = 2;
RootKey->Name = (PUCHAR)MmAllocateMemory (2);
RootKey->Name = MmAllocateMemory (2);
strcpy (RootKey->Name, "\\");
RootKey->DataType = 0;
@ -192,7 +192,7 @@ RegInitCurrentControlSet(BOOL LastKnownGood)
Error = RegSetValue(LinkKey,
NULL,
REG_LINK,
(PUCHAR)&ControlSetKey,
(PCHAR)&ControlSetKey,
sizeof(PVOID));
if (Error != ERROR_SUCCESS)
{
@ -486,7 +486,7 @@ LONG
RegSetValue(FRLDRHKEY Key,
PCHAR ValueName,
ULONG Type,
PUCHAR Data,
PCHAR Data,
ULONG DataSize)
{
PLIST_ENTRY Ptr;
@ -511,7 +511,7 @@ RegSetValue(FRLDRHKEY Key,
}
else
{
Key->Data = (PUCHAR)MmAllocateMemory(DataSize);
Key->Data = MmAllocateMemory(DataSize);
Key->DataSize = DataSize;
Key->DataType = Type;
memcpy(Key->Data, Data, DataSize);
@ -571,7 +571,7 @@ RegSetValue(FRLDRHKEY Key,
}
else
{
Value->Data = (PUCHAR)MmAllocateMemory(DataSize);
Value->Data = MmAllocateMemory(DataSize);
if (Value->Data == NULL)
return(ERROR_OUTOFMEMORY);
Value->DataType = Type;

View file

@ -34,12 +34,12 @@ typedef struct _REG_KEY
ULONG ValueCount;
ULONG NameSize;
PUCHAR Name;
PCHAR Name;
/* default data */
ULONG DataType;
ULONG DataSize;
PUCHAR Data;
PCHAR Data;
} KEY, *FRLDRHKEY, **PFRLDRHKEY;
@ -49,12 +49,12 @@ typedef struct _REG_VALUE
/* value name */
ULONG NameSize;
PUCHAR Name;
PCHAR Name;
/* value data */
ULONG DataType;
ULONG DataSize;
PUCHAR Data;
PCHAR Data;
} VALUE, *PVALUE;
@ -217,7 +217,7 @@ LONG
RegSetValue(FRLDRHKEY Key,
PCHAR ValueName,
ULONG Type,
PUCHAR Data,
PCHAR Data,
ULONG DataSize);
LONG

View file

@ -312,13 +312,11 @@ VOID RunLoader(VOID)
UiDrawStatusText("");
#endif
/* set boot drive and partition */
((char *)(&LoaderBlock.BootDevice))[0] = (char)BootDrive;
((char *)(&LoaderBlock.BootDevice))[1] = (char)BootPartition;
/* set boot device */
MachDiskGetBootDevice(&LoaderBlock.BootDevice);
/* Open boot drive */
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenBootVolume())
{
#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
@ -330,7 +328,7 @@ VOID RunLoader(VOID)
/* Open 'txtsetup.sif' */
if (!InfOpenFile (&InfHandle,
(BootDrive < 0x80) ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
MachDiskBootingFromFloppy() ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
&ErrorLine))
{
printf("Failed to open 'txtsetup.sif'\n");
@ -358,7 +356,7 @@ VOID RunLoader(VOID)
printf("LoadOptions: '%s'\n", LoadOptions);
#endif
if (BootDrive < 0x80)
if (MachDiskBootingFromFloppy())
{
/* Boot from floppy disk */
SourcePath = "\\";
@ -370,11 +368,8 @@ VOID RunLoader(VOID)
}
/* Set kernel command line */
sprintf(multiboot_kernel_cmdline,
"multi(0)disk(0)%s(%u)%s %s",
(BootDrive < 0x80) ? "fdisk" : "cdrom",
(unsigned int)BootDrive,
SourcePath,
MachDiskGetBootPath(multiboot_kernel_cmdline, sizeof(multiboot_kernel_cmdline));
strcat(strcat(strcat(multiboot_kernel_cmdline, SourcePath), " "),
LoadOptions);
/* Load ntoskrnl.exe */
@ -400,7 +395,7 @@ for(;;);
#endif
/* Insert boot disk 2 */
if (BootDrive < 0x80)
if (MachDiskBootingFromFloppy())
{
#ifdef USE_UI
UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER");
@ -410,7 +405,7 @@ for(;;);
#endif
/* Open boot drive */
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenBootVolume())
{
#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
@ -563,8 +558,14 @@ for(;;);
/* Load keyboard driver */
#if 0
if (!LoadDriver(SourcePath, "keyboard.sys"))
return;
#endif
if (!LoadDriver(SourcePath, "i8042prt.sys"))
return;
if (!LoadDriver(SourcePath, "kbdclass.sys"))
return;
/* Load screen driver */
if (!LoadDriver(SourcePath, "blue.sys"))

View file

@ -136,7 +136,7 @@ VOID TuiDrawBackdrop(VOID)
* FillArea()
* This function assumes coordinates are zero-based
*/
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */)
{
PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
ULONG i, j;
@ -162,7 +162,7 @@ VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillCha
// Loop through each character (column) in the line and fill it in
for (j=Left; j<=Right; j++)
{
ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = FillChar;
ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = (UCHAR)FillChar;
ScreenMemory[((i*2)*UiScreenWidth)+(j*2)+1] = Attr;
}
}
@ -304,7 +304,7 @@ VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyl
* DrawText()
* This function assumes coordinates are zero-based
*/
VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
VOID TuiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr)
{
PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
ULONG i, j;
@ -312,12 +312,12 @@ VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
// Draw the text
for (i=X, j=0; Text[j] && i<UiScreenWidth; i++,j++)
{
ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = Text[j];
ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
}
}
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr)
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCHAR TextString, UCHAR Attr)
{
ULONG TextLength;
ULONG BoxWidth;
@ -329,7 +329,7 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHA
ULONG RealTop;
ULONG X;
ULONG Y;
UCHAR Temp[2];
CHAR Temp[2];
TextLength = strlen(TextString);
@ -378,7 +378,7 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHA
}
}
VOID TuiDrawStatusText(PUCHAR StatusText)
VOID TuiDrawStatusText(PCHAR StatusText)
{
ULONG i;
@ -397,9 +397,9 @@ VOID TuiUpdateDateTime(VOID)
{
ULONG Year, Month, Day;
ULONG Hour, Minute, Second;
UCHAR DateString[40];
UCHAR TimeString[40];
UCHAR TempString[20];
CHAR DateString[40];
CHAR TimeString[40];
CHAR TempString[20];
BOOL PMHour = FALSE;
MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute, &Second);
@ -498,7 +498,7 @@ VOID TuiRestoreScreen(PUCHAR Buffer)
}
}
VOID TuiMessageBox(PUCHAR MessageText)
VOID TuiMessageBox(PCHAR MessageText)
{
PVOID ScreenBuffer;
@ -514,7 +514,7 @@ VOID TuiMessageBox(PUCHAR MessageText)
MmFreeMemory(ScreenBuffer);
}
VOID TuiMessageBoxCritical(PUCHAR MessageText)
VOID TuiMessageBoxCritical(PCHAR MessageText)
{
int width = 8;
int height = 1;
@ -603,7 +603,7 @@ VOID TuiMessageBoxCritical(PUCHAR MessageText)
}
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText)
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
{
ULONG Left, Top, Right, Bottom;
ULONG Width = 50; // Allow for 50 "bars"
@ -618,7 +618,7 @@ VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText)
TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
}
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PUCHAR ProgressText)
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
{
ULONG i;
ULONG ProgressBarWidth = (Right - Left) - 3;
@ -655,7 +655,7 @@ VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG
VideoCopyOffScreenBufferToVRAM();
}
UCHAR TuiTextToColor(PUCHAR ColorText)
UCHAR TuiTextToColor(PCHAR ColorText)
{
if (stricmp(ColorText, "Black") == 0)
return COLOR_BLACK;
@ -693,7 +693,7 @@ UCHAR TuiTextToColor(PUCHAR ColorText)
return COLOR_BLACK;
}
UCHAR TuiTextToFillStyle(PUCHAR FillStyleText)
UCHAR TuiTextToFillStyle(PCHAR FillStyleText)
{
if (stricmp(FillStyleText, "Light") == 0)
{
@ -765,7 +765,7 @@ VOID TuiFadeOut(VOID)
}
BOOL TuiEditBox(PUCHAR MessageText, PUCHAR EditTextBuffer, ULONG Length)
BOOL TuiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length)
{
int width = 8;
int height = 1;

View file

@ -32,23 +32,23 @@ BOOL TuiInitialize(VOID); // Initialize User-Interface
VOID TuiUnInitialize(VOID); // Un-initialize User-Interface
VOID TuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID TuiDrawStatusText(PUCHAR StatusText); // Draws text at the very bottom line on the screen
VOID TuiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID TuiDrawStatusText(PCHAR StatusText); // Draws text at the very bottom line on the screen
VOID TuiUpdateDateTime(VOID); // Updates the date and time
VOID TuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later
VOID TuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save
VOID TuiMessageBox(PUCHAR MessageText); // Displays a message box on the screen with an ok button
VOID TuiMessageBoxCritical(PUCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PUCHAR ProgressText); // Draws the progress bar showing nPos percent filled
BOOL TuiEditBox(PUCHAR MessageText, PUCHAR EditTextBuffer, ULONG Length);
VOID TuiMessageBox(PCHAR MessageText); // Displays a message box on the screen with an ok button
VOID TuiMessageBoxCritical(PCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
BOOL TuiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length);
UCHAR TuiTextToColor(PUCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR TuiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
UCHAR TuiTextToColor(PCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR TuiTextToFillStyle(PCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
VOID TuiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in
VOID TuiFadeOut(VOID); // Fades the screen out
@ -61,7 +61,7 @@ VOID TuiFadeOut(VOID); // Fades the screen out
typedef struct
{
PUCHAR *MenuItemList;
PCHAR *MenuItemList;
ULONG MenuItemCount;
LONG MenuTimeRemaining;
ULONG SelectedMenuItem;
@ -78,7 +78,7 @@ VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber);
ULONG TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter);
BOOL TuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
BOOL TuiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
/*

View file

@ -28,7 +28,7 @@
#include <video.h>
BOOL TuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
BOOL TuiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
{
TUI_MENU_INFO MenuInformation;
ULONG LastClockSecond;
@ -216,8 +216,8 @@ VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo)
VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo)
{
UCHAR MenuLineText[80];
UCHAR TempString[80];
CHAR MenuLineText[80];
CHAR TempString[80];
ULONG Idx;
//
@ -265,7 +265,7 @@ VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo)
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
{
ULONG Idx;
UCHAR MenuLineText[80];
CHAR MenuLineText[80];
ULONG SpaceTotal;
ULONG SpaceLeft;
ULONG SpaceRight;

View file

@ -48,7 +48,7 @@ UCHAR UiSelectedTextBgColor = COLOR_GRAY; // Selected text background color
UCHAR UiEditBoxTextColor = COLOR_WHITE; // Edit box text color
UCHAR UiEditBoxBgColor = COLOR_BLACK; // Edit box text background color
UCHAR UiTitleBoxTitleText[260] = "Boot Menu"; // Title box's title text
CHAR UiTitleBoxTitleText[260] = "Boot Menu"; // Title box's title text
BOOL UserInterfaceUp = FALSE; // Tells us if the user interface is displayed
@ -56,14 +56,14 @@ VIDEODISPLAYMODE UiDisplayMode = VideoTextMode; // Tells us if we are in text
BOOL UiUseSpecialEffects = FALSE; // Tells us if we should use fade effects
UCHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " };
CHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " };
BOOL UiInitialize(BOOLEAN ShowGui)
{
ULONG SectionId;
UCHAR DisplayModeText[260];
UCHAR SettingText[260];
CHAR DisplayModeText[260];
CHAR SettingText[260];
ULONG Depth;
if (!ShowGui) {
@ -201,7 +201,7 @@ BOOL UiInitialize(BOOLEAN ShowGui)
return TRUE;
}
VOID UiUnInitialize(PUCHAR BootText)
VOID UiUnInitialize(PCHAR BootText)
{
UiDrawBackdrop();
UiDrawStatusText("Booting...");
@ -233,7 +233,7 @@ VOID UiDrawBackdrop(VOID)
}
}
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */)
{
if (VideoTextMode == UiDisplayMode)
{
@ -272,7 +272,7 @@ VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle
}
}
VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
VOID UiDrawText(ULONG X, ULONG Y, PCHAR Text, UCHAR Attr)
{
if (VideoTextMode == UiDisplayMode)
{
@ -285,7 +285,7 @@ VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
}
}
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr)
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCHAR TextString, UCHAR Attr)
{
if (VideoTextMode == UiDisplayMode)
{
@ -298,7 +298,7 @@ VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR
}
}
VOID UiDrawStatusText(PUCHAR StatusText)
VOID UiDrawStatusText(PCHAR StatusText)
{
if (!UserInterfaceUp) return;
@ -326,7 +326,7 @@ VOID UiUpdateDateTime(VOID)
}
}
VOID UiInfoBox(PUCHAR MessageText)
VOID UiInfoBox(PCHAR MessageText)
{
ULONG TextLength;
ULONG BoxWidth;
@ -387,7 +387,7 @@ VOID UiInfoBox(PUCHAR MessageText)
UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
}
VOID UiMessageBox(PUCHAR MessageText)
VOID UiMessageBox(PCHAR MessageText)
{
// We have not yet displayed the user interface
// We are probably still reading the .ini file
@ -412,7 +412,7 @@ VOID UiMessageBox(PUCHAR MessageText)
}
}
VOID UiMessageBoxCritical(PUCHAR MessageText)
VOID UiMessageBoxCritical(PCHAR MessageText)
{
// We have not yet displayed the user interface
// We are probably still reading the .ini file
@ -437,7 +437,7 @@ VOID UiMessageBoxCritical(PUCHAR MessageText)
}
}
UCHAR UiTextToColor(PUCHAR ColorText)
UCHAR UiTextToColor(PCHAR ColorText)
{
if (VideoTextMode == UiDisplayMode)
{
@ -451,7 +451,7 @@ UCHAR UiTextToColor(PUCHAR ColorText)
}
}
UCHAR UiTextToFillStyle(PUCHAR FillStyleText)
UCHAR UiTextToFillStyle(PCHAR FillStyleText)
{
if (VideoTextMode == UiDisplayMode)
{
@ -465,7 +465,7 @@ UCHAR UiTextToFillStyle(PUCHAR FillStyleText)
}
}
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText)
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
{
if (!UserInterfaceUp) return;
@ -480,7 +480,7 @@ VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PUCHAR ProgressText)
}
}
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PUCHAR ProgressText)
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
{
if (VideoTextMode == UiDisplayMode)
{
@ -493,12 +493,12 @@ VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG P
}
}
VOID UiShowMessageBoxesInSection(PUCHAR SectionName)
VOID UiShowMessageBoxesInSection(PCHAR SectionName)
{
ULONG Idx;
UCHAR SettingName[80];
UCHAR SettingValue[80];
PUCHAR MessageBoxText;
CHAR SettingName[80];
CHAR SettingValue[80];
PCHAR MessageBoxText;
ULONG MessageBoxTextSize;
ULONG SectionId;
@ -524,7 +524,7 @@ VOID UiShowMessageBoxesInSection(PUCHAR SectionName)
//if (MessageBoxTextSize > 0)
{
// Allocate enough memory to hold the text
MessageBoxText = (PUCHAR)MmAllocateMemory(MessageBoxTextSize);
MessageBoxText = MmAllocateMemory(MessageBoxTextSize);
if (MessageBoxText)
{
@ -545,7 +545,7 @@ VOID UiShowMessageBoxesInSection(PUCHAR SectionName)
}
}
VOID UiEscapeString(PUCHAR String)
VOID UiEscapeString(PCHAR String)
{
ULONG Idx;
@ -563,7 +563,7 @@ VOID UiEscapeString(PUCHAR String)
}
}
VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars)
VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars)
{
if (strlen(StringText) > MaxChars)
{
@ -571,7 +571,7 @@ VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars)
}
}
BOOL UiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
BOOL UiDisplayMenu(PCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
{
if (VideoTextMode == UiDisplayMode)
{
@ -611,7 +611,7 @@ VOID UiFadeOut(VOID)
}
}
BOOL UiEditBox(PUCHAR MessageText, PUCHAR EditTextBuffer, ULONG Length)
BOOL UiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length)
{
if (VideoTextMode == UiDisplayMode)
{

View file

@ -21,9 +21,9 @@
#include <version.h>
#include <rtl.h>
UCHAR FreeLoaderVersionString[80];
CHAR FreeLoaderVersionString[80];
PUCHAR GetFreeLoaderVersionString(VOID)
PCHAR GetFreeLoaderVersionString(VOID)
{
if (FREELOADER_PATCH_VERSION == 0)
{

View file

@ -13,9 +13,9 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x00000010
HKLM,"SOFTWARE\Microsoft\Rpc",,0x00000012
; Version Information
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"4.0"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 6"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"1381"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"5.0"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 3"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"2195"
; Image File Execution Options (NtGlobalFlag with FLG_SHOW_LDR_SNAPS set for loadlib.exe)

View file

@ -64,10 +64,14 @@ HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout File",0
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout Text",0x00000000,"US-Dvorak"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout File",0x00000000,"kbdfr.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout Text",0x00000000,"FR"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout File",0x00000000,"kbdru.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout Text",0x00000000,"Russian"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout File",0x00000000,"kbdse.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout Text",0x00000000,"SE"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout File",0x00000000,"kbduk.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout Text",0x00000000,"UK"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout File",0x00000000,"kbdsg.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout Text",0x00000000,"SG"
; Network
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Adapters"
@ -166,13 +170,114 @@ HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040d",0x00000000,"l_intl.n
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040e",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0419",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409"
; Suported and installed locales
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale",,0x00000012
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000402",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000403",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000404",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000405",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000406",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000407",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000807",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c07",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001407",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000408",0x00010001,"4"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000409",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000809",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c09",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001009",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001409",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001809",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c09",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002009",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003009",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003409",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100a",0x00010001,"1"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c0a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000200a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000240a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000280a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002c0a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000300a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000340a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000380a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003c0a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000400a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000440a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000480a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00004c0a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000500a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040b",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040c",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080c",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0c",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100c",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140c",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180c",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040d",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040e",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040f",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000410",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000810",0x00010001,"1"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000411",0x00010001,""
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000412",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000413",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000813",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000414",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000814",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000415",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000416",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000816",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000418",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000419",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041a",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081a",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c1a",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041b",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041c",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041d",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081d",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041e",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041f",0x00010001,"6"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000420",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000421",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000422",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000423",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000424",0x00010001,"2"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000425",0x00010001,"3"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000426",0x00010001,"3"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000427",0x00010001,"3"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000429",0x00010001,""
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042a",0x00010001,""
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042b",0x00010001,""
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042c",0x00010001,"6"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000082c",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042d",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042f",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000436",0x00010001,"1"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000437",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000438",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000439",0x00010001,""
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043e",0x00010001,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000083e",0x00010001,"1"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043f",0x00010001,"5"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000440",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000441",0x00010001,"1"
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000443",0x00010001,"6"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000843",0x00010001,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000456",0x00010001,"1"
; Some installers check for SP6
HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDVersion",0x00010001,0x00000600
@ -288,9 +393,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Export",0x00010000,"\De
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Route",0x00010000,"3c90x1"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","SlotNumber",0x00000000,"10"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","BusNumber",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
; Afd driver
HKLM,"SYSTEM\CurrentControlSet\Services\Afd","ErrorControl",0x00010001,0x00000001
@ -441,6 +546,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%Syste
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000002
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00000010
; DHCP client service
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"Network"
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"%SystemRoot%\system32\dhcp.exe"
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Start",0x00010001,0x00000002
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000010
; Floppy driver
HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","Group",0x00000000,"Primary Disk"
@ -462,12 +574,22 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Fs_Rec","Type",0x00010001,0x00000008
;HKLM,"SYSTEM\CurrentControlSet\Services\Ide","Start",0x00010001,0x00000004
;HKLM,"SYSTEM\CurrentControlSet\Services\Ide","Type",0x00010001,0x00000001
; Keyboard driver
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Group",0x00000000,"Keyboard Port"
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","ImagePath",0x00020000,"system32\drivers\keyboard.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Type",0x00010001,0x00000001
; i8042 port driver
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Group",0x00000000,"Keyboard Port"
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","ImagePath",0x00020000,"system32\drivers\i8042prt.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt\Parameters","SampleRate",0x00010001,0x00000060
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt\Parameters","BreakOnSysRq",0x00010001,0x00000001
; Keyboard class driver
HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","Group",0x00000000,"Keyboard Class"
HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","ImagePath",0x00020000,"system32\drivers\kbdclass.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\kbdclass","Type",0x00010001,0x00000001
; Serial port enumerator
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","ErrorControl",0x00010001,0x00000001
@ -567,9 +689,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Port",0x00000000,"280"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Irq",0x00000000,"9"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","NetworkAddress",0x00000000,"001122334455"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
; one day this will happen automatically; until then we need this since ndis5 drivers
; rely on the fact that their resources are handed to them by ndis, so we have to find
@ -658,9 +780,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000","BusNumber",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}",,0x00000000,"Network Adapters"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}\Connection","Name",0x00000000,"AMD PCNet (static Registry entry)"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
; Named Pipe filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001,0x00000000
@ -727,14 +849,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%Syste
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000002
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000010
; PS/2 mouse port driver
HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Group",0x00000000,"Pointer Port"
HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","ImagePath",0x00020000,"system32\drivers\psaux.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Start",0x00010001,0x00000004
HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Psaux\Parameters","DisableExtensionDetection",0x00010001,0x00000000
; RPC service
HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","ImagePath",0x00020000,"%SystemRoot%\system32\rpcss.exe"
@ -794,6 +908,15 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","ImagePath",0x00020000,"system32
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Start",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Type",0x00010001,0x00000002
; Xbox Nvidia driver
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Group",0x00000000,"Video"
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ImagePath",0x00020000,"system32\drivers\xboxvmp.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp\Device0","InstalledDisplayDrivers",0x00010000,"framebuf"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_02A0&SUBSYS_00000000&REV_A1\0000","Service",0x00000000,"XboxVmp"
; VBE SVGA driver
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Group",0x00000000,"Video Save SVGA"
@ -853,100 +976,4 @@ HKLM,"SYSTEM\Setup","OsLoaderPath",0x00000000,"\"
HKLM,"SYSTEM\Setup","SetupType",0x00010001,0x00000001
HKLM,"SYSTEM\Setup","SystemPartition",0x00000000,"\Device\Harddisk0\Partition1"
HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000000
; ----------------------------- KJS Init ----------------------------
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","kjsinit",0x00010000,\
"function init(v) { var rk = '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Kdb'; eval(System.regread(rk,v)); } for( i = 1; i <= 45; i++ ) { init((new Number(i)).toString()); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","1",0x00010000,\
"function write(x) { System.print(x); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","2",0x00010000,\
"function regs(n) { return System.regs(n); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","3",0x00010000,\
"function debugebp() { return regs(0); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","4",0x00010000,\
"function debugeip() { return regs(1); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","5",0x00010000,\
"function tf_argmark() { return regs(2); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","6",0x00010000,\
"function tf_pointer() { return regs(3); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","7",0x00010000,\
"function tf_tempcs() { return regs(4); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","8",0x00010000,\
"function tf_tempeip() { return regs(5); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","9",0x00010000,\
"function dr0() { return regs(6); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","10",0x00010000,\
"function dr1() { return regs(7); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","11",0x00010000,\
"function dr2() { return regs(8); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","12",0x00010000,\
"function dr3() { return regs(9); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","13",0x00010000,\
"function dr6() { return regs(10); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","14",0x00010000,\
"function dr7() { return regs(11); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","15",0x00010000,\
"function gs() { return regs(12) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","16",0x00010000,\
"function es() { return regs(13) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","17",0x00010000,\
"function ds() { return regs(14) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","18",0x00010000,\
"function edx() { return regs(15); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","19",0x00010000,\
"function ecx() { return regs(16); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","20",0x00010000,\
"function eax() { return regs(17); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","21",0x00010000,\
"function tf_pmode() { return regs(18); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","22",0x00010000,\
"function tf_exl() { return regs(19); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","23",0x00010000,\
"function fs() { return regs(20) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","24",0x00010000,\
"function edi() { return regs(21); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","25",0x00010000,\
"function esi() { return regs(22); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","26",0x00010000,\
"function ebx() { return regs(23); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","27",0x00010000,\
"function ebp() { return regs(24); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","28",0x00010000,\
"function error_code() { return regs(25); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","29",0x00010000,\
"function eip() { return regs(26); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","30",0x00010000,\
"function cs() { return regs(27) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","31",0x00010000,\
"function eflags() { return regs(28); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","32",0x00010000,\
"function esp() { return regs(29); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","33",0x00010000,\
"function ss() { return regs(30) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","34",0x00010000,\
"function v86_es() { return regs(31) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","35",0x00010000,\
"function v86_ds() { return regs(32) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","36",0x00010000,\
"function v86_fs() { return regs(33) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","37",0x00010000,\
"function v86_gs() { return regs(34) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","38",0x00010000,\
"function peekl(a) { return System.mread(4,a); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","39",0x00010000,\
"function pokel(a,b) { return System.mwrite(4,a,b); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","40",0x00010000,\
"function peekw(a) { return System.mread(2,a); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","41",0x00010000,\
"function pokew(a,b) { return System.mwrite(2,a,b); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","42",0x00010000,\
"function peek(a) { return System.mread(1,a); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","43",0x00010000,\
"function poke(a,b) { return System.mwrite(1,a,b); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","44",0x00010000,\
"function regread(x,y) { return System.regread(x,y); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","45",0x00010000,\
"write('JS Registry Init Complete. Welcome to ReactOS kernel scripting');"
; EOF

View file

@ -43,8 +43,9 @@ drivers\fs\fs_rec\fs_rec.sys 2
drivers\fs\ms\msfs.sys 2
drivers\fs\mup\mup.sys 2
drivers\fs\np\npfs.sys 2
drivers\input\i8042prt\i8042prt.sys 2
drivers\input\kbdclass\kbdclass.sys 2
drivers\input\mouclass\mouclass.sys 2
drivers\input\psaux\psaux.sys 2
drivers\input\sermouse\sermouse.sys 2
drivers\net\afd\afd.sys 2
drivers\net\ndis\ndis.sys 2
@ -88,7 +89,9 @@ lib\kbddv\kbddv.dll 1
lib\kbdes\kbdes.dll 1
lib\kbdfr\kbdfr.dll 1
lib\kbdgr\kbdgr.dll 1
lib\kbdru\kbdru.dll 1
lib\kbdse\kbdse.dll 1
lib\kbdsg\kbdsg.dll 1
lib\kbduk\kbduk.dll 1
lib\kbdus\kbdus.dll 1
lib\kernel32\kernel32.dll 1
@ -165,6 +168,7 @@ subsys\system\userinit\userinit.exe 1
subsys\system\vmwinst\vmwinst.exe 1
subsys\system\winlogon\winlogon.exe 1
subsys\system\winefile\winefile.exe 1
subsys\system\dhcp\dhcp.exe 1
services\eventlog\eventlog.exe 1
services\rpcss\rpcss.exe 1
services\umpnpmgr\umpnpmgr.exe 1

View file

@ -22,7 +22,9 @@ cdrom.sys = 3
class2.sys = 3
disk.sys = 3
floppy.sys = 3
keyboard.sys = 3
;keyboard.sys = 3
i8042prt.sys = 3
kbdclass.sys = 3
l_intl.nls = 2
ntfs.sys = 3
ntoskrnl.exe = 2
@ -35,7 +37,7 @@ Cabinet=reactos.cab
[SetupData]
DefaultPath = \ReactOS
OsLoadOptions = "/NOGUIBOOT /NODEBUG"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /BAUDRATE=19200 /IRQ=4"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
@ -77,29 +79,35 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)"
00010409 = "English (USA-Dvorak)"
0000040C = "French (France)"
00000407 = "German (Germany)"
00000419 = "Russian"
0000040A = "Spanish (traditional short)"
0000041D = "Swedish (Sweden)"
00000807 = "German (Swiss)"
[Files.KeyboardLayout]
00000406 = kbdda.dll
00000407 = kbdgr.dll
00000409 = kbdus.dll
00010409 = kbddv.dll
0000040C = kbdfr.dll
0000041D = kbdse.dll
00000809 = kgbgb.dll
0000040A = kbdes.dll
0000040C = kbdfr.dll
00000419 = kbdru.dll
0000041D = kbdse.dll
00000809 = kbduk.dll
00000807 = kbdsg.dll
[Mouse]
;<id> = <user friendly name>,<spare>,<service key name>
msps2 = "Microsoft PS2 Mouse",,psaux
i8042ps2 = "PS2 Mouse",,i8042prt
;msps2 = "Microsoft PS2 Mouse",,psaux
msser = "Microsoft Serial Mouse",,sermouse
mswhs = "Microsoft Serial Wheel Mouse",,sermouse
none = "No Mouse"
[Map.Mouse]
;<id> = <pnp id string>
msps2 = "MICROSOFT PS2 MOUSE"
i8042ps2 = "MICROSOFT PS2 MOUSE"
;msps2 = "MICROSOFT PS2 MOUSE"
msser = "MICROSOFT SERIAL MOUSE"
mswhs = "MICROSOFT MOUSE WITH WHEEL"
none = "NO MOUSE"

View file

@ -71,14 +71,16 @@ ReadBytes(
PIRP Irp;
IO_STATUS_BLOCK ioStatus;
KEVENT event;
LARGE_INTEGER zero;
NTSTATUS Status;
KeInitializeEvent(&event, NotificationEvent, FALSE);
zero.QuadPart = 0;
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
LowerDevice,
Buffer, BufferSize,
0,
&zero,
&event,
&ioStatus);
if (!Irp)
@ -199,7 +201,7 @@ SerenumWait(ULONG milliseconds)
KTIMER Timer;
LARGE_INTEGER DueTime;
DueTime.QuadPart = -milliseconds * 10;
DueTime.QuadPart = milliseconds * -10;
KeInitializeTimer(&Timer);
KeSetTimer(&Timer, DueTime, NULL);
return KeWaitForSingleObject(&Timer, Executive, KernelMode, FALSE, NULL);
@ -216,7 +218,8 @@ SerenumDetectPnpDevice(
ULONG Size;
ULONG Msr, Purge;
ULONG i;
BOOLEAN BufferContainsBeginId, BufferContainsEndId;
BOOLEAN BufferContainsBeginId = FALSE;
BOOLEAN BufferContainsEndId = FALSE;
SERIAL_LINE_CONTROL Lcr;
SERIAL_TIMEOUTS Timeouts;
SERIALPERF_STATS PerfStats;
@ -325,7 +328,6 @@ SerenumCollectPnpComDeviceId:
NULL, 0, &PerfStats, &Size);
if (!NT_SUCCESS(Status)) return Status;
if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto SerenumConnectIdle;
BufferContainsBeginId = BufferContainsEndId = FALSE;
for (i = 0; i < TotalBytesReceived; i++)
{
if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE;
@ -422,6 +424,10 @@ SerenumDetectLegacyDevice(
UNICODE_STRING CompatibleIds;
NTSTATUS Status;
DPRINT("Serenum: SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n",
DeviceObject,
LowerDevice);
RtlZeroMemory(Buffer, sizeof(Buffer));
/* Reset UART */

View file

@ -18,7 +18,6 @@ SerenumAddDevice(
{
PDEVICE_OBJECT Fdo;
PFDO_DEVICE_EXTENSION DeviceExtension;
//UNICODE_STRING SymbolicLinkName;
NTSTATUS Status;
DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo);
@ -36,27 +35,22 @@ SerenumAddDevice(
DPRINT("Serenum: IoCreateDevice() failed with status 0x%08lx\n", Status);
return Status;
}
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
/* Register device interface */
#if 0 /* FIXME: activate */
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, NULL, &SymbolicLinkName);
Status = IoRegisterDeviceInterface(
Pdo,
&GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR,
NULL,
&DeviceExtension->SerenumInterfaceName);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
goto ByeBye;
IoDeleteDevice(Fdo);
return Status;
}
DPRINT1("Serenum: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
goto ByeBye;
}
RtlFreeUnicodeString(&SymbolicLinkName);
#endif
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
DeviceExtension->Common.IsFDO = TRUE;
DeviceExtension->Common.PnpState = dsStopped;
DeviceExtension->Pdo = Pdo;
@ -80,13 +74,22 @@ SerenumFdoStartDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PCOMMON_DEVICE_EXTENSION DeviceExtension;
PFDO_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
DPRINT("Serenum: SerenumFdoStartDevice() called\n");
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->PnpState == dsStopped);
DeviceExtension->PnpState = dsStarted;
ASSERT(DeviceExtension->Common.PnpState == dsStopped);
Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
return Status;
}
DeviceExtension->Common.PnpState = dsStarted;
return STATUS_SUCCESS;
}

View file

@ -18,6 +18,8 @@ SerenumDuplicateUnicodeString(
IN PUNICODE_STRING Source,
IN POOL_TYPE PoolType)
{
ASSERT(Destination);
if (Source == NULL)
{
RtlInitUnicodeString(Destination, NULL);
@ -52,6 +54,8 @@ SerenumInitMultiSzString(
ULONG DestinationSize = 0;
NTSTATUS Status = STATUS_SUCCESS;
ASSERT(Destination);
/* Calculate length needed for destination unicode string */
va_start(args, Destination);
Source = va_arg(args, PCSZ);
@ -133,6 +137,8 @@ ForwardIrpAndWait(
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
ASSERT(LowerDevice);
KeInitializeEvent(&Event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
@ -162,6 +168,7 @@ ForwardIrpToLowerDeviceAndForget(
ASSERT(DeviceExtension->Common.IsFDO);
LowerDevice = DeviceExtension->LowerDevice;
ASSERT(LowerDevice);
DPRINT("Serenum: calling lower device 0x%p [%wZ]\n",
LowerDevice, &LowerDevice->DriverObject->DriverName);
IoSkipCurrentIrpStackLocation(Irp);
@ -180,6 +187,7 @@ ForwardIrpToAttachedFdoAndForget(
ASSERT(!DeviceExtension->Common.IsFDO);
Fdo = DeviceExtension->AttachedFdo;
ASSERT(Fdo);
DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n",
Fdo, &Fdo->DriverObject->DriverName);
IoSkipCurrentIrpStackLocation(Irp);
@ -195,6 +203,7 @@ ForwardIrpAndForget(
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
ASSERT(LowerDevice);
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(LowerDevice, Irp);

View file

@ -99,6 +99,7 @@ SerenumPdoQueryDeviceRelations(
return STATUS_INSUFFICIENT_RESOURCES;
ObReferenceObject(DeviceObject);
DeviceRelations->Count = 1;
DeviceRelations->Objects[0] = DeviceObject;
*pDeviceRelations = DeviceRelations;
@ -156,7 +157,7 @@ SerenumPdoPnp(
}
case TargetDeviceRelation:
{
PDEVICE_RELATIONS DeviceRelations;
PDEVICE_RELATIONS DeviceRelations = NULL;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
Status = SerenumPdoQueryDeviceRelations(DeviceObject, &DeviceRelations);
Information = (ULONG_PTR)DeviceRelations;

View file

@ -52,7 +52,9 @@ IrpStub(
{
DPRINT1("Serenum: FDO stub for major function 0x%lx\n",
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
#ifndef NDEBUG
DbgBreakPoint();
#endif
Status = Irp->IoStatus.Status;
}
}
@ -73,7 +75,9 @@ IrpStub(
{
DPRINT1("Serenum: PDO stub for major function 0x%lx\n",
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
#ifndef NDEBUG
DbgBreakPoint();
#endif
Status = Irp->IoStatus.Status;
}
}
@ -100,12 +104,6 @@ DriverEntry(
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = IrpStub;
/*DriverObject->MajorFunction[IRP_MJ_CREATE] = SerialCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = SerialClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = SerialCleanup;
DriverObject->MajorFunction[IRP_MJ_READ] = SerialRead;
DriverObject->MajorFunction[IRP_MJ_WRITE] = SerialWrite;*/
//DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Serenum;
//DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp;
//DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;

View file

@ -66,6 +66,8 @@ typedef struct _FDO_DEVICE_EXTENSION
PDEVICE_OBJECT Pdo;
IO_REMOVE_LOCK RemoveLock;
UNICODE_STRING SerenumInterfaceName;
PDEVICE_OBJECT AttachedPdo;
ULONG Flags;
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
@ -122,7 +124,7 @@ SerenumDuplicateUnicodeString(
NTSTATUS
SerenumInitMultiSzString(
OUT PUNICODE_STRING Destination,
... /* list of ANSI_STRINGs */);
... /* list of PCSZ */);
NTSTATUS
ForwardIrpAndWait(

View file

@ -0,0 +1,38 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/createclose.c
* PURPOSE: IRP_MJ_CREATE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP operations
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#include "green.h"
NTSTATUS STDCALL
GreenCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DPRINT("Green: IRP_MJ_CREATE\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
GreenClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DPRINT("Green: IRP_MJ_CLOSE\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}

View file

@ -0,0 +1,65 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/dispatch.c
* PURPOSE: Dispatch routines
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
NTSTATUS STDCALL
GreenDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
ULONG MajorFunction;
GREEN_DEVICE_TYPE DeviceType;
ULONG_PTR Information;
NTSTATUS Status;
MajorFunction = IoGetCurrentIrpStackLocation(Irp)->MajorFunction;
DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status;
DPRINT("Green: Dispatching major function 0x%lx, DeviceType %d\n",
MajorFunction, DeviceType);
if (MajorFunction == IRP_MJ_CREATE && DeviceType == Green)
return GreenCreate(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_CLOSE && DeviceType == Green)
return GreenClose(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Green)
{
return KeyboardInternalDeviceControl(
((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Keyboard,
Irp);
}
else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Keyboard)
return KeyboardInternalDeviceControl(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Green)
{
return ScreenDeviceControl(
((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Screen,
Irp);
}
else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Screen)
return ScreenDeviceControl(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_WRITE && DeviceType == Screen)
return ScreenWrite(DeviceObject, Irp);
else
{
DPRINT1("Green: unknown combination: MajorFunction 0x%lx, DeviceType %d\n",
MajorFunction, DeviceType);
}
Irp->IoStatus.Information = Information;
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}

View file

@ -0,0 +1,44 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/green.c
* PURPOSE: Driver entry point
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#include "green.h"
VOID STDCALL
DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
// nothing to do here yet
}
/*
* Standard DriverEntry method.
*/
NTSTATUS STDCALL
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegPath)
{
ULONG i;
DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = GreenAddDevice;
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = GreenDispatch;
/* keyboard only */
//DriverObject->DriverStartIo = GreenStartIo;
/* keyboard and screen */
DriverObject->MajorFunction[IRP_MJ_CREATE] = GreenCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = GreenClose;
return STATUS_SUCCESS;
}

View file

@ -0,0 +1,179 @@
#if defined(__GNUC__)
#include <ddk/ntddk.h>
#include <ddk/ntddser.h>
#include <ntos/halfuncs.h>
#include <ddk/ntddblue.h>
#include <ddk/ntddkbd.h> /* should be in kbdmou.h */
#include <debug.h>
/* FIXME: should be in kbdmou.h */
typedef struct _CONNECT_DATA {
PDEVICE_OBJECT ClassDeviceObject;
PVOID ClassService;
} CONNECT_DATA, *PCONNECT_DATA;
/* FIXME: should be in kbdmou.h */
#define IOCTL_INTERNAL_KEYBOARD_CONNECT \
CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
NTSTATUS STDCALL
ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
ULONG Attributes,
PACCESS_STATE PassedAccessState,
ACCESS_MASK DesiredAccess,
POBJECT_TYPE ObjectType,
KPROCESSOR_MODE AccessMode,
PVOID ParseContext,
PVOID* ObjectPtr);
/* FIXME: should be in kbdmou.h */
typedef VOID (*PSERVICE_CALLBACK_ROUTINE)(PDEVICE_OBJECT, PKEYBOARD_INPUT_DATA, PKEYBOARD_INPUT_DATA, PULONG);
typedef struct _CLASS_INFORMATION
{
PDEVICE_OBJECT DeviceObject;
PVOID CallBack;
} CLASS_INFORMATION, *PCLASS_INFORMATION;
#define KEYBOARD_BUFFER_SIZE 100
#elif defined(_MSC_VER)
#include <ntddk.h>
#include <ntddser.h>
#include <kbdmou.h>
#define STDCALL
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
#define DPRINT DPRINT1
#define CHECKPOINT CHECKPOINT1
#else
#error Unknown compiler!
#endif
typedef enum
{
Green,
Screen,
Keyboard
} GREEN_DEVICE_TYPE;
typedef struct _COMMON_DEVICE_EXTENSION
{
GREEN_DEVICE_TYPE Type;
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
typedef struct _KEYBOARD_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT Green;
CLASS_INFORMATION ClassInformation;
HANDLE WorkerThreadHandle;
KDPC KeyboardDpc;
ULONG ActiveQueue;
ULONG InputDataCount[2];
KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE];
} KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION;
typedef struct _SCREEN_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT Green;
PUCHAR VideoMemory; /* Pointer to video memory */
USHORT CharAttribute; /* Current color attribute */
ULONG Mode;
UCHAR ScanLines; /* Height of a text line */
UCHAR Rows; /* Number of rows */
UCHAR Columns; /* Number of columns */
UCHAR TabWidth;
ULONG LogicalOffset; /* Position of the cursor */
UCHAR SendBuffer[1024];
ULONG SendBufferPosition;
} SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION;
typedef struct _GREEN_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT Serial;
PDEVICE_OBJECT LowerDevice;
ULONG BaudRate;
SERIAL_LINE_CONTROL LineControl;
SERIAL_TIMEOUTS Timeouts;
PDEVICE_OBJECT Keyboard;
PDEVICE_OBJECT Screen;
} GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION;
/************************************ createclose.c */
NTSTATUS STDCALL
GreenCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS STDCALL
GreenClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ dispatch.c */
NTSTATUS STDCALL
GreenDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ keyboard.c */
NTSTATUS
KeyboardInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* KeyboardFdo);
NTSTATUS
KeyboardInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ misc.c */
NTSTATUS
GreenDeviceIoControl(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG CtlCode,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferSize,
IN OUT PVOID OutputBuffer OPTIONAL,
IN OUT PULONG OutputBufferSize);
/************************************ pnp.c */
NTSTATUS STDCALL
GreenAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo);
/************************************ screen.c */
NTSTATUS
ScreenInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* ScreenFdo);
NTSTATUS
ScreenWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
ScreenDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);

View file

@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "VT100 Server Driver\0"
#define REACTOS_STR_INTERNAL_NAME "green\0"
#define REACTOS_STR_ORIGINAL_FILENAME "green.sys\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,346 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/keyboard.c
* PURPOSE: Keyboard part of green management
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
static BOOLEAN
TranslateCharToScanCodes(
IN PUCHAR InputBuffer,
IN ULONG InputBufferSize,
OUT KEYBOARD_INPUT_DATA* OutputBuffer,
OUT PULONG OutputBufferSize,
OUT PULONG BytesConsumed)
{
BOOLEAN NormalKey = FALSE;
USHORT MakeCode;
if (InputBufferSize == 0)
return FALSE;
switch (*InputBuffer)
{
case 0x1b: MakeCode = 0x01; NormalKey = TRUE; break; /* ESC */
case '1': MakeCode = 0x02; NormalKey = TRUE; break;
case '2': MakeCode = 0x03; NormalKey = TRUE; break;
case '3': MakeCode = 0x04; NormalKey = TRUE; break;
case '4': MakeCode = 0x05; NormalKey = TRUE; break;
case '5': MakeCode = 0x06; NormalKey = TRUE; break;
case '6': MakeCode = 0x07; NormalKey = TRUE; break;
case '7': MakeCode = 0x08; NormalKey = TRUE; break;
case '8': MakeCode = 0x09; NormalKey = TRUE; break;
case '9': MakeCode = 0x0a; NormalKey = TRUE; break;
case '0': MakeCode = 0x0b; NormalKey = TRUE; break;
case '-': MakeCode = 0x0c; NormalKey = TRUE; break;
case '=': MakeCode = 0x0d; NormalKey = TRUE; break;
case '\b': MakeCode = 0x0e; NormalKey = TRUE; break;
case '\t': MakeCode = 0x0f; NormalKey = TRUE; break;
case 'q': MakeCode = 0x10; NormalKey = TRUE; break;
case 'w': MakeCode = 0x11; NormalKey = TRUE; break;
case 'e': MakeCode = 0x12; NormalKey = TRUE; break;
case 'r': MakeCode = 0x13; NormalKey = TRUE; break;
case 't': MakeCode = 0x14; NormalKey = TRUE; break;
case 'y': MakeCode = 0x15; NormalKey = TRUE; break;
case 'u': MakeCode = 0x16; NormalKey = TRUE; break;
case 'i': MakeCode = 0x17; NormalKey = TRUE; break;
case 'o': MakeCode = 0x18; NormalKey = TRUE; break;
case 'p': MakeCode = 0x19; NormalKey = TRUE; break;
case '[': MakeCode = 0x1a; NormalKey = TRUE; break;
case ']': MakeCode = 0x1b; NormalKey = TRUE; break;
case '\r': MakeCode = 0x1c; NormalKey = TRUE; break;
case 'a': MakeCode = 0x1e; NormalKey = TRUE; break;
case 's': MakeCode = 0x1f; NormalKey = TRUE; break;
case 'd': MakeCode = 0x20; NormalKey = TRUE; break;
case 'f': MakeCode = 0x21; NormalKey = TRUE; break;
case 'g': MakeCode = 0x22; NormalKey = TRUE; break;
case 'h': MakeCode = 0x23; NormalKey = TRUE; break;
case 'j': MakeCode = 0x24; NormalKey = TRUE; break;
case 'k': MakeCode = 0x25; NormalKey = TRUE; break;
case 'l': MakeCode = 0x26; NormalKey = TRUE; break;
case ';': MakeCode = 0x27; NormalKey = TRUE; break;
case '\'': MakeCode = 0x28; NormalKey = TRUE; break;
case '`': MakeCode = 0x29; NormalKey = TRUE; break;
case '\\': MakeCode = 0x2b; NormalKey = TRUE; break;
case 'z': MakeCode = 0x2c; NormalKey = TRUE; break;
case 'x': MakeCode = 0x2d; NormalKey = TRUE; break;
case 'c': MakeCode = 0x2e; NormalKey = TRUE; break;
case 'v': MakeCode = 0x2f; NormalKey = TRUE; break;
case 'b': MakeCode = 0x30; NormalKey = TRUE; break;
case 'n': MakeCode = 0x31; NormalKey = TRUE; break;
case 'm': MakeCode = 0x32; NormalKey = TRUE; break;
case ',': MakeCode = 0x33; NormalKey = TRUE; break;
case '.': MakeCode = 0x34; NormalKey = TRUE; break;
case '/': MakeCode = 0x35; NormalKey = TRUE; break;
case ' ': MakeCode = 0x39; NormalKey = TRUE; break;
}
if (NormalKey && *OutputBufferSize >= 2)
{
OutputBuffer[0].MakeCode = MakeCode;
OutputBuffer[0].Flags = KEY_MAKE;
OutputBuffer[1].MakeCode = MakeCode;
OutputBuffer[1].Flags = KEY_BREAK;
*BytesConsumed = 2;
return TRUE;
}
/* Consume strange character by ignoring it */
DPRINT1("Green: strange byte received 0x%02x ('%c')\n",
*InputBuffer, *InputBuffer >= 32 ? *InputBuffer : '.');
*BytesConsumed = 1;
return TRUE;
}
NTSTATUS
KeyboardInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* KeyboardFdo)
{
PDEVICE_OBJECT Fdo;
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass1");
NTSTATUS Status;
DPRINT("Green: KeyboardInitialize() called\n");
Status = IoCreateDevice(DriverObject,
sizeof(KEYBOARD_DEVICE_EXTENSION),
&DeviceName, /* FIXME: don't hardcode string */
FILE_DEVICE_KEYBOARD,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&Fdo);
if (!NT_SUCCESS(Status))
return Status;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION));
DeviceExtension->Common.Type = Keyboard;
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
*KeyboardFdo = Fdo;
return STATUS_SUCCESS;
}
static VOID STDCALL
KeyboardDpcSendData(
IN PKDPC Dpc,
IN PVOID pDeviceExtension, /* real type PKEYBOARD_DEVICE_EXTENSION */
IN PVOID Unused1,
IN PVOID Unused2)
{
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
ULONG Queue;
ULONG InputDataConsumed;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pDeviceExtension;
Queue = DeviceExtension->ActiveQueue % 2;
InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue);
(*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.CallBack)(
DeviceExtension->ClassInformation.DeviceObject,
DeviceExtension->KeyboardInputData[Queue],
&DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]],
&InputDataConsumed);
DeviceExtension->InputDataCount[Queue] = 0;
}
static VOID STDCALL
KeyboardDeviceWorker(
PVOID Context)
{
PDEVICE_OBJECT DeviceObject;
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
PGREEN_DEVICE_EXTENSION GreenDeviceExtension;
PDEVICE_OBJECT LowerDevice;
UCHAR Buffer[16]; /* Arbitrary size */
ULONG BufferSize;
PIRP Irp;
IO_STATUS_BLOCK ioStatus;
KEVENT event;
KIRQL OldIrql;
ULONG i, Queue;
ULONG SpaceInQueue;
ULONG BytesConsumed;
PKEYBOARD_INPUT_DATA Input;
NTSTATUS Status;
DPRINT("Green: KeyboardDeviceWorker() called\n");
DeviceObject = (PDEVICE_OBJECT)Context;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
LowerDevice = GreenDeviceExtension->Serial;
BufferSize = sizeof(Buffer);
/* Initialize device extension */
DeviceExtension->ActiveQueue = 0;
DeviceExtension->InputDataCount[0] = 0;
DeviceExtension->InputDataCount[1] = 0;
KeInitializeDpc(&DeviceExtension->KeyboardDpc, KeyboardDpcSendData, DeviceExtension);
RtlZeroMemory(&DeviceExtension->KeyboardInputData, sizeof(DeviceExtension->KeyboardInputData));
/* main read loop */
while (TRUE)
{
KeInitializeEvent(&event, NotificationEvent, FALSE);
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
LowerDevice,
Buffer, BufferSize,
0,
&event,
&ioStatus);
if (!Irp)
{
/* no memory actually, try later */
CHECKPOINT;
KeStallExecutionProcessor(10);
continue;
}
Status = IoCallDriver(LowerDevice, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
Status = ioStatus.Status;
}
if (!NT_SUCCESS(Status))
continue;
/* Read all available data and process */
i = 0;
while (i < ioStatus.Information)
{
Queue = DeviceExtension->ActiveQueue % 2;
Input = &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]];
/* Translate current chars to scan codes */
SpaceInQueue = KEYBOARD_BUFFER_SIZE - DeviceExtension->InputDataCount[Queue];
if (TranslateCharToScanCodes(
&Buffer[i], /* input buffer */
ioStatus.Information - i, /* input buffer size */
Input, /* output buffer */
&SpaceInQueue, /* output buffer size */
&BytesConsumed)) /* bytes consumed in input buffer */
{
DPRINT1("Green: got char 0x%02x (%c)\n", Buffer[i], Buffer[i] >= 32 ? Buffer[i] : ' ');
DeviceExtension->InputDataCount[Queue] += BytesConsumed;
/* Send the data to the keyboard class driver */
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
KeInsertQueueDpc(&DeviceExtension->KeyboardDpc, NULL, NULL);
KeLowerIrql(OldIrql);
i += BytesConsumed;
}
else
{
/* TranslateCharToScanCodes failed. Possible reasons:
* - not enough bytes in input buffer (escape control code; wait next received bytes)
* - not enough room in output buffer (wait for the Dpc to empty it)
*
* The best way to resolve this is to try later.
*/
i++;
}
}
}
PsTerminateSystemThread(STATUS_SUCCESS);
}
NTSTATUS
KeyboardInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
PGREEN_DEVICE_EXTENSION GreenDeviceExtension;
OBJECT_ATTRIBUTES objectAttributes;
PDEVICE_OBJECT LowerDevice;
NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp);
Irp->IoStatus.Information = 0;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
LowerDevice = GreenDeviceExtension->Serial;
DPRINT1("Green: LowerDevice %p\n", LowerDevice);
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_INTERNAL_KEYBOARD_CONNECT:
{
ULONG Fcr;
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n");
if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
{
Status = STATUS_INVALID_PARAMETER;
break;
}
DeviceExtension->ClassInformation =
*((PCLASS_INFORMATION)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
/* Initialize serial port */
Fcr = 0;
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
&Fcr, sizeof(Fcr), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Set serial port speed */
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&GreenDeviceExtension->BaudRate, sizeof(GreenDeviceExtension->BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Set LCR */
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&GreenDeviceExtension->LineControl, sizeof(GreenDeviceExtension->LineControl), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Set timeouts */
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&GreenDeviceExtension->Timeouts, sizeof(GreenDeviceExtension->Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Start read loop */
InitializeObjectAttributes(&objectAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
Status = PsCreateSystemThread(
&DeviceExtension->WorkerThreadHandle,
(ACCESS_MASK)0L,
&objectAttributes,
NULL,
NULL,
KeyboardDeviceWorker,
DeviceObject);
break;
}
default:
{
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
Stack->Parameters.DeviceIoControl.IoControlCode);
Status = STATUS_INVALID_DEVICE_REQUEST;
}
}
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}

View file

@ -0,0 +1,24 @@
# $Id:
PATH_TO_TOP = ../../..
TARGET_BOOTSTRAP = yes
TARGET_TYPE = driver
TARGET_NAME = green
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
TARGET_OBJECTS = \
$(TARGET_NAME).o \
createclose.o \
dispatch.o \
keyboard.o \
misc.o \
pnp.o \
screen.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk

View file

@ -0,0 +1,60 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/misc.c
* PURPOSE: Misceallenous operations
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#include "green.h"
NTSTATUS
GreenDeviceIoControl(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG CtlCode,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferSize,
IN OUT PVOID OutputBuffer OPTIONAL,
IN OUT PULONG OutputBufferSize)
{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK IoStatus;
NTSTATUS Status;
KeInitializeEvent (&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(CtlCode,
DeviceObject,
InputBuffer,
InputBufferSize,
OutputBuffer,
(OutputBufferSize) ? *OutputBufferSize : 0,
FALSE,
&Event,
&IoStatus);
if (Irp == NULL)
{
DPRINT("Green: IoBuildDeviceIoControlRequest() failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
DPRINT("Green: Operation pending\n");
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
Status = IoStatus.Status;
}
if (OutputBufferSize)
{
*OutputBufferSize = IoStatus.Information;
}
return Status;
}

View file

@ -0,0 +1,87 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/pnp.c
* PURPOSE: IRP_MJ_PNP operations
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
NTSTATUS STDCALL
GreenAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo)
{
PDEVICE_OBJECT Fdo = NULL;
PGREEN_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING serialPortName;
NTSTATUS Status;
DPRINT("Green: AddDevice(DriverObject %p, Pdo %p)\n", DriverObject, Pdo);
/* Create green FDO */
Status = IoCreateDevice(DriverObject,
sizeof(GREEN_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_UNKNOWN,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&Fdo);
if (!NT_SUCCESS(Status))
return Status;
DeviceExtension = (PGREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(GREEN_DEVICE_EXTENSION));
DeviceExtension->Common.Type = Green;
Status = KeyboardInitialize(DriverObject, &DeviceExtension->Keyboard);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(Fdo);
return Status;
}
((PKEYBOARD_DEVICE_EXTENSION)DeviceExtension->Keyboard->DeviceExtension)->Green = Fdo;
Status = ScreenInitialize(DriverObject, &DeviceExtension->Screen);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(DeviceExtension->Keyboard);
IoDeleteDevice(Fdo);
return Status;
}
((PSCREEN_DEVICE_EXTENSION)DeviceExtension->Screen->DeviceExtension)->Green = Fdo;
/* initialize green Fdo */
DeviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo);
DeviceExtension->LineControl.WordLength = 8;
DeviceExtension->LineControl.Parity = NO_PARITY;
DeviceExtension->LineControl.StopBits = STOP_BIT_1;
DeviceExtension->BaudRate = SERIAL_BAUD_38400;
DeviceExtension->Timeouts.ReadTotalTimeoutConstant = 1; /* not null */
DeviceExtension->Timeouts.ReadIntervalTimeout = INFINITE;
DeviceExtension->Timeouts.ReadTotalTimeoutMultiplier = INFINITE;
DeviceExtension->Timeouts.WriteTotalTimeoutMultiplier = 0; /* FIXME */
DeviceExtension->Timeouts.WriteTotalTimeoutConstant = 0; /* FIXME */
/* open associated serial port */
RtlInitUnicodeString(&serialPortName, L"\\Device\\Serial1"); /* FIXME: don't hardcode string */
Status = ObReferenceObjectByName(
&serialPortName,
OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE,
NULL,
(ACCESS_MASK)0,
IoDeviceObjectType,
KernelMode,
NULL,
(PVOID*)&DeviceExtension->Serial);
/* FIXME: we never ObDereferenceObject */
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
return Status;
}

View file

@ -0,0 +1,544 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/screen.c
* PURPOSE: Screen part of green management
*
* PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
* Art Yerkes
* Hervé Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
#include <stdarg.h>
#define ESC ((UCHAR)0x1b)
/* Force a move of the cursor on each printer char.
* Very useful for debug, but it is very slow...
*/
//#define FORCE_POSITION
/* UCHAR is promoted to int when passed through '...',
* so we get int with va_arg and cast them back to UCHAR.
*/
static VOID
AddToSendBuffer(
IN PSCREEN_DEVICE_EXTENSION DeviceExtension,
IN ULONG NumberOfChars,
... /* IN int */)
{
PIRP Irp;
IO_STATUS_BLOCK ioStatus;
va_list args;
PDEVICE_OBJECT SerialDevice;
ULONG SizeLeft;
int CurrentInt;
UCHAR CurrentChar;
NTSTATUS Status;
SizeLeft = sizeof(DeviceExtension->SendBuffer) - DeviceExtension->SendBufferPosition;
if (SizeLeft < NumberOfChars * 2 || NumberOfChars == 0)
{
SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial;
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_WRITE,
SerialDevice,
DeviceExtension->SendBuffer, DeviceExtension->SendBufferPosition,
NULL, /* StartingOffset */
NULL, /* Event */
&ioStatus);
if (!Irp)
{
DPRINT1("Green: IoBuildSynchronousFsdRequest() failed. Unable to flush output buffer\n");
return;
}
Status = IoCallDriver(SerialDevice, Irp);
if (!NT_SUCCESS(Status) && Status != STATUS_PENDING)
{
DPRINT1("Green: IoCallDriver() failed. Status = 0x%08lx\n", Status);
return;
}
DeviceExtension->SendBufferPosition = 0;
SizeLeft = sizeof(DeviceExtension->SendBuffer);
}
va_start(args, NumberOfChars);
while (NumberOfChars-- > 0)
{
CurrentInt = va_arg(args, int);
if (CurrentInt > 0)
{
CurrentChar = (UCHAR)CurrentInt;
/* Why 0xff chars are printed on a 'dir' ? */
if (CurrentChar == 0xff) CurrentChar = ' ';
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = CurrentChar;
SizeLeft--;
}
else if (CurrentInt == 0)
{
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = '0';
SizeLeft--;
}
else
{
CurrentInt = -CurrentInt;
ASSERT(CurrentInt < 100);
if (CurrentInt >= 10)
{
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] =
(CurrentInt / 10) % 10 + '0';
SizeLeft--;
}
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] =
CurrentInt % 10 + '0';
SizeLeft--;
}
}
va_end(args);
}
NTSTATUS
ScreenInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* ScreenFdo)
{
PDEVICE_OBJECT Fdo;
PSCREEN_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen");
NTSTATUS Status;
DPRINT("Green: ScreenInitialize() called\n");
Status = IoCreateDevice(DriverObject,
sizeof(SCREEN_DEVICE_EXTENSION),
&DeviceName, /* FIXME: don't hardcode string */
FILE_DEVICE_SCREEN,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&Fdo);
if (!NT_SUCCESS(Status))
return Status;
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(SCREEN_DEVICE_EXTENSION));
DeviceExtension->Common.Type = Screen;
/* initialize screen */
DeviceExtension->Columns = 80;
DeviceExtension->Rows = 25;
DeviceExtension->ScanLines = 16;
DeviceExtension->VideoMemory = (PUCHAR)ExAllocatePool(
PagedPool,
2 * DeviceExtension->Columns * DeviceExtension->Rows * sizeof(UCHAR));
if (!DeviceExtension->VideoMemory)
{
IoDeleteDevice(Fdo);
return STATUS_INSUFFICIENT_RESOURCES;
}
DeviceExtension->TabWidth = 8;
/* more initialization */
DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT |
ENABLE_WRAP_AT_EOL_OUTPUT;
/* initialize screen at next write */
AddToSendBuffer(DeviceExtension, 2, ESC, 'c'); /* reset device */
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '7', 'l'); /* disable line wrap */
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '3', 'g'); /* clear all tabs */
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
*ScreenFdo = Fdo;
return STATUS_SUCCESS;
}
NTSTATUS
ScreenWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PUCHAR Buffer;
PSCREEN_DEVICE_EXTENSION DeviceExtension;
PUCHAR VideoMemory; /* FIXME: is it useful? */
ULONG VideoMemorySize; /* FIXME: is it useful? */
ULONG Columns, Rows;
ULONG CursorX, CursorY;
ULONG i, j;
NTSTATUS Status;
DPRINT("Green: IRP_MJ_WRITE\n");
Stack = IoGetCurrentIrpStackLocation (Irp);
Buffer = Irp->UserBuffer;
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
VideoMemory = DeviceExtension->VideoMemory;
Columns = DeviceExtension->Columns;
Rows = DeviceExtension->Rows;
CursorX = (DeviceExtension->LogicalOffset / 2) % Columns + 1;
CursorY = (DeviceExtension->LogicalOffset / 2) / Columns + 1;
VideoMemorySize = Columns * Rows * 2 * sizeof(UCHAR);
DPRINT1("Y: %lu\n", CursorY);
DPRINT1("Buffer =");
for (i = 0; i < Stack->Parameters.Write.Length; i++)
DbgPrint(" 0x%02x", Buffer[i]);
DbgPrint("\n");
if (!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT))
{
/* raw output mode */
CHECKPOINT;
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return STATUS_NOT_SUPPORTED;
}
else
{
for (i = 0; i < Stack->Parameters.Write.Length; i++, Buffer++)
{
switch (*Buffer)
{
case '\b':
{
if (CursorX > 1)
{
CursorX--;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
AddToSendBuffer(DeviceExtension, 1, ' ');
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
}
else if (CursorY > 1)
{
CursorX = Columns;
CursorY--;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
}
break;
}
case '\n':
{
CursorY++;
CursorX = 1;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
break;
}
case '\r':
{
if (CursorX > 1)
{
AddToSendBuffer(DeviceExtension, 4, ESC, '[', -(int)(CursorX-1), 'D');
CursorX = 1;
}
break;
}
case '\t':
{
ULONG Offset = DeviceExtension->TabWidth - (CursorX % DeviceExtension->TabWidth);
for (j = 0; j < Offset; j++)
{
#ifdef FORCE_POSITION
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
#endif
AddToSendBuffer(DeviceExtension, 1, ' ');
CursorX++;
if (CursorX > Columns)
{
CursorX = 1;
CursorY++;
}
}
break;
}
default:
{
#ifdef FORCE_POSITION
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
#endif
AddToSendBuffer(DeviceExtension, 1, *Buffer);
CursorX++;
if (CursorX > Columns)
{
CursorX = 1;
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY + 1);
CursorY++;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
}
}
}
if (CursorY > Rows)
{
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY - 1);
CursorY--;
AddToSendBuffer(DeviceExtension, 2, ESC, 'D');
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
}
}
}
DeviceExtension->LogicalOffset = ((CursorX-1) + (CursorY-1) * Columns) * 2;
/* flush output buffer */
AddToSendBuffer(DeviceExtension, 0);
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}
NTSTATUS
ScreenDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PSCREEN_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp);
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
{
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO\n");
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
pcsbi->dwSize.X = DeviceExtension->Columns;
pcsbi->dwSize.Y = DeviceExtension->Rows;
pcsbi->dwCursorPosition.X = (SHORT)(DeviceExtension->LogicalOffset % DeviceExtension->Columns);
pcsbi->dwCursorPosition.Y = (SHORT)(DeviceExtension->LogicalOffset / DeviceExtension->Columns);
pcsbi->wAttributes = DeviceExtension->CharAttribute;
pcsbi->srWindow.Left = 1;
pcsbi->srWindow.Right = DeviceExtension->Columns;
pcsbi->srWindow.Top = 1;
pcsbi->srWindow.Bottom = DeviceExtension->Rows;
pcsbi->dwMaximumWindowSize.X = DeviceExtension->Columns;
pcsbi->dwMaximumWindowSize.Y = DeviceExtension->Rows;
Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO:
{
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO\n");
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
/* FIXME: remove */ { pcsbi->dwCursorPosition.X++; }
/* FIXME: remove */ { pcsbi->dwCursorPosition.Y++; }
ASSERT(pcsbi->dwCursorPosition.X >= 1);
ASSERT(pcsbi->dwCursorPosition.Y >= 1);
ASSERT(pcsbi->dwCursorPosition.X <= DeviceExtension->Columns);
ASSERT(pcsbi->dwCursorPosition.Y <= DeviceExtension->Rows);
DeviceExtension->LogicalOffset = (
(pcsbi->dwCursorPosition.Y-1) * DeviceExtension->Columns +
(pcsbi->dwCursorPosition.X-1)) * 2;
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
-(int)pcsbi->dwCursorPosition.Y, ';',
-(int)pcsbi->dwCursorPosition.X, 'H');
/* flush buffer */
AddToSendBuffer(DeviceExtension, 0);
DeviceExtension->CharAttribute = pcsbi->wAttributes;
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_GET_CURSOR_INFO:
{
PCONSOLE_CURSOR_INFO pcci = (PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_CURSOR_INFO\n");
pcci->dwSize = 1;
pcci->bVisible = TRUE;
Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_GET_MODE:
{
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_MODE\n");
pcm->dwMode = DeviceExtension->Mode;
Irp->IoStatus.Information = sizeof(CONSOLE_MODE);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_SET_MODE:
{
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_MODE\n");
DeviceExtension->Mode = pcm->dwMode;
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE */
break;
}
case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE */
break;
}
case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE */
break;
}
case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE:
{
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE\n");
DeviceExtension->CharAttribute = (WORD)*(PWORD)Irp->AssociatedIrp.SystemBuffer;
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME:IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER */
break;
}
case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_CHARACTER\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_CHARACTER */
break;
}
case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER */
break;
}
case IOCTL_CONSOLE_DRAW:
{
PCONSOLE_DRAW ConsoleDraw;
PUCHAR Video;
ULONG x, y;
BOOLEAN DoOptimization = FALSE;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_DRAW\n");
ConsoleDraw = (PCONSOLE_DRAW)MmGetSystemAddressForMdl(Irp->MdlAddress);
/* FIXME: remove */ { ConsoleDraw->X++; ConsoleDraw->CursorX++; }
/* FIXME: remove */ { ConsoleDraw->Y++; ConsoleDraw->CursorY++; }
DPRINT1("%lu %lu %lu %lu\n",
ConsoleDraw->X, ConsoleDraw->Y,
ConsoleDraw->SizeX, ConsoleDraw->SizeY);
ASSERT(ConsoleDraw->X >= 1);
ASSERT(ConsoleDraw->Y >= 1);
ASSERT(ConsoleDraw->X <= DeviceExtension->Columns);
ASSERT(ConsoleDraw->Y <= DeviceExtension->Rows);
ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX >= 1);
ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY >= 1);
ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX - 1 <= DeviceExtension->Columns);
ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY - 1 <= DeviceExtension->Rows);
ASSERT(ConsoleDraw->CursorX >= 1);
ASSERT(ConsoleDraw->CursorY >= 1);
ASSERT(ConsoleDraw->CursorX <= DeviceExtension->Columns);
ASSERT(ConsoleDraw->CursorY <= DeviceExtension->Rows);
#if 0
if (ConsoleDraw->X == 1
&& ConsoleDraw->Y == 1
&& ConsoleDraw->SizeX == DeviceExtension->Columns
&& ConsoleDraw->SizeY == DeviceExtension->Rows)
{
CHECKPOINT1;
/* search if we need to clear all screen */
DoOptimization = TRUE;
Video = (PUCHAR)(ConsoleDraw + 1);
x = 0;
while (DoOptimization && x < DeviceExtension->Columns * DeviceExtension->Rows)
{
if (Video[x++] != ' ')
{
CHECKPOINT1;
DoOptimization = FALSE;
}
/*if (Video[x++] != DeviceExtension->CharAttribute) DoOptimization = FALSE; */
}
if (DoOptimization)
{
CHECKPOINT1;
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '2', 'J');
}
}
#endif
/* add here more optimizations if needed */
if (!DoOptimization)
{
for (y = 0; y < ConsoleDraw->SizeY; y++)
{
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
-(int)(ConsoleDraw->Y + y), ';',
-(int)(ConsoleDraw->X), 'H');
Video = (PUCHAR)(ConsoleDraw + 1);
Video = &Video[((ConsoleDraw->Y + y) * DeviceExtension->Columns + ConsoleDraw->X) * 2];
for (x = 0; x < ConsoleDraw->SizeX; x++)
{
AddToSendBuffer(DeviceExtension, 1, Video[x * 2]);
}
}
}
DeviceExtension->LogicalOffset = (
(ConsoleDraw->CursorY-1) * DeviceExtension->Columns +
(ConsoleDraw->CursorX-1)) * 2;
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
-(int)(ConsoleDraw->CursorY), ';',
-(int)(ConsoleDraw->CursorX), 'H');
/* flush buffer */
AddToSendBuffer(DeviceExtension, 0);
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
default:
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
Stack->Parameters.DeviceIoControl.IoControlCode);
Status = STATUS_NOT_IMPLEMENTED;
}
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}

View file

@ -1,13 +0,0 @@
# $Id$
PATH_TO_TOP = ../../..
TARGET_TYPE = driver
TARGET_NAME = sdisk
TARGET_OBJECTS = sdisk.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk

View file

@ -1,163 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/sdisk/sdisk.c
* PURPOSE: Disk driver for Bochs
* PROGRAMMER: David Welch (welch@mcmail.com)
* UPDATE HISTORY:
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <internal/halio.h>
#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS **************************************************************/
#define PORT (0x3ec)
static VOID SdWriteOffset(ULONG Offset)
{
outl_p(PORT,Offset);
}
NTSTATUS STDCALL
Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
int i;
PCH Buffer;
ULONG Length;
ULONG Information = 0;
switch (Stack->MajorFunction)
{
case IRP_MJ_CREATE:
DPRINT("Creating\n",0);
status = STATUS_SUCCESS;
break;
case IRP_MJ_CLOSE:
status = STATUS_SUCCESS;
break;
case IRP_MJ_WRITE:
DPRINT("Writing %d bytes\n",
Stack->Parameters.Write.Length);
Length = Stack->Parameters.Write.Length;
if ((Length%512)>0)
{
Length = Length - (Length%512);
}
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
DPRINT("Buffer %x\n",Buffer);
#if 0
for (i=0;i<Length;i++)
{
if ((i%512)==0)
{
DPRINT("Offset %x\n",
Stack->Parameters.Write.ByteOffset.LowPart+i);
SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i);
}
outb_p(PORT,Buffer[i]);
DbgPrint("%c",Buffer[i]);
}
#endif
for (i=0;i<(Length/512);i++)
{
DPRINT("Offset %x\n",
Stack->Parameters.Write.ByteOffset.LowPart+i);
SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i);
outsb(PORT,Buffer,512);
}
status = STATUS_SUCCESS;
Information = Length;
break;
case IRP_MJ_READ:
DPRINT("Reading %d bytes\n",
Stack->Parameters.Write.Length);
Length = Stack->Parameters.Write.Length;
if ((Length%512)>0)
{
Length = Length - (Length%512);
}
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
for (i=0;i<Length;i++)
{
if ((i%512)==0)
{
DPRINT("Offset %d\n",
Stack->Parameters.Write.ByteOffset.LowPart+i);
SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i);
}
Buffer[i]=inb_p(PORT);
}
status = STATUS_SUCCESS;
break;
default:
status = STATUS_NOT_IMPLEMENTED;
break;
}
Irp->IoStatus.Status = status;
Irp->IoStatus.Information = Information;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return(status);
}
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
PDEVICE_OBJECT DeviceObject;
NTSTATUS ret;
ANSI_STRING astr;
UNICODE_STRING ustr;
ANSI_STRING asymlink;
UNICODE_STRING usymlink;
DbgPrint("Simple Disk Driver 0.0.1\n");
RtlInitAnsiString(&astr,"\\Device\\SDisk");
RtlAnsiStringToUnicodeString(&ustr,&astr,TRUE);
ret = IoCreateDevice(DriverObject,0,&ustr,
FILE_DEVICE_DISK,0,FALSE,&DeviceObject);
if (ret!=STATUS_SUCCESS)
{
return(ret);
}
RtlInitAnsiString(&asymlink,"\\??\\C:");
RtlAnsiStringToUnicodeString(&usymlink,&asymlink,TRUE);
IoCreateSymbolicLink(&usymlink,&ustr);
DeviceObject->Flags=DO_DIRECT_IO;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_CREATE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_READ] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
DriverObject->DriverUnload = NULL;
return(STATUS_SUCCESS);
}

View file

@ -17,6 +17,7 @@ InitializeCircularBuffer(
IN ULONG BufferSize)
{
DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize);
ASSERT(pBuffer);
pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG);
if (!pBuffer->Buffer)
return STATUS_INSUFFICIENT_RESOURCES;
@ -30,6 +31,7 @@ FreeCircularBuffer(
IN PCIRCULAR_BUFFER pBuffer)
{
DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer);
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
return STATUS_SUCCESS;
}
@ -39,6 +41,7 @@ IsCircularBufferEmpty(
IN PCIRCULAR_BUFFER pBuffer)
{
DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer);
return (pBuffer->ReadPosition == pBuffer->WritePosition);
}
@ -49,6 +52,7 @@ PushCircularBufferEntry(
{
ULONG NextPosition;
DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry);
ASSERT(pBuffer);
ASSERT(pBuffer->Length);
NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length;
if (NextPosition == pBuffer->ReadPosition)
@ -64,6 +68,7 @@ PopCircularBufferEntry(
OUT PUCHAR Entry)
{
DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer);
ASSERT(pBuffer->Length);
if (IsCircularBufferEmpty(pBuffer))
return STATUS_ARRAY_BOUNDS_EXCEEDED;
@ -80,6 +85,7 @@ IncreaseCircularBufferSize(
PUCHAR NewBuffer;
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
ASSERT(pBuffer);
ASSERT(pBuffer->Length);
if (pBuffer->Length > NewBufferSize)
return STATUS_INVALID_PARAMETER;

View file

@ -26,6 +26,8 @@ SerialCreate(
FileObject = Stack->FileObject;
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FileObject);
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
{
CHECKPOINT;
@ -43,7 +45,7 @@ SerialCreate(
if(DeviceExtension->IsOpened)
{
DPRINT("Serial: COM%lu is already opened", DeviceExtension->ComPort);
DPRINT("Serial: COM%lu is already opened\n", DeviceExtension->ComPort);
Status = STATUS_ACCESS_DENIED;
goto ByeBye;
}

View file

@ -118,6 +118,9 @@ SerialSetLineControl(
UCHAR Lcr = 0;
NTSTATUS Status;
ASSERT(DeviceExtension);
ASSERT(NewSettings);
DPRINT("Serial: SerialSetLineControl(COM%lu, Settings { %lu %lu %lu })\n",
DeviceExtension->ComPort, NewSettings->StopBits, NewSettings->Parity, NewSettings->WordLength);
@ -184,6 +187,8 @@ BOOLEAN
SerialClearPerfStats(
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
{
ASSERT(DeviceExtension);
RtlZeroMemory(&DeviceExtension->SerialPerfStats, sizeof(SERIALPERF_STATS));
DeviceExtension->BreakInterruptErrorCount = 0;
return TRUE;
@ -195,6 +200,7 @@ SerialGetPerfStats(IN PIRP pIrp)
PSERIAL_DEVICE_EXTENSION pDeviceExtension;
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)
IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension;
ASSERT(pDeviceExtension);
/*
* we assume buffer is big enough to hold SerialPerfStats structure
* caller must verify this
@ -212,6 +218,8 @@ SerialGetCommProp(
OUT PSERIAL_COMMPROP pCommProp,
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
{
ASSERT(pCommProp);
RtlZeroMemory(pCommProp, sizeof(SERIAL_COMMPROP));
pCommProp->PacketLength = sizeof(SERIAL_COMMPROP);
@ -257,6 +265,7 @@ SerialGetCommStatus(
{
KIRQL Irql;
ASSERT(pSerialStatus);
RtlZeroMemory(pSerialStatus, sizeof(SERIAL_STATUS));
pSerialStatus->Errors = 0;

View file

@ -37,7 +37,8 @@ SerialQueryInformation(
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FileStandardInformation\n");
if (BufferLength < sizeof(FILE_STANDARD_INFORMATION))
Status = STATUS_BUFFER_OVERFLOW;
else
else if (!StandardInfo)
Status = STATUS_INVALID_PARAMETER;
{
StandardInfo->AllocationSize.QuadPart = 0;
StandardInfo->EndOfFile.QuadPart = 0;
@ -52,9 +53,13 @@ SerialQueryInformation(
{
PFILE_POSITION_INFORMATION PositionInfo = (PFILE_POSITION_INFORMATION)SystemBuffer;
ASSERT(PositionInfo);
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FilePositionInformation\n");
if (BufferLength < sizeof(PFILE_POSITION_INFORMATION))
Status = STATUS_BUFFER_OVERFLOW;
else if (!PositionInfo)
Status = STATUS_INVALID_PARAMETER;
else
{
PositionInfo->CurrentByteOffset.QuadPart = 0;

Some files were not shown because too many files have changed in this diff Show more