Author: dgorbachev
Date: Mon Mar 30 13:12:25 2009
New Revision: 40295
URL:
http://svn.reactos.org/svn/reactos?rev=40295&view=rev
Log:
Do not crash with "Assertion 'Process == PsGetCurrentProcess()' failed"
msg.
Modified:
trunk/reactos/ntoskrnl/mm/kmap.c
trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/mm/kmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/kmap.c?rev=402…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/kmap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/kmap.c [iso-8859-1] Mon Mar 30 13:12:25 2009
@@ -25,7 +25,7 @@
KIRQL Irql;
PVOID TempAddress;
- Process = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
+ Process = PsGetCurrentProcess();
TempAddress = MiMapPageInHyperSpace(Process, Page, &Irql);
if (TempAddress == NULL)
{
@@ -40,15 +40,19 @@
NTAPI
MiCopyFromUserPage(PFN_TYPE DestPage, PVOID SourceAddress)
{
+ PEPROCESS Process;
+ KIRQL Irql;
PVOID TempAddress;
- TempAddress = MmCreateHyperspaceMapping(DestPage);
+ Process = PsGetCurrentProcess();
+ TempAddress = MiMapPageInHyperSpace(Process, DestPage, &Irql);
if (TempAddress == NULL)
{
return(STATUS_NO_MEMORY);
}
memcpy(TempAddress, SourceAddress, PAGE_SIZE);
- MmDeleteHyperspaceMapping(TempAddress);
+ MiUnmapPageInHyperSpace(Process, TempAddress, Irql);
return(STATUS_SUCCESS);
}
+/* EOF */
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Mon Mar 30 13:12:25 2009
@@ -657,8 +657,11 @@
}
else
{
+ PEPROCESS Process;
+ KIRQL Irql;
PVOID PageAddr;
ULONG CacheSegOffset;
+
/*
* Allocate a page, this is rather complicated by the possibility
* we might have to move other things out of memory
@@ -692,7 +695,8 @@
}
}
- PageAddr = MmCreateHyperspaceMapping(*Page);
+ Process = PsGetCurrentProcess();
+ PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset;
Length = RawLength - SegOffset;
if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
@@ -706,7 +710,7 @@
else
{
memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, CacheSegOffset);
- MmDeleteHyperspaceMapping(PageAddr);
+ MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
Status = CcRosGetCacheSegment(Bcb,
FileOffset + CacheSegOffset,
@@ -731,7 +735,7 @@
return Status;
}
}
- PageAddr = MmCreateHyperspaceMapping(*Page);
+ PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
if (Length < PAGE_SIZE)
{
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, Length -
CacheSegOffset);
@@ -741,7 +745,7 @@
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, PAGE_SIZE -
CacheSegOffset);
}
}
- MmDeleteHyperspaceMapping(PageAddr);
+ MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
}
return(STATUS_SUCCESS);