Changeset 21959 for trunk/src/kernel32/dbglog.cpp
- Timestamp:
- Feb 1, 2012, 3:14:45 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/dbglog.cpp
r21958 r21959 301 301 #endif 302 302 303 static VMutex logMutex; 304 303 305 static void win32modname (ULONG eip, char *szModName, int cbModName) 304 306 { … … 321 323 TEB *teb = GetThreadTEB(); 322 324 325 logMutex.enter(); 326 323 327 pszLastLogEntry = tekst; 324 328 … … 393 397 { 394 398 SetFS(sel); 399 logMutex.leave(); 395 400 return 1; 396 401 } … … 400 405 { 401 406 if (flog) 402 fflush( flog); 407 fflush(flog); 408 403 409 SetFS(sel); 410 logMutex.leave(); 404 411 return 1; 405 412 } … … 491 498 #ifdef LOG_TIME 492 499 fprintf(flog, 493 "t XX--- O %02d:%02d:%02d.%03d: ",500 "t-- --- O %02d:%02d:%02d.%03d: ", 494 501 h, m, s, ms); 495 502 #else 496 503 #ifdef SHOW_FPU_CONTROLREG 497 504 fprintf(flog, 498 "t XX--- O ---: ");505 "t-- --- O ---: "); 499 506 #else 500 507 fprintf(flog, 501 "t XX--- O: ");508 "t-- --- O: "); 502 509 #endif 503 510 #endif … … 615 622 616 623 SetFS(sel); 624 logMutex.leave(); 617 625 return 1; 618 626 } … … 621 629 int SYSTEM WriteLogNoEOL(const char *tekst, ...) 622 630 { 623 USHORT sel = RestoreOS2FS(); 624 va_list argptr; 625 626 ODIN_HEAPCHECK(); 627 628 if(!init) 629 { 630 init = TRUE; 631 USHORT sel = RestoreOS2FS(); 632 va_list argptr; 633 634 logMutex.enter(); 635 636 ODIN_HEAPCHECK(); 637 638 if (!init) 639 { 640 init = TRUE; 631 641 632 642 #ifdef DEFAULT_LOGGING_OFF 633 if(getenv("WIN32LOG_ENABLED")) { 634 #else 635 if(!getenv("NOWIN32LOG")) { 636 #endif 637 char logname[CCHMAXPATH]; 638 639 sprintf(logname, "odin32_%d.log", getpid()); 640 flog = fopen(logname, "w"); 641 if(flog == NULL) {//probably running exe on readonly device 642 sprintf(logname, "%sodin32_%d.log", kernel32Path, getpid()); 643 if(getenv("WIN32LOG_ENABLED")) 644 { 645 #else 646 if (!getenv("NOWIN32LOG")) 647 { 648 #endif 649 char logname[CCHMAXPATH]; 650 651 sprintf(logname, "odin32_%d.log", getpid()); 643 652 flog = fopen(logname, "w"); 653 if(flog == NULL) {//probably running exe on readonly device 654 sprintf(logname, "%sodin32_%d.log", kernel32Path, getpid()); 655 flog = fopen(logname, "w"); 656 } 644 657 } 645 } 646 else 647 fLogging = FALSE; 648 } 649 650 if(fLogging && flog && (dwEnableLogging > 0)) 651 { 652 TEB *teb = GetThreadTEB(); 653 654 va_start(argptr, tekst); 655 if(teb) { 656 teb->o.odin.logfile = (DWORD)flog; 657 } 658 vfprintf(flog, tekst, argptr); 659 if(teb) teb->o.odin.logfile = 0; 660 va_end(argptr); 661 } 662 SetFS(sel); 663 return 1; 658 else 659 fLogging = FALSE; 660 } 661 662 if (fLogging && flog && (dwEnableLogging > 0)) 663 { 664 TEB *teb = GetThreadTEB(); 665 666 va_start(argptr, tekst); 667 if (teb) 668 teb->o.odin.logfile = (DWORD)flog; 669 vfprintf(flog, tekst, argptr); 670 if (teb) 671 teb->o.odin.logfile = 0; 672 va_end(argptr); 673 } 674 675 SetFS(sel); 676 logMutex.leave(); 677 return 1; 664 678 } 665 679 //****************************************************************************** … … 679 693 int SYSTEM WritePrivateLog(void *logfile, const char *tekst, ...) 680 694 { 681 USHORT sel = RestoreOS2FS();682 va_list argptr;683 684 if(fLogging && logfile)685 {686 TEB *teb = GetThreadTEB();687 688 va_start(argptr, tekst);689 if(teb) {690 teb->o.odin.logfile = (DWORD)flog;691 }692 vfprintf((FILE *)logfile, tekst, argptr);693 if(teb)teb->o.odin.logfile = 0;694 va_end(argptr);695 696 if(tekst[strlen(tekst)-1] != '\n')697 fprintf((FILE *)logfile, "\n");698 }699 700 SetFS(sel);701 return 1;695 USHORT sel = RestoreOS2FS(); 696 va_list argptr; 697 698 if (fLogging && logfile) 699 { 700 TEB *teb = GetThreadTEB(); 701 702 va_start(argptr, tekst); 703 if (teb) 704 teb->o.odin.logfile = (DWORD)flog; 705 vfprintf((FILE *)logfile, tekst, argptr); 706 if (teb) 707 teb->o.odin.logfile = 0; 708 va_end(argptr); 709 710 if (tekst[strlen(tekst)-1] != '\n') 711 fprintf((FILE *)logfile, "\n"); 712 } 713 714 SetFS(sel); 715 return 1; 702 716 } 703 717 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.