mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:53:05 +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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1013,57 +1013,79 @@ CallQS [] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||||
NtQuerySystemInformation (
|
OUT PVOID UnsafeSystemInformation,
|
||||||
IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
IN ULONG Length,
|
||||||
OUT PVOID SystemInformation,
|
OUT PULONG UnsafeResultLength)
|
||||||
IN ULONG Length,
|
|
||||||
OUT PULONG ResultLength
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/*
|
ULONG ResultLength;
|
||||||
* If called from user mode, check
|
PVOID SystemInformation;
|
||||||
* possible unsafe arguments.
|
NTSTATUS Status;
|
||||||
*/
|
NTSTATUS FStatus;
|
||||||
#if 0
|
|
||||||
if (KernelMode != KeGetPreviousMode())
|
if (ExGetPreviousMode() == KernelMode)
|
||||||
{
|
{
|
||||||
// Check arguments
|
SystemInformation = UnsafeSystemInformation;
|
||||||
//ProbeForWrite(
|
}
|
||||||
// SystemInformation,
|
else
|
||||||
// Length
|
{
|
||||||
// );
|
SystemInformation = ExAllocatePool(NonPagedPool, Length);
|
||||||
//ProbeForWrite(
|
if (SystemInformation == NULL)
|
||||||
// ResultLength,
|
|
||||||
// sizeof (ULONG)
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Clear the user buffer.
|
|
||||||
*/
|
|
||||||
RtlZeroMemory (SystemInformation, Length);
|
|
||||||
/*
|
|
||||||
* Check the request is valid.
|
|
||||||
*/
|
|
||||||
if ( (SystemInformationClass >= SystemInformationClassMin)
|
|
||||||
&& (SystemInformationClass < SystemInformationClassMax)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (NULL != CallQS [SystemInformationClass].Query)
|
return(STATUS_NO_MEMORY);
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Hand the request to a subhandler.
|
|
||||||
*/
|
|
||||||
return CallQS [SystemInformationClass].Query (
|
|
||||||
SystemInformation,
|
|
||||||
Length,
|
|
||||||
ResultLength
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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/ps.h>
|
||||||
#include <internal/trap.h>
|
#include <internal/trap.h>
|
||||||
#include <ntdll/ldr.h>
|
#include <ntdll/ldr.h>
|
||||||
|
#include <internal/safe.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
@ -368,6 +369,9 @@ KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2)
|
||||||
PULONG Frame;
|
PULONG Frame;
|
||||||
ULONG cr3;
|
ULONG cr3;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
ULONG ReturnAddress;
|
||||||
|
ULONG NextFrame;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the PDBR
|
* Get the PDBR
|
||||||
|
@ -452,8 +456,25 @@ KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2)
|
||||||
Frame = (PULONG)Tf->Ebp;
|
Frame = (PULONG)Tf->Ebp;
|
||||||
while (Frame != NULL)
|
while (Frame != NULL)
|
||||||
{
|
{
|
||||||
print_address((PVOID)Frame[1]);
|
Status = MmCopyToCaller(&ReturnAddress, &Frame[1], sizeof(ULONG));
|
||||||
Frame = (PULONG)Frame[0];
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue