Example #1
0
int main(int argc, const char * argv[]) 
{
    try {
        init_logger();
        parse_options(argc, argv);
        Workflow workflow(options);
        workflow.run();
    }
    catch (const std::exception & ex) {
        std::cerr << "TealTree failed with exception:" << std::endl;
        std::cerr << ex.what() << std::endl;
        std::cerr.flush();
        destroy_logger();
        exit(1);
    }
    destroy_logger();
    return 0;
}
/* Proper release of everything */
void quit()
{
	exit_time = 1;

	//nlClientReleaseSockets();
	nlClientRelease();
	
	destroy_list(peer_array, free);
	destroy_list(server_array, NULL);
	destroy_list(downloads, free);

	free_list(&peer_array);
	free_list(&server_array);
	free_list(&downloads);

	destroy_logger(&logger);
	destroy_logger(&chatlog);
	
	endwin();
	exit(0);
}
Example #3
0
/*
 * Unregister a Window as destination for logging message
 */
int LIBWDI_API wdi_unregister_logger(HWND hWnd)
{
	MUTEX_START;

	if (logger_dest == NULL) {
		MUTEX_RETURN(WDI_SUCCESS);
	}

	if (logger_dest != hWnd) {
		MUTEX_RETURN(WDI_ERROR_INVALID_PARAM);
	}

	destroy_logger();
	logger_dest = NULL;
	logger_msg = 0;

	MUTEX_RETURN(WDI_SUCCESS);
}
Example #4
0
/* entry point */
int main(int ac, char **av)
{
    int ret;

    memset(&ctx, 0, sizeof(ctx));

    /* instance handle of this module */
    {
        HMODULE module;

        module = GetModuleHandle(NULL);
        if(module == NULL) {
            error_message_le("GetModuleHandle() failed");
            return 1;
        }

        ctx.instance = (HINSTANCE)module;
    }

    /* initialize COM */
    {
        HRESULT hres;

        hres = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
        if(FAILED(hres)) {
            error_message_hr("CoInitializeEx() failed", hres);
            return 1;
        }

        hres = init_regexp();
        if(FAILED(hres)) {
            error_message_hr("init_regexp() failed", hres);
            return 1;
        }
    }

    /* create main message window */
    ctx.main_window = create_main_window();
    if(ctx.main_window == NULL) {
        error_message_le("create_main_window() failed");
        return 1;
    }

    /* logger */
    ret = create_logger();
    if(ret == 0) {
        error_message_le("create_logger() failed");
        return 1;
    }

    ctx.sprocs.hdr.api_ver = MP_OP_API_VERSION;
    ctx.sprocs.hdr.type = MP_OP_TYPE_SUPPORT;
    ctx.sprocs.log_printf = log_printf;
    ctx.sprocs.log_s_exp = log_print_s_exp;
    ctx.sprocs.log_lasterror = log_print_lasterror;
    ctx.sprocs.log_hresult = log_print_hresult;

    /* command line option */
    {
        LPWSTR *avw, file;
        int acw;

        avw = CommandLineToArgvW(GetCommandLineW(), &acw);
        if(avw != NULL && acw >= 2) {
            file = avw[1];
        } else {
            file = NULL;
        }

        /* load setting file */
        load_setting(file, TRUE);
    }

    /* start message */
    log_printf(LOG_LEVEL_NOTIFY, L"\nmouse-processor started\n");

    /* main message loop */
    ret = message_loop();

    /* uninitialize COM */
    CoUninitialize();

    /* end logger */
    destroy_logger();

    return ret;
}