2 // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 // com_utils.h: Utility functions for working with COM objects
9 #ifndef UTIL_COM_UTILS_H
10 #define UTIL_COM_UTILS_H
12 template <typename outType>
13 inline outType *DynamicCastComObject(IUnknown *object)
15 outType *outObject = nullptr;
16 HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast<void**>(&outObject));
17 if (SUCCEEDED(result))
23 SafeRelease(outObject);
28 #endif // UTIL_COM_UTILS_H