Author: tkreuzer
Date: Fri Nov 22 12:51:40 2013
New Revision: 61076
URL: http://svn.reactos.org/svn/reactos?rev=61076&view=rev
Log:
[NTOSKRNL]
Skip all images that were loaded using MmLoadSystemImage in MiFindInitializationCode. Drivers loaded by Mm are handled in MmFreeDriverInitialization (which we currently run for boot loaded images as well, so duplicated work...). But now at least session loaded images are NOT processed this way. Because even though they can have INIT sections, they don't neccessarily like it when stuff gets removed, especially win32k doesn't like it when it's .rsrc section is being discarded due to it's section flags!
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Fri Nov 22 12:51:40 2013
@@ -1457,6 +1457,15 @@
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
DllBase = (ULONG_PTR)LdrEntry->DllBase;
+ /* Only process boot loaded images. Other drivers are processed by
+ MmFreeDriverInitialization */
+ if (LdrEntry->Flags & LDRP_MM_LOADED)
+ {
+ /* Keep going */
+ NextEntry = NextEntry->Flink;
+ continue;
+ }
+
/* Get the NT header */
NtHeader = RtlImageNtHeader((PVOID)DllBase);
if (!NtHeader)
@@ -2561,6 +2570,10 @@
PFN_NUMBER PageFrameIndex;
PMMPFN Pfn1;
PAGED_CODE();
+
+ /* The page fault handler is broken and doesn't page back in! */
+ DPRINT1("WARNING: MiSetPagingOfDriver() called, but paging is broken! ignoring!\n");
+ return;
/* Get the driver's base address */
ImageBase = MiPteToAddress(PointerPte);
Author: tkreuzer
Date: Fri Nov 22 12:23:11 2013
New Revision: 61075
URL: http://svn.reactos.org/svn/reactos?rev=61075&view=rev
Log:
[NTOSKRNL]
Check the PTE as well in MmArmAccessFault, when we are at high IRQL and fail if it's not valid. Otherwise we just end up in an endless loop.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Fri Nov 22 12:23:11 2013
@@ -1365,9 +1365,10 @@
#if (_MI_PAGING_LEVELS >= 3)
(PointerPpe->u.Hard.Valid == 0) ||
#endif
- (PointerPde->u.Hard.Valid == 0))
- {
- /* This fault is not valid, printf out some debugging help */
+ (PointerPde->u.Hard.Valid == 0) ||
+ (PointerPte->u.Hard.Valid == 0))
+ {
+ /* This fault is not valid, print out some debugging help */
DbgPrint("MM:***PAGE FAULT AT IRQL > 1 Va %p, IRQL %lx\n",
Address,
OldIrql);
@@ -1411,7 +1412,7 @@
}
/* Nothing is actually wrong */
- DPRINT1("Fault at IRQL1 is ok\n");
+ DPRINT1("Fault at IRQL %u is ok (%p)\n", OldIrql, Address);
return STATUS_SUCCESS;
}
Author: tkreuzer
Date: Fri Nov 22 11:48:51 2013
New Revision: 61072
URL: http://svn.reactos.org/svn/reactos?rev=61072&view=rev
Log:
[NTOSKRNL/WIN32K]
Always call the win32 process callout from PsConvertToGuiThread and handle the case where we alrady have an allocated win32 process there. (The original win32k sometimes allocates a win32 process, but doesn't initialize it, so it needs to be called again to do so)
Modified:
trunk/reactos/ntoskrnl/ps/win32.c
trunk/reactos/win32ss/user/ntuser/main.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/win32.c?rev=61…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/win32.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/win32.c [iso-8859-1] Fri Nov 22 11:48:51 2013
@@ -82,13 +82,9 @@
MmDeleteKernelStack(OldStack, FALSE);
}
- /* This check is bizare. Check out win32k later */
- if (!Process->Win32Process)
- {
- /* Now tell win32k about us */
- Status = PspW32ProcessCallout(Process, TRUE);
- if (!NT_SUCCESS(Status)) return Status;
- }
+ /* Always do the process callout! */
+ Status = PspW32ProcessCallout(Process, TRUE);
+ if (!NT_SUCCESS(Status)) return Status;
/* Set the new service table */
Thread->Tcb.ServiceTable = KeServiceDescriptorTableShadow;
Modified: trunk/reactos/win32ss/user/ntuser/main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] Fri Nov 22 11:48:51 2013
@@ -57,7 +57,7 @@
BOOLEAN Create)
{
PPROCESSINFO ppiCurrent, *pppi;
- DECLARE_RETURN(NTSTATUS);
+ NTSTATUS Status;
ASSERT(Process->Peb);
@@ -69,18 +69,26 @@
LARGE_INTEGER Offset;
PVOID UserBase = NULL;
PRTL_USER_PROCESS_PARAMETERS pParams = Process->Peb->ProcessParameters;
- NTSTATUS Status;
-
- ASSERT(PsGetProcessWin32Process(Process) == NULL);
-
+
+ /* We might be called with an already allocated win32 process */
+ ppiCurrent = PsGetProcessWin32Process(Process);
+ if (ppiCurrent != NULL)
+ {
+ /* There is no more to do for us (this is a success code!) */
+ Status = STATUS_ALREADY_WIN32;
+ goto Leave;
+ }
+
+ /* Allocate a new win32 process */
ppiCurrent = ExAllocatePoolWithTag(NonPagedPool,
sizeof(PROCESSINFO),
USERTAG_PROCESSINFO);
-
if (ppiCurrent == NULL)
{
- ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n", HandleToUlong(Process->UniqueProcessId));
- RETURN( STATUS_NO_MEMORY);
+ ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n",
+ HandleToUlong(Process->UniqueProcessId));
+ Status = STATUS_NO_MEMORY;
+ goto Leave;
}
RtlZeroMemory(ppiCurrent, sizeof(PROCESSINFO));
@@ -111,7 +119,7 @@
if (!NT_SUCCESS(Status))
{
TRACE_CH(UserProcess,"Failed to map the global heap! 0x%x\n", Status);
- RETURN(Status);
+ goto Leave;
}
ppiCurrent->HeapMappings.Next = NULL;
ppiCurrent->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
@@ -241,11 +249,11 @@
ExFreePoolWithTag(ppiCurrent, USERTAG_PROCESSINFO);
}
- RETURN( STATUS_SUCCESS);
-
-CLEANUP:
+ Status = STATUS_SUCCESS;
+
+Leave:
UserLeave();
- END_CLEANUP;
+ return Status;
}
NTSTATUS NTAPI