// // Microsoft Corporation - Copyright 1997 // // // RESPONSE.CPP - Contains possible responses // #include "pch.h" // Globals const char g_cszTableHeader[] = "%s \
Variable Name | \Value | \
---|
" ); dwSize = 1 + lstrlen( szBuffer ); fReturn = WriteClient( lpEcb->ConnID, szBuffer, &dwSize, HSE_IO_ASYNC ); if ( !fReturn ) goto Cleanup; // and echo it back... dwSize = lpEcb->cbAvailable; fReturn = WriteClient( lpEcb->ConnID, lpEcb->lpbData, &dwSize, HSE_IO_ASYNC ); if ( !fReturn ) goto Cleanup; // and anything else that was sent... if ( lpMoreData ) { dwSize = lpEcb->cbTotalBytes - lpEcb->cbAvailable; fReturn = WriteClient( lpEcb->ConnID, lpMoreData, &dwSize, HSE_IO_ASYNC ); if ( !fReturn ) goto Cleanup; } // Create bottom part of response and send it StrCpy( szBuffer, "" ); dwSize = 1 + lstrlen( szBuffer ); fReturn = WriteClient( lpEcb->ConnID, szBuffer, &dwSize, HSE_IO_ASYNC ); if ( !fReturn ) goto Cleanup; Cleanup: if ( lpMoreData ) GlobalFree( lpMoreData ); TraceMsg( TF_FUNC | TF_RESPONSE, "SendEcho( ) Exit = %s", BOOLTOSTRING( fReturn ) ); return fReturn; } // SendEcho( ) // // What: SendServerHeader // // Desc: This sends a complete HTTP server response header including the // status, server version, message time, and MIME version. The ISAPI // application should append other HTTP headers such as the content // type and content length, followed by an extra "\r\n". This function // only takes textual data, up to the first '\0' terminator // // In: lpEcb is the EXTENDED_CONTROL_BLOCK // BOOL SendServerHeader( LPECB lpEcb ) { BOOL fReturn; CHAR szBuffer[ RESPONSE_BUF_SIZE ]; DWORD dwSize, dwParam; TraceMsg( TF_FUNC | TF_RESPONSE, "SendServerHeader( )" ); TraceMsg( TF_RESPONSE, "Sending Pre Header: %s", szBuffer ); dwSize = wsprintf( szBuffer, "200 OK" ); dwParam = 0; fReturn = ServerSupportFunction( lpEcb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER, szBuffer, &dwSize, &dwParam ); if ( !fReturn ) goto Cleanup; TraceMsg( TF_RESPONSE, "Sending Post Header: %s", szBuffer ); dwSize = wsprintf( szBuffer, "Content-Type: text/html\r\n" ); fReturn = WriteClient( lpEcb->ConnID, szBuffer, &dwSize, HSE_IO_ASYNC ); if ( !fReturn ) goto Cleanup; Cleanup: TraceMsg( TF_FUNC | TF_RESPONSE, "SendServerHeader( ) Exit = %s", BOOLTOSTRING( fReturn ) ); return fReturn; } // SendServerHeader( ) // // What: OutputHTMLString // // Desc: Outputs HTML to client. Simply changes '\n's to
Offset | Hex Dump | String Dump | Comments |
Skipping... | . | . | . |
0x%-8.8x (%-6.6u): | ", lpb - lpbData, lpb - lpbData, dwColor ); // starting color on "String Dump" cbStr = wsprintf( szString, "", dwColor ); } if ( lpb < lpbData + dwLength ) { // middle of every row... // color change if needed while (( lpDT[ cbDT ].lpAddr ) && ( lpb >= lpDT[ cbDT ].lpAddr )) { dwColor = lpDT[ cbDT ].dwColor; cbBuf += wsprintf( &szBuffer[ cbBuf ], "", dwColor ); cbStr += wsprintf( &szString[ cbStr ], "", dwColor ); cbDT++; } // output hex number cbBuf += wsprintf( &szBuffer[ cbBuf ], "%-2.2x ", *lpb ); // output "String Dump" character cbStr += wsprintf( &szString[ cbStr ], "%c", ( ( *lpb < 32 || *lpb == 127 ) ? '.' : ( ( *lpb == 32 ) ? '_' : *lpb ) ) ); lpb++; } cb++; // always count even if there is no more data if ( cb == 16 ) { // end of every row... // terminate FONT tags and append "String Dump" cbStr += wsprintf( &szString[ cbStr ], "" ); cbBuf += wsprintf( &szBuffer[ cbBuf ], " | %s | ", szString ); // skip NULL comments while (( lpDT[ cbComment ].lpAddr ) && ( !lpDT[ cbComment ].lpszComment )) cbComment++; // don't allow comments to get ahead of the bits if (( lpDT[ cbComment ].lpAddr ) && ( cbComment < cbDT )) { cbBuf += wsprintf( &szBuffer[ cbBuf ], "%s |