static void fillThreadInfo( HWND hwnd, ProcStats *info ) { HWND lb; int index; char buf[100]; DWORD threadid; ThreadStats thdinfo; #ifndef CHICAGO char *str1; #endif lb = GetDlgItem( hwnd, THREAD_LIST ); index = (int)SendMessage( lb, LB_GETCURSEL, 0, 0L ); if( index == LB_ERR ) { SetDlgItemText( hwnd, THREAD_TID, "" ); SetDlgItemText( hwnd, THREAD_SUSPEND_CNT, "" ); SetDlgItemText( hwnd, THREAD_PRIORITY, "" ); } else { enableChoices( hwnd, TRUE ); SendMessage( lb, LB_GETTEXT, index, (LPARAM)(LPSTR)buf ); threadid = getThreadId( buf ); sprintf( buf, "tid = %08lX", threadid ); SetDlgItemText( hwnd, THREAD_TID, buf ); if( GetThreadInfo( info->pid, threadid, &thdinfo ) ) { #ifndef CHICAGO if( thdinfo.state == 5 ) { /* the thread is in a wait state */ str1 = SrchMsg( thdinfo.wait_reason, ThreadWaitMsgs, NULL ); if( str1 == NULL ) { str1 = AllocRCString( STR_WAIT_4_UNKNOWN ); RCsprintf( buf, STR_STATE, str1 ); FreeRCString( str1 ); } else { RCsprintf( buf, STR_STATE, str1 ); } } else { str1 = SrchMsg( thdinfo.state, ThreadStateMsgs, NULL ); if( str1 == NULL ) { str1 = AllocRCString( STR_BRACED_UNKNOWN ); RCsprintf( buf, STR_STATE, str1 ); FreeRCString( str1 ); } else { RCsprintf( buf, STR_STATE, str1 ); } } SetDlgItemText( hwnd, THREAD_SUSPEND_CNT, buf ); #endif /* get priority */ RCsprintf( buf, STR_PRIORITY_X, thdinfo.cur_pri, thdinfo.base_pri ); SetDlgItemText( hwnd, THREAD_PRIORITY, buf ); } } }
/* * FormatException */ void FormatException( char *buf, DWORD code ) { char *str; str = SrchMsg( code, ExceptionMsgs, NULL ); if( str == NULL ) { str = buf; RCsprintf( buf, STR_UNKNOWN_EXCEPTION_X, code ); } else { strcpy( buf, str ); } }
unsigned MADCLIENTRY( String )( mad_string mstr, char *buff, unsigned buff_len ) { unsigned len; char *msg; msg = SrchMsg( mstr, MADMsgs, "String not found" ); len = strlen( msg ); if( buff_len > 0 ) { --buff_len; if( buff_len > len ) buff_len = len; memcpy( buff, msg, buff_len ); buff[buff_len]='\0'; } return( len ); }
/* * logSysInfo - record basic system info */ static void logSysInfo( bool wasfault ) { char *str; time_t tod; DWORD ver; SYSTEM_INFO sysinfo; char name[ MAX_COMPUTERNAME_LENGTH + 1 ]; DWORD bufsize; tod = time( NULL ); str = ctime( &tod ); if( wasfault ) { logPrintf( STR_FAULT_FOUND_ON_X, AppName, str ); } else { logPrintf( STR_LOG_TAKEN_ON_X, AppName, str ); } bufsize = sizeof( name ); GetComputerName( name, &bufsize ); logPrintf( STR_COMPUTER_NAME, name ); bufsize = sizeof( name ); GetUserName( name, &bufsize ); logPrintf( STR_USER_NAME, name ); #ifndef _WIN64 ver = GetVersion(); #ifdef CHICAGO // TEMPORARY FIX UNTIL WE CAN CHECK FOR WIN 95 logPrintf( STR_OPERATING_SYSTEM, "Windows 95" ); #else logPrintf( STR_OPERATING_SYSTEM, IsNT( ver ) ? "Windows NT":"Win32s" ); #endif logPrintf( STR_OS_VERSION, (int)GetMajVer( ver ), (int)GetMinVer( ver ) ); #else logPrintf( STR_OPERATING_SYSTEM, "Windows NT 64-bit" ); #endif GetSystemInfo( &sysinfo ); str = SrchMsg( sysinfo.dwProcessorType, ProcessorNames, NULL ); if( str == NULL ) { str = AllocRCString( STR_UNKNOWN ); logPrintf( STR_PROCESSOR_TYPE, str ); FreeRCString( str ); } else { logPrintf( STR_PROCESSOR_TYPE, str ); } logPrintf( STR_NUM_PROCESSORS, sysinfo.dwNumberOfProcessors ); }
/* * logFaultInfo */ static void logFaultInfo( ExceptDlgInfo *info ) { char *str; char buf[150]; char addr_buf[64]; char fname[ FNAME_BUFLEN ]; DWORD type; DWORD line; msg_id gptype; ProcStats stats; logStrPrintf( "\n" ); logPrintf( STR_OFFENDING_PROC_ULINE ); logPrintf( STR_OFFENDING_PROC_INFO ); logPrintf( STR_OFFENDING_PROC_ULINE ); while( !GetProcessInfo( info->procinfo->procid, &stats ) ) { Sleep( 100 ); RefreshInfo(); } logPrintf( STR_OFFENDING_PROC_X, stats.name, info->procinfo->procid ); type = info->dbinfo->u.Exception.ExceptionRecord.ExceptionCode; FormatException( buf, type ); MADCliAddrToString( info->init_ip, MADTypeDefault( MTK_ADDRESS, MAF_FULL, NULL, &( info->init_ip ) ), MLK_CODE, addr_buf, 63 ); logPrintf( STR_ERR_OCCURRED_AT_X_Y, buf, addr_buf ); if( type == EXCEPTION_ACCESS_VIOLATION ) { if( info->dbinfo->u.Exception.ExceptionRecord.ExceptionInformation[0] ) { gptype = STR_LOG_INV_WRITE_TO; } else { gptype = STR_LOG_INV_READ_FROM; } logPrintf( gptype, info->dbinfo->u.Exception.ExceptionRecord.ExceptionInformation[1] ); } str = SrchMsg( info->action, Actions, NULL ); if( str != NULL ) { logStrPrintf( "%s\n", str ); } logPrintf( STR_MODULES_LOADED ); logModules( info->procinfo->procid, INDENT ); logRegisters( info ); logPrintf( STR_SOURCE_INFORMATION ); if( info->got_dbginfo && GetLineNum( &info->init_ip, fname, FNAME_BUFLEN, &line ) ) { logPrintf( STR_LOG_LINE_X_OF_FILE, INDENT, "", line, fname ); } else { logPrintf( STR_LOG_N_A, INDENT, "" ); } logPrintf( STR_DISASSEMBLY ); logDisasm( info ); logStack( info ); #ifndef CHICAGO if( LogData.log_mem_manager ) { logMemManInfo( info->procinfo->procid ); } #endif if( LogData.log_mem_dmp ) { logMemDmp( info ); } }