summaryrefslogtreecommitdiff
path: root/src/md/compiler/disp.h
blob: 66bd02465f2185a452d8fc1a8d250e97031387e7 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//*****************************************************************************
// Disp.h
// 

//
// Class factories are used by the pluming in COM to activate new objects.  
// This module contains the class factory code to instantiate the debugger
// objects described in <cordb.h>.
//
//*****************************************************************************
#ifndef __Disp__h__
#define __Disp__h__


class Disp :
    public IMetaDataDispenserEx
#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
    , IMetaDataDispenserCustom
#endif
{
public:
    Disp();
    ~Disp();

    // *** IUnknown methods ***
    STDMETHODIMP    QueryInterface(REFIID riid, void** ppv);
    STDMETHODIMP_(ULONG) AddRef(void); 
    STDMETHODIMP_(ULONG) Release(void);

    // *** IMetaDataDispenser methods ***
    STDMETHODIMP DefineScope(               // Return code.
        REFCLSID    rclsid,                 // [in] What version to create.
        DWORD       dwCreateFlags,          // [in] Flags on the create.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.

    STDMETHODIMP OpenScope(                 // Return code.
        LPCWSTR     szScope,                // [in] The scope to open.
        DWORD       dwOpenFlags,            // [in] Open mode flags.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.

    STDMETHODIMP OpenScopeOnMemory(         // Return code.
        LPCVOID     pData,                  // [in] Location of scope data.
        ULONG       cbData,                 // [in] Size of the data pointed to by pData.
        DWORD       dwOpenFlags,            // [in] Open mode flags.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.

    // *** IMetaDataDispenserEx methods ***
    STDMETHODIMP SetOption(                 // Return code.
        REFGUID     optionid,               // [in] GUID for the option to be set.
        const VARIANT *pvalue);             // [in] Value to which the option is to be set.

    STDMETHODIMP GetOption(                 // Return code.
        REFGUID     optionid,               // [in] GUID for the option to be set.
        VARIANT *pvalue);                   // [out] Value to which the option is currently set.

    STDMETHODIMP OpenScopeOnITypeInfo(      // Return code.
        ITypeInfo   *pITI,                  // [in] ITypeInfo to open.
        DWORD       dwOpenFlags,            // [in] Open mode flags.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.
                                
    STDMETHODIMP GetCORSystemDirectory(     // Return code.
         __out_ecount (cchBuffer) LPWSTR szBuffer,  // [out] Buffer for the directory name
         DWORD       cchBuffer,             // [in] Size of the buffer
         DWORD*      pchBuffer);            // [OUT] Number of characters returned

    STDMETHODIMP FindAssembly(              // S_OK or error
        LPCWSTR  szAppBase,                 // [IN] optional - can be NULL
        LPCWSTR  szPrivateBin,              // [IN] optional - can be NULL
        LPCWSTR  szGlobalBin,               // [IN] optional - can be NULL
        LPCWSTR  szAssemblyName,            // [IN] required - this is the assembly you are requesting
        LPCWSTR  szName,                    // [OUT] buffer - to hold name 
        ULONG    cchName,                   // [IN] the name buffer's size
        ULONG    *pcName);                  // [OUT] the number of characters returend in the buffer

    STDMETHODIMP FindAssemblyModule(        // S_OK or error
        LPCWSTR  szAppBase,                 // [IN] optional - can be NULL
        LPCWSTR  szPrivateBin,              // [IN] optional - can be NULL
        LPCWSTR  szGlobalBin,               // [IN] optional - can be NULL
        LPCWSTR  szAssemblyName,            // [IN] required - this is the assembly you are requesting
        LPCWSTR  szModuleName,              // [IN] required - the name of the module
        __out_ecount (cchName)LPWSTR szName,// [OUT] buffer - to hold name 
        ULONG    cchName,                   // [IN]  the name buffer's size
        ULONG    *pcName);                  // [OUT] the number of characters returend in the buffer

#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
    // *** IMetaDataDispenserCustom methods ***
    STDMETHODIMP OpenScopeOnCustomDataSource(  // S_OK or error
        IMDCustomDataSource  *pCustomSource, // [in] The scope to open.
        DWORD                dwOpenFlags,    // [in] Open mode flags.
        REFIID               riid,           // [in] The interface desired.
        IUnknown             **ppIUnk);      // [out] Return interface on success.
#endif

    // Class factory hook-up.
    static HRESULT CreateObject(REFIID riid, void **ppUnk);

private:
    HRESULT OpenRawScope(                   // Return code.
        LPCWSTR     szScope,                // [in] The scope to open.
        DWORD       dwOpenFlags,            // [in] Open mode flags.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.

    HRESULT OpenRawScopeOnMemory(           // Return code.
        LPCVOID     pData,                  // [in] Location of scope data.
        ULONG       cbData,                 // [in] Size of the data pointed to by pData.
        DWORD       dwOpenFlags,            // [in] Open mode flags.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.

#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
    HRESULT OpenRawScopeOnCustomDataSource( // Return code.
        IMDCustomDataSource*  pDataSource,  // [in] scope data.
        DWORD       dwOpenFlags,            // [in] Open mode flags.
        REFIID      riid,                   // [in] The interface desired.
        IUnknown    **ppIUnk);              // [out] Return interface on success.
#endif


private:
    LONG        m_cRef;                 // Ref count
    OptionValue m_OptionValue;          // values can be set by using SetOption
};

#endif // __Disp__h__