源码 Sambar ISAPI TEST
来源(null)
下载源文件: i1831_001testisa.rar
testisa.c
/* ** TESTISA ** ** This is a simple ISAPI test DLL that takes the input and displays ** it to the user. ** ** Confidential Property of Tod Sambar ** (c) Copyright Tod Sambar 1998 ** All rights reserved. ** ** ** History: ** Chg# Date Description Resp ** ---- ------- ------------------------------------------------------- ---- ** 5FEB98 Created sambar */ #include <windows.h> #include <httpext.h> #include <string.h> #include <stdio.h> #include <stdarg.h> #include <time.h> /* ** Globals */ //#define NO_DATA_FOUND "<P>No Data Provided." #define NO_DATA_FOUND "/n<p>/n<h3>This is a GET operation</h3>/n<form action=/"testisa.dll/" method=get>/n<input type=/"checkbox/" name=/"check1/" value=/"Value1/">Value1 /n<input type=/"checkbox/" name=/"check2/" value=/"Value2/">Value2 /n<input type=/"checkbox/" name=/"check3/" value=/"Value3/">Value3<p>/n<input type=/"submit/" value=/"Execute ISAPI TEST Extension/">/n</form>/n<p>/n<h3>This is a POST operation</h3>/n<form action=/"testisa.dll/" method=post>/n<input type=/"checkbox/" name=/"check1/" value=/"Value1/">Value1 /n<input type=/"checkbox/" name=/"check2/" value=/"Value2/">Value2 /n<input type=/"checkbox/" name=/"check3/" value=/"Value3/">Value3<p>/n<input type=/"submit/" value=/"Execute ISAPI TEST Extension/">/n</form>/n<p>/n/n<p>/n<a href=/"testisa.dll?HELLO+WORLD/">Execute ISAPI TEST Extension</a>/n<p>/n" /* ** Use a critical section to protect global data. */ CRITICAL_SECTION gCS; /* ** DLL Entry point. */ BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch(ul_reason_for_call) { case DLL_PROCESS_ATTACH: InitializeCriticalSection(&gCS); break; case DLL_PROCESS_DETACH: DeleteCriticalSection(&gCS); break; default: break; } return TRUE; } /* ** GetExtensionVersion ** ** ISAPI/Win32 API method to ensure compatibility with the Server. */ BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) { pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR); lstrcpyn(pVer->lpszExtensionDesc, "Sambar Server ISAPI Test extension.", HSE_MAX_EXT_DLL_NAME_LEN); return TRUE; } /* ** HttpExtensionProc ** ** Called in response to the client request. */ DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB) { DWORD buflen; DWORD datalen; CHAR buffer[8192]; /* Prepare the response header */ wsprintf(buffer, "Content-Type: text/html/r/n" "/r/n" "<head><title>Sambar ISAPI TEST</title></head>/n" "<body><h1>Sambar ISAPI TEST - ISAPI Extension Test Page</h1>/n" "<hr>/n"); buflen = lstrlen(buffer); /* Get the GET/POST data */ if (!stricmp(pECB->lpszMethod, "GET")) { /* Append the QUERY_STRING data */ datalen = lstrlen(pECB->lpszQueryString); if (datalen > 8000) datalen = 8000; if (datalen > 0) { strncpy(&buffer[buflen], pECB->lpszQueryString, datalen); buflen += datalen; } } else /* POST */ { /* Note: cbTotalBytes = cbAvailable in the Sambar Server */ if(pECB->cbTotalBytes > 0) { datalen = pECB->cbAvailable; if (datalen > 8000) datalen = 8000; strncpy(&buffer[buflen], pECB->lpbData, datalen); buflen += datalen; } } if (datalen == 0) { datalen = lstrlen(NO_DATA_FOUND); strncpy(&buffer[buflen], NO_DATA_FOUND, datalen); buflen += datalen; } strncpy(&buffer[buflen], "</BODY></HTML>", 14); buflen += 14; if (!pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER, "200 OK", &buflen, (LPDWORD)buffer)) { pECB->dwHttpStatusCode = 500; return HSE_STATUS_ERROR; } pECB->dwHttpStatusCode = 200; return HSE_STATUS_SUCCESS; } |
testisa.def
LIBRARY testisa DESCRIPTION 'Test ISAPI Extension DLL' EXPORTS GetExtensionVersion HttpExtensionProc |
testisa.dsp
# Microsoft Developer Studio Project File - Name="testisa" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=testisa - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "testisa.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "testisa.mak" CFG="testisa - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "testisa - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "testisa - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "testisa - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TESTISA_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TESTISA_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x804 /d "NDEBUG" # ADD RSC /l 0x804 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"testisa.dll" !ELSEIF "$(CFG)" == "testisa - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TESTISA_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TESTISA_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x804 /d "_DEBUG" # ADD RSC /l 0x804 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"testisa.dll" /pdbtype:sept !ENDIF # Begin Target # Name "testisa - Win32 Release" # Name "testisa - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=./Testisa.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # Begin Source File SOURCE=./Testisa.def # End Source File # End Group # End Target # End Project |
Link: http://www.asm32.net/article_disp.asp?ID=1831