1 #include "win32k.h" 2 3 _IRQL_requires_max_(APC_LEVEL) 4 NTSTATUS 5 _MmCopyFromCaller( 6 _Out_writes_bytes_all_(Bytes) PVOID Target, 7 _In_reads_bytes_(Bytes) PVOID Source, 8 _In_ UINT Bytes) 9 { 10 NTSTATUS Status; 11 12 PAGED_CODE(); 13 ASSERT(ExGetPreviousMode() == UserMode); 14 15 Status = STATUS_SUCCESS; 16 _SEH2_TRY 17 { 18 ProbeForRead(Source, Bytes, 1); 19 RtlCopyMemory(Target, Source, Bytes); 20 } 21 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) 22 { 23 Status = _SEH2_GetExceptionCode(); 24 } 25 _SEH2_END; 26 27 return Status; 28 } 29 30 _IRQL_requires_max_(APC_LEVEL) 31 NTSTATUS 32 _MmCopyToCaller( 33 _Out_writes_bytes_all_(Bytes) PVOID Target, 34 _In_reads_bytes_(Bytes) PVOID Source, 35 _In_ UINT Bytes) 36 { 37 NTSTATUS Status; 38 39 PAGED_CODE(); 40 ASSERT(ExGetPreviousMode() == UserMode); 41 42 Status = STATUS_SUCCESS; 43 _SEH2_TRY 44 { 45 ProbeForWrite(Target, Bytes, 1); 46 RtlCopyMemory(Target, Source, Bytes); 47 } 48 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) 49 { 50 Status = _SEH2_GetExceptionCode(); 51 } 52 _SEH2_END; 53 54 return Status; 55 } 56