2003-08-11 Casper S. Hornstrup <chorns@users.sourceforge.net>

* bootdata/txtsetup.sif (SetupData): Add /NOBOOTSCREEN to OsLoadOptions.
	* hal/halx86/display.c (CHAR_ATTRIBUTE_BLACK): Define.
	(HalClearDisplay): Add CharAttribute parameter.
	(HalInitializeDisplay, HalReleaseDisplayOwnership): Blue screen.
	* hal/halx86/halinit.c (DriverEntry): Blue screen for boot phase 2.
	* include/reactos/resource.h (IDB_BOOTIMAGE): Define.
	* ntoskrnl/Makefile: Add boot video objects.
	* ntoskrnl/Makefile.i386: Ditto.
	* ntoskrnl/ntoskrnl.def: Add boot video exports.
	* ntoskrnl/ntoskrnl.edf: Ditto.
	* ntoskrnl/ntoskrnl.rc (IDB_BOOTIMAGE): Define.
	* ntoskrnl/include/internal/kd.h (KdInit3): Add.
	* ntoskrnl/kd/kdebug.c (KdInitSystem): Print information in KdInit3.
	* ntoskrnl/ke/bug.c (KeBugCheckWithTf, KeBugCheckEx): Switch to
	text-mode on crash if needed.
	* ntoskrnl/ke/main.c (ExpInitializeExecutive): Display bootscreen image
	during boot.
	* ntoskrnl/ke/i386/v86m_sup.S (_KiV86Complete): Restore previous mode and
	old exception handler list.
	* subsys/csrss/init.c: Change PrintString to DPRINT1.
	* subsys/smss/init.c: Change PrintString to DPRINT1.
	(SignalInitEvent): New.
	(InitSessionManager): Call SignalInitEvent to switch to text-mode if
	needed.
	* subsys/smss/smss.c: Change PrintString to DPRINT1.
	* ntoskrnl/inbv: New directory.
	* ntoskrnl/inbv/i386: Ditto.
	* ntoskrnl/res: Ditto.
	* include/ntos/bootvid.h: New file.
	* ntoskrnl/inbv/.cvsignore: Ditto.
	* ntoskrnl/inbv/bootvid.c: Ditto.
	* ntoskrnl/inbv/inbv.c: Ditto.
	* ntoskrnl/inbv/i386/.cvsignore: Ditto.
	* ntoskrnl/inbv/i386/pixelsup.S: Ditto.
	* ntoskrnl/res/bootimage.bmp: Ditto.

svn path=/trunk/; revision=5529
This commit is contained in:
Casper Hornstrup 2003-08-11 18:50:12 +00:00
parent bad8c294c5
commit 9858f2daeb
25 changed files with 1539 additions and 202 deletions

View file

@ -1,3 +1,41 @@
2003-08-11 Casper S. Hornstrup <chorns@users.sourceforge.net>
* bootdata/txtsetup.sif (SetupData): Add /NOBOOTSCREEN to OsLoadOptions.
* hal/halx86/display.c (CHAR_ATTRIBUTE_BLACK): Define.
(HalClearDisplay): Add CharAttribute parameter.
(HalInitializeDisplay, HalReleaseDisplayOwnership): Blue screen.
* hal/halx86/halinit.c (DriverEntry): Blue screen for boot phase 2.
* include/reactos/resource.h (IDB_BOOTIMAGE): Define.
* ntoskrnl/Makefile: Add boot video objects.
* ntoskrnl/Makefile.i386: Ditto.
* ntoskrnl/ntoskrnl.def: Add boot video exports.
* ntoskrnl/ntoskrnl.edf: Ditto.
* ntoskrnl/ntoskrnl.rc (IDB_BOOTIMAGE): Define.
* ntoskrnl/include/internal/kd.h (KdInit3): Add.
* ntoskrnl/kd/kdebug.c (KdInitSystem): Print information in KdInit3.
* ntoskrnl/ke/bug.c (KeBugCheckWithTf, KeBugCheckEx): Switch to
text-mode on crash if needed.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Display bootscreen image
during boot.
* ntoskrnl/ke/i386/v86m_sup.S (_KiV86Complete): Restore previous mode and
old exception handler list.
* subsys/csrss/init.c: Change PrintString to DPRINT1.
* subsys/smss/init.c: Change PrintString to DPRINT1.
(SignalInitEvent): New.
(InitSessionManager): Call SignalInitEvent to switch to text-mode if
needed.
* subsys/smss/smss.c: Change PrintString to DPRINT1.
* ntoskrnl/inbv: New directory.
* ntoskrnl/inbv/i386: Ditto.
* ntoskrnl/res: Ditto.
* include/ntos/bootvid.h: New file.
* ntoskrnl/inbv/.cvsignore: Ditto.
* ntoskrnl/inbv/bootvid.c: Ditto.
* ntoskrnl/inbv/inbv.c: Ditto.
* ntoskrnl/inbv/i386/.cvsignore: Ditto.
* ntoskrnl/inbv/i386/pixelsup.S: Ditto.
* ntoskrnl/res/bootimage.bmp: Ditto.
2003-08-09 Martin Fuchs <martin-fuchs@gmx.net>
* win32k/ntuser/window.c implemented NtUserSetShellWindowEx() and

View file

@ -120,10 +120,10 @@ winemine.exe = 2
[SetupData]
DefaultPath = \ReactOS
OsLoadOptions = "/NODEBUG"
;OsLoadOptions = "/DEBUGPORT=COM1"
;OsLoadOptions = "/DEBUGPORT=SCREEN"
;OsLoadOptions = "/DEBUGPORT=BOCHS"
OsLoadOptions = "/NOBOOTSCREEN /NODEBUG"
;OsLoadOptions = "/NOBOOTSCREEN /DEBUGPORT=COM1"
;OsLoadOptions = "/NOBOOTSCREEN /DEBUGPORT=SCREEN"
;OsLoadOptions = "/NOBOOTSCREEN /DEBUGPORT=BOCHS"
[NLS]
AnsiCodepage = c_1252.nls

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: display.c,v 1.5 2003/06/21 14:25:30 gvg Exp $
/* $Id: display.c,v 1.6 2003/08/11 18:50:12 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -110,6 +110,7 @@
#define CRTC_CURLO 0x0f
#define CHAR_ATTRIBUTE_BLACK 0x00 /* black on black */
#define CHAR_ATTRIBUTE 0x17 /* grey on blue */
@ -130,14 +131,14 @@ static PHAL_RESET_DISPLAY_PARAMETERS HalResetDisplayParameters = NULL;
/* STATIC FUNCTIONS *********************************************************/
static VOID
HalClearDisplay (VOID)
VOID
HalClearDisplay (UCHAR CharAttribute)
{
WORD *ptr = (WORD*)VideoBuffer;
ULONG i;
for (i = 0; i < SizeX * SizeY; i++, ptr++)
*ptr = ((CHAR_ATTRIBUTE << 8) + ' ');
*ptr = ((CharAttribute << 8) + ' ');
CursorX = 0;
CursorY = 0;
@ -214,7 +215,7 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
#ifdef BOCHS_30ROWS
SizeY=30;
#endif
HalClearDisplay();
HalClearDisplay(CHAR_ATTRIBUTE_BLACK);
DisplayInitialized = TRUE;
}
@ -238,7 +239,7 @@ HalReleaseDisplayOwnership()
if (HalResetDisplayParameters(SizeX, SizeY) == TRUE)
{
HalOwnsDisplay = TRUE;
HalClearDisplay();
HalClearDisplay(CHAR_ATTRIBUTE);
}
}

View file

@ -1,4 +1,4 @@
/* $Id: halinit.c,v 1.4 2003/02/26 14:14:03 ekohl Exp $
/* $Id: halinit.c,v 1.5 2003/08/11 18:50:12 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -24,6 +24,9 @@
/* FUNCTIONS ***************************************************************/
extern VOID
HalClearDisplay (UCHAR CharAttribute);
NTSTATUS
STDCALL
DriverEntry(
@ -39,6 +42,7 @@ HalInitSystem (ULONG BootPhase,
{
if (BootPhase == 0)
{
/* Initialize display and make the screen black */
HalInitializeDisplay (LoaderBlock);
#ifdef MP
@ -63,6 +67,11 @@ HalInitSystem (ULONG BootPhase,
/* Enumerate the devices on the motherboard */
HalpStartEnumerator();
}
else if (BootPhase == 2)
{
/* Go to blue screen */
HalClearDisplay (0x17); /* grey on blue */
}
return TRUE;
}

76
reactos/include/ntos/bootvid.h Executable file
View file

@ -0,0 +1,76 @@
#ifndef __INCLUDE_NTOS_BOOTVID_H
#define __INCLUDE_NTOS_BOOTVID_H
VOID
STDCALL
InbvAcquireDisplayOwnership(VOID);
BOOLEAN
STDCALL
InbvCheckDisplayOwnership(VOID);
BOOLEAN
STDCALL
InbvDisplayString(IN PCHAR String);
VOID
STDCALL
InbvEnableBootDriver(IN BOOLEAN Enable);
BOOLEAN
STDCALL
InbvEnableDisplayString(IN BOOLEAN Enable);
VOID
STDCALL
InbvInstallDisplayStringFilter(IN PVOID Unknown);
BOOLEAN
STDCALL
InbvIsBootDriverInstalled(VOID);
VOID
STDCALL
InbvNotifyDisplayOwnershipLost(IN PVOID Callback);
BOOLEAN
STDCALL
InbvResetDisplay(VOID);
VOID
STDCALL
InbvSetScrollRegion(IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height);
VOID
STDCALL
InbvSetTextColor(IN ULONG Color);
VOID
STDCALL
InbvSolidColorFill(IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Color);
VOID
STDCALL
VidCleanUp(VOID);
BOOLEAN
STDCALL
VidInitialize(VOID);
BOOLEAN
STDCALL
VidResetDisplay(VOID);
BOOLEAN
STDCALL
VidIsBootDriverInstalled(VOID);
#endif /* __INCLUDE_NTOS_BOOTVID_H */

View file

@ -32,5 +32,8 @@
/* ReactOS default Application Registry Root Path */
#define RES_STR_ROSAPP_REGISTRY_ROOT "Software\\ReactWare"
/* Bitmaps */
#define IDB_BOOTIMAGE 100
#endif /* ndef _INC_REACTOS_RESOURCE_H */

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.103 2003/08/07 04:03:24 royce Exp $
# $Id: Makefile,v 1.104 2003/08/11 18:50:12 chorns Exp $
#
# ReactOS Operating System
#
@ -340,6 +340,11 @@ OBJECTS_KD = \
kd/gdbstub.o \
kd/mda.o
# Boot video (Inbv)
OBJECTS_INBV = \
inbv/inbv.o \
inbv/bootvid.o
DEP_OBJECTS := $(OBJECTS_NT) $(OBJECTS_MM) $(OBJECTS_ARCH) \
$(OBJECTS_IO) $(OBJECTS_KE) $(OBJECTS_OB) \
$(OBJECTS_PS) $(OBJECTS_EX) $(OBJECTS_CC) $(OBJECTS_FS) $(OBJECTS_SE) \
@ -477,6 +482,12 @@ $(OBJECTS_PATH)/kd.o: $(OBJECTS_KD)
-o $(OBJECTS_PATH)/kd.o \
$(OBJECTS_KD)
$(OBJECTS_PATH)/inbv.o: $(OBJECTS_INBV)
$(LD) \
-r \
-o $(OBJECTS_PATH)/inbv.o \
$(OBJECTS_INBV)
# Note: arch.o MUST be the first file!!!
OBJECTS := \
$(OBJECTS_PATH)/arch.o \
@ -497,6 +508,7 @@ OBJECTS := \
$(OBJECTS_PATH)/ps.o \
$(OBJECTS_PATH)/rtl.o \
$(OBJECTS_PATH)/se.o \
$(OBJECTS_PATH)/inbv.o \
$(OBJECTS_RESOURCE)
@ -664,7 +676,7 @@ implib: $(DDK_PATH_LIB)/$(TARGETNAME).a
clean:
- $(RM) $(OBJECTS_PATH)/*.o cc/*.o cm/*.o dbg/*.o dbg/i386/*.o ex/*.o \
ex/i386/*.o io/*.o ke/*.o ldr/*.o mm/*.o nt/*.o ob/*.o ps/*.o \
ex/i386/*.o inbv/*.o io/*.o ke/*.o ldr/*.o mm/*.o nt/*.o ob/*.o ps/*.o \
rtl/*.o rtl/i386/*.o se/*.o ke/i386/*.o mm/i386/*.o fs/*.o po/*.o \
lpc/*.o kd/*.o $(TARGETNAME).o junk.tmp base.tmp temp.exp \
$(TARGETNAME).exe $(TARGETNAME).nostrip.exe $(TARGETNAME).sym ntoskrnl.map \

View file

@ -52,7 +52,11 @@ OBJECTS_RTL_I386 := \
rtl/i386/exception.o \
rtl/i386/seh.o
OBJECTS_INBV_I386 := \
inbv/i386/pixelsup.o
RTL_EXCLUDE_FILTER :=
OBJECTS_ARCH = $(OBJECTS_BOOT) $(OBJECTS_EX_I386) $(OBJECTS_KE_I386) $(OBJECTS_MM_I386) $(OBJECTS_RTL_I386)
OBJECTS_ARCH = $(OBJECTS_BOOT) $(OBJECTS_EX_I386) $(OBJECTS_KE_I386) $(OBJECTS_MM_I386) \
$(OBJECTS_RTL_I386) $(OBJECTS_INBV_I386)

View file

@ -0,0 +1,2 @@
*.d
*.o

816
reactos/ntoskrnl/inbv/bootvid.c Executable file
View file

@ -0,0 +1,816 @@
/* $Id: bootvid.c,v 1.1 2003/08/11 18:50:12 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/inbv/bootvid.c
* PURPOSE: Boot video support
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY:
* 12-07-2003 CSH Created
*/
/* INCLUDES ******************************************************************/
#include <roskrnl.h>
#include <reactos/resource.h>
#include <internal/i386/mm.h>
#include <internal/v86m.h>
#define NDEBUG
#include <internal/debug.h>
#define RT_BITMAP 2
typedef struct tagRGBQUAD {
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
} RGBQUAD, *PRGBQUAD;
typedef long FXPT2DOT30;
typedef struct tagCIEXYZ {
FXPT2DOT30 ciexyzX;
FXPT2DOT30 ciexyzY;
FXPT2DOT30 ciexyzZ;
} CIEXYZ;
typedef CIEXYZ * LPCIEXYZ;
typedef struct tagCIEXYZTRIPLE {
CIEXYZ ciexyzRed;
CIEXYZ ciexyzGreen;
CIEXYZ ciexyzBlue;
} CIEXYZTRIPLE;
typedef CIEXYZTRIPLE *LPCIEXYZTRIPLE;
typedef struct {
DWORD bV5Size;
LONG bV5Width;
LONG bV5Height;
WORD bV5Planes;
WORD bV5BitCount;
DWORD bV5Compression;
DWORD bV5SizeImage;
LONG bV5XPelsPerMeter;
LONG bV5YPelsPerMeter;
DWORD bV5ClrUsed;
DWORD bV5ClrImportant;
DWORD bV5RedMask;
DWORD bV5GreenMask;
DWORD bV5BlueMask;
DWORD bV5AlphaMask;
DWORD bV5CSType;
CIEXYZTRIPLE bV5Endpoints;
DWORD bV5GammaRed;
DWORD bV5GammaGreen;
DWORD bV5GammaBlue;
DWORD bV5Intent;
DWORD bV5ProfileData;
DWORD bV5ProfileSize;
DWORD bV5Reserved;
} BITMAPV5HEADER, *PBITMAPV5HEADER;
#define MISC 0x3c2
#define SEQ 0x3c4
#define CRTC 0x3d4
#define GRAPHICS 0x3ce
#define FEATURE 0x3da
#define ATTRIB 0x3c0
#define STATUS 0x3da
typedef struct _VideoMode {
unsigned short VidSeg;
unsigned char Misc;
unsigned char Feature;
unsigned short Seq[6];
unsigned short Crtc[25];
unsigned short Gfx[9];
unsigned char Attrib[21];
} VideoMode;
typedef struct {
ULONG r;
ULONG g;
ULONG b;
} FADER_PALETTE_ENTRY;
/* In pixelsups.S */
extern VOID
InbvPutPixels(int x, int y, unsigned long c);
/* GLOBALS *******************************************************************/
char *vidmem;
/* Must be 4 bytes per entry */
long maskbit[640];
long y80[480];
static HANDLE BitmapThreadHandle;
static CLIENT_ID BitmapThreadId;
static BOOLEAN BitmapIsDrawn;
static BOOLEAN BitmapThreadShouldTerminate;
static PUCHAR BootimageBitmap;
static BOOLEAN InGraphicsMode = FALSE;
/* DATA **********************************************************************/
static VideoMode Mode12 = {
0xa000, 0xe3, 0x00,
{0x03, 0x01, 0x0f, 0x00, 0x06 },
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x59, 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
0xff},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f, 0x81, 0x00, 0x0f, 0x00, 0x00}
};
static BOOLEAN VideoAddressSpaceInitialized = FALSE;
static PVOID NonBiosBaseAddress;
/* FUNCTIONS *****************************************************************/
static BOOLEAN
InbvFindBootimage()
{
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
LDR_RESOURCE_INFO ResourceInfo;
NTSTATUS Status;
PVOID BaseAddress = (PVOID)KERNEL_BASE;
ULONG Size;
ResourceInfo.Type = RT_BITMAP;
ResourceInfo.Name = IDB_BOOTIMAGE;
ResourceInfo.Language = 0x09;
Status = LdrFindResource_U(BaseAddress,
&ResourceInfo,
RESOURCE_DATA_LEVEL,
&ResourceDataEntry);
if (!NT_SUCCESS(Status))
{
DPRINT("LdrFindResource_U() failed with status 0x%.08x\n", Status);
return FALSE;
}
Status = LdrAccessResource(BaseAddress,
ResourceDataEntry,
(PVOID*)&BootimageBitmap,
&Size);
if (!NT_SUCCESS(Status))
{
DPRINT("LdrAccessResource() failed with status 0x%.08x\n", Status);
return FALSE;
}
return TRUE;
}
static BOOLEAN
InbvInitializeVideoAddressSpace(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING PhysMemName;
NTSTATUS Status;
HANDLE PhysMemHandle;
PVOID BaseAddress;
LARGE_INTEGER Offset;
ULONG ViewSize;
CHAR IVT[1024];
CHAR BDA[256];
PVOID start = (PVOID)0x0;
/*
* Open the physical memory section
*/
RtlInitUnicodeStringFromLiteral(&PhysMemName, L"\\Device\\PhysicalMemory");
InitializeObjectAttributes(&ObjectAttributes,
&PhysMemName,
0,
NULL,
NULL);
Status = NtOpenSection(&PhysMemHandle, SECTION_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT("Couldn't open \\Device\\PhysicalMemory\n");
return FALSE;
}
/*
* Map the BIOS and device registers into the address space
*/
Offset.QuadPart = 0xa0000;
ViewSize = 0x100000 - 0xa0000;
BaseAddress = (PVOID)0xa0000;
Status = NtMapViewOfSection(PhysMemHandle,
NtCurrentProcess(),
&BaseAddress,
0,
8192,
&Offset,
&ViewSize,
ViewUnmap,
0,
PAGE_EXECUTE_READWRITE);
if (!NT_SUCCESS(Status))
{
DPRINT("Couldn't map physical memory (%x)\n", Status);
NtClose(PhysMemHandle);
return FALSE;
}
NtClose(PhysMemHandle);
if (BaseAddress != (PVOID)0xa0000)
{
DPRINT("Couldn't map physical memory at the right address "
"(was %x)\n", BaseAddress);
return FALSE;
}
/*
* Map some memory to use for the non-BIOS parts of the v86 mode address
* space
*/
NonBiosBaseAddress = (PVOID)0x1;
ViewSize = 0xa0000 - 0x1000;
Status = NtAllocateVirtualMemory(NtCurrentProcess(),
&NonBiosBaseAddress,
0,
&ViewSize,
MEM_COMMIT,
PAGE_EXECUTE_READWRITE);
if (!NT_SUCCESS(Status))
{
DPRINT("Failed to allocate virtual memory (Status %x)\n", Status);
return FALSE;
}
if (NonBiosBaseAddress != (PVOID)0x0)
{
DPRINT("Failed to allocate virtual memory at right address "
"(was %x)\n", NonBiosBaseAddress);
return FALSE;
}
/*
* Get the real mode IVT from the kernel
*/
Status = NtVdmControl(0, IVT);
if (!NT_SUCCESS(Status))
{
DPRINT("NtVdmControl failed (status %x)\n", Status);
return FALSE;
}
/*
* Copy the real mode IVT into the right place
*/
memcpy(start, IVT, 1024);
/*
* Get the BDA from the kernel
*/
Status = NtVdmControl(1, BDA);
if (!NT_SUCCESS(Status))
{
DPRINT("NtVdmControl failed (status %x)\n", Status);
return FALSE;
}
/*
* Copy the BDA into the right place
*/
memcpy((PVOID)0x400, BDA, 256);
return TRUE;
}
static BOOLEAN
InbvDeinitializeVideoAddressSpace(VOID)
{
ULONG RegionSize;
PUCHAR ViewBase;
RegionSize = 0xa0000 - 0x1000;
NtFreeVirtualMemory(NtCurrentProcess(),
&NonBiosBaseAddress,
&RegionSize,
MEM_RELEASE);
ViewBase = (PUCHAR) 0xa0000;
NtUnmapViewOfSection(NtCurrentProcess(), ViewBase);
return TRUE;
}
static VOID
vgaPreCalc()
{
ULONG j;
for(j = 0; j < 80; j++)
{
maskbit[j * 8 + 0] = 128;
maskbit[j * 8 + 1] = 64;
maskbit[j * 8 + 2] = 32;
maskbit[j * 8 + 3] = 16;
maskbit[j * 8 + 4] = 8;
maskbit[j * 8 + 5] = 4;
maskbit[j * 8 + 6] = 2;
maskbit[j * 8 + 7] = 1;
}
for(j = 0; j < 480; j++)
{
y80[j] = j * 80; /* 80 = 640 / 8 = Number of bytes per scanline */
}
}
static __inline__ VOID
InbvOutxay(PUSHORT ad, UCHAR x, UCHAR y)
{
USHORT xy = (x << 8) + y;
WRITE_PORT_USHORT(ad, xy);
}
static VOID
InbvSetMode(VideoMode mode)
{
unsigned char x;
WRITE_PORT_UCHAR((PUCHAR)MISC, mode.Misc);
WRITE_PORT_UCHAR((PUCHAR)STATUS, 0);
WRITE_PORT_UCHAR((PUCHAR)FEATURE, mode.Feature);
for(x=0; x<5; x++)
{
InbvOutxay((PUSHORT)SEQ, mode.Seq[x], x);
}
WRITE_PORT_USHORT((PUSHORT)CRTC, 0x11);
WRITE_PORT_USHORT((PUSHORT)CRTC, (mode.Crtc[0x11] & 0x7f));
for(x=0; x<25; x++)
{
InbvOutxay((PUSHORT)CRTC, mode.Crtc[x], x);
}
for(x=0; x<9; x++)
{
InbvOutxay((PUSHORT)GRAPHICS, mode.Gfx[x], x);
}
x=READ_PORT_UCHAR((PUCHAR)FEATURE);
for(x=0; x<21; x++)
{
WRITE_PORT_UCHAR((PUCHAR)ATTRIB, x);
WRITE_PORT_UCHAR((PUCHAR)ATTRIB, mode.Attrib[x]);
}
x=READ_PORT_UCHAR((PUCHAR)STATUS);
WRITE_PORT_UCHAR((PUCHAR)ATTRIB, 0x20);
}
static VOID
InbvInitVGAMode(VOID)
{
KV86M_REGISTERS Regs;
NTSTATUS Status;
vidmem = (char *)(0xd0000000 + 0xa0000);
memset(&Regs, 0, sizeof(Regs));
Regs.Eax = 0x0012;
Status = Ke386CallBios(0x10, &Regs);
assert(NT_SUCCESS(Status));
/* Get VGA registers into the correct state (mainly for setting up the palette registers correctly) */
InbvSetMode(Mode12);
/* Get the VGA into the mode we want to work with */
WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); /* Set */
WRITE_PORT_UCHAR((PUCHAR)0x3cf,0); /* the MASK */
WRITE_PORT_USHORT((PUSHORT)0x3ce,0x0205); /* write mode = 2 (bits 0,1) read mode = 0 (bit 3) */
(UCHAR) READ_REGISTER_UCHAR(vidmem); /* Update bit buffer */
WRITE_REGISTER_UCHAR(vidmem, 0); /* Write the pixel */
WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08);
WRITE_PORT_UCHAR((PUCHAR)0x3cf,0xff);
/* Zero out video memory (clear a possibly trashed screen) */
RtlZeroMemory(vidmem, 64000);
vgaPreCalc();
}
BOOLEAN
STDCALL
VidResetDisplay(VOID)
{
KV86M_REGISTERS Regs;
NTSTATUS Status;
#if 0
/* FIXME: What if the system has crashed, eg. this function is called from KeBugCheck() ? */
/* Maybe wait until boot screen bitmap is drawn */
while (!BitmapIsDrawn)
{
NtYieldExecution();
}
#endif
/* Zero out video memory (clear the screen) */
RtlZeroMemory(vidmem, 64000);
memset(&Regs, 0, sizeof(Regs));
Regs.Eax = 0x0003;
Status = Ke386CallBios(0x10, &Regs);
assert(NT_SUCCESS(Status));
memset(&Regs, 0, sizeof(Regs));
Regs.Eax = 0x1112;
Status = Ke386CallBios(0x10, &Regs);
assert(NT_SUCCESS(Status));
memset(&Regs, 0, sizeof(Regs));
Regs.Eax = 0x0632; // AH = 0x06 - Scroll active page up, AL = 0x32 - Clear 25 lines
Regs.Ecx = 0x0000; // CX = 0x0000 - Upper left of scroll
Regs.Edx = 0x314F; // DX = 0x314F - Lower right of scroll
Regs.Ebx = 0x1100; // Use normal attribute on blanked line
Status = Ke386CallBios(0x10, &Regs);
assert(NT_SUCCESS(Status));
InGraphicsMode = FALSE;
return TRUE;
}
VOID
STDCALL
VidCleanUp(VOID)
{
if (InGraphicsMode)
{
VidResetDisplay();
}
if (VideoAddressSpaceInitialized)
{
InbvDeinitializeVideoAddressSpace();
VideoAddressSpaceInitialized = FALSE;
}
BitmapThreadShouldTerminate = TRUE;
}
static __inline__ VOID
InbvSetColor(int cindex, unsigned char red, unsigned char green, unsigned char blue)
{
red = red / (256 / 64);
green = green / (256 / 64);
blue = blue / (256 / 64);
WRITE_PORT_UCHAR((PUCHAR)0x03c8, cindex);
WRITE_PORT_UCHAR((PUCHAR)0x03c9, red);
WRITE_PORT_UCHAR((PUCHAR)0x03c9, green);
WRITE_PORT_UCHAR((PUCHAR)0x03c9, blue);
}
static __inline__ VOID
InbvSetBlackPalette()
{
register ULONG r = 0;
for (r = 0; r < 16; r++)
{
InbvSetColor(r, 0, 0, 0);
}
}
static VOID
InbvDisplayBitmap(ULONG Width, ULONG Height, PCHAR ImageData)
{
ULONG j,k,y;
register ULONG i;
register ULONG x;
register ULONG c;
k = 0;
for (y = 0; y < Height; y++)
{
for (j = 0; j < 8; j++)
{
x = j;
/*
* Loop through the line and process every 8th pixel.
* This way we can get a way with using the same bit mask
* for several pixels and thus not need to do as much I/O
* communication.
*/
while (x < 640)
{
c = 0;
if (x < Width)
{
c = ImageData[k + x];
for (i = 1; i < 4; i++)
{
if (x + i*8 < Width)
{
c |= (ImageData[k + x + i * 8] << i * 8);
}
}
}
InbvPutPixels(x, 479 - y, c);
x += 8*4;
}
}
k += Width;
}
}
static VOID
InbvDisplayCompressedBitmap()
{
PBITMAPV5HEADER bminfo;
ULONG i,j,k;
ULONG x,y;
ULONG curx,cury;
ULONG bfOffBits;
ULONG clen;
PCHAR ImageData;
bminfo = (PBITMAPV5HEADER) &BootimageBitmap[0];
DPRINT("bV5Size = %d\n", bminfo->bV5Size);
DPRINT("bV5Width = %d\n", bminfo->bV5Width);
DPRINT("bV5Height = %d\n", bminfo->bV5Height);
DPRINT("bV5Planes = %d\n", bminfo->bV5Planes);
DPRINT("bV5BitCount = %d\n", bminfo->bV5BitCount);
DPRINT("bV5Compression = %d\n", bminfo->bV5Compression);
DPRINT("bV5SizeImage = %d\n", bminfo->bV5SizeImage);
DPRINT("bV5XPelsPerMeter = %d\n", bminfo->bV5XPelsPerMeter);
DPRINT("bV5YPelsPerMeter = %d\n", bminfo->bV5YPelsPerMeter);
DPRINT("bV5ClrUsed = %d\n", bminfo->bV5ClrUsed);
DPRINT("bV5ClrImportant = %d\n", bminfo->bV5ClrImportant);
bfOffBits = bminfo->bV5Size + bminfo->bV5ClrUsed * sizeof(RGBQUAD);
DPRINT("bfOffBits = %d\n", bfOffBits);
DPRINT("size of color indices = %d\n", bminfo->bV5ClrUsed * sizeof(RGBQUAD));
DPRINT("first byte of data = %d\n", BootimageBitmap[bfOffBits]);
InbvSetBlackPalette();
ImageData = ExAllocatePool(NonPagedPool, bminfo->bV5Width * bminfo->bV5Height);
RtlZeroMemory(ImageData, bminfo->bV5Width * bminfo->bV5Height);
/*
* ImageData has 1 pixel per byte.
* bootimage has 2 pixels per byte.
*/
if (bminfo->bV5Compression == 2)
{
k = 0;
j = 0;
while ((j < bminfo->bV5SizeImage) && (k < (ULONG) (bminfo->bV5Width * bminfo->bV5Height)))
{
unsigned char b;
clen = BootimageBitmap[bfOffBits + j];
j++;
if (clen > 0)
{
/* Encoded mode */
b = BootimageBitmap[bfOffBits + j];
j++;
for (i = 0; i < (clen / 2); i++)
{
ImageData[k] = (b & 0xf0) >> 4;
k++;
ImageData[k] = b & 0xf;
k++;
}
if ((clen & 1) > 0)
{
ImageData[k] = (b & 0xf0) >> 4;
k++;
}
}
else
{
/* Absolute mode */
b = BootimageBitmap[bfOffBits + j];
j++;
if (b == 0)
{
/* End of line */
}
else if (b == 1)
{
/* End of image */
break;
}
else if (b == 2)
{
x = BootimageBitmap[bfOffBits + j];
j++;
y = BootimageBitmap[bfOffBits + j];
j++;
curx = k % bminfo->bV5Width;
cury = k / bminfo->bV5Width;
k = (cury + y) * bminfo->bV5Width + (curx + x);
}
else
{
if ((j & 1) > 0)
{
DPRINT("Unaligned copy!\n");
}
clen = b;
for (i = 0; i < (clen / 2); i++)
{
b = BootimageBitmap[bfOffBits + j];
j++;
ImageData[k] = (b & 0xf0) >> 4;
k++;
ImageData[k] = b & 0xf;
k++;
}
if ((clen & 1) > 0)
{
b = BootimageBitmap[bfOffBits + j];
j++;
ImageData[k] = (b & 0xf0) >> 4;
k++;
}
/* Word align */
j += (j & 1);
}
}
}
InbvDisplayBitmap(bminfo->bV5Width, bminfo->bV5Height, ImageData);
}
else
{
DbgPrint("Warning boot image need to be compressed using RLE4\n");
}
ExFreePool(ImageData);
}
#define PALETTE_FADE_STEPS 20
#define PALETTE_FADE_TIME 20 * 10000 /* 20ms */
static VOID
InbvFadeUpPalette()
{
PBITMAPV5HEADER bminfo;
PRGBQUAD Palette;
ULONG i;
unsigned char r,g,b;
register ULONG c;
LARGE_INTEGER Interval;
FADER_PALETTE_ENTRY FaderPalette[16];
FADER_PALETTE_ENTRY FaderPaletteDelta[16];
RtlZeroMemory(&FaderPalette, sizeof(FaderPalette));
RtlZeroMemory(&FaderPaletteDelta, sizeof(FaderPaletteDelta));
bminfo = (PBITMAPV5HEADER) &BootimageBitmap[0]; //sizeof(BITMAPFILEHEADER)];
Palette = (PRGBQUAD) &BootimageBitmap[/* sizeof(BITMAPFILEHEADER) + */ bminfo->bV5Size];
for (i = 0; i < 16; i++)
{
if (i < bminfo->bV5ClrUsed)
{
FaderPaletteDelta[i].r = ((Palette[i].rgbRed << 8) / PALETTE_FADE_STEPS);
FaderPaletteDelta[i].g = ((Palette[i].rgbGreen << 8) / PALETTE_FADE_STEPS);
FaderPaletteDelta[i].b = ((Palette[i].rgbBlue << 8) / PALETTE_FADE_STEPS);
}
}
for (i = 0; i < PALETTE_FADE_STEPS; i++)
{
for (c = 0; c < bminfo->bV5ClrUsed; c++)
{
/* Add the delta */
FaderPalette[c].r += FaderPaletteDelta[c].r;
FaderPalette[c].g += FaderPaletteDelta[c].g;
FaderPalette[c].b += FaderPaletteDelta[c].b;
/* Get the integer values */
r = FaderPalette[c].r >> 8;
g = FaderPalette[c].g >> 8;
b = FaderPalette[c].b >> 8;
/* Don't go too far */
if (r > Palette[c].rgbRed)
r = Palette[c].rgbRed;
if (g > Palette[c].rgbGreen)
g = Palette[c].rgbGreen;
if (b > Palette[c].rgbBlue)
b = Palette[c].rgbBlue;
/* Update the hardware */
InbvSetColor(c, r, g, b);
}
Interval.QuadPart = -PALETTE_FADE_TIME;
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
}
}
static VOID STDCALL
InbvBitmapThreadMain(PVOID Ignored)
{
if (InbvFindBootimage())
{
InbvDisplayCompressedBitmap();
InbvFadeUpPalette();
}
else
{
DbgPrint("Warning: Cannot find boot image\n");
}
BitmapIsDrawn = TRUE;
for(;;)
{
if (BitmapThreadShouldTerminate)
{
DPRINT("Terminating\n");
return;
}
NtYieldExecution();
}
}
BOOLEAN
STDCALL
VidIsBootDriverInstalled(VOID)
{
return InGraphicsMode;
}
BOOLEAN
STDCALL
VidInitialize(VOID)
{
NTSTATUS Status;
if (!VideoAddressSpaceInitialized)
{
InbvInitializeVideoAddressSpace();
}
InbvInitVGAMode();
InGraphicsMode = TRUE;
BitmapIsDrawn = FALSE;
BitmapThreadShouldTerminate = FALSE;
Status = PsCreateSystemThread(&BitmapThreadHandle,
THREAD_ALL_ACCESS,
NULL,
NULL,
&BitmapThreadId,
InbvBitmapThreadMain,
NULL);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
return TRUE;
}

View file

@ -0,0 +1,2 @@
*.d
*.o

View file

@ -0,0 +1,101 @@
/* $Id: pixelsup.S,v 1.1 2003/08/11 18:50:12 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/inbv/i386/pixelsup.S
* PURPOSE: Boot video support
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
/*
* VOID
* InbvPutPixels(int x, int y, unsigned long c);
*
* Will put 4 pixels on the screen at
* (x+0*8,y), (x+1*8,y), (x+2*8,y), and (x+3*8,y)
* c will contain:
* bits 0- 3: Palette index for pixel at (x+0*8,y)
* bits 8-11: Palette index for pixel at (x+1*8,y)
* bits 16-19: Palette index for pixel at (x+2*8,y)
* bits 24-27: Palette index for pixel at (x+3*8,y)
*
* Parameters:
* [EBP+08h] - x X-coordinate of first pixel
* [ESP+0Ch] - y Y-coordinate of first pixel
* [ESP+10h] - c 4*4-bit color indices
*/
.globl _InbvPutPixels
_InbvPutPixels:
pushl %ebp
movl %esp, %ebp
/* Compute mask and put it in EBX
mask = maskbit[x] */
movl 0x8(%ebp), %esi
movl _maskbit(,%esi, 4), %ebx
/* Don't set bit mask if it is already set */
cmpl (inbv_last_mask),%ebx
je .nomask
/* Set Mask Bit Register
WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08);
WRITE_PORT_UCHAR((PUCHAR)0x3cf,mask); */
movl %ebx,(inbv_last_mask)
movw $0x3ce,%dx
movb $0x08,%al
outb %al,%dx
movw $0x3cf,%dx
movb %bl,%al
outb %al,%dx
.nomask:
/* Compute offset in video memory and put it in EBX
offset = (x >> 3) + y80[y]; */
movl 0xC(%ebp), %esi /* y */
movl _y80(,%esi, 4), %ebx
movl 0x8(%ebp), %eax /* x */
shrl $0x3, %eax
addl %eax, %ebx
/* Latch first byte
(UCHAR) READ_REGISTER_UCHAR(vidmem + offset+0); */
movl (_vidmem), %esi
addl %ebx, %esi
movb 0x0(%esi), %bl
/* Write color index for first pixel
*((PUCHAR)(vidmem + offset+0)) = (c >> 0*8) & 0xff; */
movl 0x10(%ebp), %eax
movb %al, 0x0(%esi)
/* Latch second byte
(UCHAR) READ_REGISTER_UCHAR(vidmem + offset+1); */
movb 0x1(%esi), %bl
/* Write color index for second pixel
*((PUCHAR)(vidmem + offset+1)) = (c >> 1*8) & 0xff; */
shrl $0x8, %eax
movb %al, 0x1(%esi)
/* Latch third byte
(UCHAR) READ_REGISTER_UCHAR(vidmem + offset+2); */
movb 0x2(%esi), %bl
/* Write color index for third pixel
*((PUCHAR)(vidmem + offset+2)) = (c >> 2*8) & 0xff; */
shrl $0x8, %eax
movb %al, 0x2(%esi)
/* Latch fourth byte
(UCHAR) READ_REGISTER_UCHAR(vidmem + offset+3); */
movb 0x3(%esi), %bl
/* Write color index for fourth pixel
*((PUCHAR)(vidmem + offset+3)) = (c >> 3*8) & 0xff; */
shrl $0x8, %eax
movb %al, 0x3(%esi)
popl %ebp
ret
.bss
inbv_last_mask:
.short 0

127
reactos/ntoskrnl/inbv/inbv.c Executable file
View file

@ -0,0 +1,127 @@
/* $Id: inbv.c,v 1.1 2003/08/11 18:50:12 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/inbv/inbv.c
* PURPOSE: Boot video support
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY:
* 12-07-2003 CSH Created
*/
/* INCLUDES ******************************************************************/
#include <roskrnl.h>
#include <ntos/bootvid.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *******************************************************************/
/* DATA **********************************************************************/
/* FUNCTIONS *****************************************************************/
VOID
STDCALL
InbvAcquireDisplayOwnership(VOID)
{
}
BOOLEAN
STDCALL
InbvCheckDisplayOwnership(VOID)
{
return FALSE;
}
BOOLEAN
STDCALL
InbvDisplayString(IN PCHAR String)
{
return FALSE;
}
VOID
STDCALL
InbvEnableBootDriver(IN BOOLEAN Enable)
{
if (Enable)
{
VidInitialize();
}
else
{
VidCleanUp();
}
}
BOOLEAN
STDCALL
InbvEnableDisplayString(IN BOOLEAN Enable)
{
return FALSE;
}
VOID
STDCALL
InbvInstallDisplayStringFilter(IN PVOID Unknown)
{
}
BOOLEAN
STDCALL
InbvIsBootDriverInstalled(VOID)
{
return VidIsBootDriverInstalled();
}
VOID
STDCALL
InbvNotifyDisplayOwnershipLost(IN PVOID Callback)
{
}
BOOLEAN
STDCALL
InbvResetDisplay(VOID)
{
return VidResetDisplay();
}
VOID
STDCALL
InbvSetScrollRegion(IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height)
{
}
VOID
STDCALL
InbvSetTextColor(IN ULONG Color)
{
}
VOID
STDCALL
InbvSolidColorFill(IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Color)
{
}

View file

@ -1,4 +1,4 @@
/* $Id: kd.h,v 1.18 2003/02/14 17:52:30 ekohl Exp $
/* $Id: kd.h,v 1.19 2003/08/11 18:50:12 chorns Exp $
*
* kernel debugger prototypes
*/
@ -47,6 +47,9 @@ KdInit1(VOID);
VOID
KdInit2(VOID);
VOID
KdInit3(VOID);
VOID
KdPutChar(UCHAR Value);

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.45 2003/07/21 21:53:51 royce Exp $
/* $Id: kdebug.c,v 1.46 2003/08/11 18:50:12 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -225,32 +225,6 @@ KdInitSystem(ULONG Reserved,
p1 = p2;
}
/* Print some information */
if (KdDebuggerEnabled == TRUE)
{
if (KdDebugState & KD_DEBUG_GDB)
PrintString("\n GDB debugging enabled. COM%ld %ld Baud\n\n",
GdbPortInfo.ComPort, GdbPortInfo.BaudRate);
if (KdDebugState & KD_DEBUG_PICE)
PrintString("\n Private ICE debugger enabled\n\n");
if (KdDebugState & KD_DEBUG_SCREEN)
PrintString("\n Screen debugging enabled\n\n");
if (KdDebugState & KD_DEBUG_BOCHS)
PrintString("\n Bochs debugging enabled\n\n");
if (KdDebugState & KD_DEBUG_SERIAL)
PrintString("\n Serial debugging enabled. COM%ld %ld Baud\n\n",
LogPortInfo.ComPort, LogPortInfo.BaudRate);
if (KdDebugState & KD_DEBUG_FILELOG)
PrintString("\n File log debugging enabled\n\n");
if (KdDebugState & KD_DEBUG_MDA)
PrintString("\n MDA debugging enabled\n\n");
}
/* Perform any initialization nescessary */
if (KdDebuggerEnabled == TRUE)
{
@ -291,6 +265,38 @@ VOID KdInit2(VOID)
}
}
VOID
KdInit3(VOID)
{
/* Print some information */
if (KdDebuggerEnabled == TRUE)
{
if (KdDebugState & KD_DEBUG_GDB)
PrintString("\n GDB debugging enabled. COM%ld %ld Baud\n\n",
GdbPortInfo.ComPort, GdbPortInfo.BaudRate);
if (KdDebugState & KD_DEBUG_PICE)
PrintString("\n Private ICE debugger enabled\n\n");
if (KdDebugState & KD_DEBUG_SCREEN)
PrintString("\n Screen debugging enabled\n\n");
if (KdDebugState & KD_DEBUG_BOCHS)
PrintString("\n Bochs debugging enabled\n\n");
if (KdDebugState & KD_DEBUG_SERIAL)
PrintString("\n Serial debugging enabled. COM%ld %ld Baud\n\n",
LogPortInfo.ComPort, LogPortInfo.BaudRate);
if (KdDebugState & KD_DEBUG_FILELOG)
PrintString("\n File log debugging enabled\n\n");
if (KdDebugState & KD_DEBUG_MDA)
PrintString("\n MDA debugging enabled\n\n");
}
}
VOID
KdSerialDebugPrint (LPSTR Message)
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: bug.c,v 1.34 2003/07/15 16:26:18 silverblade Exp $
/* $Id: bug.c,v 1.35 2003/08/11 18:50:12 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/bug.c
@ -31,6 +31,7 @@
/* INCLUDES *****************************************************************/
#include <roskrnl.h>
#include <ntos/bootvid.h>
#include <internal/kd.h>
#include <internal/ke.h>
#include <internal/ps.h>
@ -94,6 +95,15 @@ KeBugCheckWithTf(ULONG BugCheckCode,
PRTL_MESSAGE_RESOURCE_ENTRY Message;
NTSTATUS Status;
/*
* The bug check may have happened while the bootscreen image was displayed.
* If this happened, switch back to text mode.
*/
if (InbvIsBootDriverInstalled())
{
InbvEnableBootDriver(FALSE);
}
/* Make sure we're switching back to the blue screen and print messages on it */
HalReleaseDisplayOwnership();
KdDebugState |= KD_DEBUG_SCREEN;
@ -171,6 +181,15 @@ KeBugCheckEx(ULONG BugCheckCode,
PRTL_MESSAGE_RESOURCE_ENTRY Message;
NTSTATUS Status;
/*
* The bug check may have happened while the bootscreen image was displayed.
* If this happened, switch back to text mode.
*/
if (InbvIsBootDriverInstalled())
{
InbvEnableBootDriver(FALSE);
}
/* Make sure we're switching back to the blue screen and print messages on it */
HalReleaseDisplayOwnership();
KdDebugState |= KD_DEBUG_SCREEN;

View file

@ -144,11 +144,13 @@ _KiV86Complete:
popl KV86M_REGISTERS_ECX(%ebx)
popl KV86M_REGISTERS_EAX(%ebx)
/* Ignore the previous mode */
addl $4, %esp
/* Restore the old previous mode */
popl %eax
movb %al, %ss:KTHREAD_PREVIOUS_MODE(%esi)
/* Ignore old exception handler list */
addl $4, %esp
/* Restore the old exception handler list */
popl %eax
movl %eax, %fs:KPCR_EXCEPTION_LIST
/* Ignore the 32-bit fs register */
addl $4, %esp

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.166 2003/07/21 21:53:51 royce Exp $
/* $Id: main.c,v 1.167 2003/08/11 18:50:12 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@ -50,6 +50,7 @@
#include <internal/registry.h>
#include <internal/nls.h>
#include <reactos/bugcodes.h>
#include <ntos/bootvid.h>
#ifdef HALDBG
#include <internal/ntosdbg.h>
@ -316,6 +317,10 @@ ExpInitializeExecutive(VOID)
BOOLEAN SetupBoot;
PCHAR p1, p2;
ULONG MaxMem;
BOOLEAN NoBootScreen = FALSE;
UNICODE_STRING Name;
HANDLE InitDoneEventHandle;
OBJECT_ATTRIBUTES ObjectAttributes;
/*
* Fail at runtime if someone has changed various structures without
@ -372,6 +377,11 @@ ExpInitializeExecutive(VOID)
}
}
}
else if (!_strnicmp(p2, "NOBOOTSCREEN", 12))
{
p2 += 12;
NoBootScreen = TRUE;
}
p1 = p2;
}
@ -478,19 +488,6 @@ ExpInitializeExecutive(VOID)
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
}
/*
* Display version number and copyright/warranty message
*/
HalDisplayString("Starting ReactOS "KERNEL_VERSION_STR" (Build "
KERNEL_VERSION_BUILD_STR")\n");
HalDisplayString(RES_STR_LEGAL_COPYRIGHT);
HalDisplayString("\n\nReactOS is free software, covered by the GNU General "
"Public License, and you\n");
HalDisplayString("are welcome to change it and/or distribute copies of it "
"under certain\n");
HalDisplayString("conditions. There is absolutely no warranty for "
"ReactOS.\n\n");
/* Initialize all processors */
KeNumberProcessors = 0;
@ -513,21 +510,6 @@ ExpInitializeExecutive(VOID)
KeNumberProcessors++;
}
if (KeNumberProcessors > 1)
{
sprintf(str,
"Found %d system processors. [%lu MB Memory]\n",
KeNumberProcessors,
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
else
{
sprintf(str,
"Found 1 system processor. [%lu MB Memory]\n",
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
HalDisplayString(str);
/*
* Initialize various critical subsystems
*/
@ -547,6 +529,48 @@ ExpInitializeExecutive(VOID)
/* Report all resources used by hal */
HalReportResourceUsage();
/* Display the boot screen image if not disabled */
if (!NoBootScreen)
{
InbvEnableBootDriver(TRUE);
}
/*
* Clear the screen to blue
*/
HalInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
/*
* Display version number and copyright/warranty message
*/
HalDisplayString("Starting ReactOS "KERNEL_VERSION_STR" (Build "
KERNEL_VERSION_BUILD_STR")\n");
HalDisplayString(RES_STR_LEGAL_COPYRIGHT);
HalDisplayString("\n\nReactOS is free software, covered by the GNU General "
"Public License, and you\n");
HalDisplayString("are welcome to change it and/or distribute copies of it "
"under certain\n");
HalDisplayString("conditions. There is absolutely no warranty for "
"ReactOS.\n\n");
if (KeNumberProcessors > 1)
{
sprintf(str,
"Found %d system processors. [%lu MB Memory]\n",
KeNumberProcessors,
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
else
{
sprintf(str,
"Found 1 system processor. [%lu MB Memory]\n",
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
HalDisplayString(str);
KdInit3();
/* Create the NLS section */
RtlpCreateNlsSection();
@ -682,10 +706,6 @@ ExpInitializeExecutive(VOID)
PiInitDefaultLocale();
/*
* Start the motherboard enumerator (the HAL)
*/
HalInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
#if 0
/*
* Load boot start drivers
@ -714,6 +734,24 @@ ExpInitializeExecutive(VOID)
*/
InitSystemSharedUserPage ((PUCHAR)KeLoaderBlock.CommandLine);
/* Create 'ReactOSInitDone' event */
RtlInitUnicodeString(&Name, L"\\ReactOSInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&Name,
0,
NULL,
NULL);
Status = NtCreateEvent(&InitDoneEventHandle,
EVENT_ALL_ACCESS,
&ObjectAttributes,
FALSE, /* Synchronization event */
FALSE); /* Not signalled */
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create 'ReactOSInitDone' event (Status 0x%x)\n", Status);
InitDoneEventHandle = INVALID_HANDLE_VALUE;
}
/*
* Launch initial process
*/
@ -724,6 +762,53 @@ ExpInitializeExecutive(VOID)
KEBUGCHECKEX(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
if (InitDoneEventHandle != INVALID_HANDLE_VALUE)
{
HANDLE Handles[2]; /* Init event, Initial process */
Handles[0] = InitDoneEventHandle;
Handles[1] = ProcessHandle;
/* Wait for the system to be initialized */
Timeout.QuadPart = -1200000000LL; /* 120 second timeout */
Status = NtWaitForMultipleObjects(((LONG) sizeof(Handles) / sizeof(HANDLE)),
Handles,
WaitAny,
FALSE, /* Non-alertable */
&Timeout);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtWaitForMultipleObjects failed with status 0x%x!\n", Status);
}
else if (Status == STATUS_TIMEOUT)
{
DPRINT1("WARNING: System not initialized after 120 seconds.\n");
}
else if (Status == STATUS_WAIT_0 + 1)
{
/*
* Crash the system if the initial process was terminated.
*/
KEBUGCHECKEX(SESSION5_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
if (!NoBootScreen)
{
InbvEnableBootDriver(FALSE);
}
NtSetEvent(InitDoneEventHandle, NULL);
NtClose(InitDoneEventHandle);
}
else
{
/* On failure to create 'ReactOSInitDone' event, go to text mode ASAP */
if (!NoBootScreen)
{
InbvEnableBootDriver(FALSE);
}
/*
* Crash the system if the initial process terminates within 5 seconds.
*/
@ -735,6 +820,7 @@ ExpInitializeExecutive(VOID)
{
KEBUGCHECKEX(SESSION5_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
}
NtClose(ThreadHandle);
NtClose(ProcessHandle);

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.159 2003/07/25 23:51:23 dwelch Exp $
; $Id: ntoskrnl.def,v 1.160 2003/08/11 18:50:12 chorns Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -212,6 +212,18 @@ FsRtlUninitializeMcb@4
FsRtlUninitializeOplock@4
HalDispatchTable DATA
HalPrivateDispatchTable DATA
InbvAcquireDisplayOwnership@0
InbvCheckDisplayOwnership@0
InbvDisplayString@4
InbvEnableBootDriver@4
InbvEnableDisplayString@4
InbvInstallDisplayStringFilter@4
InbvIsBootDriverInstalled@0
InbvNotifyDisplayOwnershipLost@4
InbvResetDisplay@0
InbvSetScrollRegion@16
InbvSetTextColor@4
InbvSolidColorFill@20
@InterlockedCompareExchange@12
@InterlockedDecrement@4
@InterlockedExchange@8

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.147 2003/07/31 01:44:18 royce Exp $
; $Id: ntoskrnl.edf,v 1.148 2003/08/11 18:50:12 chorns Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -212,6 +212,18 @@ FsRtlUninitializeMcb=FsRtlUninitializeMcb@4
FsRtlUninitializeOplock=FsRtlUninitializeOplock@4
HalDispatchTable DATA
HalPrivateDispatchTable DATA
InbvAcquireDisplayOwnership=InbvAcquireDisplayOwnership@0
InbvCheckDisplayOwnership=InbvCheckDisplayOwnership@0
InbvDisplayString=InbvDisplayString@4
InbvEnableBootDriver=InbvEnableBootDriver@4
InbvEnableDisplayString=InbvEnableDisplayString@4
InbvInstallDisplayStringFilter=InbvInstallDisplayStringFilter@4
InbvIsBootDriverInstalled=InbvIsBootDriverInstalled@0
InbvNotifyDisplayOwnershipLost=InbvNotifyDisplayOwnershipLost@4
InbvResetDisplay=InbvResetDisplay@0
InbvSetScrollRegion=InbvSetScrollRegion@16
InbvSetTextColor=InbvSetTextColor@4
InbvSolidColorFill=InbvSolidColorFill@20
InterlockedCompareExchange=@InterlockedCompareExchange@12
InterlockedDecrement=@InterlockedDecrement@4
InterlockedExchange=@InterlockedExchange@8

View file

@ -36,4 +36,6 @@ BEGIN
END
END
IDB_BOOTIMAGE BITMAP DISCARDABLE "res/bootimage.bmp"
#include "bugcodes.rc"

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View file

@ -1,4 +1,4 @@
/* $Id: init.c,v 1.19 2003/06/17 13:55:16 gvg Exp $
/* $Id: init.c,v 1.20 2003/08/11 18:50:12 chorns Exp $
*
* reactos/subsys/csrss/init.c
*
@ -17,6 +17,9 @@
#include "api.h"
#define NDEBUG
#include <debug.h>
/* GLOBALS ******************************************************************/
/*
@ -136,7 +139,7 @@ CsrServerInitialization (
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
if (!NT_SUCCESS(Status))
{
PrintString("CSR: Unable to parse the command line (Status: %x)\n", Status);
DPRINT1("CSR: Unable to parse the command line (Status: %x)\n", Status);
return(FALSE);
}
@ -157,7 +160,7 @@ CsrServerInitialization (
0);
if (!NT_SUCCESS(Status))
{
PrintString("CSR: Unable to create \\ApiPort (Status %x)\n", Status);
DPRINT1("CSR: Unable to create \\ApiPort (Status %x)\n", Status);
return(FALSE);
}
CsrssApiHeap = RtlCreateHeap(HEAP_GROWABLE,
@ -168,7 +171,7 @@ CsrServerInitialization (
NULL);
if (CsrssApiHeap == NULL)
{
PrintString("CSR: Failed to create private heap, aborting\n");
DPRINT1("CSR: Failed to create private heap, aborting\n");
return FALSE;
}
@ -185,7 +188,7 @@ CsrServerInitialization (
NULL);
if (!NT_SUCCESS(Status))
{
PrintString("CSR: Unable to create server thread\n");
DPRINT1("CSR: Unable to create server thread\n");
NtClose(ApiPortHandle);
return FALSE;
}
@ -194,13 +197,13 @@ CsrServerInitialization (
Status = NtCreateEvent( &RefreshEventHandle, STANDARD_RIGHTS_ALL, &RefreshEventAttr, FALSE, FALSE );
if( !NT_SUCCESS( Status ) )
{
PrintString( "CSR: Unable to create refresh event!\n" );
DPRINT1( "CSR: Unable to create refresh event!\n" );
return FALSE;
}
Status = RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, 0, NULL, NULL, (PTHREAD_START_ROUTINE)Console_Api, (PVOID) RefreshEventHandle, NULL, NULL );
if( !NT_SUCCESS( Status ) )
{
PrintString( "CSR: Unable to create console thread\n" );
DPRINT1( "CSR: Unable to create console thread\n" );
return FALSE;
}

View file

@ -1,4 +1,4 @@
/* $Id: init.c,v 1.49 2003/07/24 18:14:59 royce Exp $
/* $Id: init.c,v 1.50 2003/08/11 18:50:12 chorns Exp $
*
* init.c - Session Manager initialization
*
@ -37,7 +37,7 @@
#include "smss.h"
#define NDEBUG
#include <debug.h>
/* GLOBALS ******************************************************************/
@ -63,8 +63,8 @@ SmObjectDirectoryQueryRoutine(PWSTR ValueName,
NTSTATUS Status = STATUS_SUCCESS;
#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
DbgPrint("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DbgPrint("ValueData '%S'\n", (PWSTR)ValueData);
#endif
if (ValueType != REG_SZ)
{
@ -125,10 +125,8 @@ SmDosDevicesQueryRoutine(PWSTR ValueName,
WCHAR LinkBuffer[80];
NTSTATUS Status;
#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
if (ValueType != REG_SZ)
{
@ -143,11 +141,9 @@ SmDosDevicesQueryRoutine(PWSTR ValueName,
RtlInitUnicodeString(&DeviceName,
(PWSTR)ValueData);
#ifndef NDEBUG
PrintString("SM: Linking %wZ --> %wZ\n",
DPRINT("SM: Linking %wZ --> %wZ\n",
&LinkName,
&DeviceName);
#endif
/* create symbolic link */
InitializeObjectAttributes(&ObjectAttributes,
@ -161,7 +157,7 @@ SmDosDevicesQueryRoutine(PWSTR ValueName,
&DeviceName);
if (!NT_SUCCESS(Status))
{
PrintString("SmDosDevicesQueryRoutine: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n",
DPRINT1("SmDosDevicesQueryRoutine: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n",
&LinkName,
&DeviceName);
}
@ -211,10 +207,8 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
ULONG len;
NTSTATUS Status;
#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
if (ValueType != REG_SZ)
{
@ -248,11 +242,9 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
wcscpy(CommandLine, p2);
}
PrintString("Running %S...\n", Description);
#ifndef NDEBUG
PrintString("ImageName: '%S'\n", ImageName);
PrintString("CommandLine: '%S'\n", CommandLine);
#endif
DPRINT("Running %S...\n", Description);
DPRINT("ImageName: '%S'\n", ImageName);
DPRINT("CommandLine: '%S'\n", CommandLine);
/* initialize executable path */
wcscpy(ImagePath, L"\\SystemRoot\\system32\\");
@ -288,7 +280,7 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
&ProcessInfo);
if (!NT_SUCCESS(Status))
{
PrintString("Running %s failed (Status %lx)\n", Description, Status);
DPRINT1("Running %s failed (Status %lx)\n", Description, Status);
return(STATUS_SUCCESS);
}
@ -334,7 +326,7 @@ SmRunBootApps(VOID)
NULL);
if (!NT_SUCCESS(Status))
{
PrintString("SmRunBootApps: RtlQueryRegistryValues() failed! (Status %lx)\n", Status);
DPRINT1("SmRunBootApps: RtlQueryRegistryValues() failed! (Status %lx)\n", Status);
}
return(Status);
@ -344,15 +336,11 @@ SmRunBootApps(VOID)
static NTSTATUS
SmProcessFileRenameList(VOID)
{
#ifndef NDEBUG
PrintString("SmProcessFileRenameList() called\n");
#endif
DPRINT("SmProcessFileRenameList() called\n");
/* FIXME: implement it! */
#ifndef NDEBUG
PrintString("SmProcessFileRenameList() done\n");
#endif
DPRINT("SmProcessFileRenameList() done\n");
return(STATUS_SUCCESS);
}
@ -373,10 +361,8 @@ SmKnownDllsQueryRoutine(PWSTR ValueName,
HANDLE SectionHandle;
NTSTATUS Status;
#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S' Context %p EntryContext %p\n", (PWSTR)ValueData, Context, EntryContext);
#endif
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DPRINT("ValueData '%S' Context %p EntryContext %p\n", (PWSTR)ValueData, Context, EntryContext);
/* Ignore the 'DllDirectory' value */
if (!_wcsicmp(ValueName, L"DllDirectory"))
@ -398,15 +384,11 @@ SmKnownDllsQueryRoutine(PWSTR ValueName,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("NtOpenFile() failed (Status %lx)\n", Status);
#endif
DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
return STATUS_SUCCESS;
}
#ifndef NDEBUG
PrintString("Opened file %wZ successfully\n", &ImageName);
#endif
DPRINT("Opened file %wZ successfully\n", &ImageName);
/* Check for valid image checksum */
Status = LdrVerifyImageMatchesChecksum (FileHandle,
@ -425,9 +407,8 @@ SmKnownDllsQueryRoutine(PWSTR ValueName,
}
else if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("Failed to check the image checksum\n");
#endif
DPRINT1("Failed to check the image checksum\n");
NtClose(SectionHandle);
NtClose(FileHandle);
@ -448,9 +429,7 @@ SmKnownDllsQueryRoutine(PWSTR ValueName,
FileHandle);
if (NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("Created section successfully\n");
#endif
DPRINT("Created section successfully\n");
NtClose(SectionHandle);
}
@ -474,9 +453,7 @@ SmLoadKnownDlls(VOID)
HANDLE SymlinkHandle;
NTSTATUS Status;
#ifndef NDEBUG
PrintString("SmLoadKnownDlls() called\n");
#endif
DPRINT("SmLoadKnownDlls() called\n");
/* Create 'KnownDlls' object directory */
RtlInitUnicodeString(&Name,
@ -491,9 +468,7 @@ SmLoadKnownDlls(VOID)
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("NtCreateDirectoryObject() failed (Status %lx)\n", Status);
#endif
DPRINT1("NtCreateDirectoryObject() failed (Status %lx)\n", Status);
return Status;
}
@ -513,28 +488,22 @@ SmLoadKnownDlls(VOID)
SmSystemEnvironment);
if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
#endif
DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
return Status;
}
#ifndef NDEBUG
PrintString("DllDosPath: '%wZ'\n", &DllDosPath);
#endif
DPRINT("DllDosPath: '%wZ'\n", &DllDosPath);
if (!RtlDosPathNameToNtPathName_U(DllDosPath.Buffer,
&DllNtPath,
NULL,
NULL))
{
#ifndef NDEBUG
PrintString("RtlDosPathNameToNtPathName_U() failed\n");
#endif
DPRINT1("RtlDosPathNameToNtPathName_U() failed\n");
return STATUS_OBJECT_NAME_INVALID;
}
PrintString("DllNtPath: '%wZ'\n", &DllNtPath);
DPRINT("DllNtPath: '%wZ'\n", &DllNtPath);
/* Open the dll path directory */
InitializeObjectAttributes(&ObjectAttributes,
@ -550,9 +519,7 @@ SmLoadKnownDlls(VOID)
FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE);
if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("NtOpenFile() failed (Status %lx)\n", Status);
#endif
DPRINT("NtOpenFile() failed (Status %lx)\n", Status);
return Status;
}
@ -570,9 +537,7 @@ SmLoadKnownDlls(VOID)
&DllDosPath);
if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("NtCreateSymbolicLink() failed (Status %lx)\n", Status);
#endif
DPRINT1("NtCreateSymbolicLink() failed (Status %lx)\n", Status);
return Status;
}
@ -591,14 +556,10 @@ SmLoadKnownDlls(VOID)
NULL);
if (!NT_SUCCESS(Status))
{
#ifndef NDEBUG
PrintString("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
#endif
DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
}
#ifndef NDEBUG
PrintString("SmLoadKnownDlls() done\n");
#endif
DPRINT("SmLoadKnownDlls() done\n");
return Status;
}
@ -618,10 +579,8 @@ SmPagingFilesQueryRoutine(PWSTR ValueName,
NTSTATUS Status;
LPWSTR p;
#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
if (ValueType != REG_SZ)
{
@ -702,10 +661,8 @@ SmEnvironmentQueryRoutine(PWSTR ValueName,
UNICODE_STRING EnvVariable;
UNICODE_STRING EnvValue;
#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
if (ValueType != REG_SZ)
{
@ -797,7 +754,7 @@ SmLoadSubsystems(VOID)
&ImageInfo,
sizeof(SYSTEM_LOAD_AND_CALL_IMAGE));
PrintString("SMSS: Loaded win32k.sys (Status %lx)\n", Status);
DPRINT("SMSS: Loaded win32k.sys (Status %lx)\n", Status);
#if 0
if (!NT_SUCCESS(Status))
{
@ -811,6 +768,43 @@ SmLoadSubsystems(VOID)
}
static VOID
SignalInitEvent()
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeString;
HANDLE ReactOSInitEvent;
RtlInitUnicodeStringFromLiteral(&UnicodeString, L"\\ReactOSInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
EVENT_ALL_ACCESS,
0,
NULL);
Status = NtOpenEvent(&ReactOSInitEvent,
EVENT_ALL_ACCESS,
&ObjectAttributes);
if (NT_SUCCESS(Status))
{
LARGE_INTEGER Timeout;
/* This will cause the boot screen image to go away (if displayed) */
NtPulseEvent(ReactOSInitEvent, NULL);
/* Wait for the display mode to be changed (if in graphics mode) */
Timeout.QuadPart = -50000000LL; /* 5 second timeout */
NtWaitForSingleObject(ReactOSInitEvent, FALSE, &Timeout);
NtClose(ReactOSInitEvent);
}
else
{
/* We don't really care if this fails */
DPRINT1("SM: Failed to open ReactOS init notification event\n");
}
}
NTSTATUS
InitSessionManager(HANDLE Children[])
{
@ -827,7 +821,7 @@ InitSessionManager(HANDLE Children[])
Status = SmCreateObjectDirectories();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to create object directories (Status %lx)\n", Status);
DPRINT1("SM: Failed to create object directories (Status %lx)\n", Status);
return(Status);
}
@ -835,7 +829,7 @@ InitSessionManager(HANDLE Children[])
Status = SmCreateApiPort();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to create SmApiPort (Status %lx)\n", Status);
DPRINT1("SM: Failed to create SmApiPort (Status %lx)\n", Status);
return(Status);
}
@ -844,7 +838,7 @@ InitSessionManager(HANDLE Children[])
&SmSystemEnvironment);
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to create the system environment (Status %lx)\n", Status);
DPRINT1("SM: Failed to create the system environment (Status %lx)\n", Status);
return(Status);
}
@ -852,7 +846,7 @@ InitSessionManager(HANDLE Children[])
Status = SmSetEnvironmentVariables();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to set system environment variables (Status %lx)\n", Status);
DPRINT1("SM: Failed to set system environment variables (Status %lx)\n", Status);
return(Status);
}
@ -860,7 +854,7 @@ InitSessionManager(HANDLE Children[])
Status = SmInitDosDevices();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to create dos device links (Status %lx)\n", Status);
DPRINT1("SM: Failed to create dos device links (Status %lx)\n", Status);
return(Status);
}
@ -868,7 +862,7 @@ InitSessionManager(HANDLE Children[])
Status = SmRunBootApps();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to run boot applications (Status %lx)\n", Status);
DPRINT1("SM: Failed to run boot applications (Status %lx)\n", Status);
return(Status);
}
@ -876,31 +870,31 @@ InitSessionManager(HANDLE Children[])
Status = SmProcessFileRenameList();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to process the file rename list (Status %lx)\n", Status);
DPRINT1("SM: Failed to process the file rename list (Status %lx)\n", Status);
return(Status);
}
PrintString("SM: loading well-known DLLs\n");
DPRINT("SM: loading well-known DLLs\n");
/* Load the well known DLLs */
Status = SmLoadKnownDlls();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to preload system DLLs (Status %lx)\n", Status);
DPRINT1("SM: Failed to preload system DLLs (Status %lx)\n", Status);
/* Don't crash ReactOS if DLLs cannot be loaded */
}
PrintString("SM: creating system paging files\n");
DPRINT("SM: creating system paging files\n");
/* Create paging files */
Status = SmCreatePagingFiles();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to create paging files (Status %lx)\n", Status);
DPRINT1("SM: Failed to create paging files (Status %lx)\n", Status);
return(Status);
}
PrintString("SM: initializing registry\n");
DPRINT("SM: initializing registry\n");
/* Load remaining registry hives */
NtInitializeRegistry(FALSE);
@ -910,22 +904,26 @@ InitSessionManager(HANDLE Children[])
Status = SmUpdateEnvironment();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to update environment variables (Status %lx)\n", Status);
DPRINT1("SM: Failed to update environment variables (Status %lx)\n", Status);
return(Status);
}
#endif
PrintString("SM: loading subsystems\n");
DPRINT("SM: loading subsystems\n");
/* Load the subsystems */
Status = SmLoadSubsystems();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to load subsystems (Status %lx)\n", Status);
DPRINT1("SM: Failed to load subsystems (Status %lx)\n", Status);
return(Status);
}
PrintString("SM: initializing csrss\n");
SignalInitEvent();
DPRINT("SM: initializing csrss\n");
/* Run csrss.exe */
RtlInitUnicodeStringFromLiteral(&UnicodeString,
@ -996,7 +994,7 @@ InitSessionManager(HANDLE Children[])
* Start the logon process (winlogon.exe)
*/
PrintString("SM: starting winlogon\n");
DPRINT("SM: starting winlogon\n");
/* initialize executable path */
wcscpy(UnicodeBuffer, L"\\??\\");

View file

@ -1,4 +1,4 @@
/* $Id: smss.c,v 1.14 2002/10/25 22:08:20 chorns Exp $
/* $Id: smss.c,v 1.15 2003/08/11 18:50:12 chorns Exp $
*
* smss.c - Session Manager
*
@ -30,6 +30,9 @@
#include "smss.h"
#define NDEBUG
#include <debug.h>
void
DisplayString(LPCWSTR lpwString)
@ -73,7 +76,7 @@ NtProcessStartup(PPEB Peb)
Status = InitSessionManager(Children);
if (!NT_SUCCESS(Status))
{
PrintString("SM: Initialization failed!\n");
DPRINT1("SM: Initialization failed!\n");
goto ByeBye;
}
@ -84,11 +87,11 @@ NtProcessStartup(PPEB Peb)
NULL); /* NULL for infinite */
if (!NT_SUCCESS(Status))
{
PrintString("SM: NtWaitForMultipleObjects failed!\n");
DPRINT1("SM: NtWaitForMultipleObjects failed!\n");
}
else
{
PrintString("SM: Process terminated!\n");
DPRINT1("SM: Process terminated!\n");
}
ByeBye: