-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compartment.h
63 lines (50 loc) · 1.71 KB
/
Compartment.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
62
63
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#pragma once
#include "Private.h"
class CCompartment
{
public:
CCompartment(_In_ IUnknown *punk, TfClientId tfClientId, _In_ REFGUID guidCompartment);
~CCompartment();
HRESULT _GetCompartment(_Outptr_ ITfCompartment **ppCompartment);
HRESULT _GetCompartmentBOOL(_Out_ BOOL &flag);
HRESULT _SetCompartmentBOOL(_In_ BOOL flag);
HRESULT _GetCompartmentDWORD(_Out_ DWORD &dw);
HRESULT _SetCompartmentDWORD(_In_ DWORD dw);
HRESULT _ClearCompartment();
VOID _GetGUID(GUID *pguid)
{
*pguid = _guidCompartment;
}
private:
GUID _guidCompartment;
IUnknown *_punk;
TfClientId _tfClientId;
};
typedef HRESULT (*CESCALLBACK)(void *pv, REFGUID guidCompartment);
class CCompartmentEventSink : public ITfCompartmentEventSink
{
public:
CCompartmentEventSink(_In_ CESCALLBACK pfnCallback, _In_ void *pv);
~CCompartmentEventSink();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, _Outptr_ void **ppvObj);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
// ITfCompartmentEventSink
STDMETHODIMP OnChange(_In_ REFGUID guid);
// function
HRESULT _Advise(_In_ IUnknown *punk, _In_ REFGUID guidCompartment);
HRESULT _Unadvise();
private:
ITfCompartment *_pCompartment;
DWORD _dwCookie;
CESCALLBACK _pfnCallback;
void *_pv;
LONG _refCount;
};