3 * Copyright 2002 TransGaming Technologies Inc.
4 * Copyright 2006 Roderick Colenbrander
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
35 static LONG dll_count;
38 * Dll lifetime tracking declaration
40 static void LockModule(void)
42 InterlockedIncrement(&dll_count);
45 static void UnlockModule(void)
47 InterlockedDecrement(&dll_count);
50 /******************************************************************************
51 * DirectInput8Create (DINPUT8.@)
53 HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter) {
54 /* TODO: Create the interface using CoCreateInstance as that's what windows does too and check if the version number >= 0x800 */
55 return DirectInputCreateEx(hinst, dwVersion, riid, ppDI, punkOuter);
58 /*******************************************************************************
59 * DirectInput8 ClassFactory
64 const IClassFactoryVtbl *lpVtbl;
67 static HRESULT WINAPI DI8CF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
68 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
69 FIXME("%p %s %p\n",This,debugstr_guid(riid),ppobj);
73 static ULONG WINAPI DI8CF_AddRef(LPCLASSFACTORY iface) {
78 static ULONG WINAPI DI8CF_Release(LPCLASSFACTORY iface) {
83 static HRESULT WINAPI DI8CF_CreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj) {
84 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
86 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
87 if( IsEqualGUID( &IID_IDirectInput8A, riid ) || IsEqualGUID( &IID_IDirectInput8W, riid ) ) {
88 return DirectInput8Create(0, DIRECTINPUT_VERSION, riid, ppobj, pOuter);
91 ERR("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
95 static HRESULT WINAPI DI8CF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
96 TRACE("(%p)->(%d)\n", iface, dolock);
106 static const IClassFactoryVtbl DI8CF_Vtbl = {
107 DI8CF_QueryInterface,
110 DI8CF_CreateInstance,
113 static IClassFactoryImpl DINPUT8_CF = { &DI8CF_Vtbl };
116 /***********************************************************************
117 * DllCanUnloadNow (DINPUT8.@)
119 HRESULT WINAPI DllCanUnloadNow(void)
121 return dll_count == 0 ? S_OK : S_FALSE;
124 /***********************************************************************
125 * DllGetClassObject (DINPUT8.@)
127 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
129 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
130 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
131 *ppv = (LPVOID)&DINPUT8_CF;
132 IClassFactory_AddRef((IClassFactory*)*ppv);
136 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
137 return CLASS_E_CLASSNOTAVAILABLE;
140 /***********************************************************************
141 * DllRegisterServer (DINPUT8.@)
143 HRESULT WINAPI DllRegisterServer(void)
145 FIXME("(void): stub\n");
150 /***********************************************************************
151 * DllUnregisterServer (DINPUT8.@)
153 HRESULT WINAPI DllUnregisterServer(void)
155 FIXME("(void): stub\n");