コード例 #1
0
ファイル: hwlist.c プロジェクト: Azarien/open-watcom-v2
int SortByGlobType( heap_list **p1, heap_list **p2 )
{
    WORD        t1;
    WORD        t2;
    WORD        tmp;
    int         ret;

    if( !ListingDPMI ) {
        t1 = (*p1)->info.ge.wType;
        t2 = (*p2)->info.ge.wType;
        ret = strcmp( gbl_types[t1], gbl_types[t2] );
        if( ret == 0 ) {
            tmp = t1;
            t1 = (*p1)->info.ge.wData;
            t2 = (*p2)->info.ge.wData;
            if( tmp == GT_CODE ) {
                /* compare the module names */
                ret = strcmp( (*p1)->szModule, (*p2)->szModule );
                if( ret == 0 ) {
                    ret = t1 - t2;
                }
            } else if( tmp == GT_RESOURCE ) {
                if( t1 >= ( sizeof( res_types ) / sizeof( char * ) ) ) {
                    ret = strcmp( HWGetRCString( STR_LOWER_UNKNOWN ), res_types[t2] );
                } else if( t2 >= ( sizeof( res_types ) / sizeof( char * ) ) ) {
                    ret = strcmp(  res_types[t1], HWGetRCString( STR_LOWER_UNKNOWN ) );
                } else {
                    ret = strcmp( res_types[t1], res_types[t2] );
                }
            }
        }
        return( ret );
    } else {
        t1 = (*p1)->info.mem.desc.type;
        t2 = (*p2)->info.mem.desc.type;
        if( t1 == t2 )
            return( 0 );
        if( t1 == 2 )
            return( 1 );
        return( -1 );
    }
} /* SortByType */
コード例 #2
0
ファイル: hwconfig.c プロジェクト: Azarien/open-watcom-v2
/*
 * GetDefaults - set 'info' to the default configuration values
 */
static void GetDefaults( HeapConfigInfo *info ) {

    WORD        x;
    WORD        y;
    const char  *str;

    info->save_glob_pos = TRUE;
    info->save_mem_pos = TRUE;
    info->disp_res = TRUE;
    x = GetSystemMetrics( SM_CXSCREEN );
    y = GetSystemMetrics( SM_CYSCREEN );
    info->glob_xpos = x / 32;
    info->glob_ypos = y / 8;
    info->glob_xsize = 15 * ( x / 16 );
    info->glob_ysize = 3 * ( y / 4 );
    str = HWGetRCString( STR_DEF_GLOB_HEAP_FNAME );
    strcpy( info->gfname, str );
    str = HWGetRCString( STR_DEF_LCL_HEAP_FNAME );
    strcpy( info->lfname, str );
} /* GetDefaults */
コード例 #3
0
ファイル: hwmonit.c プロジェクト: ABratovic/open-watcom-v2
void BeginMonitor( heap_list *item ) {

    HWND                hwnd;
    char                title[50];
    int                 width;
    int                 hight;
    LocalMonInfo        *info;
    WORD                i;
    char                *msgtitle;

    if( !LabelsInitialized ) {
        MonitorLabels[ STATIC_SIZE ] = HWGetRCString( STR_STATIC_DATA );
        MonitorLabels[ STACK_SIZE ] = HWGetRCString( STR_STACK_ALLOCATED );
        MonitorLabels[ FIXED_SIZE ] = HWGetRCString( STR_FIXED_HEAP );
        MonitorLabels[ MOVE_SIZE ] = HWGetRCString( STR_MOVEABLE_HEAP );
        MonitorLabels[ FREE_SIZE ] = HWGetRCString( STR_FREE_HEAP );
        MonitorLabels[ OTHER_SIZE ] = HWGetRCString( STR_MONITOR_UNKNOWN );
        LabelsInitialized = TRUE;
    }
    if( Brushes.use_cnt == 0 ) {
        for( i=0; i < SIZE_CNT; i++ ) {
            Brushes.brush[i] = CreateSolidBrush( BarColors[i] );
        }
    }
    Brushes.use_cnt++;
    width = GetSystemMetrics( SM_CXSCREEN );
    hight = GetSystemMetrics( SM_CYSCREEN );
    RCsprintf( title, STR_LCL_MONITOR_TITLE, item->szModule );

    info = MemAlloc( sizeof( LocalMonInfo ) );
    memset( info, 0, sizeof( LocalMonInfo ) );
    info->instance = item->info.ge.hBlock;
    info->task_hdl = GetTaskHdl( info->instance );
    info->total_size = item->info.ge.dwBlockSize;
    info->handle = item->info.ge.hBlock;

    hwnd = CreateWindow(
        LOCAL_MONITOR_CLASS,            /* Window class name */
        title,                          /* Window caption */
        WS_OVERLAPPED|WS_CAPTION
        |WS_SYSMENU|WS_THICKFRAME
        |WS_MAXIMIZEBOX,                /* Window style */
        width/12,                       /* Initial X position */
        hight/4,                        /* Initial Y position */
        5*width/6,                      /* Initial X size */
        hight/2,                        /* Initial Y size */
        HeapWalkMainWindow,             /* Parent window handle */
        NULL,                           /* Window menu handle */
        Instance,                       /* Program instance handle */
        info );                         /* Create parameters */
    if( hwnd == NULL ) {
        msgtitle = HWAllocRCString( STR_MONITOR_LCL_HEAP );
        RCMessageBox( NULL, STR_CANT_OPEN_LCL_MONITOR, HeapWalkName,
                    MB_OK | MB_TASKMODAL | MB_ICONINFORMATION );
        HWFreeRCString( msgtitle );
    }
    ShowWindow( hwnd, SW_SHOWNORMAL );
    UpdateWindow( hwnd );
}
コード例 #4
0
ファイル: hwlist.c プロジェクト: Azarien/open-watcom-v2
BOOL FormatHeapListItem( char *line, unsigned index )
{
    char        type[30];
    char        handle[5];
    char        lock[15];
    heap_list   *hl;

    if( index >= HeapListSize ) return( FALSE );
    hl = HeapList[index];
    if( hl->is_dpmi ) {
        FormatSel( NULL, hl->info.mem.sel, line );
    } else {
        if( hl->info.ge.hBlock != 0 ) {
            sprintf( handle,"%04x", hl->info.ge.hBlock );
        } else {
            handle[0] = 0;
        }
        lock[0] = 0;
        if( hl->info.ge.wcLock ) {
            strcat( lock, "L1" );
            if( hl->info.ge.wcPageLock ) strcat( lock,"," );
        }
        if( hl->info.ge.wcPageLock ) {
            strcat( lock, "P1" );
        }
        if( hl->info.ge.wType == GT_CODE ) {
            sprintf( type,"%s(%d)", gbl_types[GT_CODE], hl->info.ge.wData );
        } else if( hl->info.ge.wType == GT_RESOURCE ) {
            sprintf( type,"%s(%s)", gbl_types[GT_RESOURCE],
                   (hl->info.ge.wData < ( sizeof( res_types ) / sizeof( char * ) )) ?
                    res_types[ hl->info.ge.wData ] : HWGetRCString( STR_LOWER_UNKNOWN ) );
        } else {
            strcpy( type,gbl_types[hl->info.ge.wType] );
        }
        sprintf( line,"%s%4s  %08lx %8ld  %-8s   %c   %-5s  %c   %-21s",
                hl->is_added ? "*" : " ",
                handle,
                hl->info.ge.dwAddress,
                hl->info.ge.dwBlockSize,
                hl->szModule,
                hl->flag,
                lock,
                (hl->info.ge.wHeapPresent ? 'Y':' '),
                type
                );
    }
    return( TRUE );
} /* FormatHeapListItem */
コード例 #5
0
static HWND MkDisplayWin( msg_id captionid, HWND parent )
{

    HWND        hdl;
    const char  *caption;

    caption = HWGetRCString( captionid );
    hdl = CreateWindow(
        ITEM_DISPLAY_CLASS,     /* Window class name */
        caption,                /* Window caption */
        WS_OVERLAPPED|WS_CAPTION
        |WS_SYSMENU|WS_THICKFRAME
        |WS_MAXIMIZEBOX,        /* Window style */
        0,                      /* Initial X position */
        0,                      /* Initial Y position */
        200,                    /* Initial X size */
        100,                    /* Initial Y size */
        parent,                 /* Parent window handle */
        NULL,                   /* Window menu handle */
        Instance,               /* Program instance handle */
        NULL);                  /* Create parameters */
        SetWindowLong( hdl, 0, 0L );
        return( hdl );
}
コード例 #6
0
ファイル: hwlist.c プロジェクト: Azarien/open-watcom-v2
void InitListStrTables( void )
{
    gbl_types[ 0 ] = HWGetRCString( STR_MC_UNKNOWN );
    gbl_types[ 1 ] = HWGetRCString( STR_DGROUP );
    gbl_types[ 2 ] = HWGetRCString( STR_DATA );
    gbl_types[ 3 ] = HWGetRCString( STR_CODE );
    gbl_types[ 4 ] = HWGetRCString( STR_TASK );
    gbl_types[ 5 ] = HWGetRCString( STR_RESOURCE );
    gbl_types[ 6 ] = HWGetRCString( STR_MC_MODULE );
    gbl_types[ 7 ] = HWGetRCString( STR_MC_FREE );
    gbl_types[ 8 ] = HWGetRCString( STR_INTERNAL );
    gbl_types[ 9 ] = HWGetRCString( STR_SENTINEL );
    gbl_types[ 10 ] = HWGetRCString( STR_BURGERMASTER );
    res_types[ 0 ] = HWGetRCString( STR_USERDEFINED );
    res_types[ 1 ] = HWGetRCString( STR_CURSOR_COMP );
    res_types[ 2 ] = HWGetRCString( STR_MC_BITMAP );
    res_types[ 3 ] = HWGetRCString( STR_ICON_COMP );
    res_types[ 4 ] = HWGetRCString( STR_MC_MENU );
    res_types[ 5 ] = HWGetRCString( STR_DIALOG );
    res_types[ 6 ] = HWGetRCString( STR_STRING );
    res_types[ 7 ] = HWGetRCString( STR_FONTDIR );
    res_types[ 8 ] = HWGetRCString( STR_MC_FONT );
    res_types[ 9 ] = HWGetRCString( STR_ACCELERATORS );
    res_types[ 10 ] = HWGetRCString( STR_RCDATA );
    res_types[ 11 ] = HWGetRCString( STR_ERRTABLE );
    res_types[ 12 ] = HWGetRCString( STR_MC_CURSOR );
    res_types[ 13 ] = HWGetRCString( STR_MC_ICON );
    res_types[ 14 ] = HWGetRCString( STR_NAMETABLE );
}
コード例 #7
0
/*
 * SetDisplayType - changes the heap display type to 'type' unless type is
 *                  'HEAPMENU_DISPLAY_INIT' in which case this is assumed to
 *                  be the first call to SetDisplayType and the heap display
 *                  type is set to 'HeapType'
 */
static void SetDisplayType( HWND hwnd, HWND **title, WORD type ) {

    HMENU       mh;
    char        buf[256];
    char        *typename;

    if( type == HeapType ) return;
    if( type == HEAPMENU_DISPLAY_DPMI && !WDebug386 ) {
        RCMessageBox( HeapWalkMainWindow, STR_INSTALL_WDEBUG,
                      HeapWalkName, MB_OK | MB_ICONEXCLAMATION );
        return;
    }
    mh = GetMenu( hwnd );
    if( type == HEAPMENU_DISPLAY_INIT ) {
        type = HeapType;
        HeapType = HEAPMENU_DISPLAY_INIT;
    } else {
        CheckMenuItem( mh, HeapType, MF_UNCHECKED | MF_BYCOMMAND );
    }

    /* undo anything done for the previous state */
    switch( HeapType ) {
    case HEAPMENU_DISPLAY_DPMI:
        EnableMenuItem( mh, HEAPMENU_ADD, MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_DISCARD,
                        MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_OLDEST,
                        MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_NEWEST,
                        MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_LOCAL_LOCALWALK,
                        MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_COMPACT_AND_LOCALWALK,
                        MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_GET_SELECTOR,
                        MF_BYCOMMAND | MF_ENABLED );
        EnableMenuItem( mh, HEAPMENU_LOCAL_MONITOR,
                        MF_BYCOMMAND | MF_ENABLED );
        ModifyMenu( mh, 2, MF_BYPOSITION | MF_POPUP,
                    (UINT)LoadMenu( Instance, "SORTMENU" ),
                    HWGetRCString( STR_SORT ) );
        KillPushWin( *title );
        *title = SetUpPushWindows( hwnd, HEAPMENU_DISPLAY_ENTIRE );
        if( GSortType == HEAPMENU_SORT_GRAN ||
            GSortType == HEAPMENU_SORT_DPL ) GSortType = HEAPMENU_SORT_HANDLE;
        break;
    case HEAPMENU_DISPLAY_LRU:
        DeleteMenu( mh, HEAPMENU_SORT_LRU, MF_BYCOMMAND );
        if( GSortType == HEAPMENU_SORT_LRU ) GSortType = HEAPMENU_SORT_HANDLE;
        break;
    case HEAPMENU_DISPLAY_INIT:
        if( type != HEAPMENU_DISPLAY_DPMI ) {
            *title = SetUpPushWindows( hwnd, type );
            ModifyMenu( mh, 2, MF_BYPOSITION | MF_POPUP,
                    (UINT)LoadMenu( Instance, "SORTMENU" ),
                    HWGetRCString( STR_SORT ) );
        } else {
            *title = NULL;
        }
        break;
    }
    /* do things for the new state */
    switch( type ) {
    case HEAPMENU_DISPLAY_DPMI:
        ModifyMenu( mh, 2, MF_BYPOSITION | MF_POPUP,
                    (UINT)LoadMenu( Instance, "SORTDPMIMENU" ),
                    HWGetRCString( STR_SORT ) );
        EnableMenuItem( mh, HEAPMENU_ADD, MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_DISCARD,
                        MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_OLDEST,
                        MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_NEWEST,
                        MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_LOCAL_LOCALWALK,
                        MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_COMPACT_AND_LOCALWALK,
                        MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_OBJECT_GET_SELECTOR,
                        MF_BYCOMMAND | MF_GRAYED );
        EnableMenuItem( mh, HEAPMENU_LOCAL_MONITOR,
                        MF_BYCOMMAND | MF_GRAYED );
        if( GSortType == HEAPMENU_SORT_MODULE ||
                GSortType == HEAPMENU_SORT_TYPE ) {
            CheckMenuItem( mh, GSortType, MF_UNCHECKED | MF_BYCOMMAND );
            GSortType = HEAPMENU_SORT_ADDR;
        }
//      SetTitle( HeapDPMITitles, title );
        KillPushWin( *title );
        *title = SetUpPushWindows( hwnd, type );
        typename = HWAllocRCString( STR_SELECTOR_LIST_ITEMS );
        break;
    case HEAPMENU_DISPLAY_LRU:
        InsertMenu( mh, HEAPMENU_SORT_FLAG, MF_BYCOMMAND, HEAPMENU_SORT_LRU,
                   GetRCString( STR_BY_AGE ) );
        typename = HWAllocRCString( STR_LRU_ITEMS );
        break;
    case HEAPMENU_DISPLAY_ENTIRE:
        typename = HWAllocRCString( STR_ENTIRE_HEAP );
        break;
    case HEAPMENU_DISPLAY_FREE:
        typename = HWAllocRCString( STR_FREE_ITEMS );
        break;
    default:
        typename = "";
        break;
    }
    CheckMenuItem( mh, type, MF_CHECKED | MF_BYCOMMAND );
    CheckMenuItem( mh, GSortType, MF_CHECKED | MF_BYCOMMAND );
    DrawMenuBar( hwnd );
    sprintf( buf, "%s - %s", HeapWalkName, typename );
    HWFreeRCString( typename );
    SetWindowText( hwnd, buf );
    HeapType = type;
} /* SetDisplayType */