2010-04-26 13:58:46 +00:00
|
|
|
#include "win32k.h"
|
2005-07-13 08:48:49 +00:00
|
|
|
|
2014-04-24 17:19:20 +00:00
|
|
|
_IRQL_requires_max_(APC_LEVEL)
|
|
|
|
NTSTATUS
|
|
|
|
_MmCopyFromCaller(
|
|
|
|
_Out_writes_bytes_all_(Bytes) PVOID Target,
|
|
|
|
_In_reads_bytes_(Bytes) PVOID Source,
|
|
|
|
_In_ UINT Bytes)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2014-04-24 17:19:20 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
ASSERT(ExGetPreviousMode() == UserMode);
|
|
|
|
|
|
|
|
Status = STATUS_SUCCESS;
|
2009-02-12 15:33:06 +00:00
|
|
|
_SEH2_TRY
|
|
|
|
{
|
2014-04-24 17:19:20 +00:00
|
|
|
ProbeForRead(Source, Bytes, 1);
|
|
|
|
RtlCopyMemory(Target, Source, Bytes);
|
2009-02-12 15:33:06 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
2005-07-13 08:48:49 +00:00
|
|
|
|
2005-07-22 20:51:36 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2014-04-24 17:19:20 +00:00
|
|
|
_IRQL_requires_max_(APC_LEVEL)
|
|
|
|
NTSTATUS
|
|
|
|
_MmCopyToCaller(
|
|
|
|
_Out_writes_bytes_all_(Bytes) PVOID Target,
|
|
|
|
_In_reads_bytes_(Bytes) PVOID Source,
|
|
|
|
_In_ UINT Bytes)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
PAGED_CODE();
|
|
|
|
ASSERT(ExGetPreviousMode() == UserMode);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2014-04-24 17:19:20 +00:00
|
|
|
Status = STATUS_SUCCESS;
|
2009-02-12 15:33:06 +00:00
|
|
|
_SEH2_TRY
|
|
|
|
{
|
2014-04-24 17:19:20 +00:00
|
|
|
ProbeForWrite(Target, Bytes, 1);
|
|
|
|
RtlCopyMemory(Target, Source, Bytes);
|
2009-02-12 15:33:06 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
2005-07-13 08:48:49 +00:00
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|