| 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 | // | 
|---|
| 6 | // CoreBindResult.cpp | 
|---|
| 7 | // | 
|---|
| 8 |  | 
|---|
| 9 | // | 
|---|
| 10 | // Implements the CoreBindResult class | 
|---|
| 11 | // ============================================================ | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | #include "common.h" | 
|---|
| 15 |  | 
|---|
| 16 | #include "../binder/inc/assembly.hpp" | 
|---|
| 17 |  | 
|---|
| 18 | #ifndef DACCESS_COMPILE | 
|---|
| 19 |  | 
|---|
| 20 | STDMETHODIMP CoreBindResult::QueryInterface(REFIID   riid, | 
|---|
| 21 | void   **ppv) | 
|---|
| 22 | { | 
|---|
| 23 | HRESULT hr = S_OK; | 
|---|
| 24 |  | 
|---|
| 25 | if (ppv == NULL) | 
|---|
| 26 | { | 
|---|
| 27 | hr = E_POINTER; | 
|---|
| 28 | } | 
|---|
| 29 | else | 
|---|
| 30 | { | 
|---|
| 31 | if ( IsEqualIID(riid, IID_IUnknown) ) | 
|---|
| 32 | { | 
|---|
| 33 | AddRef(); | 
|---|
| 34 | *ppv = static_cast<IUnknown *>(this); | 
|---|
| 35 | } | 
|---|
| 36 | else | 
|---|
| 37 | { | 
|---|
| 38 | *ppv = NULL; | 
|---|
| 39 | hr = E_NOINTERFACE; | 
|---|
| 40 | } | 
|---|
| 41 | } | 
|---|
| 42 |  | 
|---|
| 43 | return hr; | 
|---|
| 44 | } | 
|---|
| 45 |  | 
|---|
| 46 | STDMETHODIMP_(ULONG) CoreBindResult::AddRef() | 
|---|
| 47 | { | 
|---|
| 48 | return InterlockedIncrement(&m_cRef); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | STDMETHODIMP_(ULONG) CoreBindResult::Release() | 
|---|
| 52 | { | 
|---|
| 53 | ULONG ulRef = InterlockedDecrement(&m_cRef); | 
|---|
| 54 |  | 
|---|
| 55 | if (ulRef == 0) | 
|---|
| 56 | { | 
|---|
| 57 | delete this; | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | return ulRef; | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|
| 64 | #endif  // DACCES_COMPILE | 
|---|
| 65 |  | 
|---|