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