views:

19

answers:

1

I've been given an ISAPI extension dll compiled in VC6 which calls "ServerSupportFunction" through MFC's CHttpServerContext class. The code looks something like (assume Ctx is object of the class CHttpServerContext)

CString str;
str = "Content-Type: text/plain\r\n";
str += "Content-Length: 200\r\n";
str += "\r\n";

DWORD len = str.GetLength();

Ctx->ServerSupportFunction(HSE_REQ_SEND_RESPONSE_HEADER,NULL,
                           &len,
                           (LPWORD)(LPCTSTR)str);

when running on windows 2003 IIS6 , this code works fine. If running on windows 2008 IIS7 it returns a windows error code of ERROR_INVALID_PARAMETER

if i change the last parameter to be (LPWORD)"Content-Type: text/plain\r\n\r\n" instaed of using CString , the function call succeed. The dll is compiled in windows xp with VC6 with static MFC .

Since i reluctant to change the dll code , does anyone know of a reason why this problem occurs in windows 2008 and how it can be solved?

Was there any change in windows 2008 affecting this? (I didn't found any) Can it be related to the machine codepage? Should the dll compiled differenatly?(maybe without UNICODE)

A: 

I found the problem. The string the original code sent was "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n...." When the "HTTP/1.0 200 OK\r\n" was removed , and the string contained only HTTP headers , the call worked perfectly well.

Ohad

related questions