The following example illustrates using MCI_BUFFER to allocate memory.
MCI_MIX_BUFFER MyBuffers[ MAX_BUFFERS ];
BufferParms.ulNumBuffers = 40;
BufferParms.ulBufferSize = 4096;
BufferParms.pBufList = MyBuffers;
rc = mciSendCommand( usDeviceID,
MCI_BUFFER,
MCI_WAIT | MCI_ALLOCATE_MEMORY,
( PVOID ) &BufferParms,
0 );
if ( ULONG_LOWD( rc ) != MCIERR_SUCCESS )
{
printf( "Error allocating memory. rc is: %d", rc );
exit ( 1 );
}
/* MCI driver will return the number of buffers */
/* it was able to allocate. */
/* It will also return the size of the information */
/* allocated with each buffer. */
ulNumBuffers = BufferParms.ulNumBuffers;
for ( ulLoop = 0; ulLoop < ulNumBuffers; ulLoop++ )
{
rc = mmioRead ( hmmio,
MyBuffers[ ulLoop ].pBuffer,
MyBuffers[ ulLoop ].ulBufferLength );
if ( !rc )
{
exit( rc );
}
MyBuffers[ ulLoop ].ulUserParm = ulLoop;
}