| 368 | } |
| 369 | |
| 370 | enum ele7en_status inlineHook(uint32_t target_addr) { |
| 371 | int i; |
| 372 | struct inlineHookItem *item; |
| 373 | |
| 374 | item = NULL; |
| 375 | for (i = 0; i < info.size; ++i) { |
| 376 | if (info.item[i].target_addr == target_addr) { |
| 377 | item = &info.item[i]; |
| 378 | break; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | if (item == NULL) { |
| 383 | return ELE7EN_ERROR_NOT_REGISTERED; |
| 384 | } |
| 385 | |
| 386 | if (item->status == REGISTERED) { |
| 387 | pid_t pid; |
| 388 | |
| 389 | pid = freeze(item, ACTION_ENABLE); |
| 390 | |
| 391 | doInlineHook(item); |
| 392 | |
| 393 | unFreeze(pid); |
| 394 | |
| 395 | return ELE7EN_OK; |
| 396 | } else if (item->status == HOOKED) { |
| 397 | return ELE7EN_ERROR_ALREADY_HOOKED; |
| 398 | } else { |
| 399 | return ELE7EN_ERROR_UNKNOWN; |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | void inlineHookAll() { |
| 404 | pid_t pid; |
no test coverage detected