mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
cleanup of import
svn path=/trunk/; revision=42
This commit is contained in:
parent
40473b6aba
commit
6bdaf42c26
|
@ -691,3 +691,4 @@ gdt:
|
||||||
_end:
|
_end:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,20 @@ LOADERS = dos
|
||||||
#
|
#
|
||||||
# Select the device drivers and filesystems you want
|
# Select the device drivers and filesystems you want
|
||||||
#
|
#
|
||||||
KERNEL_SERVICES = parallel keyboard null mouse serial sound test ide ide-test
|
KERNEL_SERVICES = parallel keyboard null mouse serial sound ide test minix
|
||||||
|
|
||||||
all: $(COMPONENTS) $(LOADERS) $(KERNEL_SERVICES)
|
all: $(COMPONENTS) $(LOADERS) $(KERNEL_SERVICES)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Device driver rules
|
# Device driver rules
|
||||||
#
|
#
|
||||||
|
sdisk: dummy
|
||||||
|
make -C services/sdisk
|
||||||
|
|
||||||
|
minix: dummy
|
||||||
|
make -C services/fs/minix
|
||||||
|
|
||||||
|
|
||||||
ide-test: dummy
|
ide-test: dummy
|
||||||
make -C services/ide-test
|
make -C services/ide-test
|
||||||
|
|
||||||
|
|
|
@ -82,177 +82,6 @@ VOID IoMarkIrpPending(PIRP Irp)
|
||||||
IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED;
|
IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
|
|
||||||
PDEVICE_OBJECT DeviceObject,
|
|
||||||
PVOID Buffer,
|
|
||||||
ULONG Length,
|
|
||||||
PLARGE_INTEGER StartingOffset,
|
|
||||||
PIO_STATUS_BLOCK IoStatusBlock)
|
|
||||||
/*
|
|
||||||
* FUNCTION: Allocates and sets up an IRP to be sent to lower level drivers
|
|
||||||
* ARGUMENTS:
|
|
||||||
* MajorFunction = One of IRP_MJ_READ, IRP_MJ_WRITE,
|
|
||||||
* IRP_MJ_FLUSH_BUFFERS or IRP_MJ_SHUTDOWN
|
|
||||||
* DeviceObject = Device object to send the irp to
|
|
||||||
* Buffer = Buffer into which data will be read or written
|
|
||||||
* Length = Length in bytes of the irp to be allocated
|
|
||||||
* StartingOffset = Starting offset on the device
|
|
||||||
* IoStatusBlock (OUT) = Storage for the result of the operation
|
|
||||||
* RETURNS: The IRP allocated on success, or
|
|
||||||
* NULL on failure
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
PIRP Irp;
|
|
||||||
PIO_STACK_LOCATION StackPtr;
|
|
||||||
|
|
||||||
Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE);
|
|
||||||
if (Irp==NULL)
|
|
||||||
{
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Irp->UserBuffer = (LPVOID)Buffer;
|
|
||||||
if (DeviceObject->Flags&DO_BUFFERED_IO)
|
|
||||||
{
|
|
||||||
DPRINT("Doing buffer i/o\n",0);
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = (PVOID)
|
|
||||||
ExAllocatePool(NonPagedPool,Length);
|
|
||||||
if (Irp->AssociatedIrp.SystemBuffer==NULL)
|
|
||||||
{
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
Irp->UserBuffer = NULL;
|
|
||||||
}
|
|
||||||
if (DeviceObject->Flags&DO_DIRECT_IO)
|
|
||||||
{
|
|
||||||
DPRINT("Doing direct i/o\n",0);
|
|
||||||
|
|
||||||
Irp->MdlAddress = MmCreateMdl(NULL,Buffer,Length);
|
|
||||||
MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoWriteAccess);
|
|
||||||
Irp->UserBuffer = NULL;
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Irp->UserIosb = IoStatusBlock;
|
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
|
||||||
StackPtr->MajorFunction = MajorFunction;
|
|
||||||
StackPtr->MinorFunction = 0;
|
|
||||||
StackPtr->Flags = 0;
|
|
||||||
StackPtr->Control = 0;
|
|
||||||
StackPtr->DeviceObject = DeviceObject;
|
|
||||||
StackPtr->FileObject = NULL;
|
|
||||||
StackPtr->Parameters.Write.Length = Length;
|
|
||||||
if (StartingOffset!=NULL)
|
|
||||||
{
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.LowPart =
|
|
||||||
StartingOffset->LowPart;
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.HighPart =
|
|
||||||
StartingOffset->HighPart;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.LowPart = 0;
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.HighPart = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(Irp);
|
|
||||||
}
|
|
||||||
|
|
||||||
PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode,
|
|
||||||
PDEVICE_OBJECT DeviceObject,
|
|
||||||
PVOID InputBuffer,
|
|
||||||
ULONG InputBufferLength,
|
|
||||||
PVOID OutputBuffer,
|
|
||||||
ULONG OutputBufferLength,
|
|
||||||
BOOLEAN InternalDeviceIoControl,
|
|
||||||
PKEVENT Event,
|
|
||||||
PIO_STATUS_BLOCK IoStatusBlock)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction,
|
|
||||||
PDEVICE_OBJECT DeviceObject,
|
|
||||||
PVOID Buffer,
|
|
||||||
ULONG Length,
|
|
||||||
PLARGE_INTEGER StartingOffset,
|
|
||||||
PKEVENT Event,
|
|
||||||
PIO_STATUS_BLOCK IoStatusBlock)
|
|
||||||
/*
|
|
||||||
* FUNCTION: Allocates and builds an IRP to be sent synchronously to lower
|
|
||||||
* level driver(s)
|
|
||||||
* ARGUMENTS:
|
|
||||||
* MajorFunction = Major function code, one of IRP_MJ_READ,
|
|
||||||
* IRP_MJ_WRITE, IRP_MJ_FLUSH_BUFFERS, IRP_MJ_SHUTDOWN
|
|
||||||
* DeviceObject = Target device object
|
|
||||||
* Buffer = Buffer containing data for a read or write
|
|
||||||
* Length = Length in bytes of the information to be transferred
|
|
||||||
* StartingOffset = Offset to begin the read/write from
|
|
||||||
* Event (OUT) = Will be set when the operation is complete
|
|
||||||
* IoStatusBlock (OUT) = Set to the status of the operation
|
|
||||||
* RETURNS: The IRP allocated on success, or
|
|
||||||
* NULL on failure
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
PIRP Irp;
|
|
||||||
PIO_STACK_LOCATION StackPtr;
|
|
||||||
|
|
||||||
Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE);
|
|
||||||
if (Irp==NULL)
|
|
||||||
{
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Irp->UserBuffer = (LPVOID)Buffer;
|
|
||||||
if (DeviceObject->Flags&DO_BUFFERED_IO)
|
|
||||||
{
|
|
||||||
DPRINT("Doing buffer i/o\n",0);
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = (PVOID)
|
|
||||||
ExAllocatePool(NonPagedPool,Length);
|
|
||||||
if (Irp->AssociatedIrp.SystemBuffer==NULL)
|
|
||||||
{
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
Irp->UserBuffer = NULL;
|
|
||||||
}
|
|
||||||
if (DeviceObject->Flags&DO_DIRECT_IO)
|
|
||||||
{
|
|
||||||
DPRINT("Doing direct i/o\n",0);
|
|
||||||
|
|
||||||
Irp->MdlAddress = MmCreateMdl(NULL,Buffer,Length);
|
|
||||||
MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoWriteAccess);
|
|
||||||
Irp->UserBuffer = NULL;
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Irp->UserIosb = IoStatusBlock;
|
|
||||||
Irp->UserEvent = Event;
|
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
|
||||||
StackPtr->MajorFunction = MajorFunction;
|
|
||||||
StackPtr->MinorFunction = 0;
|
|
||||||
StackPtr->Flags = 0;
|
|
||||||
StackPtr->Control = 0;
|
|
||||||
StackPtr->DeviceObject = DeviceObject;
|
|
||||||
StackPtr->FileObject = NULL;
|
|
||||||
StackPtr->Parameters.Write.Length = Length;
|
|
||||||
if (StartingOffset!=NULL)
|
|
||||||
{
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.LowPart =
|
|
||||||
StartingOffset->LowPart;
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.HighPart =
|
|
||||||
StartingOffset->HighPart;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.LowPart = 0;
|
|
||||||
StackPtr->Parameters.Write.ByteOffset.HighPart = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(Irp);
|
|
||||||
}
|
|
||||||
|
|
||||||
USHORT IoSizeOfIrp(CCHAR StackSize)
|
USHORT IoSizeOfIrp(CCHAR StackSize)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Determines the size of an IRP
|
* FUNCTION: Determines the size of an IRP
|
||||||
|
@ -275,6 +104,7 @@ VOID IoInitializeIrp(PIRP Irp, USHORT PacketSize, CCHAR StackSize)
|
||||||
{
|
{
|
||||||
assert(Irp!=NULL);
|
assert(Irp!=NULL);
|
||||||
memset(Irp,0,PacketSize);
|
memset(Irp,0,PacketSize);
|
||||||
|
Irp->StackCount=StackSize;
|
||||||
Irp->CurrentLocation=StackSize;
|
Irp->CurrentLocation=StackSize;
|
||||||
Irp->Tail.Overlay.CurrentStackLocation=IoGetCurrentIrpStackLocation(Irp);
|
Irp->Tail.Overlay.CurrentStackLocation=IoGetCurrentIrpStackLocation(Irp);
|
||||||
}
|
}
|
||||||
|
@ -358,6 +188,7 @@ PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Irp->StackCount=StackSize;
|
||||||
Irp->CurrentLocation=StackSize;
|
Irp->CurrentLocation=StackSize;
|
||||||
|
|
||||||
DPRINT("Irp %x Irp->StackPtr %d\n",Irp,Irp->CurrentLocation);
|
DPRINT("Irp %x Irp->StackPtr %d\n",Irp,Irp->CurrentLocation);
|
||||||
|
@ -399,15 +230,11 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
|
||||||
* thread making the request
|
* thread making the request
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned int i=0;
|
unsigned int i;
|
||||||
unsigned int stack_size;
|
|
||||||
|
|
||||||
DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d)\n",
|
DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d)\n",
|
||||||
Irp,PriorityBoost);
|
Irp,PriorityBoost);
|
||||||
DPRINT("Irp->Stack[i].DeviceObject->StackSize %x\n",
|
for (i=0;i<Irp->StackCount;i++)
|
||||||
Irp->Stack[i].DeviceObject->StackSize);
|
|
||||||
stack_size = Irp->Stack[i].DeviceObject->StackSize;
|
|
||||||
for (i=0;i<stack_size;i++)
|
|
||||||
{
|
{
|
||||||
if (Irp->Stack[i].CompletionRoutine!=NULL)
|
if (Irp->Stack[i].CompletionRoutine!=NULL)
|
||||||
{
|
{
|
||||||
|
@ -420,12 +247,4 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
|
||||||
{
|
{
|
||||||
KeSetEvent(Irp->UserEvent,PriorityBoost,FALSE);
|
KeSetEvent(Irp->UserEvent,PriorityBoost,FALSE);
|
||||||
}
|
}
|
||||||
if (Irp->UserIosb!=NULL)
|
|
||||||
{
|
|
||||||
*Irp->UserIosb=Irp->IoStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,50 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <internal/iomgr.h>
|
#include <internal/io.h>
|
||||||
#include <internal/string.h>
|
#include <internal/string.h>
|
||||||
#include <internal/objmgr.h>
|
#include <internal/ob.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#define DPRINT1(x) printk(x)
|
|
||||||
#else
|
|
||||||
#define DPRINT1(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
|
static VOID IoSecondStageCompletion(PIRP Irp,
|
||||||
|
BOOLEAN FromDevice,
|
||||||
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
ULONG Length,
|
||||||
|
PVOID Buffer)
|
||||||
|
/*
|
||||||
|
* FUNCTION: Performs the second stage of irp completion for read/write irps
|
||||||
|
* ARGUMENTS:
|
||||||
|
* Irp = Irp to completion
|
||||||
|
* FromDevice = True if the operation transfered data from the device
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
if (Irp->UserIosb!=NULL)
|
||||||
|
{
|
||||||
|
*Irp->UserIosb=Irp->IoStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceObject->Flags & DO_BUFFERED_IO && FromDevice)
|
||||||
|
{
|
||||||
|
memcpy(Buffer,Irp->AssociatedIrp.SystemBuffer,Length);
|
||||||
|
}
|
||||||
|
if (DeviceObject->Flags & DO_DIRECT_IO)
|
||||||
|
{
|
||||||
|
if (Irp->MdlAddress->MappedSystemVa!=NULL)
|
||||||
|
{
|
||||||
|
MmUnmapLockedPages(Irp->MdlAddress->MappedSystemVa,
|
||||||
|
Irp->MdlAddress);
|
||||||
|
}
|
||||||
|
MmUnlockPages(Irp->MdlAddress);
|
||||||
|
ExFreePool(Irp->MdlAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
IoFreeIrp(Irp);
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS ZwReadFile(HANDLE FileHandle,
|
NTSTATUS ZwReadFile(HANDLE FileHandle,
|
||||||
HANDLE EventHandle,
|
HANDLE EventHandle,
|
||||||
PIO_APC_ROUTINE ApcRoutine,
|
PIO_APC_ROUTINE ApcRoutine,
|
||||||
|
@ -43,49 +72,33 @@ NTSTATUS ZwReadFile(HANDLE FileHandle,
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("ZwReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, "
|
||||||
|
"IoStatusBlock %x)\n",
|
||||||
|
FileHandle,Buffer,Length,ByteOffset,IoStatusBlock);
|
||||||
|
|
||||||
if (hdr==NULL)
|
if (hdr==NULL)
|
||||||
{
|
{
|
||||||
|
DPRINT("%s() = STATUS_INVALID_HANDLE\n",__FUNCTION__);
|
||||||
return(STATUS_INVALID_HANDLE);
|
return(STATUS_INVALID_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize,TRUE);
|
if (ByteOffset==NULL)
|
||||||
if (Irp==NULL)
|
|
||||||
{
|
{
|
||||||
return(STATUS_UNSUCCESSFUL);
|
ByteOffset = &(FileObject->CurrentByteOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->UserBuffer = (LPVOID)Buffer;
|
|
||||||
if (FileObject->DeviceObject->Flags&DO_BUFFERED_IO)
|
|
||||||
{
|
|
||||||
DPRINT1("Doing buffer i/o\n");
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = (PVOID)
|
|
||||||
ExAllocatePool(NonPagedPool,Length);
|
|
||||||
if (Irp->AssociatedIrp.SystemBuffer==NULL)
|
|
||||||
{
|
|
||||||
return(STATUS_UNSUCCESSFUL);
|
|
||||||
}
|
|
||||||
Irp->UserBuffer = NULL;
|
|
||||||
}
|
|
||||||
if (FileObject->DeviceObject->Flags&DO_DIRECT_IO)
|
|
||||||
{
|
|
||||||
DPRINT1("Doing direct i/o\n");
|
|
||||||
|
|
||||||
Irp->MdlAddress = MmCreateMdl(NULL,Buffer,Length);
|
|
||||||
MmProbeAndLockPages(Irp->MdlAddress,UserMode,IoWriteAccess);
|
|
||||||
Irp->UserBuffer = NULL;
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = NULL;
|
|
||||||
}
|
|
||||||
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||||
Irp->UserEvent=&Event;
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||||
|
FileObject->DeviceObject,
|
||||||
|
Buffer,
|
||||||
|
Length,
|
||||||
|
ByteOffset,
|
||||||
|
&Event,
|
||||||
|
IoStatusBlock);
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
DPRINT("StackPtr %x\n",StackPtr);
|
|
||||||
StackPtr->MajorFunction = IRP_MJ_READ;
|
|
||||||
StackPtr->MinorFunction = 0;
|
|
||||||
StackPtr->Flags = 0;
|
|
||||||
StackPtr->Control = 0;
|
|
||||||
StackPtr->DeviceObject = FileObject->DeviceObject;
|
|
||||||
StackPtr->FileObject = FileObject;
|
StackPtr->FileObject = FileObject;
|
||||||
StackPtr->Parameters.Read.Length = Length;
|
StackPtr->Parameters.Read.Length = Length;
|
||||||
if (ByteOffset!=NULL)
|
if (ByteOffset!=NULL)
|
||||||
|
@ -139,6 +152,7 @@ NTSTATUS ZwWriteFile(HANDLE FileHandle,
|
||||||
PFILE_OBJECT FileObject = (PFILE_OBJECT)hdr;
|
PFILE_OBJECT FileObject = (PFILE_OBJECT)hdr;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (hdr==NULL)
|
if (hdr==NULL)
|
||||||
{
|
{
|
||||||
|
@ -204,6 +218,11 @@ NTSTATUS ZwWriteFile(HANDLE FileHandle,
|
||||||
|
|
||||||
DPRINT("FileObject->DeviceObject %x\n",FileObject->DeviceObject);
|
DPRINT("FileObject->DeviceObject %x\n",FileObject->DeviceObject);
|
||||||
Status = IoCallDriver(FileObject->DeviceObject,Irp);
|
Status = IoCallDriver(FileObject->DeviceObject,Irp);
|
||||||
|
if (Status==STATUS_PENDING)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||||
|
Status = IoStatusBlock->Status;
|
||||||
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,16 +122,21 @@ asmlinkage void _main(boot_param* _bp)
|
||||||
/*
|
/*
|
||||||
* Copy the parameters to a local buffer because lowmem will go away
|
* Copy the parameters to a local buffer because lowmem will go away
|
||||||
*/
|
*/
|
||||||
memcpy(&bp,_bp,sizeof(bp));
|
memcpy(&bp,_bp,sizeof(boot_param));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initalize the console (before printing anything)
|
* Initalize the console (before printing anything)
|
||||||
*/
|
*/
|
||||||
InitConsole(&bp);
|
HalInitConsole(&bp);
|
||||||
|
|
||||||
printk("Starting ReactOS "KERNEL_VERSION"\n");
|
DbgPrint("Starting ReactOS "KERNEL_VERSION"\n");
|
||||||
|
|
||||||
start = KERNEL_BASE + PAGE_ROUND_UP(bp.module_length[0]);
|
start = KERNEL_BASE + PAGE_ROUND_UP(bp.module_length[0]);
|
||||||
|
if (start <= ((int)&end))
|
||||||
|
{
|
||||||
|
DbgPrint("Kernel booted incorrectly, aborting\n");
|
||||||
|
for(;;);
|
||||||
|
}
|
||||||
DPRINT("MmGetPhysicalAddress(start) = %x\n",MmGetPhysicalAddress(start));
|
DPRINT("MmGetPhysicalAddress(start) = %x\n",MmGetPhysicalAddress(start));
|
||||||
DPRINT("bp.module_length[0] %x PAGE_ROUND_UP(bp.module_length[0]) %x\n",
|
DPRINT("bp.module_length[0] %x PAGE_ROUND_UP(bp.module_length[0]) %x\n",
|
||||||
bp.module_length[0],PAGE_ROUND_UP(bp.module_length[0]));
|
bp.module_length[0],PAGE_ROUND_UP(bp.module_length[0]));
|
||||||
|
@ -147,7 +152,6 @@ asmlinkage void _main(boot_param* _bp)
|
||||||
* Initalize various critical subsystems
|
* Initalize various critical subsystems
|
||||||
*/
|
*/
|
||||||
HalInit(&bp);
|
HalInit(&bp);
|
||||||
// set_breakpoint(0,start,HBP_READWRITE,HBP_DWORD);
|
|
||||||
MmInitalize(&bp);
|
MmInitalize(&bp);
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
KeInit();
|
KeInit();
|
||||||
|
@ -165,12 +169,12 @@ asmlinkage void _main(boot_param* _bp)
|
||||||
DPRINT("%d files loaded\n",bp.nr_files);
|
DPRINT("%d files loaded\n",bp.nr_files);
|
||||||
|
|
||||||
start = KERNEL_BASE + PAGE_ROUND_UP(bp.module_length[0]);
|
start = KERNEL_BASE + PAGE_ROUND_UP(bp.module_length[0]);
|
||||||
|
start1 = start+PAGE_ROUND_UP(bp.module_length[1]);
|
||||||
|
// DbgPrint("start1 %x *start1 %x\n",start1,*((unsigned int *)start1));
|
||||||
for (i=1;i<bp.nr_files;i++)
|
for (i=1;i<bp.nr_files;i++)
|
||||||
{
|
{
|
||||||
DPRINT("start %x *start %x\n",start,*((unsigned int *)start));
|
|
||||||
CHECKPOINT;
|
|
||||||
process_boot_module(start);
|
process_boot_module(start);
|
||||||
CHECKPOINT;
|
// DbgPrint("start1 %x *start1 %x\n",start1,*((unsigned int *)start1));
|
||||||
start=start+PAGE_ROUND_UP(bp.module_length[i]);
|
start=start+PAGE_ROUND_UP(bp.module_length[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
#include <internal/iomgr.h>
|
#include <internal/io.h>
|
||||||
#include <internal/symbol.h>
|
#include <internal/symbol.h>
|
||||||
#include <internal/string.h>
|
#include <internal/string.h>
|
||||||
#include <internal/mm.h>
|
#include <internal/mm.h>
|
||||||
|
@ -67,6 +67,27 @@ static void get_symbol_name(module* mod, unsigned int i, char* name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int get_symbol_value_by_name(module* mod, char* sname,
|
||||||
|
unsigned int idx)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
char name[255];
|
||||||
|
|
||||||
|
DPRINT("get_symbol_value_by_name(sname %s, idx %x)\n",sname,idx);
|
||||||
|
|
||||||
|
for (i=0; i<mod->nsyms; i++)
|
||||||
|
{
|
||||||
|
get_symbol_name(mod,i,name);
|
||||||
|
// DPRINT("Scanning %s Value %x\n",name,mod->sym_list[i].e_value);
|
||||||
|
if (strcmp(name,sname)==0)
|
||||||
|
{
|
||||||
|
DPRINT("Returning %x\n",mod->sym_list[i].e_value);
|
||||||
|
return(mod->sym_list[i].e_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned int get_symbol_value(module* mod, unsigned int i)
|
static unsigned int get_symbol_value(module* mod, unsigned int i)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Get the value of a module defined symbol
|
* FUNCTION: Get the value of a module defined symbol
|
||||||
|
@ -117,19 +138,34 @@ static int do_reloc32_reloc(module* mod, SCNHDR* scn, RELOC* reloc)
|
||||||
memset(name,0,255);
|
memset(name,0,255);
|
||||||
get_symbol_name(mod,reloc->r_symndx,name);
|
get_symbol_name(mod,reloc->r_symndx,name);
|
||||||
val = get_kernel_symbol_addr(name);
|
val = get_kernel_symbol_addr(name);
|
||||||
|
if (val==0)
|
||||||
|
{
|
||||||
|
val = get_symbol_value_by_name(mod,name,reloc->r_symndx);
|
||||||
if (val==0)
|
if (val==0)
|
||||||
{
|
{
|
||||||
DbgPrint("Undefined symbol %s in module\n",name);
|
DbgPrint("Undefined symbol %s in module\n",name);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
// DPRINT("REL32 value %x name %s\n",val,name);
|
|
||||||
// printk("value %x\n",val);
|
|
||||||
loc=(unsigned int *)(mod->base+reloc->r_vaddr);
|
loc=(unsigned int *)(mod->base+reloc->r_vaddr);
|
||||||
// printk("old %x ",*loc);
|
DPRINT("old %x ",*loc);
|
||||||
|
// (*loc) = (*loc) + val + mod->base - scn->s_vaddr;
|
||||||
|
(*loc) = (*loc);
|
||||||
|
DPRINT("mod->base %x scn->s_vaddr %x\n",mod->base,scn->s_vaddr);
|
||||||
|
|
||||||
|
DPRINT("new %x\n",*loc);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("REL32 value %x name %s\n",val,name);
|
||||||
|
DPRINT("value %x\n",val);
|
||||||
|
loc=(unsigned int *)(mod->base+reloc->r_vaddr);
|
||||||
|
DPRINT("old %x ",*loc);
|
||||||
|
DPRINT("mod->base %x scn->s_vaddr %x\n",mod->base,scn->s_vaddr);
|
||||||
(*loc) = (*loc) + val - mod->base + scn->s_vaddr;
|
(*loc) = (*loc) + val - mod->base + scn->s_vaddr;
|
||||||
|
|
||||||
// printk("new %x\n",*loc);
|
DPRINT("new %x\n",*loc);
|
||||||
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,6 +274,7 @@ BOOLEAN process_boot_module(unsigned int start)
|
||||||
mod=(module *)ExAllocatePool(NonPagedPool,sizeof(module));
|
mod=(module *)ExAllocatePool(NonPagedPool,sizeof(module));
|
||||||
|
|
||||||
DPRINT("magic %x\n",((FILHDR *)start)->f_magic);
|
DPRINT("magic %x\n",((FILHDR *)start)->f_magic);
|
||||||
|
// DbgPrint("Start1 %x\n",*((unsigned int *)0xc0017000));
|
||||||
|
|
||||||
memcpy(&hdr,(void *)start,FILHSZ);
|
memcpy(&hdr,(void *)start,FILHSZ);
|
||||||
|
|
||||||
|
@ -258,6 +295,7 @@ BOOLEAN process_boot_module(unsigned int start)
|
||||||
mod->scn_list = (SCNHDR *)(start+FILHSZ+hdr.f_opthdr);
|
mod->scn_list = (SCNHDR *)(start+FILHSZ+hdr.f_opthdr);
|
||||||
mod->size=0;
|
mod->size=0;
|
||||||
mod->raw_data_off = start;
|
mod->raw_data_off = start;
|
||||||
|
mod->nsyms = hdr.f_nsyms;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine the length of the module
|
* Determine the length of the module
|
||||||
|
@ -288,7 +326,9 @@ BOOLEAN process_boot_module(unsigned int start)
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
// DbgPrint("Start1 %x\n",*((unsigned int *)0xc0017000));
|
||||||
mod->base = (unsigned int)MmAllocateSection(mod->size);
|
mod->base = (unsigned int)MmAllocateSection(mod->size);
|
||||||
|
// DbgPrint("Start1 %x\n",*((unsigned int *)0xc0017000));
|
||||||
if (mod->base == 0)
|
if (mod->base == 0)
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to alloc section for module\n");
|
DbgPrint("Failed to alloc section for module\n");
|
||||||
|
|
|
@ -26,7 +26,7 @@ IO_OBJECTS = io/iomgr.o io/create.o io/irp.o io/device.o io/rw.o \
|
||||||
io/shutdown.o io/fdisk.o io/cancel.o io/error.o io/arc.o \
|
io/shutdown.o io/fdisk.o io/cancel.o io/error.o io/arc.o \
|
||||||
io/dpc.o io/symlink.o io/adapter.o io/cntrller.o io/mdl.o \
|
io/dpc.o io/symlink.o io/adapter.o io/cntrller.o io/mdl.o \
|
||||||
io/resource.o io/event.o io/process.o io/file.o io/ioctrl.o \
|
io/resource.o io/event.o io/process.o io/file.o io/ioctrl.o \
|
||||||
io/fs.o
|
io/fs.o io/vpb.o io/buildirp.o
|
||||||
|
|
||||||
OB_OBJECTS = ob/object.o ob/handle.o ob/namespc.o
|
OB_OBJECTS = ob/object.o ob/handle.o ob/namespc.o
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ SE_OBJECTS = se/semgr.o
|
||||||
|
|
||||||
CFG_OBJECTS = cfg/registry.o
|
CFG_OBJECTS = cfg/registry.o
|
||||||
|
|
||||||
TST_OBJECTS = tst/test.o
|
TST_OBJECTS = tst/test.o tst/sshell.o tst/readline.o
|
||||||
|
|
||||||
DBG_OBJECTS = dbg/brkpoint.o
|
DBG_OBJECTS = dbg/brkpoint.o
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ VOID MmDumpMemoryAreas(VOID)
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
current_entry = ListHead->Flink;
|
current_entry = ListHead->Flink;
|
||||||
i=0;
|
|
||||||
while (current_entry!=ListHead)
|
while (current_entry!=ListHead)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
||||||
|
@ -41,14 +40,7 @@ VOID MmDumpMemoryAreas(VOID)
|
||||||
current->BaseAddress+current->Length,current->Attributes,
|
current->BaseAddress+current->Length,current->Attributes,
|
||||||
current->Entry.Flink);
|
current->Entry.Flink);
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
i++;
|
|
||||||
if (i>6)
|
|
||||||
{
|
|
||||||
CHECKPOINT;
|
|
||||||
for(;;);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
CHECKPOINT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MmLockMemoryAreaList(ULONG Address, PKIRQL oldlvl)
|
VOID MmLockMemoryAreaList(ULONG Address, PKIRQL oldlvl)
|
||||||
|
@ -88,8 +80,12 @@ static PLIST_ENTRY MmGetRelatedListHead(ULONG BaseAddress)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PKPROCESS CurrentProcess = KeGetCurrentProcess();
|
PEPROCESS CurrentProcess = PsGetCurrentProcess();
|
||||||
return(&(CurrentProcess->MemoryAreaList));
|
if (CurrentProcess==NULL)
|
||||||
|
{
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
return(&(CurrentProcess->Pcb.MemoryAreaList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +95,16 @@ static MEMORY_AREA* MmInternalOpenMemoryAreaByAddress(PLIST_ENTRY ListHead,
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
MEMORY_AREA* current;
|
MEMORY_AREA* current;
|
||||||
|
|
||||||
|
MmDumpMemoryAreas();
|
||||||
|
|
||||||
|
DPRINT("MmInternalOpenMemoryAreaByAddress(ListHead %x, Address %x)\n",
|
||||||
|
ListHead,Address);
|
||||||
|
|
||||||
|
if (ListHead==NULL)
|
||||||
|
{
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
current_entry = ListHead->Flink;
|
current_entry = ListHead->Flink;
|
||||||
while (current_entry!=ListHead)
|
while (current_entry!=ListHead)
|
||||||
{
|
{
|
||||||
|
@ -307,14 +313,14 @@ static ULONG MmFindGapWithoutLock(KPROCESSOR_MODE Mode, ULONG Length)
|
||||||
DPRINT("Base %x Gap %x\n",current->BaseAddress,Gap);
|
DPRINT("Base %x Gap %x\n",current->BaseAddress,Gap);
|
||||||
if (Gap >= Length)
|
if (Gap >= Length)
|
||||||
{
|
{
|
||||||
return(current->BaseAddress + current->Length);
|
return(current->BaseAddress + PAGE_ROUND_UP(current->Length));
|
||||||
}
|
}
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
}
|
}
|
||||||
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
|
||||||
//DbgPrint("current %x returning %x\n",current,current->BaseAddress+
|
//DbgPrint("current %x returning %x\n",current,current->BaseAddress+
|
||||||
// current->Length);
|
// current->Length);
|
||||||
return(current->BaseAddress + current->Length);
|
return(current->BaseAddress + PAGE_ROUND_UP(current->Length));
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS MmInitMemoryAreas(VOID)
|
NTSTATUS MmInitMemoryAreas(VOID)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <internal/string.h>
|
#include <internal/string.h>
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
#include <in.h>
|
#include <in.h>
|
||||||
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
static KEVENT event = {};
|
static KEVENT event = {};
|
||||||
//static KEVENT event2;
|
//static KEVENT event2;
|
||||||
|
NTSTATUS TstShell(VOID);
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
/*
|
NTSTATUS TstPlaySound(VOID)
|
||||||
NTSTATUS TstPlaySound(void)
|
|
||||||
{
|
{
|
||||||
HANDLE hfile;
|
HANDLE hfile;
|
||||||
|
|
||||||
|
@ -45,23 +45,31 @@ NTSTATUS TstPlaySound(void)
|
||||||
|
|
||||||
NTSTATUS TstFirstThread(PVOID start)
|
NTSTATUS TstFirstThread(PVOID start)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
printk("Beginning Thread A\n");
|
printk("Beginning Thread A\n");
|
||||||
for (;;)
|
for (;;)
|
||||||
|
// for (i=0;i<10;i++)
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&event,Executive,KernelMode,FALSE,NULL);
|
KeWaitForSingleObject(&event,Executive,KernelMode,FALSE,NULL);
|
||||||
printk("AAA ");
|
printk("AAA ");
|
||||||
KeSetEvent(&event,IO_NO_INCREMENT,FALSE);
|
KeSetEvent(&event,IO_NO_INCREMENT,FALSE);
|
||||||
|
for (i=0;i<10000;i++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS TstSecondThread(PVOID start)
|
NTSTATUS TstSecondThread(PVOID start)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
printk("Beginning Thread B\n");
|
printk("Beginning Thread B\n");
|
||||||
for (;;)
|
for(;;)
|
||||||
|
// for (i=0;i<10;i++)
|
||||||
{
|
{
|
||||||
KeSetEvent(&event,IO_NO_INCREMENT,FALSE);
|
|
||||||
KeWaitForSingleObject(&event,Executive,KernelMode,FALSE,NULL);
|
KeWaitForSingleObject(&event,Executive,KernelMode,FALSE,NULL);
|
||||||
printk("BBB ");
|
printk("BBB ");
|
||||||
|
KeSetEvent(&event,IO_NO_INCREMENT,FALSE);
|
||||||
|
for (i=0;i<100000;i++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,23 +77,23 @@ NTSTATUS TstThreadSupport()
|
||||||
{
|
{
|
||||||
HANDLE th1, th2;
|
HANDLE th1, th2;
|
||||||
|
|
||||||
KeInitializeEvent(&event,SynchronizationEvent,FALSE);
|
KeInitializeEvent(&event,SynchronizationEvent,TRUE);
|
||||||
PsCreateSystemThread(&th1,0,NULL,NULL,NULL,TstFirstThread,NULL);
|
PsCreateSystemThread(&th1,0,NULL,NULL,NULL,TstFirstThread,NULL);
|
||||||
PsCreateSystemThread(&th2,0,NULL,NULL,NULL,TstSecondThread,NULL);
|
PsCreateSystemThread(&th2,0,NULL,NULL,NULL,TstSecondThread,NULL);
|
||||||
printk("Ending main thread\n");
|
printk("Ending main thread\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TstGeneralWrite()
|
void TstGeneralWrite(VOID)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
HANDLE hfile;
|
HANDLE hfile;
|
||||||
char buf[256];
|
char buf[512];
|
||||||
ANSI_STRING afilename;
|
ANSI_STRING afilename;
|
||||||
UNICODE_STRING ufilename;
|
UNICODE_STRING ufilename;
|
||||||
|
|
||||||
DbgPrint("Opening test device\n");
|
DbgPrint("Opening test device\n");
|
||||||
RtlInitAnsiString(&afilename,"\\Device\\Test");
|
RtlInitAnsiString(&afilename,"\\Device\\SDisk");
|
||||||
RtlAnsiStringToUnicodeString(&ufilename,&afilename,TRUE);
|
RtlAnsiStringToUnicodeString(&ufilename,&afilename,TRUE);
|
||||||
InitializeObjectAttributes(&attr,&ufilename,0,NULL,NULL);
|
InitializeObjectAttributes(&attr,&ufilename,0,NULL,NULL);
|
||||||
ZwOpenFile(&hfile,0,&attr,NULL,0,0);
|
ZwOpenFile(&hfile,0,&attr,NULL,0,0);
|
||||||
|
@ -94,19 +102,19 @@ void TstGeneralWrite()
|
||||||
DbgPrint("Failed to open test device\n");
|
DbgPrint("Failed to open test device\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy(buf,"hello world");
|
ZwReadFile(hfile,
|
||||||
ZwWriteFile(hfile,
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
buf,
|
buf,
|
||||||
strlen(buf),
|
512,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
|
DbgPrint("buf %s\n",buf);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void TstParallelPortWrite()
|
void TstParallelPortWrite(VOID)
|
||||||
{
|
{
|
||||||
HANDLE hfile;
|
HANDLE hfile;
|
||||||
|
|
||||||
|
@ -119,7 +127,7 @@ void TstParallelPortWrite()
|
||||||
// WriteFile(hfile,"hello world",strlen("hello world"),NULL,NULL);
|
// WriteFile(hfile,"hello world",strlen("hello world"),NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TstKeyboardRead()
|
void TstKeyboardRead(VOID)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
HANDLE hfile;
|
HANDLE hfile;
|
||||||
|
@ -152,7 +160,7 @@ void TstKeyboardRead()
|
||||||
// DbgPrint("%c",key[1].AsciiChar);
|
// DbgPrint("%c",key[1].AsciiChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/* IDE TEST STUFF ***********************************************************/
|
/* IDE TEST STUFF ***********************************************************/
|
||||||
|
|
||||||
typedef struct _BOOT_PARAMETERS {
|
typedef struct _BOOT_PARAMETERS {
|
||||||
|
@ -196,6 +204,43 @@ typedef struct _ROOT_DIR_ENTRY {
|
||||||
|
|
||||||
#define ENTRIES_PER_BLOCK (512 / sizeof(ROOT_DIR_ENTRY))
|
#define ENTRIES_PER_BLOCK (512 / sizeof(ROOT_DIR_ENTRY))
|
||||||
|
|
||||||
|
void TstFileRead(VOID)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
HANDLE hfile;
|
||||||
|
ANSI_STRING afilename;
|
||||||
|
UNICODE_STRING ufilename;
|
||||||
|
char ch;
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
|
||||||
|
DbgPrint("Opening file\n");
|
||||||
|
RtlInitAnsiString(&afilename,"\\??\\C:\\my_other_directory\\..\\"
|
||||||
|
"my_valid_directory\\apc.txt");
|
||||||
|
RtlAnsiStringToUnicodeString(&ufilename,&afilename,TRUE);
|
||||||
|
InitializeObjectAttributes(&attr,&ufilename,0,NULL,NULL);
|
||||||
|
ZwOpenFile(&hfile,0,&attr,NULL,0,0);
|
||||||
|
if (hfile==NULL)
|
||||||
|
{
|
||||||
|
DbgPrint("Failed to open file\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
// CHECKPOINT;
|
||||||
|
ZwReadFile(hfile,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
&ch,
|
||||||
|
1,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
DbgPrint("%c",ch);
|
||||||
|
}
|
||||||
|
CHECKPOINT;
|
||||||
|
}
|
||||||
|
|
||||||
void TstIDERead(void)
|
void TstIDERead(void)
|
||||||
{
|
{
|
||||||
BOOLEAN TestFailed;
|
BOOLEAN TestFailed;
|
||||||
|
@ -371,9 +416,12 @@ for(;;);
|
||||||
|
|
||||||
void TstBegin()
|
void TstBegin()
|
||||||
{
|
{
|
||||||
|
// TstFileRead();
|
||||||
// TstGeneralWrite();
|
// TstGeneralWrite();
|
||||||
// TstThreadSupport();
|
// TstThreadSupport();
|
||||||
// TstKeyboardRead();
|
// TstKeyboardRead();
|
||||||
TstIDERead();
|
TstIDERead();
|
||||||
|
// TstKeyboardRead();
|
||||||
|
// TstShell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue