|
From: Jason F. <jas...@ya...> - 2001-09-25 18:29:37
|
Has anyone tested/updated the tree with this update and the latest
one from Jack?
Jack: it seems that most developers prefer that you send them the
"diffs".. but I don't think I have diff installed?..
- Jason
--- "Jack (Butch) Griffin" <bu...@qw...> wrote:
> I have been playing with the ReactOS operating system and trying to
> get a
> console mode app written in vistual C++ to run. The app is your
> basic hello
> world application. I did not really expect that the complete
> infra-structure was in place for this to run, but I figured it
> would point
> out what was missing and give me a starting point for beginning to
> learn
> about the design of this OS.
>
> Anyway I have found a problem and do not know who should get the
> updated
> code. The problem is in MiReadPage() and the updated code is
> below. The
> only change is that STATUS_END_OF_FILE is a legimate return from
> IoPageRead(). It does not mean an error occurred, just that the
> file did
> not contain enough data to fill the page. Function that call
> MiReadPage()
> assume that the data read are OK if the return value is
> STATUS_END_OF_FILE,
> so the update of the Page pointer must be done in this case.
>
> Thanks
> Jack Griffin
>
>
> NTSTATUS
> MiReadPage(PMEMORY_AREA MemoryArea,
> PLARGE_INTEGER Offset,
> PVOID* Page)
> {
> IO_STATUS_BLOCK IoStatus;
> PFILE_OBJECT FileObject;
> PMDL Mdl;
> NTSTATUS Status;
> PREACTOS_COMMON_FCB_HEADER Fcb;
>
> FileObject = MemoryArea->Data.SectionData.Section->FileObject;
> Fcb = (PREACTOS_COMMON_FCB_HEADER)FileObject->FsContext;
>
> if (FileObject->Flags & FO_DIRECT_CACHE_PAGING_READ &&
> (Offset->QuadPart % PAGESIZE) == 0)
> {
> ULONG BaseOffset;
> PVOID BaseAddress;
> BOOLEAN UptoDate;
> PCACHE_SEGMENT CacheSeg;
> LARGE_INTEGER SegOffset;
> PHYSICAL_ADDRESS Addr;
> Status = CcRosGetCacheSegment(Fcb->Bcb,
> (ULONG)Offset->QuadPart,
> &BaseOffset,
> &BaseAddress,
> &UptoDate,
> &CacheSeg);
> if (!NT_SUCCESS(Status))
> {
> return(Status);
> }
> if (!UptoDate)
> {
> Mdl = MmCreateMdl(NULL, BaseAddress,
> Fcb->Bcb->CacheSegmentSize);
> MmBuildMdlForNonPagedPool(Mdl);
> SegOffset.QuadPart = BaseOffset;
> Status = IoPageRead(FileObject,
> Mdl,
> &SegOffset,
> &IoStatus,
> TRUE);
> if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
> {
> CcRosReleaseCacheSegment(Fcb->Bcb, CacheSeg, FALSE);
> return(Status);
> }
> }
> Addr = MmGetPhysicalAddress(BaseAddress +
> Offset->QuadPart - BaseOffset);
> (*Page) = (PVOID)(ULONG)Addr.QuadPart;
> MmReferencePage((*Page));
>
> CcRosReleaseCacheSegment(Fcb->Bcb, CacheSeg, TRUE);
> return(STATUS_SUCCESS);
> }
> else
> {
> /*
> * Allocate a page, this is rather complicated by the
> possibility
> * we might have to move other things out of memory
> */
> (*Page) = MmAllocPage(0);
> while ((*Page) == NULL)
> {
> MmWaitForFreePages();
> (*Page) = MmAllocPage(0);
> }
>
> /*
> * Create an mdl to hold the page we are going to read data
> into.
> */
> Mdl = MmCreateMdl(NULL, NULL, PAGESIZE);
> MmBuildMdlFromPages(Mdl, (PULONG)Page);
> /*
> * Call the FSD to read the page
> */
> Status = IoPageRead(FileObject,
> Mdl,
> Offset,
> &IoStatus,
> FALSE);
> return(Status);
> }
> }
>
> ====================================================
> = To remove yourself from this mailing list, go to =
> = http://www.reactos.com/home/mailing.html =
> ====================================================
>
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com
====================================================
= To remove yourself from this mailing list, go to =
= http://www.reactos.com/home/mailing.html =
====================================================
|