unsigned OnAnotherThreadSimpAccess( unsigned in_len, in_data_p in_data, unsigned out_len, out_data_p out_data ) { unsigned result; if( !ToldWinHandle || IsTrapFilePumpingMessageQueue() ) { return( TrapSimpAccess( in_len, in_data, out_len, out_data ) ); } else { DosSemClear( &PumpMessageSem ); result = TrapSimpAccess( in_len, in_data, out_len, out_data ); WinPostMsg( GUIGetSysHandle( WndGui( WndMain ) ), WM_QUIT, 0, 0 ); DosSemWait( &PumpMessageDoneSem, SEM_INDEFINITE_WAIT ); DosSemSet( &PumpMessageDoneSem ); return( result ); } }
void RemoteSuspend( void ) { suspend_req acc; acc.req = REQ_SUSPEND; TrapSimpAccess( sizeof( acc ), &acc, 0, NULL ); }
unsigned OnAnotherThreadSimpAccess( unsigned in_len, in_data_p in_data, unsigned out_len, out_data_p out_data ) { unsigned result; ULONG ulCount; if( !ToldWinHandle || IsTrapFilePumpingMessageQueue() ) { return( TrapSimpAccess( in_len, in_data, out_len, out_data ) ); } else { DosPostEventSem( PumpMessageSem ); result = TrapSimpAccess( in_len, in_data, out_len, out_data ); WinPostMsg( GUIGetSysHandle( WndGui( WndMain ) ), WM_QUIT, 0, 0 ); DosWaitEventSem( PumpMessageDoneSem, SEM_INDEFINITE_WAIT ); DosResetEventSem( PumpMessageDoneSem, &ulCount ); return result; } }
unsigned long RemoteSeek( sys_handle hdl, unsigned long pos, unsigned method ) { file_seek_req acc; file_seek_ret ret; int locfile; if( SuppFileId == 0 ) return( 0 ); /* Seek on local copy too (if available) */ locfile = GetCachedHandle( hdl ); if( locfile != -1 ) { lseek( locfile, pos, method ); } SUPP_FILE_SERVICE( acc, REQ_FILE_SEEK ); acc.handle = hdl; /* Magic again! The seek mode mapped exactly to our definition! */ acc.mode = method; acc.pos = pos; CONV_LE_32( acc.handle ); CONV_LE_32( acc.pos ); TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); CONV_LE_32( ret.pos ); CONV_LE_32( ret.err ); if( ret.err != 0 ) { StashErrCode( ret.err, OP_REMOTE ); return( -1UL ); } else { return( ret.pos ); } }
void RemoteResume( void ) { resume_req acc; acc.req = REQ_RESUME; TrapSimpAccess( sizeof( acc ), &acc, 0, NULL ); }
void RemoteErrMsg( sys_error err, char *msg ) { get_err_text_req acc; acc.req = REQ_GET_ERR_TEXT; acc.err = err; TrapSimpAccess( sizeof( acc ), &acc, MAX_ERR_MSG_SIZE, msg ); // TrapErrTranslate( msg, MAX_ERR_MSG_SIZE ); }
bool InitFileSupp( void ) { file_get_config_req acc; InitHandleCache(); SuppFileId = GetSuppId( FILE_SUPP_NAME ); if( SuppFileId == 0 ) return( FALSE ); SUPP_FILE_SERVICE( acc, REQ_FILE_GET_CONFIG ); TrapSimpAccess( sizeof( acc ), &acc, sizeof( RemFile ), &RemFile ); return( TRUE ); }
dtid_t RemoteGetNextRunThread( dtid_t tid ) { run_thread_get_next_req acc; run_thread_get_next_ret ret; if( SuppRunThreadId == 0 ) return( tid == 0 ? DEFAULT_TID : 0 ); acc.supp.core_req = REQ_PERFORM_SUPPLEMENTARY_SERVICE; acc.supp.id = SuppRunThreadId; acc.req = REQ_RUN_THREAD_GET_NEXT; acc.thread = tid; TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); return( ret.thread ); }
void RemoteRunThdName( dtid_t tid, char *name ) { run_thread_get_name_req acc; if( SuppRunThreadId == 0 ) { *name = NULLCHAR; return; } acc.supp.core_req = REQ_PERFORM_SUPPLEMENTARY_SERVICE; acc.supp.id = SuppRunThreadId; acc.req = REQ_RUN_THREAD_GET_NAME; acc.thread = tid; TrapSimpAccess( sizeof( acc ), &acc, MAX_THD_NAME_LEN, name ); }
void FiniTrap( void ) { disconnect_req in_mx; in_mx.req = REQ_DISCONNECT; TrapSimpAccess( sizeof( in_mx ), &in_mx, 0, NULL ); RestoreHandlers(); KillTrap(); GrabHandlers(); #if !defined( BUILD_RFX ) FiniSuppServices(); #endif #ifdef ENABLE_TRAP_LOGGING CloseTrapTraceFile(); #endif }
static bool CapabilitiesGet8ByteBreakpointSupport( void ) { capabilities_get_8b_bp_req acc; capabilities_get_8b_bp_ret ret; if( SuppCapabilitiesId == 0 ) return( FALSE ); SUPP_CAPABILITIES_SERVICE( acc, REQ_CAPABILITIES_GET_8B_BP ); TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); if( ret.err != 0 ) { return( FALSE ); } else { Supports8ByteBreakpoints = TRUE; /* The trap supports 8 byte breakpoints */ return( TRUE ); } }
dtid_t RemoteSetRunThreadWithErr( dtid_t tid, error_idx *erridx ) { run_thread_set_req acc; run_thread_set_ret ret; if( SuppRunThreadId == 0 ) return( DEFAULT_TID ); acc.supp.core_req = REQ_PERFORM_SUPPLEMENTARY_SERVICE; acc.supp.id = SuppRunThreadId; acc.req = REQ_RUN_THREAD_SET; acc.thread = tid; TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); if( ret.err != 0 ) { *erridx = StashErrCode( ret.err, OP_REMOTE ); return( 0 ); } return( ret.old_thread ); }
static bool CapabilitiesSetExactBreakpointSupport( bool status ) { capabilities_set_8b_bp_req acc; capabilities_set_8b_bp_ret ret; if( SuppCapabilitiesId == 0 ) return( FALSE ); SUPP_CAPABILITIES_SERVICE( acc, REQ_CAPABILITIES_SET_EXACT_BP ); acc.status = status ? TRUE : FALSE; TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); if( ret.err != 0 ) { return( FALSE ); } else { _SwitchSet( SW_BREAK_ON_WRITE, ret.status ? TRUE : FALSE ); return( TRUE ); } }
static bool CapabilitiesSet8ByteBreakpointSupport( bool status ) { capabilities_set_8b_bp_req acc; capabilities_set_8b_bp_ret ret; if( SuppCapabilitiesId == 0 ) return( FALSE ); SUPP_CAPABILITIES_SERVICE( acc, REQ_CAPABILITIES_SET_8B_BP ); acc.status = status ? TRUE : FALSE; TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); if( ret.err != 0 ) { return( FALSE ); } else { Supports8ByteBreakpoints = ret.status ? TRUE : FALSE; return( TRUE ); } }
static bool CapabilitiesGetExactBreakpointSupport( void ) { capabilities_get_8b_bp_req acc; capabilities_get_8b_bp_ret ret; if( SuppCapabilitiesId == 0 ) return( FALSE ); SUPP_CAPABILITIES_SERVICE( acc, REQ_CAPABILITIES_GET_EXACT_BP ); TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); if( ret.err != 0 ) { return( FALSE ); } else { /* The trap may support it, but it is not possible currently */ SupportsExactBreakpoints = ret.status ? TRUE : FALSE; return( TRUE ); } }
unsigned RemoteClose( sys_handle hdl ) { file_close_req acc; file_close_ret ret; int locfile; if( SuppFileId == 0 ) return( 0 ); locfile = GetCachedHandle( hdl ); if( locfile != -1 ) { close( locfile ); DelCachedHandle( locfile ); #ifdef LOGGING fprintf( logf, "Closing remote file handle %d\n", hdl ); #endif } SUPP_FILE_SERVICE( acc, REQ_FILE_CLOSE ); acc.handle = hdl; CONV_LE_32( acc.handle ); TrapSimpAccess( sizeof( acc ), &acc, sizeof( ret ), &ret ); CONV_LE_32( ret.err ); return( StashErrCode( ret.err, OP_REMOTE ) ); }
unsigned OnAnotherThreadSimpAccess( trap_elen in_len, in_data_p in_data, trap_elen out_len, out_data_p out_data ) { return( TrapSimpAccess( in_len, in_data, out_len, out_data ) ); }
unsigned OnAnotherThreadSimpAccess( unsigned in_len, in_data_p in_data, unsigned out_len, out_data_p out_data ) { return( TrapSimpAccess( in_len, in_data, out_len, out_data ) ); }