- Add an initial stub of DSound
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 26 Oct 2009 10:54:05 +0000 (10:54 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 26 Oct 2009 10:54:05 +0000 (10:54 +0000)
svn path=/trunk/; revision=43774

reactos/dll/directx/dsound_new/classfactory.c [new file with mode: 0644]
reactos/dll/directx/dsound_new/dsound.c [new file with mode: 0644]
reactos/dll/directx/dsound_new/dsound.spec [new file with mode: 0644]
reactos/dll/directx/dsound_new/dsound_new.rbuild [new file with mode: 0644]
reactos/dll/directx/dsound_new/precomp.h [new file with mode: 0644]
reactos/dll/directx/dsound_new/stubs.c [new file with mode: 0644]
reactos/dll/directx/dsound_new/version.rc [new file with mode: 0644]

diff --git a/reactos/dll/directx/dsound_new/classfactory.c b/reactos/dll/directx/dsound_new/classfactory.c
new file mode 100644 (file)
index 0000000..c2aeea8
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Configuration of network devices
+ * FILE:            dll/directx/dsound_new/classfactory.c
+ * PURPOSE:         IClassFactory implementation
+ *
+ * PROGRAMMERS:     Johannes Anderwald (janderwald@reactos.org)
+ */
+
+
+#include "precomp.h"
+
+typedef struct
+{
+    const IClassFactoryVtbl    *lpVtbl;
+    LONG                       ref;
+    CLSID                      *rclsid;
+    LPFNCREATEINSTANCE         lpfnCI;
+    const IID *                riidInst;
+} IClassFactoryImpl;
+
+
+static
+HRESULT
+WINAPI
+IClassFactory_fnQueryInterface(
+    LPCLASSFACTORY iface,
+    REFIID riid,
+    LPVOID *ppvObj)
+{
+    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+
+    *ppvObj = NULL;
+    if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
+    {
+        *ppvObj = This;
+        InterlockedIncrement(&This->ref);
+        return S_OK;
+    }
+    return E_NOINTERFACE;
+}
+
+static
+ULONG
+WINAPI
+IClassFactory_fnAddRef(
+    LPCLASSFACTORY iface)
+{
+    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+    ULONG refCount = InterlockedIncrement(&This->ref);
+
+    return refCount;
+}
+
+static
+ULONG
+WINAPI
+IClassFactory_fnRelease(
+    LPCLASSFACTORY iface)
+{
+    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+    ULONG refCount = InterlockedDecrement(&This->ref);
+
+    if (!refCount)
+    {
+        CoTaskMemFree(This);
+        return 0;
+    }
+    return refCount;
+}
+
+static
+HRESULT
+WINAPI
+IClassFactory_fnCreateInstance(
+    LPCLASSFACTORY iface,
+    LPUNKNOWN pUnkOuter,
+    REFIID riid,
+    LPVOID *ppvObject)
+{
+    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+
+    *ppvObject = NULL;
+
+    if ( This->riidInst==NULL || IsEqualCLSID(riid, This->riidInst) || IsEqualCLSID(riid, &IID_IUnknown) )
+    {
+        return This->lpfnCI(pUnkOuter, riid, ppvObject);
+    }
+
+    return E_NOINTERFACE;
+}
+
+static
+HRESULT
+WINAPI IClassFactory_fnLockServer(
+    LPCLASSFACTORY iface,
+    BOOL fLock)
+{
+    //IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+    return E_NOTIMPL;
+}
+
+
+static const IClassFactoryVtbl dclfvt =
+{
+    IClassFactory_fnQueryInterface,
+    IClassFactory_fnAddRef,
+    IClassFactory_fnRelease,
+    IClassFactory_fnCreateInstance,
+    IClassFactory_fnLockServer
+};
+
+
+IClassFactory * 
+IClassFactory_fnConstructor(
+    LPFNCREATEINSTANCE lpfnCI, 
+    PLONG pcRefDll, 
+    REFIID riidInst)
+{
+    IClassFactoryImpl* lpclf;
+
+    lpclf = CoTaskMemAlloc(sizeof(IClassFactoryImpl));
+    lpclf->ref = 1;
+    lpclf->lpVtbl = &dclfvt;
+    lpclf->lpfnCI = lpfnCI;
+
+    if (pcRefDll)
+        InterlockedIncrement(pcRefDll);
+    lpclf->riidInst = riidInst;
+
+    return (LPCLASSFACTORY)lpclf;
+}
+
+
diff --git a/reactos/dll/directx/dsound_new/dsound.c b/reactos/dll/directx/dsound_new/dsound.c
new file mode 100644 (file)
index 0000000..5b1f341
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Configuration of network devices
+ * FILE:            dll/directx/dsound_new/dsound.c
+ * PURPOSE:         Handles DSound initialization
+ *
+ * PROGRAMMERS:     Johannes Anderwald (janderwald@reactos.org)
+ */
+
+#include "precomp.h"
+
+
+HINSTANCE dsound_hInstance;
+
+HRESULT
+WINAPI
+DllCanUnloadNow()
+{
+    return S_FALSE;
+}
+
+HRESULT
+WINAPI
+DllGetClassObject(
+    REFCLSID rclsid,
+    REFIID riid,
+    LPVOID *ppv)
+{
+    UNIMPLEMENTED
+    return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+BOOL
+WINAPI
+DllMain(
+    HINSTANCE hInstDLL,
+    DWORD fdwReason,
+    LPVOID lpvReserved)
+{
+    switch (fdwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            dsound_hInstance = hInstDLL;
+            DisableThreadLibraryCalls(dsound_hInstance);
+            break;
+    default:
+        break;
+    }
+
+    return TRUE;
+}
+
diff --git a/reactos/dll/directx/dsound_new/dsound.spec b/reactos/dll/directx/dsound_new/dsound.spec
new file mode 100644 (file)
index 0000000..e4878a8
--- /dev/null
@@ -0,0 +1,14 @@
+1 stdcall DirectSoundCreate(ptr ptr ptr)
+2 stdcall DirectSoundEnumerateA(ptr ptr)
+3 stdcall DirectSoundEnumerateW(ptr ptr)
+6 stdcall DirectSoundCaptureCreate(ptr ptr ptr)
+7 stdcall DirectSoundCaptureEnumerateA(ptr ptr)
+8 stdcall DirectSoundCaptureEnumerateW(ptr ptr)
+9 stdcall GetDeviceID(ptr ptr)
+10 stdcall DirectSoundFullDuplexCreate(ptr ptr ptr ptr long long ptr ptr ptr ptr)
+11 stdcall DirectSoundCreate8(ptr ptr ptr)
+12 stdcall DirectSoundCaptureCreate8(ptr ptr ptr)
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
diff --git a/reactos/dll/directx/dsound_new/dsound_new.rbuild b/reactos/dll/directx/dsound_new/dsound_new.rbuild
new file mode 100644 (file)
index 0000000..af785b0
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
+<module name="dsound_new" type="win32dll" baseaddress="${BASEADDRESS_DSOUND}" installbase="system32" installname="dsound_new.dll" crt="msvcrt">
+       <autoregister infsection="OleControlDlls" type="DllRegisterServer" />
+       <importlibrary definition="dsound.spec" />
+       <include base="dsound">.</include>
+       <library>uuid</library>
+       <library>ntdll</library>
+       <library>kernel32</library>
+       <library>user32</library>
+       <library>advapi32</library>
+       <library>ole32</library>
+       <library>winmm</library>
+       <library>dxguid</library>
+       <file>classfactory.c</file>
+       <file>dsound.c</file>
+       <file>stubs.c</file>
+       <file>version.rc</file>
+</module>
diff --git a/reactos/dll/directx/dsound_new/precomp.h b/reactos/dll/directx/dsound_new/precomp.h
new file mode 100644 (file)
index 0000000..0e5d791
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef PRECOMP_H__
+#define PRECOMP_H__
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include <windows.h>
+#include <setupapi.h>
+#include <olectl.h>
+#include <unknwn.h>
+#include <dsound.h>
+#include <debug.h>
+
+
+/* factory method */
+typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
+
+/* factory table */
+typedef struct
+{
+    REFIID riid;
+    LPFNCREATEINSTANCE lpfnCI;
+} INTERFACE_TABLE;
+
+/* globals */
+extern HINSTANCE dsound_hInstance;
+
+
+#endif
diff --git a/reactos/dll/directx/dsound_new/stubs.c b/reactos/dll/directx/dsound_new/stubs.c
new file mode 100644 (file)
index 0000000..74b521b
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Configuration of network devices
+ * FILE:            dll/directx/dsound_new/stubs.c
+ * PURPOSE:         DSound stubs
+ *
+ * PROGRAMMERS:     Johannes Anderwald (janderwald@reactos.org)
+ */
+
+#include "precomp.h"
+
+HRESULT
+WINAPI
+DirectSoundCreate(
+    LPCGUID lpcGUID,
+    LPDIRECTSOUND *ppDS,
+    IUnknown *pUnkOuter)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+
+HRESULT
+WINAPI
+DirectSoundEnumerateA(
+    LPDSENUMCALLBACKA lpDSEnumCallback,
+    LPVOID lpContext)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DirectSoundEnumerateW(
+    LPDSENUMCALLBACKW lpDSEnumCallback,
+    LPVOID lpContext )
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DllRegisterServer(void)
+{
+    UNIMPLEMENTED
+    return SELFREG_E_CLASS;
+}
+
+HRESULT
+WINAPI
+DllUnregisterServer(void)
+{
+    UNIMPLEMENTED
+    return SELFREG_E_CLASS;
+}
+
+HRESULT
+WINAPI
+DirectSoundCaptureCreate(
+    LPCGUID lpcGUID,
+    LPDIRECTSOUNDCAPTURE *ppDSC,
+    LPUNKNOWN pUnkOuter)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DirectSoundCaptureCreate8(
+    LPCGUID lpcGUID,
+    LPDIRECTSOUNDCAPTURE8 *ppDSC8,
+    LPUNKNOWN pUnkOuter)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DirectSoundCreate8(
+    LPCGUID lpcGUID,
+    LPDIRECTSOUND8 *ppDS,
+    IUnknown *pUnkOuter)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DirectSoundFullDuplexCreate(
+    LPCGUID pcGuidCaptureDevice,
+    LPCGUID pcGuidRenderDevice,
+    LPCDSCBUFFERDESC pcDSCBufferDesc,
+    LPCDSBUFFERDESC pcDSBufferDesc,
+    HWND hWnd,
+    DWORD dwLevel,
+    LPDIRECTSOUNDFULLDUPLEX *ppDSFD,
+    LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8,
+    LPDIRECTSOUNDBUFFER8 *ppDSBuffer8,
+    LPUNKNOWN pUnkOuter)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DirectSoundCaptureEnumerateA(
+    LPDSENUMCALLBACKA lpDSEnumCallback,
+    LPVOID lpContext)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+DirectSoundCaptureEnumerateW(
+    LPDSENUMCALLBACKW lpDSEnumCallback,
+    LPVOID lpContext)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
+
+HRESULT
+WINAPI
+GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
+{
+    UNIMPLEMENTED
+    return DSERR_INVALIDPARAM;
+}
diff --git a/reactos/dll/directx/dsound_new/version.rc b/reactos/dll/directx/dsound_new/version.rc
new file mode 100644 (file)
index 0000000..763c823
--- /dev/null
@@ -0,0 +1,14 @@
+#include <windows.h>
+#include "shlobj.h"
+#include "resource.h"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION   "DirectSound\0"
+#define REACTOS_STR_INTERNAL_NAME      "dsound.dll\0"
+#define REACTOS_STR_ORIGINAL_FILENAME  "dsound.dll\0"
+#define REACTOS_STR_PRODUCT_VERSION     "5.3.1.904\0"
+#define REACTOS_STR_FILE_VERSION        "5.3.1.904\0"
+
+#include <reactos/version.rc>