Пример #1
0
/*
 * redrawMemList
 */
static void redrawMemList( LBoxHdl *hdl, MemListData *info ) {

    DWORD       i;
    char        buf[150];

    ClearListBox( hdl );
    for( i=0; i < info->used; i++ ) {
        FormatMemListEntry( buf, info->data[i] );
        LBStrPrintf( hdl, buf );
    }
    SendMessage( GetListBoxHwnd( hdl ), LB_SETTOPINDEX, 0, 0 );
}
Пример #2
0
/*
 * logMemDump
 */
static void logMemDmp( ExceptDlgInfo *info ) {

    SelMemDlgInfo       selinfo;
    DWORD               i;
    char                buf[150];

    logPrintf( STR_PROCESS_MEM_DMP );
    selinfo.list.allocated = 0;
    selinfo.list.used = 0;
    selinfo.list.data = NULL;
    selinfo.prochdl = info->procinfo->prochdl;
    RefreshMemList( info->procinfo->procid, info->procinfo->prochdl,
                    &selinfo.list );
    logStrPrintf( "%s\n\n", MEM_WALKER_HEADER );
    for( i=0; i < selinfo.list.used; i++ ) {
        FormatMemListEntry( buf, selinfo.list.data[i] );
        logStrPrintf( "%s\n", buf );
    }
    JDialogBoxParam( Instance, "SEL_MEM_TO_DMP", NULL, MemDmpDlgProc, (LPARAM)&selinfo );
    FreeMemList( &selinfo.list );
}
Пример #3
0
BOOL CALLBACK MemDmpDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    SelMemDlgInfo               *info;
    HWND                        lb;

    info = (SelMemDlgInfo *)GetWindowLong( hwnd, DWL_USER );
    switch( msg ) {
    case WM_INITDIALOG:
        {
            char    buf[150];
            LRESULT i;
            int     j;

            info = (SelMemDlgInfo *)lparam;
            SetWindowLong( hwnd, DWL_USER, lparam );
            lb = GetDlgItem( hwnd, DMP_BOX );
            SetDlgMonoFont( hwnd, DMP_BOX );
            SetDlgMonoFont( hwnd, DMP_LABEL );
            SetDlgItemText( hwnd, DMP_LABEL, MEM_WALKER_HEADER );
            for( i = 0; i < info->list.used; i++ ) {
                if( info->list.data[i]->mbi.State == MEM_COMMIT ) {
                    FormatMemListEntry( buf, info->list.data[i] );
                    j = (int)SendMessage( lb, LB_ADDSTRING, 0, (LPARAM)buf );
                    SendMessage( lb, LB_SETITEMDATA, j, i );
                }
            }
        }
        break;
    case WM_COMMAND:
        switch( LOWORD( wparam ) ) {
        case IDOK:
            {
                int     selcnt;

                lb = GetDlgItem( hwnd, DMP_BOX );
                selcnt = (int)SendMessage( lb, LB_GETSELCOUNT, 0, 0 );
                if( selcnt > 0 ) {
                    int     i, j;
                    int     *selitems;

                    logStrPrintf( "\n" );
                    selitems = MemAlloc( selcnt * sizeof( int ) );
                    SendMessage( lb, LB_GETSELITEMS, selcnt, (LPARAM)selitems );
                    for( i = 0; i < selcnt; i++ ) {
                        MEMORY_BASIC_INFORMATION    *mbi;

                        j = (int)SendMessage( lb, LB_GETITEMDATA, selitems[i], 0 );
                        mbi = &info->list.data[j]->mbi;
                        logPrintf( STR_MEM_DMP_X_TO_Y,
                           mbi->BaseAddress,
                           (DWORD)mbi->BaseAddress + mbi->RegionSize );
                        logDumpMemItem( info->prochdl, mbi );
                    }
                    MemFree( selitems );
                }
                SendMessage( hwnd, WM_CLOSE, 0, 0L );
            }
            break;
        case IDCANCEL:
            SendMessage( hwnd, WM_CLOSE, 0, 0L );
            break;
        case DMP_SEL_ALL:
            SendDlgItemMessage( hwnd, DMP_BOX, LB_SELITEMRANGE, TRUE,
                                MAKELPARAM( 0, info->list.used - 1 ) );
            break;
        case DMP_CLEAR_ALL:
            SendDlgItemMessage( hwnd, DMP_BOX, LB_SELITEMRANGE, FALSE,
                                MAKELPARAM( 0, info->list.used - 1 ) );
            break;
        }
        break;
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    default:
        return( FALSE );
        break;
    }
    return( TRUE );
}