summaryrefslogtreecommitdiff
path: root/src/debug/ildbsymlib/symbinder.h
blob: a0dcf7d4c7c17bae6238465a9f911355ff5ad2e7 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ===========================================================================
// File: SymBinder.h
//

// ===========================================================================

#ifndef SYMBINDER_H_
#define SYMBINDER_H_

/* ------------------------------------------------------------------------- *
 * SymBinder class
 * ------------------------------------------------------------------------- */

class SymBinder : ISymUnmanagedBinder2
{
// ctor/dtor
public:
    SymBinder()
    {   
    m_refCount = 0;
    }

    virtual ~SymBinder() {}

    static HRESULT NewSymBinder( REFCLSID clsid, void** ppObj );

// IUnknown methods
public:

    //-----------------------------------------------------------
    // IUnknown support
    //-----------------------------------------------------------
    ULONG STDMETHODCALLTYPE AddRef()
    {
        return (InterlockedIncrement((LONG *) &m_refCount));
    }

    ULONG STDMETHODCALLTYPE Release()
    {
        LONG refCount = InterlockedDecrement((LONG *) &m_refCount);
        if (refCount == 0)
            DELETE(this);

        return (refCount);
    }
    STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject);

    // ISymUnmanagedBinder
public:

    STDMETHOD(GetReaderForFile)( IUnknown *importer,
                                 const WCHAR *fileName,
                                 const WCHAR *searchPath,
                                 ISymUnmanagedReader **pRetVal);
    STDMETHOD(GetReaderFromStream)(IUnknown *importer,
                    IStream *pstream,
                    ISymUnmanagedReader **pRetVal);

    // ISymUnmanagedBinder2
    STDMETHOD(GetReaderForFile2)( IUnknown *importer,
                                  const WCHAR *fileName,
                                  const WCHAR *searchPath,
                                  ULONG32 searchPolicy,
                                  ISymUnmanagedReader **pRetVal);

private:
    SIZE_T      m_refCount;

};
#endif