Skip to content

ArgumentException on IAudioClient Activation and Initialization #1178

Closed Answered by AArnott
waylaa asked this question in Q&A
Discussion options

You must be logged in to vote

Given cbSize is 22, then per the struct's documentation there are bytes after the struct that are important. But you're taking the WAVEFORMATEX* and copying only the struct itself onto your stack, and then freeing the non-managed memory that held the original struct and the data you never copied.

A struct like this must not ever be handed around as WAVEFORMATEX. You must only ever hand around WAVEFORMATEX* because of this un-managed size of the struct, meaning it can never exist on the stack.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@waylaa
Comment options

@AArnott
Comment options

Answer selected by waylaa
@waylaa
Comment options

@AArnott
Comment options

@AArnott
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants