Example #1
0
/*
 * init_mail()
 *
 * Defines the mail{} conf section.
 *
 * inputs: none
 * output: none
 */
void
init_mail(void)
{
  struct ConfSection *s = add_conf_section("mail", 2);

  hreset = install_hook(reset_conf, reset_mail);
  hverify = install_hook(verify_conf, verify_mail);

  add_conf_field(s, "command", CT_STRING, NULL, &Mail.command);
  add_conf_field(s, "from_address", CT_STRING, NULL, &Mail.from_address);
  add_conf_field(s, "expire_time", CT_TIME, NULL, &Mail.expire_time);
}
Example #2
0
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch(ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			//to speed things up, disable recieving of messages in subsequent loaded copies
			DisableThreadLibraryCalls( hModule );
			if(!ref_count)
				install_hook(hModule);
			ref_count++;
			break;
		case DLL_THREAD_ATTACH:
			// A thread is created. Do any required initialization on a per thread basis
			break;
		case DLL_THREAD_DETACH:
			// Thread exits with cleanup
			break;
		case DLL_PROCESS_DETACH:
			// The DLL unmapped from process's address space. Do necessary cleanup
			ref_count--;
			if(!ref_count)
				remove_hook();
		break;
	}
    return TRUE;
}
Example #3
0
/*
 * init_netio
 *
 * This is a needed exported function which will be called to initialise
 * the network loop code.
 */
void
init_netio(void)
{
  FD_ZERO(&select_readfds);
  FD_ZERO(&select_writefds);

  hookptr = install_hook(fdlimit_cb, changing_fdlimit);
}
Example #4
0
File: hook.cpp Project: Carye/gdipp
bool gdimm_hook::install_hook(LPCWSTR lib_name, LPCSTR proc_name, void *hook_proc)
{
	// the target library module must have been loaded in this process before hooking
	const HMODULE h_lib = GetModuleHandleW(lib_name);
	if (h_lib == NULL)
		return false;

	return install_hook(h_lib, proc_name, hook_proc);
}
Example #5
0
int main() 
{
	hooked("ok?");
	hook_buffer<> * hook = install_hook((char*)hooked,(const char*)installed);
	hooked_entry = (hooked_entry_type) (hook->begin());
	hooked("ok?");

	destruct_hook(hook);
	hooked("ok?");
}
Example #6
0
/*
 * init_netio
 *
 * This is a needed exported function which will be called to initialise
 * the network loop code.
 */
void
init_netio(void)
{
  int fd;

  pollfds = MyMalloc(sizeof(struct pollfd) * hard_fdlimit);

  for (fd = 0; fd < hard_fdlimit; fd++)
    pollfds[fd].fd = -1;

  hookptr = install_hook(fdlimit_cb, changing_fdlimit);
}
Example #7
0
_STATIC int __init socket_notify_init(void)
{
	int err;

	if ((err = install_hook("IPv4", &inet_family_ops, &hooked_inet_family_ops)))
		return err;
	if ((err = register_jprobe(&inet_sock_destruct_jprobe)) < 0) {
		printk(KERN_ERR "error registering inet_sock_destruct_jprobe\n");
		sock_unregister(hooked_inet_family_ops.family);
		reinstall_family("IPv4", &inet_family_ops);		
		return err;
	}
#if defined(CONFIG_IPV6)
	if ((err = install_hook("IPv6", &inet6_family_ops, &hooked_inet6_family_ops))) {
		unregister_jprobe(&inet_sock_destruct_jprobe);
		sock_unregister(hooked_inet_family_ops.family);
		reinstall_family("IPv4", &inet_family_ops);
		return err;
	}
#endif
	return 0;
}
Example #8
0
void setup(bench_problem *p)
{
     double tim;

     setup_sigfpe_handler();

     if (amnesia) {
	  FFTW(forget_wisdom)();
	  havewisdom = 0;
     }

     /* Regression test: check that fftw_malloc exists and links
      * properly */
     {
          void *ptr = FFTW(malloc(42));
          //BENCH_ASSERT(FFTW(alignment_of)(ptr) == 0);
          FFTW(free(ptr));
     }

     rdwisdom();
     install_hook();

#ifdef HAVE_SMP
     if (verbose > 1 && nthreads > 1) printf("NTHREADS = %d\n", nthreads);
#endif

     timer_start(USER_TIMER);
     the_plan = mkplan(p, preserve_input_flags(p) | the_flags);
     tim = timer_stop(USER_TIMER);
     if (verbose > 1) printf("planner time: %g s\n", tim);

     BENCH_ASSERT(the_plan);

     {
	  double add, mul, nfma, cost, pcost;
	  FFTW(flops)(the_plan, &add, &mul, &nfma);
	  cost = FFTW(estimate_cost)(the_plan);
	  pcost = FFTW(cost)(the_plan);
	  if (verbose > 1) {
	       FFTW(print_plan)(the_plan);
	       printf("\n");
	       printf("flops: %0.0f add, %0.0f mul, %0.0f fma\n",
		      add, mul, nfma);
	       printf("estimated cost: %f, pcost = %f\n", cost, pcost);
	  }
     }
}
Example #9
0
File: hook.cpp Project: Carye/gdipp
bool gdimm_hook::install_delayed_hook(LPCWSTR lib_name, HMODULE h_lib)
{
	bool b_ret = true;

	lib_hook_map_w::const_iterator lib_iter = _delayed_hooks_w.find(lib_name);
	if (lib_iter != _delayed_hooks_w.end())
	{
		for (hook_proc_map::const_iterator proc_iter = lib_iter->second->begin(); proc_iter != lib_iter->second->end(); proc_iter++)
		{
			b_ret &= install_hook(h_lib, proc_iter->first, proc_iter->second);
			if (!b_ret)
				break;
		}
	}

	return b_ret;
}
Example #10
0
/*
 * Initialize Winsock, create a window handle.
 */
void
init_netio(void)
{
  WNDCLASS wndclass;
  WSADATA wsa;
  HMODULE lib;

  /* Initialize Winsock networking */
  if (WSAStartup(0x101, &wsa) != 0)
  {
    MessageBox(NULL, "Cannot initialize Winsock -- terminating ircd",
      NULL, MB_OK | MB_ICONERROR);
    exit(1);
  }

  /* First, we need a class for our window that has message handler
   * set to hybrid_wndproc() */
  memset(&wndclass, 0, sizeof(wndclass));

  wndclass.lpfnWndProc = hybrid_wndproc;
  wndclass.hInstance = GetModuleHandle(NULL);
  wndclass.lpszClassName = PACKAGE_NAME;

  RegisterClass(&wndclass);

  /* Now, initialize the window */
  wndhandle = CreateWindow(PACKAGE_NAME, NULL, 0,
    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
    NULL, NULL, wndclass.hInstance, NULL);

  if (!wndhandle)
  {
    MessageBox(NULL, "Cannot allocate window handle -- terminating ircd",
      NULL, MB_OK | MB_ICONERROR);
    exit(1);
  }

  /* Set up a timer which will periodically post a message to our queue.
   * This way, ircd won't wait infinitely for a network event */
  SetTimer(wndhandle, 0, SELECT_DELAY, NULL);

  if ((lib = LoadLibrary("IPHLPAPI.DLL")) != NULL)
    _GetNetworkParams = GetProcAddress(lib, "GetNetworkParams");

  setupfd_hook = install_hook(setup_socket_cb, setup_winsock_fd);
}
Example #11
0
void
_modinit(void)
{
  if ((info_cb = find_callback("doing_info")))
    prev_hook = install_hook(info_cb, show_info);
}
Example #12
0
static struct ServiceMessage jupe_msgtab = {
  jupe_subs, "JUPE", 0, 2, 2, 0, OPER_FLAG, OS_JUPE_HELP_SHORT,
  OS_JUPE_HELP_LONG, NULL
};

INIT_MODULE(operserv, "$Revision$")
{
  operserv = make_service("OperServ");
  clear_serv_tree_parse(&operserv->msg_tree);
  dlinkAdd(operserv, &operserv->node, &services_list);
  hash_add_service(operserv);
  introduce_client(operserv->name, operserv->name, TRUE);

  load_language(operserv->languages, "operserv.en");

  os_newuser_hook = install_hook(on_newuser_cb, os_on_newuser);
  os_burst_done_hook = install_hook(on_burst_done_cb, os_on_burst_done);
  os_quit_hook = install_hook(on_quit_cb, os_on_quit);

  mod_add_servcmd(&operserv->msg_tree, &help_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &mod_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &raw_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &admin_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &akill_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &set_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &raw_msgtab);
  mod_add_servcmd(&operserv->msg_tree, &jupe_msgtab);

  eventAdd("Expire akills", expire_akills, NULL, 60);
  eventAdd("Check akills", check_akills, NULL, OPERSERV_AKILL_CHECK_TIME);
void
_modinit(void)
{
  if ((stats_cb = find_callback("doing_stats")))
    prev_hook = install_hook(stats_cb, show_stats);
}
Example #14
0
File: hook.cpp Project: Carye/gdipp
bool gdimm_hook::hook()
{
	bool b_ret;
	
	b_ret = install_hook(L"gdi32.dll", "ExtTextOutW", ExtTextOutW_hook);
	if (b_ret)
	{
		// hook other GDI APIs only if ExtTextOut is successfully hooked

		// reserve for future use
		// b_ret &= install_hook(L"user32.dll", "DrawTextExA", DrawTextExA_hook);
		// b_ret &= install_hook(L"user32.dll", "DrawTextExW", DrawTextExW_hook);

		b_ret &= install_hook(L"gdi32.dll", "GetTextExtentPoint32A", GetTextExtentPoint32A_hook);
		b_ret &= install_hook(L"gdi32.dll", "GetTextExtentPoint32W", GetTextExtentPoint32W_hook);
		b_ret &= install_hook(L"gdi32.dll", "GetTextExtentPointI", GetTextExtentPointI_hook);

		b_ret &= install_hook(L"gdi32.dll", "GetTextExtentExPointA", GetTextExtentExPointA_hook);
		b_ret &= install_hook(L"gdi32.dll", "GetTextExtentExPointW", GetTextExtentExPointW_hook);
		b_ret &= install_hook(L"gdi32.dll", "GetTextExtentExPointI", GetTextExtentExPointI_hook);

		b_ret &= install_hook(L"gdi32.dll", "GetGlyphOutlineA", GetGlyphOutlineA_hook);
		b_ret &= install_hook(L"gdi32.dll", "GetGlyphOutlineW", GetGlyphOutlineW_hook);
 
		b_ret &= install_hook(L"gdi32.dll", "AbortPath", AbortPath_hook);
		b_ret &= install_hook(L"gdi32.dll", "BeginPath", BeginPath_hook);
		b_ret &= install_hook(L"gdi32.dll", "EndPath", EndPath_hook);

		install_hook(L"usp10.dll", "ScriptPlace", ScriptPlace_hook);

		// register hooks whose libraries are dynamically loaded by LoadLibrary
		register_delayed_hook("d2d1.dll", L"d2d1.dll", "D2D1CreateFactory", D2D1CreateFactory_hook);

		if (!_delayed_hook_registry.empty())
		{
			install_hook(L"kernel32.dll", "LoadLibraryA", LoadLibraryA_hook);
			install_hook(L"kernel32.dll", "LoadLibraryExA", LoadLibraryExA_hook);
			install_hook(L"kernel32.dll", "LoadLibraryW", LoadLibraryW_hook);
			install_hook(L"kernel32.dll", "LoadLibraryExW", LoadLibraryExW_hook);
		}
	}

#if defined GDIPP_INJECT_SANDBOX && !defined _M_X64
	// currently not support inject at EIP for 64-bit processes
	b_ret &= install_hook(L"advapi32.dll", "CreateProcessAsUserW", CreateProcessAsUserW_hook);
#endif // GDIPP_INJECT_SANDBOX && !_M_X64

	return b_ret;
}
void
_modinit(void)
{
  if ((admin_cb = find_callback("doing_admin")))
    prev_hook = install_hook(admin_cb, show_admin);
}
Example #16
0
void
_modinit(void)
{
  if ((links_cb = find_callback("doing_links")))
    prev_hook = install_hook(links_cb, show_links);
}