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