From: robiwan Date: Mon, 2 Jul 2012 08:19:02 +0000 (+0000) Subject: Removed _alloca in WdmGetPropertySimple which seems to mess up the stack when using... X-Git-Tag: pa_stable_v19_20140130_r1919~53 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=ee7fa396e16d87691a0f6cdad82b72e7be836db5;p=portaudio Removed _alloca in WdmGetPropertySimple which seems to mess up the stack when using MinGW --- diff --git a/src/hostapi/wdmks/pa_win_wdmks.c b/src/hostapi/wdmks/pa_win_wdmks.c index 44e0b3b..17e07d5 100644 --- a/src/hostapi/wdmks/pa_win_wdmks.c +++ b/src/hostapi/wdmks/pa_win_wdmks.c @@ -451,13 +451,13 @@ static PaError WdmSyncIoctl(HANDLE handle, void* outBuffer, unsigned long outBufferCount, unsigned long* bytesReturned); + static PaError WdmGetPropertySimple(HANDLE handle, const GUID* const guidPropertySet, unsigned long property, void* value, - unsigned long valueCount, - void* instance, - unsigned long instanceCount); + unsigned long valueCount); + static PaError WdmSetPropertySimple(HANDLE handle, const GUID* const guidPropertySet, unsigned long property, @@ -473,11 +473,13 @@ static PaError WdmGetPinPropertySimple(HANDLE handle, void* value, unsigned long valueCount, unsigned long* byteCount); + static PaError WdmGetPinPropertyMulti(HANDLE handle, unsigned long pinId, const GUID* const guidPropertySet, unsigned long property, KSMULTIPLE_ITEM** ksMultipleItem); + static PaError WdmGetPropertyMulti(HANDLE handle, const GUID* const guidPropertySet, unsigned long property, @@ -730,36 +732,20 @@ static PaError WdmGetPropertySimple(HANDLE handle, const GUID* const guidPropertySet, unsigned long property, void* value, - unsigned long valueCount, - void* instance, - unsigned long instanceCount) + unsigned long valueCount) { PaError result; - KSPROPERTY* ksProperty; - unsigned long propertyCount; - - propertyCount = sizeof(KSPROPERTY) + instanceCount; - ksProperty = (KSPROPERTY*)_alloca( propertyCount ); - if( !ksProperty ) - { - return paInsufficientMemory; - } - - FillMemory((void*)ksProperty,sizeof(ksProperty),0); - ksProperty->Set = *guidPropertySet; - ksProperty->Id = property; - ksProperty->Flags = KSPROPERTY_TYPE_GET; + KSPROPERTY ksProperty; - if( instance ) - { - memcpy( (void*)(((char*)ksProperty)+sizeof(KSPROPERTY)), instance, instanceCount ); - } + ksProperty.Set = *guidPropertySet; + ksProperty.Id = property; + ksProperty.Flags = KSPROPERTY_TYPE_GET; result = WdmSyncIoctl( handle, IOCTL_KS_PROPERTY, - ksProperty, - propertyCount, + &ksProperty, + sizeof(KSPROPERTY), value, valueCount, NULL); @@ -2117,9 +2103,7 @@ static PaError PinInstantiate(PaWinWdmPin* pin) &KSPROPSETID_Connection, KSPROPERTY_CONNECTION_ALLOCATORFRAMING, &ksaf, - sizeof(ksaf), - NULL, - 0); + sizeof(ksaf)); if( result != paNoError ) { @@ -2128,9 +2112,7 @@ static PaError PinInstantiate(PaWinWdmPin* pin) &KSPROPSETID_Connection, KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX, &ksafex, - sizeof(ksafex), - NULL, - 0); + sizeof(ksafex)); if( result == paNoError ) { pin->frameSize = ksafex.FramingItem[0].FramingRange.Range.MinFrameSize; @@ -2699,7 +2681,7 @@ static PaWinWdmFilter* FilterNew( PaWDMKSType type, DWORD devNode, const wchar_t /* Get product GUID (it might not be supported) */ { KSCOMPONENTID compId; - if (WdmGetPropertySimple(filter->handle, &KSPROPSETID_General, KSPROPERTY_GENERAL_COMPONENTID, &compId, sizeof(KSCOMPONENTID), NULL, 0) == paNoError) + if (WdmGetPropertySimple(filter->handle, &KSPROPSETID_General, KSPROPERTY_GENERAL_COMPONENTID, &compId, sizeof(KSCOMPONENTID)) == paNoError) { filter->devInfo.deviceProductGuid = compId.Product; }