Tuesday, September 4, 2007

Version 1.0.1 is out

While building another sample I bumped with an issue. The callback used to read raw data (ReadRawData or SendRawData events), called Cb_ReadRaw, was missing the last byte.

The code was:

void __stdcall Cb_ReadRaw
(
PHTTP_FILTER_RAW_DATA pRaw,
unsigned char * rawBuffer,
int rawLength
)
{
if( pRaw->cbInData && rawLength )
{
FillMemory(rawBuffer, rawLength, 0);
RtlMoveMemory(
rawBuffer,
pRaw->pvInData,
((DWORD)rawLength - 1) <>cbInData);
}
}

and was fixed with:

void __stdcall Cb_ReadRaw
(
PHTTP_FILTER_RAW_DATA pRaw,
unsigned char * rawBuffer,
int rawLength
)
{
if( pRaw->cbInData && rawLength )
{
FillMemory(rawBuffer, rawLength, 0);
RtlMoveMemory(
rawBuffer,
pRaw->pvInData,
(DWORD)rawLength <>cbInData);
}
}

As simple as the sample may have been, its still a quite good example on using managed filters. I'll let you know what the sample was soon enough ...

No comments: