summaryrefslogtreecommitdiffstats
path: root/private/ntos/mailslot/except.c
blob: 56d5171dc81e1d61e6447565351f05c765c912bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*++

Copyright (c) 1989  Microsoft Corporation

Module Name:

    except.c

Abstract:

    This module declares the exception handling function used by the
    mailslot file system.

Author:

    Manny Weiser (mannyw)    7-Jan-1991

Revision History:

--*/

#include "mailslot.h"

#define Dbg             DEBUG_TRACE_CATCH_EXCEPTIONS
#ifdef ALLOC_PRAGMA
#pragma alloc_text( PAGE, MsExceptionFilter )
#pragma alloc_text( PAGE, MsProcessException )
#endif

LONG
MsExceptionFilter (
    IN NTSTATUS ExceptionCode
    )
{
    PAGED_CODE();
    DebugTrace(0, Dbg, "MsExceptionFilter %08lx\n", ExceptionCode);
    DebugDump("", Dbg, NULL );

    if (FsRtlIsNtstatusExpected( ExceptionCode )) {

        return EXCEPTION_EXECUTE_HANDLER;

    } else {

        return EXCEPTION_CONTINUE_SEARCH;
    }
}

NTSTATUS
MsProcessException (
    IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
    IN PIRP Irp,
    IN NTSTATUS ExceptionCode
    )
{
    NTSTATUS FinalExceptionCode;

    PAGED_CODE();
    FinalExceptionCode = ExceptionCode;

    if (FsRtlIsNtstatusExpected( ExceptionCode )) {

        MsCompleteRequest( Irp, ExceptionCode );

    } else {

        KeBugCheck( MAILSLOT_FILE_SYSTEM );
    }

    return FinalExceptionCode;
}