summaryrefslogtreecommitdiff
path: root/plugins/Chess4Net/NonRefInterfacedObjectUnit.pas
blob: a6a32f2901cdc067bbf088d53402d554dafc029e (plain)
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
////////////////////////////////////////////////////////////////////////////////
// All code below is exclusively owned by author of Chess4Net - Pavel Perminov
// (packpaul@mail.ru, packpaul1@gmail.com).
// Any changes, modifications, borrowing and adaptation are a subject for
// explicit permition from the owner.

unit NonRefInterfacedObjectUnit;

interface

type
  TNonRefInterfacedObject = class(TObject, IInterface)
  protected
    function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
    function _AddRef: Integer; stdcall;
    function _Release: Integer; stdcall;
  end;

implementation

////////////////////////////////////////////////////////////////////////////////
// TNonRefInterfacedObject

function TNonRefInterfacedObject.QueryInterface(const IID: TGUID; out Obj): HResult;
begin
  if GetInterface(IID, Obj) then
    Result := 0
  else
    Result := E_NOINTERFACE;
end;


function TNonRefInterfacedObject._AddRef: Integer;
begin
  Result := -1;
end;


function TNonRefInterfacedObject._Release: Integer;
begin
  Result := -1;
end;

end.