void *DbgMustAlloc( size_t size ) { void *ptr; ptr = DbgAlloc( size ); if( ptr == NULL ) { Error( ERR_NONE, LIT_ENG( ERR_NO_MEMORY ) ); } return( ptr ); }
void *DbgMustAlloc( unsigned size ) { void *ptr; ptr = DbgAlloc( size ); if( ptr == NULL ) { Error( ERR_NONE, LIT( ERR_NO_MEMORY ) ); } return( ptr ); }
char *DupStrLen( const char *str, size_t len ) { char *dup; dup = DbgAlloc( len + 1 ); if( dup != NULL ) { memcpy( dup, str, len ); dup[len] = '\0'; } return( dup ); }
extern char *DUILoadString( int id ) { char buff[256]; char *ret; int size; size = WinLoadString( 0, NULLHANDLE, id, sizeof( buff ), buff ); // size = LoadString( GetModuleHandle( NULL ), id, buff, sizeof( buff ) ); buff[size] = NULLCHAR; ret = DbgAlloc( size + 1 ); strcpy( ret, buff ); return( ret ); }
extern char *DUILoadString( int id ) { char buff[256]; char *ret; int size; size = LoadString( GetModuleHandle( NULL ), id, buff, sizeof( buff ) ); if( size < 0 ) size = 0; buff[size++] = NULLCHAR; ret = DbgAlloc( size ); memcpy( ret, buff, size ); return( ret ); }
static void VarModify( a_window *wnd, int row, int piece ) { var_node *v; type_kind class; var_window *var = WndVar( wnd ); bool ok; bool followable; unsigned old; if( row < 0 ) { if( var->vtype == VAR_WATCH || var->vtype == VAR_VARIABLE ) { VarMenuItem( wnd, MENU_VAR_NEW_EXPRESSION, row, piece ); } return; } VarErrState(); VarKillExprSPCache( &var->i ); v = VarFindRow( &var->i, row ); if( v == NULL ) { v = VarFindRowNode( &var->i, row ); if( v == NULL ) return; if( piece != VAR_PIECE_GADGET && piece != VAR_PIECE_NAME ) return; if( v->expand != NULL || v->node_type == NODE_INHERIT ) { VarExpandRow( &var->i, v, row ); WndNewCurrent( wnd, row, VAR_PIECE_NAME ); VarRepaint( wnd ); } return; } followable = VarGetStackClass( &class ); switch( piece ) { case VAR_PIECE_GADGET: case VAR_PIECE_NAME: if( VarExpandable( class ) || followable || v->expand != NULL ) { VarExpandRow( &var->i, v, row ); WndNewCurrent( wnd, row, VAR_PIECE_NAME ); VarRepaint( wnd ); } break; case VAR_PIECE_VALUE: if( !VarExpandable( class ) ) { char *value = DbgAlloc( TXT_LEN ); char *name = DbgAlloc( TXT_LEN ); old = VarNewCurrRadix( v ); ExprValue( ExprSP ); VarBuildName( &var->i, v, FALSE ); StrCopy( TxtBuff, name ); VarPrintText( &var->i, value, PrintValue, TXT_LEN ); VarKillExprSPCache( &var->i ); v = VarFindRow( &var->i, row ); FreezeStack(); ok = DlgAnyExpr( name, value, TXT_LEN ); UnFreezeStack( FALSE ); if( ok ) VarDoAssign( &var->i, v, value ); NewCurrRadix( old ); WndRowDirty( wnd, row ); DbgFree( value ); DbgFree( name ); } break; } VarDoneRow( &var->i ); VarOldErrState(); }