mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
- SEHify LockRequest
- Free everything and return if MmMapLockedPages fails svn path=/branches/aicom-network-fixes/; revision=35454
This commit is contained in:
parent
ea2d464b14
commit
2a199d0cb2
1 changed files with 21 additions and 1 deletions
|
@ -15,6 +15,8 @@
|
|||
|
||||
/* Lock a method_neither request so it'll be available from DISPATCH_LEVEL */
|
||||
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
||||
BOOLEAN LockFailed = FALSE;
|
||||
|
||||
Irp->MdlAddress =
|
||||
IoAllocateMdl( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength,
|
||||
|
@ -22,9 +24,27 @@ PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
|||
FALSE,
|
||||
NULL );
|
||||
if( Irp->MdlAddress ) {
|
||||
MmProbeAndLockPages( Irp->MdlAddress, KernelMode, IoModifyAccess );
|
||||
_SEH_TRY {
|
||||
MmProbeAndLockPages( Irp->MdlAddress, KernelMode, IoModifyAccess );
|
||||
} _SEH_HANDLE {
|
||||
LockFailed = TRUE;
|
||||
} _SEH_END;
|
||||
|
||||
if( LockFailed ) {
|
||||
IoFreeMdl( Irp->MdlAddress );
|
||||
Irp->MdlAddress = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer =
|
||||
MmMapLockedPages( Irp->MdlAddress, KernelMode );
|
||||
|
||||
if( !IrpSp->Parameters.DeviceIoControl.Type3InputBuffer ) {
|
||||
IoFreeMdl( Irp->MdlAddress );
|
||||
Irp->MdlAddress = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
|
||||
} else return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue