Beispiel #1
0
/*
 * NotifyHandler - call back routine for notifications
 */
BOOL __export FAR PASCAL NotifyHandler( WORD id, DWORD data )
{
    notify      *ptr;

    if( id == NFY_TASKIN || id == NFY_TASKOUT ) {
        if( GetCurrentTask() == ourTask ) {
            if( id == NFY_TASKIN ) {
                UnPauseSampler();
            } else {
                PauseSampler();
            }
        }
        return( FALSE );
    }
    PauseSampler();

    ptr = getNotifyData( data );

    switch( id ) {
    case NFY_STARTDLL:
        _fmemcpy( &ptr->startdll, (LPVOID) data, sizeof( NFYSTARTDLL ) );
        MyModuleFindHandle( &ptr->me, ptr->startdll.hModule );
        HandleLibLoad( SAMP_CODE_LOAD, ptr->startdll.hModule );
        break;
    case NFY_STARTTASK:
        if( ourTask == NULL ) { // handle spawned tasks
            ourTask = GetCurrentTask();
            MyTaskFindHandle( &ptr->te, ptr->task );
            MyModuleFindHandle( &ptr->me, ptr->te.hModule );
            HandleLibLoad( SAMP_MAIN_LOAD, ptr->te.hModule );
            StartSampler();
        } else {
            MyTaskFindHandle( &ptr->te, ptr->task );
            MyModuleFindHandle( &ptr->me, ptr->te.hModule );
            HandleLibLoad( SAMP_CODE_LOAD, ptr->te.hModule );
        }
        break;
    case NFY_EXITTASK:
        if( GetCurrentTask() == ourTask ) { // handle spawned tasks
            QuitSampler( &TotalTime );
            SharedMemory->TaskEnded = TRUE;
        }
        break;
    }
    UnPauseSampler();
    return( FALSE );

} /* NotifyHandler */
Beispiel #2
0
/*
 * NotifyHandler - call back routine for notifications
 */
BOOL __export FAR PASCAL NotifyHandler( WORD id, DWORD data )
{
    BOOL        rc;
    LPSTR       src;
    notify      *ptr;

    ptr = getNotifyData( data );

    switch( id ) {
    case NFY_OUTSTR:
        src = (LPSTR) data;
        while( *src ) {
            if( outPos < MAX_STR-1 ) {
                outBuff[ outPos++ ] = *src;
            }
            src++;
        }
        break;
    case NFY_STARTDLL:
        memcpy( &ptr->startdll, (LPVOID) data, sizeof( NFYSTARTDLL ) );
        MyModuleFindHandle( &ptr->me, ptr->startdll.hModule );
        break;
    case NFY_DELMODULE:
        MyModuleFindHandle( &ptr->me, (HMODULE)data );
        break;
    case NFY_RIP:
        memcpy( &ptr->rip, (LPVOID) data, sizeof( NFYRIP ) );
        MyTaskFindHandle( &ptr->te, ptr->task );
        MyModuleFindHandle( &ptr->me, ptr->te.hModule );
        break;
    case NFY_STARTTASK:
        MyTaskFindHandle( &ptr->te, ptr->task );
        MyModuleFindHandle( &ptr->me, ptr->te.hModule );
        break;
    }
    PostMessage( MainWindow, WM_USER, id, (LPARAM)ptr );
    rc = 0;
    if( id == NFY_INCHAR ) {
        rc = 'i';
    }
    if( WDebug386 && !AlwaysRespondToDebugInChar ) {
        if( IsDebuggerExecuting != NULL && IsDebuggerExecuting() ) {
            rc = 0;
        }
    }
    return( rc );

} /* NotifyHandler */