probe the pointers in _MmCopyFromCaller and _MmCopyToCaller. There's no need to check the processor mode since it's always just used to copy from/to user memory

svn path=/trunk/; revision=16690
This commit is contained in:
Thomas Bluemel 2005-07-22 20:51:36 +00:00
parent 8112d02490
commit 4bfbd2cfaf
2 changed files with 18 additions and 3 deletions

View file

@ -4,8 +4,9 @@
#include <pseh/pseh.h>
NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes );
NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes );
#define MmCopyFromCaller(x,y,z) _MmCopyFromCaller((PCHAR)(x),(PCHAR)(y),(UINT)(z))
#define MmCopyToCaller(x,y,z) MmCopyFromCaller(x,y,z)
#define MmCopyToCaller(x,y,z) _MmCopyToCaller((PCHAR)(x),(PCHAR)(y),(UINT)(z))
#endif/*NDK_MMCOPY_H*/

View file

@ -2,9 +2,23 @@
NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ) {
NTSTATUS Status = STATUS_SUCCESS;
_SEH_TRY {
RtlCopyMemory(Target,Source,Bytes);
ProbeForRead(Source,Bytes,1);
RtlCopyMemory(Target,Source,Bytes);
} _SEH_HANDLE {
Status = _SEH_GetExceptionCode();
} _SEH_END;
return Status;
}
NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ) {
NTSTATUS Status = STATUS_SUCCESS;
_SEH_TRY {
ProbeForWrite(Target,Bytes,1);
RtlCopyMemory(Target,Source,Bytes);
} _SEH_HANDLE {
Status = _SEH_GetExceptionCode();
} _SEH_END;