diff --git a/reactos/ntoskrnl/config/cminit.c b/reactos/ntoskrnl/config/cminit.c index 553b84a962c..154ba1530b6 100644 --- a/reactos/ntoskrnl/config/cminit.c +++ b/reactos/ntoskrnl/config/cminit.c @@ -163,13 +163,17 @@ CmpInitializeHive(OUT PCMHIVE *RegistryHive, /* Set flags */ Hive->Flags = HiveFlags; - /* Check how large the file is */ - ZwQueryInformationFile(Primary, - &IoStatusBlock, - &FileInformation, - sizeof(FileInformation), - FileStandardInformation); - Cluster = FileInformation.EndOfFile.LowPart; + /* Check if this is a primary */ + if (Primary) + { + /* Check how large the file is */ + ZwQueryInformationFile(Primary, + &IoStatusBlock, + &FileInformation, + sizeof(FileInformation), + FileStandardInformation); + Cluster = FileInformation.EndOfFile.LowPart; + } /* Initialize it */ Status = HvInitialize(&Hive->Hive, diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index d2794a4b52f..fed59bce758 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -303,7 +303,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) KernelMode, &ExpNlsSectionPointer, NULL); - ZwClose(NlsSection); + ObCloseHandle(NlsSection, KernelMode); if (!NT_SUCCESS(Status)) { /* Failed */ diff --git a/reactos/ntoskrnl/ex/work.c b/reactos/ntoskrnl/ex/work.c index d7bdae23583..abedd6b4985 100644 --- a/reactos/ntoskrnl/ex/work.c +++ b/reactos/ntoskrnl/ex/work.c @@ -310,7 +310,7 @@ ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType, /* Dereference and close handle */ ObDereferenceObject(Thread); - ZwClose(hThread); + ObCloseHandle(hThread, KernelMode); } /*++ @@ -586,7 +586,7 @@ ExpInitializeWorkerThreads(VOID) ExpWorkerThreadBalanceManagerPtr = Thread; /* Close the handle and return */ - ZwClose(ThreadHandle); + ObCloseHandle(ThreadHandle, KernelMode); } /* PUBLIC FUNCTIONS **********************************************************/ diff --git a/reactos/ntoskrnl/include/internal/trap_x.h b/reactos/ntoskrnl/include/internal/trap_x.h index b5f6e58e06e..bf82738f22d 100644 --- a/reactos/ntoskrnl/include/internal/trap_x.h +++ b/reactos/ntoskrnl/include/internal/trap_x.h @@ -165,7 +165,7 @@ FORCEINLINE KiUserTrap(IN PKTRAP_FRAME TrapFrame) { /* Anything else but Ring 0 is Ring 3 */ - return (TrapFrame->SegCs != KGDT_R0_CODE); + return (TrapFrame->SegCs & MODE_MASK); } BOOLEAN diff --git a/reactos/ntoskrnl/ke/i386/traphdlr.c b/reactos/ntoskrnl/ke/i386/traphdlr.c index 1bbb520b43c..bf82b8e51a2 100644 --- a/reactos/ntoskrnl/ke/i386/traphdlr.c +++ b/reactos/ntoskrnl/ke/i386/traphdlr.c @@ -466,7 +466,7 @@ KiDispatchExceptionFromTrapFrame(IN NTSTATUS Code, NULL, TrapFrame, TrapFrame->EFlags & EFLAGS_V86_MASK ? - -1 : TrapFrame->SegCs & MODE_MASK, + -1 : KiUserTrap(TrapFrame), TRUE); /* Return from this trap */ diff --git a/reactos/ntoskrnl/ps/psmgr.c b/reactos/ntoskrnl/ps/psmgr.c index f30a03d93f1..9fa513b0f17 100644 --- a/reactos/ntoskrnl/ps/psmgr.c +++ b/reactos/ntoskrnl/ps/psmgr.c @@ -586,7 +586,7 @@ PspInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock) KernelMode, (PVOID*)&SysThread, NULL); - ZwClose(SysThreadHandle); + ObCloseHandle(SysThreadHandle, KernelMode); SysThreadCreated = TRUE; /* Return success */