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// Disp.h
6//
7
8//
9// Class factories are used by the pluming in COM to activate new objects.
10// This module contains the class factory code to instantiate the debugger
11// objects described in <cordb.h>.
12//
13//*****************************************************************************
14#ifndef __Disp__h__
15#define __Disp__h__
16
17
18class Disp :
19 public IMetaDataDispenserEx
20#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
21 , IMetaDataDispenserCustom
22#endif
23{
24public:
25 Disp();
26 virtual ~Disp();
27
28 // *** IUnknown methods ***
29 STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
30 STDMETHODIMP_(ULONG) AddRef(void);
31 STDMETHODIMP_(ULONG) Release(void);
32
33 // *** IMetaDataDispenser methods ***
34 STDMETHODIMP DefineScope( // Return code.
35 REFCLSID rclsid, // [in] What version to create.
36 DWORD dwCreateFlags, // [in] Flags on the create.
37 REFIID riid, // [in] The interface desired.
38 IUnknown **ppIUnk); // [out] Return interface on success.
39
40 STDMETHODIMP OpenScope( // Return code.
41 LPCWSTR szScope, // [in] The scope to open.
42 DWORD dwOpenFlags, // [in] Open mode flags.
43 REFIID riid, // [in] The interface desired.
44 IUnknown **ppIUnk); // [out] Return interface on success.
45
46 STDMETHODIMP OpenScopeOnMemory( // Return code.
47 LPCVOID pData, // [in] Location of scope data.
48 ULONG cbData, // [in] Size of the data pointed to by pData.
49 DWORD dwOpenFlags, // [in] Open mode flags.
50 REFIID riid, // [in] The interface desired.
51 IUnknown **ppIUnk); // [out] Return interface on success.
52
53 // *** IMetaDataDispenserEx methods ***
54 STDMETHODIMP SetOption( // Return code.
55 REFGUID optionid, // [in] GUID for the option to be set.
56 const VARIANT *pvalue); // [in] Value to which the option is to be set.
57
58 STDMETHODIMP GetOption( // Return code.
59 REFGUID optionid, // [in] GUID for the option to be set.
60 VARIANT *pvalue); // [out] Value to which the option is currently set.
61
62 STDMETHODIMP OpenScopeOnITypeInfo( // Return code.
63 ITypeInfo *pITI, // [in] ITypeInfo to open.
64 DWORD dwOpenFlags, // [in] Open mode flags.
65 REFIID riid, // [in] The interface desired.
66 IUnknown **ppIUnk); // [out] Return interface on success.
67
68 STDMETHODIMP GetCORSystemDirectory( // Return code.
69 __out_ecount (cchBuffer) LPWSTR szBuffer, // [out] Buffer for the directory name
70 DWORD cchBuffer, // [in] Size of the buffer
71 DWORD* pchBuffer); // [OUT] Number of characters returned
72
73 STDMETHODIMP FindAssembly( // S_OK or error
74 LPCWSTR szAppBase, // [IN] optional - can be NULL
75 LPCWSTR szPrivateBin, // [IN] optional - can be NULL
76 LPCWSTR szGlobalBin, // [IN] optional - can be NULL
77 LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
78 LPCWSTR szName, // [OUT] buffer - to hold name
79 ULONG cchName, // [IN] the name buffer's size
80 ULONG *pcName); // [OUT] the number of characters returend in the buffer
81
82 STDMETHODIMP FindAssemblyModule( // S_OK or error
83 LPCWSTR szAppBase, // [IN] optional - can be NULL
84 LPCWSTR szPrivateBin, // [IN] optional - can be NULL
85 LPCWSTR szGlobalBin, // [IN] optional - can be NULL
86 LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
87 LPCWSTR szModuleName, // [IN] required - the name of the module
88 __out_ecount (cchName)LPWSTR szName,// [OUT] buffer - to hold name
89 ULONG cchName, // [IN] the name buffer's size
90 ULONG *pcName); // [OUT] the number of characters returend in the buffer
91
92#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
93 // *** IMetaDataDispenserCustom methods ***
94 STDMETHODIMP OpenScopeOnCustomDataSource( // S_OK or error
95 IMDCustomDataSource *pCustomSource, // [in] The scope to open.
96 DWORD dwOpenFlags, // [in] Open mode flags.
97 REFIID riid, // [in] The interface desired.
98 IUnknown **ppIUnk); // [out] Return interface on success.
99#endif
100
101 // Class factory hook-up.
102 static HRESULT CreateObject(REFIID riid, void **ppUnk);
103
104private:
105 HRESULT OpenRawScope( // Return code.
106 LPCWSTR szScope, // [in] The scope to open.
107 DWORD dwOpenFlags, // [in] Open mode flags.
108 REFIID riid, // [in] The interface desired.
109 IUnknown **ppIUnk); // [out] Return interface on success.
110
111 HRESULT OpenRawScopeOnMemory( // Return code.
112 LPCVOID pData, // [in] Location of scope data.
113 ULONG cbData, // [in] Size of the data pointed to by pData.
114 DWORD dwOpenFlags, // [in] Open mode flags.
115 REFIID riid, // [in] The interface desired.
116 IUnknown **ppIUnk); // [out] Return interface on success.
117
118#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
119 HRESULT OpenRawScopeOnCustomDataSource( // Return code.
120 IMDCustomDataSource* pDataSource, // [in] scope data.
121 DWORD dwOpenFlags, // [in] Open mode flags.
122 REFIID riid, // [in] The interface desired.
123 IUnknown **ppIUnk); // [out] Return interface on success.
124#endif
125
126
127private:
128 LONG m_cRef; // Ref count
129 OptionValue m_OptionValue; // values can be set by using SetOption
130};
131
132#endif // __Disp__h__
133