2 * Copyright (C) 2006 Robert Reif
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(asio
);
30 /* {48D0C522-BFCC-45cc-8B84-17F25F33E6E8} */
31 static GUID
const CLSID_WineASIO
= {
32 0x48d0c522, 0xbfcc, 0x45cc, { 0x8b, 0x84, 0x17, 0xf2, 0x5f, 0x33, 0xe6, 0xe8 } };
35 const IClassFactoryVtbl
* lpVtbl
;
39 extern HRESULT WINAPI
WineASIOCreateInstance(REFIID riid
, LPVOID
*ppobj
);
41 /*******************************************************************************
45 static HRESULT WINAPI
CF_QueryInterface(LPCLASSFACTORY iface
, REFIID riid
, LPVOID
*ppobj
)
47 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
48 FIXME("(%p, %s, %p) stub!\n", This
, debugstr_guid(riid
), ppobj
);
54 static ULONG WINAPI
CF_AddRef(LPCLASSFACTORY iface
)
56 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
57 ULONG ref
= InterlockedIncrement(&(This
->ref
));
58 TRACE("iface: %p, ref has been set to %x\n", This
, ref
);
62 static ULONG WINAPI
CF_Release(LPCLASSFACTORY iface
)
64 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
65 ULONG ref
= InterlockedDecrement(&(This
->ref
));
66 TRACE("iface %p, ref has been set to %x\n", This
, ref
);
67 /* static class, won't be freed */
71 static HRESULT WINAPI
CF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
73 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
74 TRACE("iface: %p, pOuter: %p, riid: %s, ppobj: %p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
77 return CLASS_E_NOAGGREGATION
;
80 WARN("invalid parameter\n");
85 TRACE("Creating the WineASIO object\n");
86 return WineASIOCreateInstance(riid
, ppobj
);
89 static HRESULT WINAPI
CF_LockServer(LPCLASSFACTORY iface
, BOOL dolock
)
91 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
92 FIXME("iface: %p, dolock: %d) stub!\n", This
, dolock
);
96 static const IClassFactoryVtbl CF_Vtbl
= {
104 static IClassFactoryImpl WINEASIO_CF
= { &CF_Vtbl
, 1 };
106 /*******************************************************************************
107 * DllGetClassObject [DSOUND.@]
108 * Retrieves class object from a DLL object
111 * Docs say returns STDAPI
114 * rclsid [I] CLSID for the class object
115 * riid [I] Reference to identifier of interface for class object
116 * ppv [O] Address of variable to receive interface pointer for riid
120 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
123 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
125 TRACE("rclsid: %s, riid: %s, ppv: %p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
128 WARN("invalid parameter\n");
134 if (!IsEqualIID(riid
, &IID_IClassFactory
) && !IsEqualIID(riid
, &IID_IUnknown
))
136 WARN("no interface for %s\n", debugstr_guid(riid
));
137 return E_NOINTERFACE
;
140 if (IsEqualGUID(rclsid
, &CLSID_WineASIO
))
142 CF_AddRef((IClassFactory
*) &WINEASIO_CF
);
147 WARN("rclsid: %s, riid: %s, ppv: %p): no class found.\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
148 return CLASS_E_CLASSNOTAVAILABLE
;
152 /*******************************************************************************
154 * Determines whether the DLL is in use.
160 HRESULT WINAPI
DllCanUnloadNow(void)
162 FIXME("(void): stub\n");
166 /***********************************************************************
167 * DllMain (ASIO.init)
169 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
171 TRACE("hInstDLL: %p, fdwReason: %x lpvReserved: %p)\n", hInstDLL
, fdwReason
, lpvReserved
);
174 case DLL_PROCESS_ATTACH
:
175 /* TRACE("DLL_PROCESS_ATTACH\n"); */
177 case DLL_PROCESS_DETACH
:
178 /* TRACE("DLL_PROCESS_DETACH\n"); */
180 case DLL_THREAD_ATTACH
:
181 /* TRACE("DLL_THREAD_ATTACH\n"); */
183 case DLL_THREAD_DETACH
:
184 /* TRACE("DLL_THREAD_DETACH\n"); */
187 /* TRACE("UNKNOWN REASON\n"); */