This repository has been archived by the owner on Jun 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ComSession.h
61 lines (53 loc) · 1.84 KB
/
ComSession.h
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
/*!
* \brief The file contains COM session abstruction interface
* \author \verbatim
Created by: Alexander Egorov
\endverbatim
* \date \verbatim
Creation date: 2010-04-11
\endverbatim
* Copyright 2008-2012 Alexander Egorov <egoroff@gmail.com> (http://www.egoroff.spb.ru)
*/
#pragma once
/**
* \brief Represents a COM session abstruction. Contains different COM infrastructure helpers methods.
*/
class ComSession {
public:
/**
* \brief Creates new ComSession instance.
*/
ComSession();
/**
* \brief Virtual descructor
*/
virtual ~ComSession();
protected:
/**
* \brief Just calls CoUninitialize();
*/
virtual void Clear();
/**
* \brief Checks HRESULT and throws exception in case of an error (bad HRESULT)
* @param result HRESULT to check
* @param pMessage Error message
*/
void ThrowIfError(HRESULT result, __in LPCWSTR pMessage) const;
/**
* \brief Checks HRESULT and throws exception in case of an error (bad HRESULT)
* @param result HRESULT to check
* @param pObjectWithError Checked object
* @param rErrorInterface Checked object's interface
*/
void ThrowIfError(
HRESULT result,
__in IUnknown* pObjectWithError,
REFIID rErrorInterface) const;
private:
void DumpErrorInfo(IUnknown *, REFIID) const;
/**
* \brief DumpErrorInfo queries SQLOLEDB error interfaces, retrieving available status or error information.
*/
void DumpErrorInfo(__in std::wostream *, IUnknown *, REFIID) const;
DISALLOW_COPY_AND_ASSIGN(ComSession);
};