Exemple #1
0
CapturingTestLogger::CapturingTestLogger(int level) : BaseTestLogger()
{
  take_over();
  setPrinting(PrintingTestLogger::DEFAULT.isPrinting());
  setLoggingLevel(level);
  pthread_mutex_init(&_logger_lock, NULL);
};
Exemple #2
0
int
#if INIT_BEFORE_LIBC
_init(int argc, char *arg0, ...)
{
  char **argv = &arg0, **envp = &argv[argc + 1];
#else
_init ()
{
#endif
    int init;
    const char *name;
#if VERBOSE_INIT_FINI
    fprintf (stderr, "preload initialized\n");
#endif /* VERBOSE_INIT_FINI */
#ifdef VMX86_SERVER
    vmk_init_lib();
#endif

#if INIT_BEFORE_LIBC
  {
      int i;
      for (i=0; i<argc; i++)
          fprintf(stderr, "\targ %d = %s\n", i, argv[i]);
      fprintf(stderr, "env 0 is %s\n", envp[0]);
      fprintf(stderr, "env 1 is %s\n", envp[1]);
      fprintf(stderr, "env 2 is %s\n", envp[2]);
  }
#endif

#if START_DYNAMO
    pf("ready to start dynamo\n");
    name = get_application_short_name();
    pf("preload _init: running %s\n", name);
    if (!take_over(name))
        return 0;
    /* FIXME i#287/PR 546544: now load DYNAMORIO_AUTOINJECT DR .so 
     * and only LD_PRELOAD the preload lib itself
     */
    init = dynamorio_app_init();
    pf("dynamorio_app_init() returned %d\n", init);
    dynamorio_app_take_over();
    pf("dynamo started\n");
#endif /* START_DYNAMO */

    return 0;
}

int
_fini ()
{
#if VERBOSE_INIT_FINI
    fprintf (stderr, "preload finalized\n");
#endif /* VERBOSE_INIT_FINI */

    /* since we're using dynamorio_app_take_over we do not need to call dr_app_stop
     * or dynamorio_app_exit
     */

    return 0;
}
Exemple #3
0
int WINAPI wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int )
{
	try {
		INITCOMMONCONTROLSEX icc_ex = {
			sizeof( INITCOMMONCONTROLSEX ),
			ICC_WIN95_CLASSES
		};
		InitCommonControlsEx( &icc_ex );

		std::locale::global( std::locale( "ja-JP" ) );
		std::setlocale( LC_ALL, "ja-JP" );

		take_over();

		STARTUPINFOW si;
		GetStartupInfoW( &si );

		mmaccel::key_config::window().show( si.dwX, si.dwY );
	
		auto const args = winapi::get_command_line_args();
		if( !args.empty() && args[0] == L"--mmd" ) {
			write_key_config_window( si.hStdOutput, mmaccel::key_config::window().handle() );
		}

		MSG msg;
		for( ;; ) {
			auto const result = GetMessageW( &msg, nullptr, 0, 0 );
			if( result == 0 || result == -1 ) {
				break;
			}
			if( IsDialogMessageW( mmaccel::key_config::window().handle(), &msg ) ) {
				continue;
			}

			DispatchMessageW( &msg );
		}
	}
	catch( std::exception const& e ) {
		STARTUPINFOW si;
		GetStartupInfoW( &si );

		write_key_config_window( si.hStdOutput, nullptr );
		winapi::message_box( u8"MMAccel", e.what(), MB_OK | MB_ICONERROR );
	}

	return 0;
}
PrintingTestLogger::PrintingTestLogger() : _last_logger(NULL)
{
  take_over();
  LOG_DEBUG("Logger creation");
}
Exemple #5
0
PrintingTestLogger::PrintingTestLogger() : BaseTestLogger()
{
  take_over();
}