Hello, I am a newbee on WinCE and on ISAPI. I have managed to create an ISAPI dll that dynamically generated html pages and sends them to the client.

When I put an <img> tag in my html, I notice that an additional call to HttpExtensionProc is made with the image (file)name in the lpszPathInfo member of the EXTENSION_CONTROL_BLOCK struct.

My problem is, that I can't find out how to send the image data. My attempts until now fail.

An excerpt of my code (taken from my HttpExtensionProc implementation):

HANDLE hFile;
BYTE byBuffer[512];
DWORD dwBytesRead;
HSE_SEND_HEADER_EX_INFO HeaderExInfo;
char chHeader[100];

hFile = CreateFile(szFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
dwBytesRead = GetFileSize(hFile, NULL);
sprintf_s(chHeader, 100, "Content-Type: image/jpeg\r\nContent-length: %d\r\n", dwBytesRead);
HeaderExInfo.pszStatus = "200 OK";
HeaderExInfo.pszHeader = chHeader;
HeaderExInfo.cchStatus = strlen(HeaderExInfo.pszStatus);
HeaderExInfo.cchHeader = strlen(HeaderExInfo.pszHeader);
HeaderExInfo.fKeepConn = FALSE;
pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL));
ReadFile(hFile, byBuffer, 512, &dwBytesRead, NULL);
while (dwBytesRead > 0) {

g_WriteClient(pECB->ConnID, byBuffer, &dwBytesRead, 0));
ReadFile(hFile, byBuffer, 512, &dwBytesRead, NULL);

}
CloseHandle(hFile);


Any hints?