| 1 |
#include "pa_win_ds_dynlink.h" |
| 2 |
|
| 3 |
|
| 4 |
PaWinDsDSoundEntryPoints paWinDsDSoundEntryPoints = { 0, 0, 0, 0, 0, 0, 0 }; |
| 5 |
|
| 6 |
|
| 7 |
static HRESULT WINAPI DummyDirectSoundCreate(LPGUID lpcGuidDevice, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter) |
| 8 |
{ |
| 9 |
(void)lpcGuidDevice; |
| 10 |
(void)ppDS; |
| 11 |
(void)pUnkOuter; |
| 12 |
return E_NOTIMPL; |
| 13 |
} |
| 14 |
|
| 15 |
static HRESULT WINAPI DummyDirectSoundEnumerateW(LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext) |
| 16 |
{ |
| 17 |
(void)lpDSEnumCallback; |
| 18 |
(void)lpContext; |
| 19 |
return E_NOTIMPL; |
| 20 |
} |
| 21 |
|
| 22 |
static HRESULT WINAPI DummyDirectSoundEnumerateA(LPDSENUMCALLBACKA lpDSEnumCallback, LPVOID lpContext) |
| 23 |
{ |
| 24 |
(void)lpDSEnumCallback; |
| 25 |
(void)lpContext; |
| 26 |
return E_NOTIMPL; |
| 27 |
} |
| 28 |
|
| 29 |
static HRESULT WINAPI DummyDirectSoundCaptureCreate(LPGUID lpcGUID, LPDIRECTSOUNDCAPTURE *lplpDSC, LPUNKNOWN pUnkOuter) |
| 30 |
{ |
| 31 |
(void)lpcGUID; |
| 32 |
(void)lplpDSC; |
| 33 |
(void)pUnkOuter; |
| 34 |
return E_NOTIMPL; |
| 35 |
} |
| 36 |
|
| 37 |
static HRESULT WINAPI DummyDirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW lpDSCEnumCallback, LPVOID lpContext) |
| 38 |
{ |
| 39 |
(void)lpDSCEnumCallback; |
| 40 |
(void)lpContext; |
| 41 |
return E_NOTIMPL; |
| 42 |
} |
| 43 |
|
| 44 |
static HRESULT WINAPI DummyDirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA lpDSCEnumCallback, LPVOID lpContext) |
| 45 |
{ |
| 46 |
(void)lpDSCEnumCallback; |
| 47 |
(void)lpContext; |
| 48 |
return E_NOTIMPL; |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
void PaWinDs_InitializeDSoundEntryPoints(void) |
| 53 |
{ |
| 54 |
paWinDsDSoundEntryPoints.hInstance_ = LoadLibrary("dsound.dll"); |
| 55 |
if( paWinDsDSoundEntryPoints.hInstance_ != NULL ) |
| 56 |
{ |
| 57 |
paWinDsDSoundEntryPoints.DirectSoundCreate = |
| 58 |
(HRESULT (WINAPI *)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN)) |
| 59 |
GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundCreate" ); |
| 60 |
if( paWinDsDSoundEntryPoints.DirectSoundCreate == NULL ) |
| 61 |
paWinDsDSoundEntryPoints.DirectSoundCreate = DummyDirectSoundCreate; |
| 62 |
|
| 63 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateW = |
| 64 |
(HRESULT (WINAPI *)(LPDSENUMCALLBACKW, LPVOID)) |
| 65 |
GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundEnumerateW" ); |
| 66 |
if( paWinDsDSoundEntryPoints.DirectSoundEnumerateW == NULL ) |
| 67 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateW = DummyDirectSoundEnumerateW; |
| 68 |
|
| 69 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateA = |
| 70 |
(HRESULT (WINAPI *)(LPDSENUMCALLBACKA, LPVOID)) |
| 71 |
GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundEnumerateA" ); |
| 72 |
if( paWinDsDSoundEntryPoints.DirectSoundEnumerateA == NULL ) |
| 73 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateA = DummyDirectSoundEnumerateA; |
| 74 |
|
| 75 |
paWinDsDSoundEntryPoints.DirectSoundCaptureCreate = |
| 76 |
(HRESULT (WINAPI *)(LPGUID, LPDIRECTSOUNDCAPTURE *, LPUNKNOWN)) |
| 77 |
GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundCaptureCreate" ); |
| 78 |
if( paWinDsDSoundEntryPoints.DirectSoundCaptureCreate == NULL ) |
| 79 |
paWinDsDSoundEntryPoints.DirectSoundCaptureCreate = DummyDirectSoundCaptureCreate; |
| 80 |
|
| 81 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW = |
| 82 |
(HRESULT (WINAPI *)(LPDSENUMCALLBACKW, LPVOID)) |
| 83 |
GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundCaptureEnumerateW" ); |
| 84 |
if( paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW == NULL ) |
| 85 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW = DummyDirectSoundCaptureEnumerateW; |
| 86 |
|
| 87 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA = |
| 88 |
(HRESULT (WINAPI *)(LPDSENUMCALLBACKA, LPVOID)) |
| 89 |
GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundCaptureEnumerateA" ); |
| 90 |
if( paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA == NULL ) |
| 91 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA = DummyDirectSoundCaptureEnumerateA; |
| 92 |
} |
| 93 |
else |
| 94 |
{ |
| 95 |
|
| 96 |
paWinDsDSoundEntryPoints.DirectSoundCreate = DummyDirectSoundCreate; |
| 97 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateW = DummyDirectSoundEnumerateW; |
| 98 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateA = DummyDirectSoundEnumerateA; |
| 99 |
paWinDsDSoundEntryPoints.DirectSoundCaptureCreate = DummyDirectSoundCaptureCreate; |
| 100 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW = DummyDirectSoundCaptureEnumerateW; |
| 101 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA = DummyDirectSoundCaptureEnumerateA; |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
|
| 106 |
void PaWinDs_TerminateDSoundEntryPoints(void) |
| 107 |
{ |
| 108 |
if( paWinDsDSoundEntryPoints.hInstance_ != NULL ) |
| 109 |
{ |
| 110 |
|
| 111 |
paWinDsDSoundEntryPoints.DirectSoundCreate = 0; |
| 112 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateW = 0; |
| 113 |
paWinDsDSoundEntryPoints.DirectSoundEnumerateA = 0; |
| 114 |
paWinDsDSoundEntryPoints.DirectSoundCaptureCreate = 0; |
| 115 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW = 0; |
| 116 |
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA = 0; |
| 117 |
|
| 118 |
FreeLibrary( paWinDsDSoundEntryPoints.hInstance_ ); |
| 119 |
paWinDsDSoundEntryPoints.hInstance_ = NULL; |
| 120 |
} |
| 121 |
} |