mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
Fixed bugs with vim
svn path=/trunk/; revision=2377
This commit is contained in:
parent
5d289c12b2
commit
189a5e8404
2 changed files with 94 additions and 51 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sysinfo.c,v 1.13 2001/09/02 17:29:51 dwelch Exp $
|
||||
/* $Id: sysinfo.c,v 1.14 2001/11/18 00:31:23 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1013,57 +1013,79 @@ CallQS [] =
|
|||
};
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQuerySystemInformation (
|
||||
IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||
OUT PVOID SystemInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||
OUT PVOID UnsafeSystemInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG UnsafeResultLength)
|
||||
{
|
||||
/*
|
||||
* If called from user mode, check
|
||||
* possible unsafe arguments.
|
||||
*/
|
||||
#if 0
|
||||
if (KernelMode != KeGetPreviousMode())
|
||||
{
|
||||
// Check arguments
|
||||
//ProbeForWrite(
|
||||
// SystemInformation,
|
||||
// Length
|
||||
// );
|
||||
//ProbeForWrite(
|
||||
// ResultLength,
|
||||
// sizeof (ULONG)
|
||||
// );
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Clear the user buffer.
|
||||
*/
|
||||
RtlZeroMemory (SystemInformation, Length);
|
||||
/*
|
||||
* Check the request is valid.
|
||||
*/
|
||||
if ( (SystemInformationClass >= SystemInformationClassMin)
|
||||
&& (SystemInformationClass < SystemInformationClassMax)
|
||||
)
|
||||
ULONG ResultLength;
|
||||
PVOID SystemInformation;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS FStatus;
|
||||
|
||||
if (ExGetPreviousMode() == KernelMode)
|
||||
{
|
||||
SystemInformation = UnsafeSystemInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemInformation = ExAllocatePool(NonPagedPool, Length);
|
||||
if (SystemInformation == NULL)
|
||||
{
|
||||
if (NULL != CallQS [SystemInformationClass].Query)
|
||||
{
|
||||
/*
|
||||
* Hand the request to a subhandler.
|
||||
*/
|
||||
return CallQS [SystemInformationClass].Query (
|
||||
SystemInformation,
|
||||
Length,
|
||||
ResultLength
|
||||
);
|
||||
}
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
return (STATUS_INVALID_INFO_CLASS);
|
||||
}
|
||||
|
||||
/* Clear user buffer. */
|
||||
RtlZeroMemory(SystemInformation, Length);
|
||||
|
||||
/*
|
||||
* Check the request is valid.
|
||||
*/
|
||||
if ((SystemInformationClass >= SystemInformationClassMin) &&
|
||||
(SystemInformationClass < SystemInformationClassMax))
|
||||
{
|
||||
if (NULL != CallQS [SystemInformationClass].Query)
|
||||
{
|
||||
/*
|
||||
* Hand the request to a subhandler.
|
||||
*/
|
||||
FStatus = CallQS [SystemInformationClass].Query(SystemInformation,
|
||||
Length,
|
||||
&ResultLength);
|
||||
if (ExGetPreviousMode() != KernelMode)
|
||||
{
|
||||
Status = MmCopyToCaller(UnsafeSystemInformation,
|
||||
SystemInformation,
|
||||
Length);
|
||||
ExFreePool(SystemInformation);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
if (UnsafeResultLength != NULL)
|
||||
{
|
||||
if (ExGetPreviousMode() == KernelMode)
|
||||
{
|
||||
*UnsafeResultLength = ResultLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = MmCopyToCaller(UnsafeResultLength,
|
||||
&ResultLength,
|
||||
sizeof(ULONG));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(FStatus);
|
||||
}
|
||||
}
|
||||
return (STATUS_INVALID_INFO_CLASS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <internal/ps.h>
|
||||
#include <internal/trap.h>
|
||||
#include <ntdll/ldr.h>
|
||||
#include <internal/safe.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
@ -368,6 +369,9 @@ KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2)
|
|||
PULONG Frame;
|
||||
ULONG cr3;
|
||||
ULONG i;
|
||||
ULONG ReturnAddress;
|
||||
ULONG NextFrame;
|
||||
NTSTATUS Status;
|
||||
|
||||
/*
|
||||
* Get the PDBR
|
||||
|
@ -452,8 +456,25 @@ KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2)
|
|||
Frame = (PULONG)Tf->Ebp;
|
||||
while (Frame != NULL)
|
||||
{
|
||||
print_address((PVOID)Frame[1]);
|
||||
Frame = (PULONG)Frame[0];
|
||||
Status = MmCopyToCaller(&ReturnAddress, &Frame[1], sizeof(ULONG));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("????????\n");
|
||||
break;
|
||||
}
|
||||
print_address((PVOID)ReturnAddress);
|
||||
Status = MmCopyToCaller(&NextFrame, &Frame[0], sizeof(ULONG));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Frame is inaccessible.\n");
|
||||
break;
|
||||
}
|
||||
if ((NextFrame + sizeof(ULONG)) >= KERNEL_BASE)
|
||||
{
|
||||
DbgPrint("Next frame is in kernel space!\n");
|
||||
break;
|
||||
}
|
||||
Frame = (PULONG)NextFrame;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue