Make the SQL insert query work.
[wine] / dlls / comcat / manager.c
1 /*
2  *      ComCatMgr IUnknown implementation for comcat.dll
3  *
4  * Copyright (C) 2002 John K. Hohm
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "comcat_private.h"
22
23 #include "wine/debug.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(ole);
26
27 static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface);
28
29 /**********************************************************************
30  * COMCAT_IUnknown_QueryInterface
31  */
32 static HRESULT WINAPI COMCAT_IUnknown_QueryInterface(
33     LPUNKNOWN iface,
34     REFIID riid,
35     LPVOID *ppvObj)
36 {
37     ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
38     TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
39
40     if (This == NULL || ppvObj == NULL) return E_POINTER;
41
42     if (IsEqualGUID(riid, &IID_IUnknown)) {
43         *ppvObj = (LPVOID)&This->unkVtbl;
44         COMCAT_IUnknown_AddRef(iface);
45         return S_OK;
46     }
47
48     if (IsEqualGUID(riid, &IID_ICatRegister)) {
49         *ppvObj = (LPVOID)&This->regVtbl;
50         COMCAT_IUnknown_AddRef(iface);
51         return S_OK;
52     }
53
54     if (IsEqualGUID(riid, &IID_ICatInformation)) {
55         *ppvObj = (LPVOID)&This->infVtbl;
56         COMCAT_IUnknown_AddRef(iface);
57         return S_OK;
58     }
59
60     return E_NOINTERFACE;
61 }
62
63 /**********************************************************************
64  * COMCAT_IUnknown_AddRef
65  */
66 static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface)
67 {
68     ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
69     TRACE("\n");
70
71     if (This == NULL) return E_POINTER;
72
73     if (InterlockedIncrement(&This->ref) == 1) {
74         InterlockedIncrement(&dll_ref);
75     }
76     return This->ref;
77 }
78
79 /**********************************************************************
80  * COMCAT_IUnknown_Release
81  */
82 static ULONG WINAPI COMCAT_IUnknown_Release(LPUNKNOWN iface)
83 {
84     ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
85     TRACE("\n");
86
87     if (This == NULL) return E_POINTER;
88
89     if (InterlockedDecrement(&This->ref) == 0) {
90         InterlockedDecrement(&dll_ref);
91     }
92     return This->ref;
93 }
94
95 /**********************************************************************
96  * COMCAT_IUnknown_Vtbl
97  */
98 static ICOM_VTABLE(IUnknown) COMCAT_IUnknown_Vtbl =
99 {
100     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
101     COMCAT_IUnknown_QueryInterface,
102     COMCAT_IUnknown_AddRef,
103     COMCAT_IUnknown_Release
104 };
105
106 /**********************************************************************
107  * static ComCatMgr instance
108  */
109 ComCatMgrImpl COMCAT_ComCatMgr =
110 {
111     &COMCAT_IUnknown_Vtbl,
112     &COMCAT_ICatRegister_Vtbl,
113     &COMCAT_ICatInformation_Vtbl,
114     0
115 };