mmdevapi: Return interface pointers instead of impl pointers.

This commit is contained in:
Nikolay Sivov 2015-05-31 23:12:25 +03:00 committed by Alexandre Julliard
parent f0c5086618
commit 336cc78744
2 changed files with 21 additions and 20 deletions

View file

@ -40,8 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
typedef struct AEVImpl {
IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
LONG ref;
@ -52,18 +50,6 @@ static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *
return CONTAINING_RECORD(iface, AEVImpl, IAudioEndpointVolumeEx_iface);
}
HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
{
AEVImpl *This;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
*ppv = (IAudioEndpointVolume*)This;
if (!This)
return E_OUTOFMEMORY;
This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
This->ref = 1;
return S_OK;
}
static void AudioEndpointVolume_Destroy(AEVImpl *This)
{
HeapFree(GetProcessHeap(), 0, This);
@ -79,7 +65,7 @@ static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID r
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
*ppv = This;
*ppv = &This->IAudioEndpointVolumeEx_iface;
}
else
return E_NOINTERFACE;
@ -286,3 +272,18 @@ static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
AEV_GetVolumeRange,
AEV_GetVolumeRangeChannel
};
HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
{
AEVImpl *This;
*ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
This->ref = 1;
*ppv = (IAudioEndpointVolume*)&This->IAudioEndpointVolumeEx_iface;
return S_OK;
}

View file

@ -551,7 +551,7 @@ static HRESULT WINAPI MMDevice_QueryInterface(IMMDevice *iface, REFIID riid, voi
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDevice))
*ppv = This;
*ppv = &This->IMMDevice_iface;
else if (IsEqualIID(riid, &IID_IMMEndpoint))
*ppv = &This->IMMEndpoint_iface;
if (*ppv)
@ -797,7 +797,7 @@ static HRESULT WINAPI MMDevCol_QueryInterface(IMMDeviceCollection *iface, REFIID
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDeviceCollection))
*ppv = This;
*ppv = &This->IMMDeviceCollection_iface;
else
*ppv = NULL;
if (!*ppv)
@ -897,7 +897,7 @@ HRESULT MMDevEnum_Create(REFIID riid, void **ppv)
load_driver_devices(eRender);
load_driver_devices(eCapture);
}
return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
return IMMDeviceEnumerator_QueryInterface(&This->IMMDeviceEnumerator_iface, riid, ppv);
}
void MMDevEnum_Free(void)
@ -920,7 +920,7 @@ static HRESULT WINAPI MMDevEnum_QueryInterface(IMMDeviceEnumerator *iface, REFII
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDeviceEnumerator))
*ppv = This;
*ppv = &This->IMMDeviceEnumerator_iface;
else
*ppv = NULL;
if (!*ppv)
@ -1345,7 +1345,7 @@ static HRESULT WINAPI MMDevPropStore_QueryInterface(IPropertyStore *iface, REFII
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IPropertyStore))
*ppv = This;
*ppv = &This->IPropertyStore_iface;
else
*ppv = NULL;
if (!*ppv)