Пример #1
0
NTSTATUS DllInitialize(__in PUNICODE_STRING RegistryPath)
{
	int ret;

	UNREFERENCED_PARAMETER(RegistryPath);

	ret = csf_init();
	if (ret) {
		TRACE_ERR("csf_init", ret);
		return STATUS_UNSUCCESSFUL;
	}

	TRACE_MSG(TRACE_LEVEL_INFO, TRACE_FLAG_DEFAULT, "DLL initialized\n");
	return STATUS_SUCCESS;
}
Пример #2
0
int 
main(int argc, char **argv)
{
	int o;
	
	printf("\nCSF[%d] starting...\n", (int)getpid());

	realpath(argv[0], exec_path);
	if (set_working_dir(exec_path) != 0) {
		PRINT("Can not set the working directory.");
		return (2);
	}
	set_conf_file(CONF_FILE);

	while(-1 != (o = getopt(argc, argv, "f:hv"))) {
		switch(o) {
		case 'f':
			set_conf_file(optarg);
			break;

		case 'v': output_config(); return 0;
		case 'h': show_help(); return 0;
		default:
			break;
		}

	}

    /* init each modules */
	if (csf_init() < 0) {
        PRINT("CSF init failed. Exited.");
        return (2);
    }
	set_signals();
	save_pid(argv[0]);	

    /* starts the server */

    server_init(&main_conf);

    WLOG_ERR("Fatal Error, SERVER DOWN!");
	logger_deinit();
    PRINT("Fatal Error, SERVER DOWN!");
    
	return (2);
}