MCPcopy Create free account
hub / github.com/acl-dev/acl / winapi_hook_once

Function winapi_hook_once

lib_fiber/cpp/src/winapi_hook.cpp:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40static bool __hook_ok = false;
41
42static void winapi_hook_once() {
43 //DetourIsHelperProcess();
44 DetourRestoreAfterWith();
45 DetourTransactionBegin();
46 DetourUpdateThread(GetCurrentThread());
47
48 HOOK_API(__socket, &acl_fiber_socket, set_socket_fn);
49 HOOK_API(__close, acl_fiber_close, set_close_fn);
50 HOOK_API(__listen, acl_fiber_listen, set_listen_fn);
51 HOOK_API(__accept, acl_fiber_accept, set_accept_fn);
52 HOOK_API(__connect, acl_fiber_connect, set_connect_fn);
53 HOOK_API(__recv, acl_fiber_recv, set_recv_fn);
54 HOOK_API(__recvfrom, acl_fiber_recvfrom, set_recvfrom_fn);
55 HOOK_API(__send, acl_fiber_send, set_send_fn);
56 HOOK_API(__sendto, acl_fiber_sendto, set_sendto_fn);
57 HOOK_API(__poll, acl_fiber_poll, set_poll_fn);
58 HOOK_API(__select, acl_fiber_select, set_select_fn);
59 HOOK_API(__getaddrinfo, acl_fiber_getaddrinfo, set_getaddrinfo_fn);
60 HOOK_API(__freeaddrinfo, acl_fiber_freeaddrinfo, set_freeaddrinfo_fn);
61 HOOK_API(__gethostbyname, acl_fiber_gethostbyname, set_gethostbyname_fn);
62
63#ifdef SYS_WSA_API
64 HOOK_API(__WSARecv, acl_fiber_WSARecv, set_WSARecv_fn);
65 HOOK_API(__WSAAccept, acl_fiber_WSAAccept, set_WSAAccept_fn);
66#endif
67
68 DetourTransactionCommit();
69 __hook_ok = true;
70}
71
72static pthread_once_t __once = PTHREAD_ONCE_INIT;
73

Callers

nothing calls this directly

Calls 4

DetourRestoreAfterWithFunction · 0.85
DetourTransactionBeginFunction · 0.85
DetourUpdateThreadFunction · 0.85
DetourTransactionCommitFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…