1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | // =========================================================================== |
5 | // File: SymBinder.h |
6 | // |
7 | |
8 | // =========================================================================== |
9 | |
10 | #ifndef SYMBINDER_H_ |
11 | #define SYMBINDER_H_ |
12 | |
13 | /* ------------------------------------------------------------------------- * |
14 | * SymBinder class |
15 | * ------------------------------------------------------------------------- */ |
16 | |
17 | class SymBinder : ISymUnmanagedBinder2 |
18 | { |
19 | // ctor/dtor |
20 | public: |
21 | SymBinder() |
22 | { |
23 | m_refCount = 0; |
24 | } |
25 | |
26 | virtual ~SymBinder() {} |
27 | |
28 | static HRESULT NewSymBinder( REFCLSID clsid, void** ppObj ); |
29 | |
30 | // IUnknown methods |
31 | public: |
32 | |
33 | //----------------------------------------------------------- |
34 | // IUnknown support |
35 | //----------------------------------------------------------- |
36 | ULONG STDMETHODCALLTYPE AddRef() |
37 | { |
38 | return (InterlockedIncrement((LONG *) &m_refCount)); |
39 | } |
40 | |
41 | ULONG STDMETHODCALLTYPE Release() |
42 | { |
43 | LONG refCount = InterlockedDecrement((LONG *) &m_refCount); |
44 | if (refCount == 0) |
45 | DELETE(this); |
46 | |
47 | return (refCount); |
48 | } |
49 | STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject); |
50 | |
51 | // ISymUnmanagedBinder |
52 | public: |
53 | |
54 | STDMETHOD(GetReaderForFile)( IUnknown *importer, |
55 | const WCHAR *fileName, |
56 | const WCHAR *searchPath, |
57 | ISymUnmanagedReader **pRetVal); |
58 | STDMETHOD(GetReaderFromStream)(IUnknown *importer, |
59 | IStream *pstream, |
60 | ISymUnmanagedReader **pRetVal); |
61 | |
62 | // ISymUnmanagedBinder2 |
63 | STDMETHOD(GetReaderForFile2)( IUnknown *importer, |
64 | const WCHAR *fileName, |
65 | const WCHAR *searchPath, |
66 | ULONG32 searchPolicy, |
67 | ISymUnmanagedReader **pRetVal); |
68 | |
69 | private: |
70 | SIZE_T m_refCount; |
71 | |
72 | }; |
73 | #endif |
74 | |