Hi Mike,
Your suggestion worked a treat I'm now getting all responses calling OnSendResponse() which is exactly what I wanted. Thanks!
However, once one problem is solved another appears. I'm trying to handle response chunks from file (HttpDataChunkFromFileHandle) and don't seem to be able to read from the file handle supplied. Example code below:
if (pEntityChunk->DataChunkType == HttpDataChunkFromFileHandle)
{
BYTE* pbyData = (BYTE*) pHttpContext->AllocateRequestMemory(dwContentLength);
::SetLastError(0);
LONG nDistanceToMoveHigh = 0;
::SetFilePointer(pEntityChunk->FromFileHandle.FileHandle, 0, &nDistanceToMoveHigh, FILE_BEGIN);
DWORD dwError = ::GetLastError();
::SetLastError(0);
DWORD dwBytesRead = 0;
::ReadFile(pEntityChunk->FromFileHandle.FileHandle, pbyData, dwContentLength, &dwBytesRead, NULL);
dwError = ::GetLastError();
// do something interesting here
}
I've added the Set/GetLastError() calls so that I can catch what is going wrong. The SetFilePointer() call succeeds, however the ReadFile() call doesn't. The error number is 0x57 which maps to 'The parameter is incorrect'. I've tried various other calls like GetFileSize() and GetFileType() which work as expected.
Incidentally the value of the handle appears in Sysinternal's Process Explorer as a valid handle associated with the w3wp process, so I know it is valid.
Thanks.
Craig Minihan, IISxpress Lead Developer, www.ripcordsoftware.com