Annotation of parser3/src/targets/isapi/parser3isapi.C, revision 1.82.2.6.2.5
1.29 paf 1: /** @file
2: Parser: IIS extension.
3:
1.82.2.1 paf 4: Copyright (c) 2000,2001-2003 ArtLebedev Group (http://www.artlebedev.com)
1.63 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.77 paf 6: */
1.29 paf 7:
1.82.2.6.2.5! paf 8: static const char* IDENT_PARSER3ISAPI_C="$Date: 2003/03/21 13:42:32 $";
1.29 paf 9:
1.1 paf 10: #ifndef _MSC_VER
1.10 paf 11: # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)]
1.1 paf 12: #endif
1.43 parser 13:
14: #include "pa_config_includes.h"
1.1 paf 15:
1.9 paf 16: #include "pa_sapi.h"
1.1 paf 17: #include "pa_globals.h"
18: #include "pa_request.h"
19: #include "pa_version.h"
1.13 paf 20: #include "pool_storage.h"
1.24 paf 21: #include "pa_socks.h"
1.1 paf 22:
1.64 paf 23: #include <windows.h>
24: #include <process.h>
25:
26: #include <httpext.h>
1.51 parser 27:
1.1 paf 28: #define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION")
1.44 parser 29:
30: // consts
1.1 paf 31:
1.82.2.1 paf 32: const char* IIS51vars[]={
1.73 paf 33: "APPL_MD_PATH", "APPL_PHYSICAL_PATH",
34: "AUTH_PASSWORD", "AUTH_TYPE", "AUTH_USER",
35: "CERT_COOKIE", "CERT_FLAGS", "CERT_ISSUER", "CERT_KEYSIZE", "CERT_SECRETKEYSIZE",
36: "CERT_SERIALNUMBER", "CERT_SERVER_ISSUER", "CERT_SERVER_SUBJECT", "CERT_SUBJECT",
37: "CONTENT_LENGTH", "CONTENT_TYPE",
38: "LOGON_USER",
39: "HTTPS", "HTTPS_KEYSIZE", "HTTPS_SECRETKEYSIZE", "HTTPS_SERVER_ISSUER", "HTTPS_SERVER_SUBJECT",
40: "INSTANCE_ID", "INSTANCE_META_PATH",
41: "PATH_INFO", "PATH_TRANSLATED",
42: "QUERY_STRING",
43: "REMOTE_ADDR", "REMOTE_HOST", "REMOTE_USER", "REQUEST_METHOD",
44: "SCRIPT_NAME",
45: "SERVER_NAME", "SERVER_PORT", "SERVER_PORT_SECURE", "SERVER_PROTOCOL", "SERVER_SOFTWARE",
46: "URL",
47: };
48: const int IIS51var_count=sizeof(IIS51vars)/sizeof(*IIS51vars);
49:
1.65 paf 50: // globals
51:
52: char argv0[MAX_STRING]="";
53:
1.18 paf 54: // SAPI
55:
1.38 parser 56: #ifndef DOXYGEN
57: /*
1.18 paf 58: ISAPI SAPI functions receive this context information.
1.38 parser 59: see Pool::set_context
1.18 paf 60: */
1.15 paf 61: struct SAPI_func_context {
1.3 paf 62: LPEXTENSION_CONTROL_BLOCK lpECB;
63: String *header;
64: DWORD http_response_code;
65: };
1.38 parser 66: #endif
1.3 paf 67:
1.26 paf 68: // goes to 'cs-uri-query' log file field. webmaster: switch it ON[default OFF].
1.82.2.6.2.1 paf 69: void SAPI::logconst char* fmt, ...) {
1.53 parser 70: SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
1.26 paf 71:
72: va_list args;
73: va_start(args,fmt);
74: char buf[MAX_STRING];
1.82.2.1 paf 75: const char* prefix="PARSER_ERROR:";
1.26 paf 76: strcpy(buf, prefix);
1.47 parser 77: char *start=buf+strlen(prefix);
1.51 parser 78: DWORD size=vsnprintf(start, MAX_STRING-strlen(prefix), fmt, args);
1.47 parser 79: remove_crlf(start, start+size);
80:
1.26 paf 81: ctx.lpECB->ServerSupportFunction(ctx.lpECB->ConnID,
82: HSE_APPEND_LOG_PARAMETER, buf, &size, 0);
1.55 parser 83: }
84:
85: /// @todo event log
1.82.2.6 paf 86: static void die_or_abort(const char* fmt, va_list args, bool write_core) {
87: if(FILE *log=fopen("c:\\parser3die.log", "at")) {
1.65 paf 88: vfprintf(log, fmt, args);
89: fclose(log);
90: }
1.81 paf 91: // exit & try to produce core dump
92: abort();
1.26 paf 93: }
1.82.2.6 paf 94: void SAPI::die(const char* fmt, ...) {
95: va_list args;
96: va_start(args, fmt);
97: die_or_abort(fmt, args, false/*write core?*/);
98: va_end(args);
99: }
100:
101: void SAPI::abort(const char* fmt, ...) {
102: va_list args;
103: va_start(args, fmt);
104: die_or_abort(fmt, args, true/*write core?*/);
105: va_end(args);
106: }
1.26 paf 107:
1.82.2.6.2.1 paf 108: const char* SAPI::get_envconst char* name) {
1.53 parser 109: SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
1.82.2.6.2.5! paf 110: char *variable_buf=new(PointerFreeGC) char[MAX_STRING];
1.1 paf 111: DWORD variable_len = MAX_STRING-1;
112:
1.3 paf 113: if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast<char *>(name),
1.1 paf 114: variable_buf, &variable_len)) {
1.73 paf 115: if(*variable_buf) { // saw returning len=1 && *buf=0 :(
116: variable_buf[variable_len]=0;
117: return variable_buf;
118: }
1.7 paf 119: } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
1.82.2.6.2.5! paf 120: variable_buf=new(PointerFreeGC) char[variable_len+1];
1.7 paf 121:
122: if(ctx.lpECB->GetServerVariable(ctx.lpECB->ConnID, const_cast<char *>(name),
123: variable_buf, &variable_len)) {
1.73 paf 124: if(*variable_buf) {
125: variable_buf[variable_len]=0;
126: return variable_buf;
127: }
1.7 paf 128: }
1.1 paf 129: }
1.7 paf 130:
1.1 paf 131: return 0;
132: }
133:
1.82.2.1 paf 134: static int grep_char(const char* s, char c) {
1.72 paf 135: int result=0;
136: if(s) {
137: while(s=strchr(s, c)) {
138: s++; // skip found c
139: result++;
140: }
141: }
142: return result;
143: }
1.82.2.6.2.1 paf 144: static const char* mk_env_pairconst char* key, const char* value) {
1.82.2.6.2.5! paf 145: char *result=new(PointerFreeGC) char[strlen(key)+1/*=*/+strlen(value)+1/*0*/];
1.72 paf 146: strcpy(result, key); strcat(result, "="); strcat(result, value);
147: return result;
148: }
1.82.2.6.2.1 paf 149: const char* const *SAPI::environment(SAPI_Info& info, ) {
1.72 paf 150: // we know this buf is writable
1.82.2.6.2.2 paf 151: const char* all_http_vars=SAPI::get_env("ALL_HTTP");
1.72 paf 152: const int http_var_count=grep_char(all_http_vars, '\n')+1/*\n for theoretical(never saw) this \0*/;
153:
1.82.2.6.2.1 paf 154: const char* *result=new const char*[IIS51var_count+http_var_count+1/*0*/];
1.82.2.1 paf 155: const char* *cur=result;
1.72 paf 156:
157: // IIS5.1 vars
158: for(int i=0; i<IIS51var_count; i++) {
1.82.2.1 paf 159: const char* key=IIS51vars[i];
1.82.2.6.2.2 paf 160: if(const char* value=SAPI::get_env(key))
161: *cur++=mk_env_pair(key, value);
1.72 paf 162: }
163:
164: // HTTP_* vars
165: if(char *s=all_http_vars) {
166: while(char *key=lsplit(&s, '\n'))
167: if(char *value=lsplit(key, ':'))
1.82.2.6.2.2 paf 168: *cur++=mk_env_pair(key, value);
1.72 paf 169: }
170:
171: // mark EOE
172: *cur=0;
173:
174: return result;
175: }
176:
1.82.2.6.2.1 paf 177: size_t SAPI::read_postchar *buf, size_t max_bytes) {
1.53 parser 178: SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
1.1 paf 179:
180: DWORD read_from_buf=0;
181: DWORD read_from_input=0;
182: DWORD total_read=0;
183:
1.3 paf 184: read_from_buf=min(ctx.lpECB->cbAvailable, max_bytes);
185: memcpy(buf, ctx.lpECB->lpbData, read_from_buf);
1.1 paf 186: total_read+=read_from_buf;
187:
188: if(read_from_buf<max_bytes &&
1.3 paf 189: read_from_buf<ctx.lpECB->cbTotalBytes) {
1.1 paf 190: DWORD cbRead=0, cbSize;
191:
1.3 paf 192: read_from_input=min(max_bytes-read_from_buf,
193: ctx.lpECB->cbTotalBytes-read_from_buf);
1.1 paf 194: while(cbRead < read_from_input) {
195: cbSize=read_from_input - cbRead;
1.3 paf 196: if(!ctx.lpECB->ReadClient(ctx.lpECB->ConnID,
197: buf+read_from_buf+cbRead, &cbSize) ||
1.1 paf 198: cbSize==0)
199: break;
200: cbRead+=cbSize;
201: }
202: total_read+=cbRead;
203: }
204: return total_read;
205: }
206:
1.82.2.6.2.1 paf 207: void SAPI::add_header_attribute
1.82.2.2 paf 208: const char* dont_store_key, const char* dont_store_value) {
1.53 parser 209: SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
1.3 paf 210:
211: if(strcasecmp(key, "location")==0)
212: ctx.http_response_code=302;
213:
214: if(strcasecmp(key, "status")==0)
1.82.2.2 paf 215: ctx.http_response_code=atoi(dont_store_value);
1.3 paf 216: else {
1.82.2.2 paf 217: todo: copy dont_store_ to nonvilotile
218: ctx.header->APPEND_CONST(dont_store_key);
1.3 paf 219: ctx.header->APPEND_CONST(": ");
1.82.2.2 paf 220: ctx.header->APPEND_CONST(dont_store_value);
1.30 paf 221: ctx.header->APPEND_CONST("\r\n");
1.3 paf 222: }
1.1 paf 223: }
224:
1.23 paf 225: /// @todo intelligent cache-control
1.82.2.6.2.1 paf 226: void SAPI::send_header() {
1.53 parser 227: SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
1.1 paf 228:
1.64 paf 229: HSE_SEND_HEADER_EX_INFO header_info;
1.1 paf 230:
231: char status_buf[MAX_STATUS_LENGTH];
1.3 paf 232: switch(ctx.http_response_code) {
1.1 paf 233: case 200:
234: header_info.pszStatus="200 OK";
235: break;
236: case 302:
237: header_info.pszStatus="302 Moved Temporarily";
238: break;
1.8 paf 239: case 401:// useless untill parser auth mech
1.1 paf 240: header_info.pszStatus="401 Authorization Required";
1.8 paf 241: break;
1.1 paf 242: default:
1.3 paf 243: snprintf(status_buf, MAX_STATUS_LENGTH,
244: "%d Undescribed", ctx.http_response_code);
1.1 paf 245: header_info.pszStatus=status_buf;
246: break;
247: }
248: header_info.cchStatus=strlen(header_info.pszStatus);
1.66 paf 249: *ctx.header << "\r\n"; // ISAPI v<5 did quite well without it
1.3 paf 250: header_info.pszHeader=ctx.header->cstr();
1.82.2.6.2.3 paf 251: header_info.cchHeader=ctx.header->length();
1.5 paf 252: header_info.fKeepConn=true;
1.1 paf 253:
1.3 paf 254: ctx.lpECB->dwHttpStatusCode=ctx.http_response_code;
1.1 paf 255:
1.3 paf 256: ctx.lpECB->ServerSupportFunction(ctx.lpECB->ConnID,
257: HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
1.1 paf 258: }
259:
1.82.2.6.2.1 paf 260: void SAPI::send_bodyconst void *buf, size_t size) {
1.53 parser 261: SAPI_func_context& ctx=*static_cast<SAPI_func_context *>(pool.get_context());
1.1 paf 262:
263: DWORD num_bytes=size;
1.3 paf 264: ctx.lpECB->WriteClient(ctx.lpECB->ConnID,
1.23 paf 265: const_cast<void *>(buf), &num_bytes, HSE_IO_SYNC);
1.1 paf 266: }
1.16 paf 267:
1.1 paf 268:
1.15 paf 269: static bool parser_init() {
1.1 paf 270: static bool globals_inited=false;
271: if(globals_inited)
1.15 paf 272: return true;
1.1 paf 273: globals_inited=true;
274:
1.65 paf 275: static Pool pool(&pool_storage); // global pool
1.53 parser 276: try {
1.27 paf 277: // init socks
1.82.2.6.2.1 paf 278: pa_init_socks();
1.32 paf 279: // init global classes
1.82.2.6.2.1 paf 280: init_methoded_array();
1.1 paf 281: // init global variables
1.82.2.6.2.1 paf 282: pa_globals_init();
1.65 paf 283:
1.15 paf 284: // successful finish
285: return true;
1.53 parser 286: } catch(const Exception& e) { // global problem
1.82.2.1 paf 287: const char* body=e.comment();
1.15 paf 288:
289: // unsuccessful finish
290: return false;
1.1 paf 291: }
292: }
293:
294: /// ISAPI //
295: BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) {
296: pVer->dwExtensionVersion = HSE_VERSION;
1.36 parser 297: strncpy(pVer->lpszExtensionDesc, "Parser "PARSER_VERSION, HSE_MAX_EXT_DLL_NAME_LEN-1);
298: pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1]=0;
1.15 paf 299: return parser_init();
1.1 paf 300: }
301:
1.6 paf 302: /**
303: ISAPI // main workhorse
304:
1.23 paf 305: @todo
1.10 paf 306: IIS: remove trailing default-document[index.html] from $request.uri.
307: to do that we need to consult metabase,
1.12 paf 308: wich is tested&works but seems slow runtime
309: and not could-be-quickly-implemented if prepared.
1.37 parser 310: @test
311: PARSER_VERSION from outside
1.6 paf 312: */
1.53 parser 313:
1.82.2.6.2.1 paf 314: void real_parser_handlerLPEXTENSION_CONTROL_BLOCK lpECB, bool header_only) {
315: static_cast<SAPI_func_context *>(pool.get_context())->header=new String();
1.53 parser 316:
317: // Request info
318: Request::Info request_info;
319:
320: size_t path_translated_buf_size=strlen(lpECB->lpszPathTranslated)+1;
1.82.2.4 paf 321: char *filespec_to_process=pool.copy(lpECB->lpszPathTranslated, path_translated_buf_size);
1.53 parser 322: #ifdef WIN32
323: back_slashes_to_slashes(filespec_to_process);
324: #endif
325:
1.82.2.6.2.2 paf 326: if(const char* path_info=SAPI::get_env("PATH_INFO")) {
1.53 parser 327: // IIS
328: size_t len=strlen(filespec_to_process)-strlen(path_info);
1.82.2.6.2.5! paf 329: char *buf=new(PointerFreeGC) char[len+1];
1.53 parser 330: strncpy(buf, filespec_to_process, len); buf[len]=0;
331: request_info.document_root=buf;
332: } else
1.67 paf 333: throw Exception("parser.runtime",
1.53 parser 334: 0,
335: "ISAPI: no PATH_INFO defined (in reinventing DOCUMENT_ROOT)");
336:
337: request_info.path_translated=filespec_to_process;
338: request_info.method=lpECB->lpszMethod;
339: request_info.query_string=lpECB->lpszQueryString;
340: if(lpECB->lpszQueryString && *lpECB->lpszQueryString) {
1.82.2.6.2.5! paf 341: char *reconstructed_uri=new(PointerFreeGC) char[
1.53 parser 342: strlen(lpECB->lpszPathInfo)+1/*'?'*/+
1.82.2.4 paf 343: strlen(lpECB->lpszQueryString)+1/*0*/];
1.53 parser 344: strcpy(reconstructed_uri, lpECB->lpszPathInfo);
345: strcat(reconstructed_uri, "?");
346: strcat(reconstructed_uri, lpECB->lpszQueryString);
347: request_info.uri=reconstructed_uri;
348: } else
349: request_info.uri=lpECB->lpszPathInfo;
350:
351: request_info.content_type=lpECB->lpszContentType;
352: request_info.content_length=lpECB->cbTotalBytes;
1.82.2.6.2.2 paf 353: request_info.cookie=SAPI::get_env("HTTP_COOKIE");
1.76 paf 354: request_info.mail_received=false;
1.53 parser 355:
356: // prepare to process request
357: Request request(pool,
358: request_info,
1.82.2.6.2.4 paf 359: String::L_HTML|String::L_OPTIMIZE_BIT,
1.70 paf 360: #ifdef _DEBUG
361: true
362: #else
363: false
364: #endif
365: /* status_allowed */);
1.53 parser 366:
1.65 paf 367: // beside by binary
1.75 paf 368: static char beside_binary_path[MAX_STRING];
369: strncpy(beside_binary_path, argv0, MAX_STRING-1); beside_binary_path[MAX_STRING-1]=0; // filespec of my binary
1.65 paf 370: if(!(
1.75 paf 371: rsplit(beside_binary_path, '/') ||
372: rsplit(beside_binary_path, '\\'))) { // strip filename
1.65 paf 373: // no path, just filename
1.75 paf 374: beside_binary_path[0]='.'; beside_binary_path[1]=0;
1.65 paf 375: }
1.74 paf 376: char config_filespec[MAX_STRING];
377: snprintf(config_filespec, MAX_STRING,
1.65 paf 378: "%s/%s",
1.75 paf 379: beside_binary_path, AUTO_FILE_NAME);
1.79 paf 380: bool fail_on_config_read_problem=entry_exists(config_filespec);
1.65 paf 381:
1.53 parser 382: // process the request
383: request.core(
1.79 paf 384: config_filespec, fail_on_config_read_problem, // /path/to/first/auto.p
1.53 parser 385: header_only);
386: }
387:
1.82.2.6.2.1 paf 388: void call_real_parser_handler__do_SEH
1.53 parser 389: LPEXTENSION_CONTROL_BLOCK lpECB,
390: bool header_only) {
1.54 parser 391: #if _MSC_VER & !defined(_DEBUG)
1.53 parser 392: LPEXCEPTION_POINTERS system_exception=0;
393: __try {
394: #endif
1.82.2.6.2.2 paf 395: real_parser_handler(lpECB, header_only);
1.53 parser 396:
1.54 parser 397: #if _MSC_VER & !defined(_DEBUG)
1.53 parser 398: } __except (
399: (system_exception=GetExceptionInformation()),
400: EXCEPTION_EXECUTE_HANDLER) {
401:
402: if(system_exception)
403: if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord)
1.67 paf 404: throw Exception(0,
1.53 parser 405: 0,
406: "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress);
407: else
1.67 paf 408: throw Exception(0, 0, "Exception <no exception record>");
1.53 parser 409: else
1.67 paf 410: throw Exception(0, 0, "Exception <no exception information>");
1.53 parser 411: }
412: #endif
413: }
414:
1.71 paf 415: inline DWORD RealHttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) {
1.13 paf 416: Pool_storage pool_storage;
1.15 paf 417: Pool pool(&pool_storage); // no allocations until assigned context [for reporting]
418: SAPI_func_context ctx={
419: lpECB,
1.18 paf 420: 0, // filling later: so that if there would be error pool would have ctx
1.80 paf 421: 200 // default http_response_code [lpECB->dwHttpStatusCode seems to be always 0, even on 404 redirect to /404.html]
1.15 paf 422: };
423: pool.set_context(&ctx);// no allocations before this line!
1.71 paf 424:
1.1 paf 425: bool header_only=strcasecmp(lpECB->lpszMethod, "HEAD")==0;
1.53 parser 426: try { // global try
1.82.2.6.2.2 paf 427: call_real_parser_handler__do_SEH(lpECB, header_only);
1.2 paf 428: // successful finish
1.53 parser 429: } catch(const Exception& e) { // global problem
1.12 paf 430: // don't allocate anything on pool here:
431: // possible pool' exception not catch-ed now
1.31 paf 432: // and there could be out-of-memory exception
1.82.2.1 paf 433: const char* body=e.comment();
1.16 paf 434: // log it
1.82.2.6.2.2 paf 435: SAPI::log("exception in request exception handler: %s", body);
1.16 paf 436:
437: //
1.1 paf 438: int content_length=strlen(body);
439:
1.12 paf 440: // prepare header // not using SAPI func wich allocates on pool
441: char header_buf[MAX_STRING];
442: int header_len=snprintf(header_buf, MAX_STRING,
1.30 paf 443: "content-type: text/plain\r\n"
444: "content-length: %lu\r\n"
1.69 paf 445: // "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n"
1.30 paf 446: "\r\n",
1.12 paf 447: content_length);
448:
449: HSE_SEND_HEADER_EX_INFO header_info;
450: header_info.pszStatus="200 OK";
451: header_info.cchStatus=strlen(header_info.pszStatus);
452: header_info.pszHeader=header_buf;
453: header_info.cchHeader=header_len;
454: header_info.fKeepConn=true;
455:
1.1 paf 456: // send header
1.12 paf 457: lpECB->dwHttpStatusCode=200;
458: lpECB->ServerSupportFunction(lpECB->ConnID,
459: HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
1.1 paf 460:
461: // send body
462: if(!header_only)
1.82.2.6.2.2 paf 463: SAPI::send_body(body, content_length);
1.1 paf 464:
465: // unsuccessful finish
466: }
1.65 paf 467: /*
1.82.2.1 paf 468: const char* body="test";
1.65 paf 469:
470: //
471: int content_length=strlen(body);
472:
473: // prepare header // not using SAPI func wich allocates on pool
474: char header_buf[MAX_STRING];
475: int header_len=snprintf(header_buf, MAX_STRING,
476: "content-type: text/plain\r\n"
477: "content-length: %lu\r\n"
478: "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n"
479: "\r\n",
480: content_length);
481: HSE_SEND_HEADER_EX_INFO header_info;
482: header_info.pszStatus="200 OK";
483: header_info.cchStatus=strlen(header_info.pszStatus);
484: header_info.pszHeader=header_buf;
485: header_info.cchHeader=header_len;
486: header_info.fKeepConn=true;
487:
488: // send header
489: lpECB->dwHttpStatusCode=200;
490: lpECB->ServerSupportFunction(lpECB->ConnID,
491: HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
492:
493: // send body
494: DWORD num_bytes=content_length;
495: lpECB->WriteClient(lpECB->ConnID,
496: (void *)body, &num_bytes, HSE_IO_SYNC);
497: */
1.71 paf 498: return HSE_STATUS_SUCCESS_AND_KEEP_CONN;
499: }
1.66 paf 500:
1.71 paf 501: #ifdef _DEBUG
502: //for memory leaks detection only
503: #undef _WINDOWS_
504: #include <afx.h>
505: #endif
506: DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) {
507: // Declare the variables needed
508: #ifdef _DEBUG
509: // _crtBreakAlloc=97779;//97777; //997;
510:
511: CMemoryState oldMemState, newMemState, diffMemState;
512: oldMemState.Checkpoint();
513: //global_pool_storagep->fbreak_on_alloc=true;
514: #endif
515:
516: DWORD result=RealHttpExtensionProc(lpECB);
517:
518: #ifdef _DEBUG
519: newMemState.Checkpoint();
520: if( diffMemState.Difference( oldMemState, newMemState ) )
521: {
522: TRACE( "Memory leaked!\n" );
523: diffMemState.DumpStatistics( );
524: diffMemState.DumpAllObjectsSince();
525: }
526: #endif
527: return result;
1.1 paf 528: }
1.65 paf 529:
530: BOOL WINAPI DllMain(
531: HINSTANCE hinstDLL, // handle to the DLL module
532: DWORD fdwReason, // reason for calling function
533: LPVOID lpvReserved // reserved
534: ) {
535:
536: GetModuleFileName(
537: hinstDLL, // handle to module
538: argv0, // file name of module
539: sizeof(argv0) // size of buffer
540: );
541:
542: return TRUE;
543: }
E-mail: