blob: 77022eea5ae31914790e720346f621ff5d54ecc6 (
plain) (
blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1996.
//
// File: cdllsrv.cxx
//
// Contents: Class that represents dll inproc servers:
// CDllServer
//
//
// History: 21-May-96 t-AdamE Created
//
//--------------------------------------------------------------------------
#include "cdllsrv.hxx"
//+---------------------------------------------------------------------------
//
// Function: CDllServer::CDllServer()
//
// Synopsis: constructor for CDllServer
//
// History: 6-21-96 t-Adame Created
//
//----------------------------------------------------------------------------
CDllServer::CDllServer(REFCLSID clsid) :
_clsid(clsid),
_pSrgtFact(NULL)
{}
//+---------------------------------------------------------------------------
//
// Function: CDllServer::~CDllServer()
//
// Synopsis: destructor for CDllServer
//
// History: 6-21-96 t-Adame Created
//
//----------------------------------------------------------------------------
CDllServer::~CDllServer()
{
if(_pSrgtFact)
{
_pSrgtFact->Release();
_pSrgtFact = NULL;
}
}
//+---------------------------------------------------------------------------
//
// Function: CDllServer::Revoke()
//
// Synopsis: revokes the class factory for this dll server
//
// History: 6-21-96 t-Adame Created
//
//----------------------------------------------------------------------------
HRESULT CDllServer::Revoke()
{
return _pSrgtFact->Revoke();
}
//+---------------------------------------------------------------------------
//
// Function: CDllServer::LoadServer
//
// Synopsis: Registers a generic class factory object as if it were
// the real class factory for the _clsid stored serviced
// by this object
//
// History: 6-21-96 t-Adame Created
//
//----------------------------------------------------------------------------
HRESULT CDllServer::LoadServer()
{
CSurrogateFactory* pSrgtFact = new CSurrogateFactory(_clsid);
if(!pSrgtFact)
{
return E_OUTOFMEMORY;
}
pSrgtFact->AddRef();
HRESULT hr;
if(FAILED(hr = pSrgtFact->Register()))
{
pSrgtFact->Release();
return hr;
}
_pSrgtFact = pSrgtFact;
return S_OK;
}
//+---------------------------------------------------------------------------
//
// Function: CDllServer::FIsCompatible
//
// Synopsis: returns TRUE if this server implements the CLSID specified
// in the clsid argument, FALSE if not
//
// History: 6-21-96 t-Adame Created
//
//----------------------------------------------------------------------------
BOOL CDllServer::FIsCompatible(REFCLSID clsid)
{
return _clsid == clsid;
}
|