ISAPI Filter 输出自定义 HTML 代码的问题
正在学习编写 ISAPI Filter,请问如何输出自定义 HTML 代码? 这个代码加在哪里?我对C++不太熟悉,麻烦高手最好给出代码。
下面是我现在的代码。
#include <windows.h>#include <stdio.h>#include <stdlib.h>#include <httpfilt.h>#include <iostream>#include <fstream>using namespace std; using namespace System;DWORD DoSendResponse(HTTP_FILTER_CONTEXT * pfc, HTTP_FILTER_SEND_RESPONSE * pResponse);BOOL WINAPI __stdcall GetFilterVersion(HTTP_FILTER_VERSION *pVer){ pVer->dwFlags = ( SF_NOTIFY_ORDER_DEFAULT | SF_NOTIFY_SEND_RESPONSE ); pVer->dwFilterVersion = HTTP_FILTER_REVISION; strcpy(pVer->lpszFilterDesc, "Replace Server Header ISAPI filter, Version 1.0"); return TRUE;}DWORD WINAPI __stdcall HttpFilterProc(HTTP_FILTER_CONTEXT *pfc, DWORD NotificationType, VOID *pvData){ switch (NotificationType) { case SF_NOTIFY_SEND_RESPONSE : return DoSendResponse(pfc, (HTTP_FILTER_SEND_RESPONSE *) pvData); default : break; } return SF_STATUS_REQ_NEXT_NOTIFICATION;}DWORD DoSendResponse(HTTP_FILTER_CONTEXT * pfc,HTTP_FILTER_SEND_RESPONSE * pResponse){ System::IO::File::AppendAllText("c:\\abc.txt", "\r\n"); char PATH_TRANSLATED[1024]; DWORD cb; cb=sizeof(PATH_TRANSLATED); int len = 0; len = pfc->GetServerVariable(pfc, "PATH_TRANSLATED", PATH_TRANSLATED, &cb); String ^sPATH_TRANSLATED = gcnew String(PATH_TRANSLATED); System::IO::File::AppendAllText("c:\\abc.txt", sPATH_TRANSLATED); BOOL fServer = TRUE; DWORD dwServerError; fServer = pResponse->SetHeader(pfc, "Server:", "MyWebServer"); if ( !fServer ) { dwServerError = GetLastError(); pfc->pFilterContext = (LPVOID)(DWORD64)pResponse->HttpStatus; } return SF_STATUS_REQ_NEXT_NOTIFICATION;}