blob: 88d8c052f0fe43c670dadbfd6819c345ffe8f80c (
plain)
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
|
//+--------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This source code is intended only as a supplement to Microsoft
// Development Tools and/or on-line documentation. See these other
// materials for detailed information regarding Microsoft code samples.
//
// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//
// Abstract:
// WDK print filter sample.
// The filters need to derive from DllLockManager. Thus the filter constructor and
// destructor call the DllLockManager constructor and destructor, respectively.
//
//----------------------------------------------------------------------------
#ifndef _FILTER_MAIN_HXX_
#define _FILTER_MAIN_HXX_
class DllLockManager
{
public:
DllLockManager()
{
InterlockedIncrement(&m_cGlobalRef);
}
~DllLockManager()
{
InterlockedDecrement(&m_cGlobalRef);
}
static
LONG
GetGlobalRef()
{
return InterlockedCompareExchange(&m_cGlobalRef, 0, 0);
}
private:
static LONG m_cGlobalRef;
};
#endif
|