MCPcopy Create free account
hub / github.com/WallBreaker2/op / Bind

Function Bind

libop/hook/InputHookClient.cpp:158–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156namespace op::hook::input_hook_client {
157
158long Bind(HWND hwnd, int mode) {
159 if (!::IsWindow(hwnd))
160 return 0;
161
162 std::lock_guard<std::mutex> lock(g_mutex);
163 auto &refs = g_bind_refs[hwnd];
164 // 鼠标和键盘 dx 会共用同一个目标进程 Hook,宿主侧只做一次注入。
165 if (refs > 0) {
166 ++refs;
167 return 1;
168 }
169
170 const long ret = call_set_input_hook(hwnd, mode);
171 if (ret == 1) {
172 refs = 1;
173 } else {
174 g_bind_refs.erase(hwnd);
175 }
176 return ret;
177}
178
179long UnBind(HWND hwnd) {
180 if (!hwnd)

Callers 2

BindMethod · 0.85
BindMethod · 0.85

Calls 2

call_set_input_hookFunction · 0.85
eraseMethod · 0.80

Tested by

no test coverage detected