ReactOS 0.4.15-dev-5669-g09dde2c
mxpagedlockum.h
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5ModuleName:
6
7 MxPagedLockUm.h
8
9Abstract:
10
11 User mode implementation of paged lock defined in
12 MxPagedLock.h
13
14Author:
15
16
17
18Revision History:
19
20
21
22--*/
23
24#pragma once
25
26typedef struct {
31
32#include "MxPagedLock.h"
33
34__inline
36 )
37{
38 m_Lock.Initialized = false;
40}
41
43__inline
46 )
47{
49 m_Lock.Initialized = true;
50
51 return S_OK;
52 }
53 else {
55 return WinErrorToNtStatus(err);
56 }
57}
58
59__inline
60VOID
61#pragma prefast(suppress:__WARNING_UNMATCHED_DEFN, "Can't apply kernel mode annotations.");
62MxPagedLockNoDynam::Acquire(
63 )
64{
66
67 DWORD threadId = GetCurrentThreadId();
68
69 if (threadId == m_Lock.OwnerThreadId) {
70 Mx::MxAssertMsg("Recursive acquision of the lock is not allowed", FALSE);
71 }
72
74}
75
76__inline
77VOID
79 )
80{
81 MxPagedLockNoDynam::Acquire();
82}
83
84__inline
86#pragma prefast(suppress:__WARNING_UNMATCHED_DEFN, "Can't apply kernel mode annotations.");
87MxPagedLockNoDynam::TryToAcquire(
88 )
89{
91}
92
93
94__inline
95VOID
96#pragma prefast(suppress:__WARNING_UNMATCHED_DEFN, "Can't apply kernel mode annotations.");
97MxPagedLockNoDynam::Release(
98 )
99{
101
103}
104
105__inline
106VOID
108 )
109{
110 MxPagedLockNoDynam::Release();
111}
112
113__inline
114VOID
116 )
117{
119 m_Lock.Initialized = false;
120}
121
122__inline
124 )
125{
126 if (m_Lock.Initialized) {
127 this->Uninitialize();
128 }
129}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
MdPagedLock m_Lock
Definition: mxpagedlock.h:40
__inline VOID Uninitialize()
__inline VOID AcquireUnsafe()
Definition: mxpagedlockkm.h:78
_Must_inspect_result_ __inline NTSTATUS Initialize()
Definition: mxpagedlockkm.h:52
__inline VOID ReleaseUnsafe()
__inline ~MxPagedLock()
__inline MxPagedLock()
Definition: mxpagedlockkm.h:33
static __inline VOID MxAssertMsg(__in LPSTR Message, __in BOOLEAN Condition)
Definition: mxgeneralkm.h:176
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
NTSTATUS WinErrorToNtStatus(__in ULONG WinError)
Definition: errtostatus.cpp:60
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define err(...)
CRITICAL_SECTION Lock
Definition: mxpagedlockum.h:27
DWORD OwnerThreadId
Definition: mxpagedlockum.h:29
bool Initialized
Definition: mxpagedlockum.h:28
BOOL WINAPI InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount)
Definition: synch.c:765
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
BOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)