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