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 */
|
/* Lock a method_neither request so it'll be available from DISPATCH_LEVEL */
|
||||||
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
||||||
|
BOOLEAN LockFailed = FALSE;
|
||||||
|
|
||||||
Irp->MdlAddress =
|
Irp->MdlAddress =
|
||||||
IoAllocateMdl( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
IoAllocateMdl( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
||||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength,
|
IrpSp->Parameters.DeviceIoControl.InputBufferLength,
|
||||||
|
@ -22,9 +24,27 @@ PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL );
|
NULL );
|
||||||
if( Irp->MdlAddress ) {
|
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 =
|
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer =
|
||||||
MmMapLockedPages( Irp->MdlAddress, KernelMode );
|
MmMapLockedPages( Irp->MdlAddress, KernelMode );
|
||||||
|
|
||||||
|
if( !IrpSp->Parameters.DeviceIoControl.Type3InputBuffer ) {
|
||||||
|
IoFreeMdl( Irp->MdlAddress );
|
||||||
|
Irp->MdlAddress = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
|
return IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
|
||||||
} else return NULL;
|
} else return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue