FilterGetMessage and error_insufficient_buffer

I’m sending variable length data from the filter to a usermode client, with
the filter awaiting a response from the client.
Upon receiveing the data in usermode via FilterGetMessage, my usermode
buffer is too small and I therefore get an ERROR_INSUFFICIENT_BUFFER error.

If I resize the buffer and call GetFilterMessage again, I can’ access the
buffer. How annoying…

Am I right in thinking I need to call FilterReplyMessage using something
like STATUS_RETRY, then recall FilterGetMessage. The filter can then resend
the same data back to usermode whereby this time I’ll have the correct size
of buffer?

It seems like a unnecessary traps considering all the other windows APIs
allow you to recall the API with the resized buffer.

Am I missing something?
Thanks.

I’ve just realised a major flaw in this. If the user buffer isn’t large
enough to receive the message sent from the driver, you can’t respond to the
driver (after resizing the usermode buffer) to ask it to resend the data
because you don’t have the MessageId.
Therefore unless I have a timeout on the FltSendMessage call, it will hang.

What a frustrating design. It appears the only answer to sending variable
size buffers, is to send a fixed size header containing the size of the
buffer, then to send the actual data afterwards.

-----Original Message-----
From: Ged Murphy [mailto:xxxxx@gmail.com]
Sent: 11 February 2014 13:44
To: ‘Windows File Systems Devs Interest List’
Subject: FilterGetMessage and error_insufficient_buffer

I’m sending variable length data from the filter to a usermode client, with
the filter awaiting a response from the client.
Upon receiveing the data in usermode via FilterGetMessage, my usermode
buffer is too small and I therefore get an ERROR_INSUFFICIENT_BUFFER error.

If I resize the buffer and call GetFilterMessage again, I can’ access the
buffer. How annoying…

Am I right in thinking I need to call FilterReplyMessage using something
like STATUS_RETRY, then recall FilterGetMessage. The filter can then resend
the same data back to usermode whereby this time I’ll have the correct size
of buffer?

It seems like a unnecessary traps considering all the other windows APIs
allow you to recall the API with the resized buffer.

Am I missing something?
Thanks.