Exemplo n.º 1
0
bool DarunGrim::DiffDatabaseFiles(const char *src_storage_filename, DWORD source_address, const char *target_storage_filename, DWORD target_address, const char *output_storage_filename)
{
	Logger.Log(10, "%s: (output storage: %s)\n", __FUNCTION__, output_storage_filename);

	Logger.Log(10, "	source_address: %x\n", source_address);
	Logger.Log(10, "	target_address: %x\n", target_address);

	pDiffMachine->SetSource((char *)src_storage_filename, 1, source_address);
	pDiffMachine->SetTarget((char *)target_storage_filename, 1, target_address);

	pDiffMachine->SetLoadIDAController(true);
	pDiffMachine->Load((char *)output_storage_filename);
	pSourceController = pDiffMachine->GetSourceController();
	pTargetController = pDiffMachine->GetTargetController();

	Logger.Log(10, "Analyze\n");
	pDiffMachine->Analyze();

	if (pStorageDB)
		delete pStorageDB;

	Logger.Log(10, "Save\n");
	pStorageDB = new DBWrapper((char *)output_storage_filename);
	SetDatabase(pStorageDB);

	pDiffMachine->Save(*pStorageDB);

	return TRUE;
}
Exemplo n.º 2
0
CCarta::CCarta()
{
	// Inicializacion de variables
	m_pdbTableInfo = &CartaTableInfo;
	m_InfStatus = INFS_NONE;
	SetDatabase(&Correspodb);
}
Exemplo n.º 3
0
BEGIN_NCBI_SCOPE


CEInfo_Request::CEInfo_Request(const string& db,
                               CRef<CEUtils_ConnContext>& ctx)
    : CEUtils_Request(ctx, "einfo.fcgi")
{
    SetDatabase(db);
}
Exemplo n.º 4
0
__fastcall TIBEventAlerter::~TIBEventAlerter(void)
{
  UnRegisterEvents();
  SetDatabase(NULL);
  ((TStringList*)FEvents)->OnChange = NULL;
  delete FEvents;
  DeleteCriticalSection( &CS);
  if( LibHandle >= 32 )
    FreeLibrary((HINSTANCE)LibHandle);
}
Exemplo n.º 5
0
BEGIN_NCBI_SCOPE


CESearch_Request::CESearch_Request(const string& db,
                                   CRef<CEUtils_ConnContext>& ctx)
    : CEUtils_Request(ctx, "esearch.fcgi"),
      m_UseHistory(true),
      m_RelDate(0),
      m_RetStart(0),
      m_RetMax(0),
      m_RetType(eRetType_none),
      m_Sort(eSort_none)
{
    SetDatabase(db);
}
Exemplo n.º 6
0
bool DarunGrim::AcceptIDAClientsFromSocket( const char *storage_filename )
{
	Logger.Log(10, "%s: entry\n", __FUNCTION__ );

	if( storage_filename )
	{
		if( pStorageDB )
			delete pStorageDB;

		pStorageDB = new DBWrapper( (char *) storage_filename );
	}

	if( pStorageDB )
	{
		SetDatabase( pStorageDB );
	}
	StartIDAListener(DARUNGRIM_PORT);

	pSourceController=new IDAController( pStorageDB );
	pTargetController=new IDAController( pStorageDB );

	//Create a thread that will call ConnectToDarunGrim one by one
	DWORD dwThreadId;
	CreateThread( NULL, 0, ConnectToDarunGrimThread, ( PVOID )this, 0, &dwThreadId );
	AcceptIDAClient( pSourceController, pDiffMachine? FALSE:pStorageDB?TRUE:FALSE );
	SetLoadedSourceFile( TRUE );

	CreateThread( NULL, 0, ConnectToDarunGrimThread, ( PVOID )this, 0, &dwThreadId );
	AcceptIDAClient( pTargetController, pDiffMachine? FALSE:pStorageDB?TRUE:FALSE );

	if( !pDiffMachine )
	{
		Analyze();
	}

	CreateIDACommandProcessorThread();
	StopIDAListener();

	return TRUE;
}
Exemplo n.º 7
0
void
CloseDatabaseRPC::operator()(const std::string &db)
{
    SetDatabase(db);
    Execute();
}
Exemplo n.º 8
0
void 
CreateDatabase( struct Connection* conn ) {
    for ( int i=0; i<MAX_ROWS; i++ ) {
        struct Address addr = { .id = i, .set = 0 };
        conn->db->rows[ i ] = addr;
    }
}

void
SetDatabase( struct Connection* conn, int id, const char* name, const char* email ) {
    struct Address* addr = &conn->db->rows[ id ];
    if ( addr->set ) {
        Die( "Already set, delete it first" );
    }

    addr->set = 1;

    char* res = strncpy( addr->name, name, MAX_DATA );

    if ( !res ) {
        Die( "Name copy failed." );
    }

    res = strncpy( addr->email, email, MAX_DATA );
    if ( !res ) {
        Die( "Email copy failed." );
    }
}

void 
GetDatabase( struct Connection* conn, int id ) {
    struct Address* addr = &conn->db->rows[ id ];

    if ( addr->set ) {
        PrintAddress( addr );
    } else {
        Die( "ID is not set." );
    }
}

void
DeleteDatabase( struct Connection* conn, int id ) {
    struct Address addr = { .id = id, .set = 0 };
    conn->db->rows[ id ] = addr;
}

void
ListDatabase( struct Connection* conn ) {
    struct Database* db = conn->db;

    for ( int i=0; i<MAX_ROWS; i++ ) {
        struct Address* cur = &db->rows[ i ];

        if ( cur->set ) {
            PrintAddress( cur );
        }
    }
}

int
main( int argc, char* argv[] ) {
    if ( argc < 3 ) {
        Die( "USAGE: ex17 <dbfile> <action> [action params]" );
    }

    char* filename = argv[ 1 ];
    char action = argv[ 2 ][ 0 ];
    struct Connection* conn = OpenDatabase( filename, action );
    int id = 0;

    if ( argc > 3 ) {
        id = atoi( argv[ 3 ] );
    }
    if ( id>= MAX_ROWS ) {
        Die( "There is not that many records." );
    }

    if ( action == 'c' ) {
        CreateDatabase( conn );
        WriteDatabase( conn );
    } else if ( action == 'g' ) {
        if ( argc != 4 ) {
            Die( "Need an id to get" );
        } else {
            GetDatabase( conn, id );
        }
    } else if ( action == 's' ) {
        if ( argc != 6 ) {
            Die( "Need id, name, email to set" );
        } else {
            SetDatabase( conn, id, argv[ 4 ], argv[ 5 ] );
            WriteDatabase( conn );
        }
    } else if ( action == 'd' ) {
        if ( argc != 4 ) {
            Die( "Need id to delete" );
        } else {
            DeleteDatabase( conn, id );
            WriteDatabase( conn );
        }
    } else if ( action == 'l' ) {
        ListDatabase( conn );
    } else {
        Die( "Invalid action, only: c=create, g=get, d=delete, l=list" );
    }
    CloseDatabase( conn );
    return 0;
}
Exemplo n.º 9
0
MockImapSession::MockImapSession(const MojRefCountedPtr<MockImapClient>& client, MockDatabase& database)
: ImapSession(client.get())
{
	Init();
	SetDatabase(database);
}
Exemplo n.º 10
0
MockImapSession::MockImapSession(const MojRefCountedPtr<MockImapClient>& client)
: ImapSession(client.get())
{
	Init();
	SetDatabase(m_defaultMockDatabase);
}
Exemplo n.º 11
0
TableName::TableName(const char *n, const char *d) { SetName(n); SetDatabase(d); }