1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 ModuleName:
6 
7     MxPagedLock.h
8 
9 Abstract:
10 
11     Mode agnostic definition of paged lock
12 
13     See MxPagedLockKm.h and MxPagedLockUm.h for mode
14     specific implementations
15 
16 Author:
17 
18 
19 
20 Revision History:
21 
22 
23 
24 --*/
25 
26 #pragma once
27 
28 //
29 // MxPagedLockNoDynam has no c'tor/d'tor
30 // so as to be usable in global structs in km
31 //
32 // MxPagedLock dervies from it and adds c'tor/d'tor
33 //
34 class MxPagedLockNoDynam
35 {
36 
37 DECLARE_DBGFLAG_INITIALIZED;
38 
39 protected:
40     MdPagedLock m_Lock;
41 public:
42     _Must_inspect_result_
43     __inline
44     NTSTATUS
45     Initialize(
46         );
47 
48     __drv_maxIRQL(APC_LEVEL)
49     __drv_setsIRQL(APC_LEVEL)
50     __drv_savesIRQLGlobal(FastMutexObject, this->m_Lock)
51     _Acquires_lock_(this->m_Lock)
52     __inline
53     VOID
54     Acquire(
55         );
56 
57 
58     __inline
59     VOID
60     AcquireUnsafe(
61         );
62 
63     _Must_inspect_result_
64     __drv_maxIRQL(APC_LEVEL)
65     __drv_savesIRQLGlobal(FastMutexObject, this->m_Lock)
66     __drv_valueIs(==1;==0)
67     __drv_when(return==1, __drv_setsIRQL(APC_LEVEL))
68     _When_(return==1, _Acquires_lock_(this->m_Lock))
69     __inline
70     BOOLEAN
71     TryToAcquire(
72         );
73 
74     __drv_requiresIRQL(APC_LEVEL)
75     __drv_restoresIRQLGlobal(FastMutexObject,this->m_Lock)
76     _Releases_lock_(this->m_Lock)
77     __inline
78     VOID
79     Release(
80         );
81 
82 
83     __inline
84     VOID
85     ReleaseUnsafe(
86         );
87 
88     __inline
89     VOID
90     Uninitialize(
91         );
92 };
93 
94 class MxPagedLock : public MxPagedLockNoDynam
95 {
96 public:
97     __inline
98     MxPagedLock();
99 
100     __inline
101     ~MxPagedLock();
102 };
103 
104