Implement A->W call for GetNamedSecurityInfo.
[wine] / dlls / dmband / dmband_main.c
1 /* DirectMusicBand Main
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmband_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmband);
23
24 typedef struct {
25     /* IUnknown fields */
26     ICOM_VFIELD(IClassFactory);
27     DWORD                       ref;
28 } IClassFactoryImpl;
29
30 /******************************************************************
31  *              DirectMusicBand ClassFactory
32  */
33  
34 static HRESULT WINAPI BandCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
35         ICOM_THIS(IClassFactoryImpl,iface);
36         FIXME("(%p, %s, %p): stub\n",This, debugstr_dmguid(riid), ppobj);
37         return E_NOINTERFACE;
38 }
39
40 static ULONG WINAPI BandCF_AddRef(LPCLASSFACTORY iface) {
41         ICOM_THIS(IClassFactoryImpl,iface);
42         return ++(This->ref);
43 }
44
45 static ULONG WINAPI BandCF_Release(LPCLASSFACTORY iface) {
46         ICOM_THIS(IClassFactoryImpl,iface);
47         /* static class, won't be  freed */
48         return --(This->ref);
49 }
50
51 static HRESULT WINAPI BandCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
52         ICOM_THIS(IClassFactoryImpl,iface);
53         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
54         return DMUSIC_CreateDirectMusicBandImpl (riid, ppobj, pOuter);
55 }
56
57 static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
58         ICOM_THIS(IClassFactoryImpl,iface);
59         FIXME("(%p, %d): stub\n", This, dolock);
60         return S_OK;
61 }
62
63 static ICOM_VTABLE(IClassFactory) BandCF_Vtbl = {
64         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
65         BandCF_QueryInterface,
66         BandCF_AddRef,
67         BandCF_Release,
68         BandCF_CreateInstance,
69         BandCF_LockServer
70 };
71
72 static IClassFactoryImpl Band_CF = {&BandCF_Vtbl, 1 };
73
74
75 /******************************************************************
76  *              DirectMusicBandTrack ClassFactory
77  */
78  
79 static HRESULT WINAPI BandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
80         ICOM_THIS(IClassFactoryImpl,iface);
81
82         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
83         return E_NOINTERFACE;
84 }
85
86 static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) {
87         ICOM_THIS(IClassFactoryImpl,iface);
88         return ++(This->ref);
89 }
90
91 static ULONG WINAPI BandTrackCF_Release(LPCLASSFACTORY iface) {
92         ICOM_THIS(IClassFactoryImpl,iface);
93         /* static class, won't be  freed */
94         return --(This->ref);
95 }
96
97 static HRESULT WINAPI BandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
98         ICOM_THIS(IClassFactoryImpl,iface);
99         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
100         return DMUSIC_CreateDirectMusicBandTrack (riid, ppobj, pOuter);
101 }
102
103 static HRESULT WINAPI BandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
104         ICOM_THIS(IClassFactoryImpl,iface);
105         FIXME("(%p, %d): stub\n", This, dolock);
106         return S_OK;
107 }
108
109 static ICOM_VTABLE(IClassFactory) BandTrackCF_Vtbl = {
110         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
111         BandTrackCF_QueryInterface,
112         BandTrackCF_AddRef,
113         BandTrackCF_Release,
114         BandTrackCF_CreateInstance,
115         BandTrackCF_LockServer
116 };
117
118 static IClassFactoryImpl BandTrack_CF = {&BandTrackCF_Vtbl, 1 };
119
120 /******************************************************************
121  *              DllMain
122  *
123  *
124  */
125 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
126         if (fdwReason == DLL_PROCESS_ATTACH) {
127             DisableThreadLibraryCalls(hinstDLL);
128                 /* FIXME: Initialisation */
129         } else if (fdwReason == DLL_PROCESS_DETACH) {
130                 /* FIXME: Cleanup */
131         }
132
133         return TRUE;
134 }
135
136
137 /******************************************************************
138  *              DllCanUnloadNow (DMBAND.1)
139  *
140  *
141  */
142 HRESULT WINAPI DMBAND_DllCanUnloadNow(void) {
143     FIXME("(void): stub\n");
144     return S_FALSE;
145 }
146
147
148 /******************************************************************
149  *              DllGetClassObject (DMBAND.2)
150  *
151  *
152  */
153 HRESULT WINAPI DMBAND_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) {
154     TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
155
156         if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBand) && IsEqualIID (riid, &IID_IClassFactory)) {
157                 *ppv = (LPVOID) &Band_CF;
158                 IClassFactory_AddRef((IClassFactory*)*ppv);
159                 return S_OK;
160         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBandTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
161                 *ppv = (LPVOID) &BandTrack_CF;
162                 IClassFactory_AddRef((IClassFactory*)*ppv);
163                 return S_OK;    
164         }
165         
166     WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
167     return CLASS_E_CLASSNOTAVAILABLE;
168 }