Esempio n. 1
0
/*
 * LogOptsDlgProc
 */
BOOL CALLBACK LogOptsDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    WORD                cmd;
    char                buf[BUF_SIZE];
    char                title[BUF_SIZE];

    lparam = lparam;
    switch( msg ) {
    case WM_INITDIALOG:
        fillLogOptions( hwnd );
        break;
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( cmd ) {
        case IDOK:
            if( readLogOptions( hwnd, buf ) ) {
                SendMessage( hwnd, WM_CLOSE, 0, 0 );
            }
            break;
        case IDCANCEL:
            SendMessage( hwnd, WM_CLOSE, 0, 0 );
            break;
        case LOG_BROWSE_FILE:
            CopyRCString( STR_PICK_LOG_FILE, title, BUF_SIZE );
            strcpy( buf, LogData.logname );
            if( getNewLogName( hwnd, buf, title, TRUE ) ) {
                strlwr( buf );
                SetDlgItemText( hwnd, LOG_FILE_NAME, buf );
            }
            break;
        case LOG_BROWSE_VIEWER:
            CopyRCString( STR_PICK_LOG_VIEWER, title, BUF_SIZE );
            strcpy( buf, LogData.editor );
            if( getNewLogName( hwnd, buf, title, FALSE ) ) {
                strlwr( buf );
                SetDlgItemText( hwnd, LOG_VIEWER, buf );
            }
            break;
        }
        break;
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    default:
        return( FALSE );
        break;
    }
    return( TRUE );
}
Esempio n. 2
0
/*
 * getNewLogName
 */
static BOOL getNewLogName( HWND parent, char *buf, char *title, BOOL outfile ) {
    OPENFILENAME        of;
    BOOL                ret;
    char                filter[100];
    char                *ptr;

    memset( &of, 0, sizeof( OPENFILENAME ) );
    of.lStructSize = sizeof( OPENFILENAME );
    of.hwndOwner = parent;
    of.hInstance = Instance;
    of.lpstrDefExt = NULL;
    of.lpstrFile = buf;
    of.nMaxFile = BUF_SIZE;
    CopyRCString( STR_ALL_FILE_FILTER, filter, sizeof( filter ) );
    ptr = filter + strlen( filter ) + 1;
    strcpy( ptr, "*.*" );
    ptr += strlen( ptr ) + 1;
    *ptr = '\0';
    of.lpstrFilter = filter;
    of.nFilterIndex = 1L;
    of.lpstrTitle = title;
    if( outfile ) {
        of.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
        ret = GetSaveFileName( &of );
    } else {
        of.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
        ret = GetOpenFileName( &of );
    }
    return( ret );
}
Esempio n. 3
0
BOOL LoadTheDips( void ) {

    int         rc;
    unsigned    i;
    char        *ptr;
    char        buf[256];
    char        status[80];
    BOOL        diploaded;

    diploaded = FALSE;
    i = 0;
    initDipMsgs();
    ptr = DIPDefaults;
    while( *ptr != '\0' ) {
        rc = DIPLoad( ptr );
        if( rc & DS_ERR ) {
            rc &= ~DS_ERR;
            switch( rc ) {
            case DS_FOPEN_FAILED:
                CopyRCString( STR_DIP_NOT_FOUND, status, sizeof( status ) );
                break;
            case DS_INVALID_DIP_VERSION:
                CopyRCString( STR_WRONG_DIP_VERSION, status, sizeof( status ) );
                break;
            case DS_INVALID_DIP:
                CopyRCString( STR_BAD_DIP, status, sizeof( status) );
                break;
            case DS_TOO_MANY_DIPS:
                CopyRCString( STR_TOO_MANY_DIPS, status, sizeof( status) );
                break;
            default:
                CopyRCString( STR_DIP_ERR_OTHER, status, sizeof( status) );
                break;
            }
        } else {
            CopyRCString( STR_DIP_LOADED, status, sizeof( status) );
            diploaded = TRUE;
        }
        sprintf( buf, "%-18s %s", ptr, status );
        theLoadInfo[i].loadmsg = MemAlloc( strlen( buf ) + 1 );
        theLoadInfo[i].loaded = !( rc & DS_ERR );
#ifdef __WINDOWS__
        if( theLoadInfo[i].loaded ) {
            theLoadInfo[i].hinst = DIPLastHandle;
        }
#endif
        strcpy( theLoadInfo[i].loadmsg, buf );
        ptr += strlen( ptr ) + 1;
        i++;
    }
    if( !diploaded ) {
        RCMessageBox( NULL, STR_NO_DIPS_LOADED, AppName,
                      MB_OK | MB_ICONEXCLAMATION );
        ShowDIPStatus( NULL );
        DIPFini();
        return( FALSE );
    }
    return( TRUE );
}
Esempio n. 4
0
static BOOL readLogOptions( HWND hwnd, char *buf ) {

    DWORD       asm_lines;
    DWORD       asm_bkup;
    DWORD       max_fsize;
    char        numhelp[NUM_HELP_SIZE];

    CopyRCString( STR_FIELD_MUST_BE_NUMERIC, numhelp, NUM_HELP_SIZE );
    GetDlgItemText( hwnd, LOG_MAXFL, buf, BUF_SIZE );
    if( !ParseNumeric( buf, FALSE, &max_fsize ) ) {
        RCsprintf( buf, STR_MAX_LOG_FILE_SIZE_INV, numhelp );
        MessageBox( hwnd, buf, AppName, MB_OK | MB_ICONEXCLAMATION );
        return( FALSE );
    }
    GetDlgItemText( hwnd, LOG_DISASM_LINES, buf, BUF_SIZE );
    if( !ParseNumeric( buf, FALSE, &asm_lines ) ) {
        RCsprintf( buf, STR_DISASM_LINES_INVALID, numhelp );
        MessageBox( hwnd, buf, AppName, MB_OK | MB_ICONEXCLAMATION );
        return( FALSE );
    }
    GetDlgItemText( hwnd, LOG_DISASM_BACKUP, buf, BUF_SIZE );
    if( !ParseNumeric( buf, FALSE, &asm_bkup ) ) {
        RCsprintf( buf, STR_DISASM_BKUP_INVALID, numhelp );
        MessageBox( hwnd, buf, AppName, MB_OK | MB_ICONEXCLAMATION );
        return( FALSE );
    }
    GetDlgItemText( hwnd, LOG_FILE_NAME, LogData.logname, BUF_SIZE );
    GetDlgItemText( hwnd, LOG_VIEWER, LogData.editor, BUF_SIZE );
    LogData.asm_cnt = asm_lines;
    LogData.asm_bkup = asm_bkup;
    LogData.max_flen = max_fsize;
    LogData.log_process = IsDlgButtonChecked( hwnd, LOG_TASKS );
    LogData.log_stacktrace = IsDlgButtonChecked( hwnd, LOG_STACK_TRACE );
    LogData.log_mem_manager = IsDlgButtonChecked( hwnd, LOG_MEM );
    LogData.log_mem_dmp = IsDlgButtonChecked( hwnd, LOG_MEM_DMP );
    LogData.query_notes = IsDlgButtonChecked( hwnd, LOG_QUERY_NOTES );
    LogData.autolog = IsDlgButtonChecked( hwnd, LOG_AUTOLOG );
    LogData.log_modules = IsDlgButtonChecked( hwnd, LOG_LOADED_MODULES );
    return( TRUE );
}
Esempio n. 5
0
static void fillExceptionDlg( HWND hwnd, ExceptDlgInfo *info ) {

    char                buf[BUF_SIZE];
    char                fname[ FNAME_BUFLEN ];
    DWORD               line;
    ProcStats           stats;
    HWND                ctl;
    address             addr;

    GetCurrAddr(&addr,info->regs);
    SetDlgCourierFont( hwnd, INT_TASK_NAME );
    SetDlgCourierFont( hwnd, INT_TASK_PATH );
    SetDlgCourierFont( hwnd, INT_FAULT_TYPE );
    SetDlgCourierFont( hwnd, INT_CS_IP );
    SetDlgCourierFont( hwnd, INT_SOURCE_INFO );
    SetDlgCourierFont( hwnd, INT_SOURCE_INFO2 );

    RCsprintf( buf, STR_EXCEPTION_ENCOUNTERED, AppName );
    SetWindowText( hwnd, buf );

    CopyRCString( STR_PROCESS_NAME, buf, BUF_SIZE );
    SetDlgItemText( hwnd, INT_TASK_NAME_TEXT, buf );

    if( !info->dbinfo->u.Exception.dwFirstChance ) {
        if( ConfigData.exception_action == INT_CHAIN_TO_NEXT ) {
            ConfigData.exception_action = INT_TERMINATE;
        }
        ctl = GetDlgItem( hwnd, INT_CHAIN_TO_NEXT );
        EnableWindow( ctl, FALSE );
    }
    CheckDlgButton( hwnd, ConfigData.exception_action, BST_CHECKED );
    CopyRCString( STR_PROCESS_ID, buf, BUF_SIZE );
    SetDlgItemText( hwnd, INT_TASK_PATH_TEXT, buf );

    while( !GetProcessInfo( info->procinfo->procid, &stats ) ) {
        Sleep( 100 );
        RefreshInfo();
    }
    SetDlgItemText( hwnd, INT_TASK_NAME, stats.name );

    sprintf( buf, "%08lX", info->procinfo->procid );
    SetDlgItemText( hwnd, INT_TASK_PATH, buf );

    FormatException( buf, info->dbinfo->u.Exception.ExceptionRecord.ExceptionCode );
    SetDlgItemText( hwnd, INT_FAULT_TYPE, buf );

    if( info->threadinfo != NULL ) {
        strcpy( buf, "Fault " );
        MADRegSpecialName( MSR_IP, info->regs, MAF_FULL, BUF_SIZE - 7, buf+6 );
        SetDlgItemText( hwnd, INT_IP_NAME, buf );
        SetIp( hwnd, &addr );
    }
    if( info->got_dbginfo && GetLineNum( &addr,fname, FNAME_BUFLEN, &line ) ) {
        RCsprintf( buf, STR_LINE_X_OF, line );
        SetDlgItemText( hwnd, INT_SOURCE_INFO, buf );
        SetDlgItemText( hwnd, INT_SOURCE_INFO2, fname );
    } else {
        CopyRCString( STR_N_A, buf, BUF_SIZE );
        SetDlgItemText( hwnd, INT_SOURCE_INFO, buf );
        SetDlgItemText( hwnd, INT_SOURCE_INFO2, "" );
    }
}
Esempio n. 6
0
/*
 * InitStatDialog
 */
static void InitStatDialog( HWND hwnd )
{
    int                 i;
    char                buff[256];
    ExceptDlgInfo       *info;
    syminfo             si;
    CreateRegListData   data;
    StatData            *statdata;
    RECT                c_rect;
    HWND                combo;

    info = StatGetExceptDlgInfo( hwnd );
    StatHdl = hwnd;
    statdata = MemAlloc( sizeof( StatData ) );

    /*
     * fill in source information
     */
    GetCurrAddr( &( statdata->curr_addr ), info->regs );
    if( FindWatSymbol( &( statdata->curr_addr ), &si, TRUE ) == FOUND ) {
        RCsprintf( buff, STR_SRC_INFO_FMT, si.linenum, si.filename );
        StatShowSymbols = TRUE;
        CheckDlgButton( hwnd, STAT_SYMBOLS, ( StatShowSymbols ) ? BST_CHECKED : BST_UNCHECKED );
    } else {
        RCsprintf( buff, STR_N_A );
        StatShowSymbols = FALSE;
        EnableWindow( GetDlgItem( hwnd, STAT_SYMBOLS ), FALSE );
    }
    SetDlgMonoFont( hwnd, STAT_SRC_INFO );
    SetDlgItemText( hwnd, STAT_SRC_INFO, buff );

#ifdef __NT__
    {
        ProcStats       procinfo;
        HWND            button;
        if( GetProcessInfo( info->procinfo->procid, &procinfo ) ) {
            RCsprintf( buff, STR_STATUS_4_PROC_X, info->procinfo->procid, procinfo.name );
            SetWindowText( hwnd, buff );
        }
        CopyRCString( STR_VIEW_MEM_HT_KEY, buff, sizeof( buff ) );
        SetDlgItemText( hwnd, STAT_SEG_MAP, buff );
        button = GetDlgItem( hwnd, STAT_STACK_TRACE );
        ShowWindow( button, SW_HIDE );
    }
#endif
    InstructionBackward( 2, &( statdata->curr_addr ) );
    for( i = STAT_DISASM_1;i <= STAT_DISASM_8; i++ ) {
        SetDlgCourierFont( hwnd, i );
    }
    DisplayAsmLines( hwnd, &( statdata->curr_addr ) );
    data.index = 0;
    data.parent = hwnd;
    data.max_len = 0;
    combo = GetDlgItem( hwnd, STAT_REGISTER_COMBO );
    MADRegSetWalk( MTK_ALL, CreateAllRegLists, &data );
    if( data.index == 1 ) {
        SendMessage( combo, CB_GETLBTEXT, (WPARAM)0, (LPARAM)buff );
        SetDlgItemText( hwnd, STAT_REGISTER_SET, buff );
        DestroyWindow( combo );
    } else {
        GetChildPos( hwnd, combo, &c_rect );
        SendMessage( combo, CB_SETCURSEL, (WPARAM)0, (LPARAM)0 );
        c_rect.right += data.max_len;
        c_rect.bottom += SendMessage( combo, CB_GETITEMHEIGHT, 0, 0 ) * ( data.index + 1);
        MoveWindow( combo, c_rect.left, c_rect.top, c_rect.right, c_rect.bottom, FALSE );
    }
    SetFocus( GetDlgItem( hwnd, IDOK ) );
    statdata->reg_set_index = 0;
    SetWindowLong(hwnd,DWL_USER,(LONG)statdata);
} /* InitStatDialog */
Esempio n. 7
0
/*
 * AboutProc - callback routine for settings dialog
 */
WINEXPORT INT_PTR CALLBACK AboutProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char        buff[256];
    LPABOUTINFO pai;

    lparam = lparam;

    switch( msg ) {
    case WM_INITDIALOG:
        pai = (LPABOUTINFO)lparam;
        if( pai->title != NULL ) {
            SetWindowText( hwnd, pai->title );
        }
        if( pai->name != NULL ) {
            sprintf( buff, banner1p1( "%s" ), pai->name );
            SetDlgItemText( hwnd, ABOUT_NAME, buff );
        }
        if( pai->version != NULL ) {
            SetDlgItemText( hwnd, ABOUT_VERSION, pai->version );
        }
        if( pai->first_cr_year != NULL ) {
#if defined( __WATCOMC__) && !defined( __ALPHA__ )
            if( _fstrcmp( pai->first_cr_year, CURR_YEAR ) ) {
#else
            if( strcmp( pai->first_cr_year, CURR_YEAR ) ) {
#endif
                sprintf( buff, banner2a( "%s" ), pai->first_cr_year );
            } else {
                strcpy( buff, banner2a( "1984" ) );
            }
            SetDlgItemText( hwnd, ABOUT_COPYRIGHT, buff );
        }
#if defined( __WINDOWS__ ) || defined( __WINDOWS_386__ )
        {
            DWORD       flags;
            DWORD       kfree;
            WORD        pcfree;
            SYSHEAPINFO shi;
            char        work[16];
            char        info[50];

            flags = GetWinFlags();
            if( flags & WF_ENHANCED ) {
                CopyRCString( ABT_386_ENH, info, sizeof( info ) );
            } else {
                CopyRCString( ABT_STD_MODE, info, sizeof( info ) );
            }
            SetDlgItemText( hwnd, ABOUT_INFO1, info );
            kfree = GetFreeSpace( 0 ) / 1024L;
            ltoa( kfree, work, 10 );
            RCsprintf( buff, ABT_MEM_X_KB_FREE, (LPSTR)work );
            SetDlgItemText( hwnd, ABOUT_INFO2, buff );

            shi.dwSize = sizeof( shi );
            if( SystemHeapInfo( &shi ) ) {
                pcfree = shi.wGDIFreePercent;
                if( pcfree > shi.wUserFreePercent )
                    pcfree = shi.wUserFreePercent;
                RCsprintf( buff, ABT_SYS_RESOURCES_FREE, pcfree );
            } else {
                CopyRCString( ABT_SYS_RESOURCES_N_A, buff, sizeof( buff ) );
            }
            SetDlgItemText( hwnd, ABOUT_INFO3, buff );
        }
#else
        {
            SYSTEM_INFO         si;
            MEMORYSTATUS        ms;

            GetSystemInfo( &si );
            switch( si.dwProcessorType ) {
            case PROCESSOR_INTEL_386:
                CopyRCString( ABT_RUNNING_ON_386, buff, sizeof( buff ) );
                break;
            case PROCESSOR_INTEL_486:
                CopyRCString( ABT_RUNNING_ON_486, buff, sizeof( buff ) );
                break;
            case PROCESSOR_INTEL_PENTIUM:
                CopyRCString( ABT_RUNNING_ON_586, buff, sizeof( buff ) );
                break;
            case PROCESSOR_MIPS_R4000:
            case PROCESSOR_ALPHA_21064:
            default:
                buff[0] = '\0';
                break;
            }
            SetDlgItemText( hwnd, ABOUT_INFO1, buff );

            ms.dwLength = sizeof( ms );
            GlobalMemoryStatus( &ms );
            RCsprintf( buff, ABT_VIRT_MEM,
                       (ms.dwAvailPhys + ms.dwAvailPageFile) / 1024L );
            SetDlgItemText( hwnd, ABOUT_INFO2, buff );
            RCsprintf( buff, ABT_MEM_LOAD, ms.dwMemoryLoad );
            SetDlgItemText( hwnd, ABOUT_INFO3, buff );

        }
#endif
        return( TRUE );
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    case WM_COMMAND:
        switch( LOWORD( wparam ) ) {
        case IDOK:
        case IDCANCEL:
            EndDialog( hwnd, 0 );
            break;
        }
    }
    return( FALSE );

} /* AboutProc */

/*
 * DoAbout - show the startup dialog
 */
void DoAbout( LPABOUTINFO ai )
{
    FARPROC     proc;

    proc = MakeDlgProcInstance( AboutProc, ai->inst );
    DialogBoxParam( ai->inst, "About", ai->owner, (DLGPROC)proc, (LPARAM)ai );
    FreeProcInstance( proc );

} /* DoAbout */
Esempio n. 8
0
/*
 * InitStatDialog
 */
static void InitStatDialog( HWND hwnd )
{
    int         i;
    char        buff[256];
    syminfo     si;
    ADDRESS     addr;

    SetDWORDEditField( hwnd, STAT_AX, IntData.EAX );
    SetDWORDEditField( hwnd, STAT_BX, IntData.EBX );
    SetDWORDEditField( hwnd, STAT_CX, IntData.ECX );
    SetDWORDEditField( hwnd, STAT_DX, IntData.EDX );
    SetDWORDEditField( hwnd, STAT_SI, IntData.ESI );
    SetDWORDEditField( hwnd, STAT_DI, IntData.EDI );
    SetDWORDEditField( hwnd, STAT_BP, IntData.EBP );

    SetWORDEditField( hwnd, STAT_DS, IntData.DS );
    SetWORDEditField( hwnd, STAT_ES, IntData.ES );
    SetWORDEditField( hwnd, STAT_FS, IntData.FS );
    SetWORDEditField( hwnd, STAT_GS, IntData.GS );

    SetWORDEditField( hwnd, STAT_CS, IntData.CS );
    SetDWORDEditField( hwnd, STAT_IP, IntData.EIP );
    SetWORDEditField( hwnd, STAT_SS, IntData.SS );
    SetDWORDEditField( hwnd, STAT_SP, IntData.ESP );

    CheckDlgButton( hwnd, STAT_FLAG_A, ( IntData.EFlags & FLAG_A_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_C, ( IntData.EFlags & FLAG_C_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_D, ( IntData.EFlags & FLAG_D_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_I, ( IntData.EFlags & FLAG_I_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_Z, ( IntData.EFlags & FLAG_Z_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_S, ( IntData.EFlags & FLAG_S_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_P, ( IntData.EFlags & FLAG_P_MASK ) ? BST_CHECKED : BST_UNCHECKED );
    CheckDlgButton( hwnd, STAT_FLAG_O, ( IntData.EFlags & FLAG_O_MASK ) ? BST_CHECKED : BST_UNCHECKED );

    CheckDlgButton( hwnd, STAT_SYMBOLS, ( StatShowSymbols ) ? BST_CHECKED : BST_UNCHECKED );

    /*
     * fill in source information
     */
    addr.seg = IntData.CS;
    addr.offset = IntData.EIP;
    if( FindWatSymbol( &addr, &si, TRUE ) == FOUND ) {
        RCsprintf( buff, STR_SRC_INFO_FMT, si.linenum, si.filename );
    } else {
        RCsprintf( buff, STR_N_A );
    }
    SetDlgMonoFont( hwnd, STAT_SRC_INFO );
    SetDlgItemText( hwnd, STAT_SRC_INFO, buff );

#ifdef __NT__
    {
        ProcStats       procinfo;
        HWND            button;

        if( GetProcessInfo( processID, &procinfo ) ) {
            RCsprintf( buff, STR_STATUS_4_PROC_X, processID, procinfo.name );
            SetWindowText( hwnd, buff );
        }
        CopyRCString( STR_VIEW_MEM_HT_KEY, buff, sizeof( buff ) );
        SetDlgItemText( hwnd, STAT_SEG_MAP, buff );
        button = GetDlgItem( hwnd, STAT_STACK_TRACE );
        ShowWindow( button, SW_HIDE );
    }
#endif

    /*
     * display code, starting 2 instructions before hand
     */
    currAddr.seg = IntData.CS;
    currAddr.offset = IntData.EIP;
    firstAddr = currAddr;
    InstructionBackup( 2, &currAddr );
    for( i=STAT_DISASM_1;i<=STAT_DISASM_8;i++ ) {
        SetDlgCourierFont( hwnd, i );
    }
    DisplayAsmLines( hwnd, &currAddr, &firstAddr, STAT_DISASM_1,
                        STAT_DISASM_8, STAT_SCROLL );

} /* InitStatDialog */
Esempio n. 9
0
int WRCopyRCString( msg_id id, char *buf, int bufsize )
{
    return( CopyRCString( id, buf, bufsize ) );
}