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

Function DetourTransactionCommitEx

lib_fiber/cpp/src/detours/detours.cpp:1680–1947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1678}
1679
1680LONG WINAPI DetourTransactionCommitEx(_Out_opt_ PVOID **pppFailedPointer)
1681{
1682 if (pppFailedPointer != NULL) {
1683 // Used to get the last error.
1684 *pppFailedPointer = s_ppPendingError;
1685 }
1686 if (s_nPendingThreadId != (LONG)GetCurrentThreadId()) {
1687 return ERROR_INVALID_OPERATION;
1688 }
1689
1690 // If any of the pending operations failed, then we abort the whole transaction.
1691 if (s_nPendingError != NO_ERROR) {
1692 DETOUR_BREAK();
1693 DetourTransactionAbort();
1694 return s_nPendingError;
1695 }
1696
1697 // Common variables.
1698 DetourOperation *o;
1699 DetourThread *t;
1700 BOOL freed = FALSE;
1701
1702 // Insert or remove each of the detours.
1703 for (o = s_pPendingOperations; o != NULL; o = o->pNext) {
1704 if (o->fIsRemove) {
1705 CopyMemory(o->pbTarget,
1706 o->pTrampoline->rbRestore,
1707 o->pTrampoline->cbRestore);
1708#ifdef DETOURS_IA64
1709 *o->ppbPointer = (PBYTE)o->pTrampoline->ppldTarget;
1710#endif // DETOURS_IA64
1711
1712#ifdef DETOURS_X86
1713 *o->ppbPointer = o->pbTarget;
1714#endif // DETOURS_X86
1715
1716#ifdef DETOURS_X64
1717 *o->ppbPointer = o->pbTarget;
1718#endif // DETOURS_X64
1719
1720#ifdef DETOURS_ARM
1721 *o->ppbPointer = DETOURS_PBYTE_TO_PFUNC(o->pbTarget);
1722#endif // DETOURS_ARM
1723
1724#ifdef DETOURS_ARM64
1725 *o->ppbPointer = o->pbTarget;
1726#endif // DETOURS_ARM
1727 }
1728 else {
1729 DETOUR_TRACE(("detours: pbTramp =%p, pbRemain=%p, pbDetour=%p, cbRestore=%u\n",
1730 o->pTrampoline,
1731 o->pTrampoline->pbRemain,
1732 o->pTrampoline->pbDetour,
1733 o->pTrampoline->cbRestore));
1734
1735 DETOUR_TRACE(("detours: pbTarget=%p: "
1736 "%02x %02x %02x %02x "
1737 "%02x %02x %02x %02x "

Callers 1

DetourTransactionCommitFunction · 0.85

Calls 12

DetourTransactionAbortFunction · 0.85
detour_gen_jmp_indirectFunction · 0.85
detour_gen_jmp_immediateFunction · 0.85
detour_gen_brkFunction · 0.85
detour_align_from_targetFunction · 0.85
detour_free_trampolineFunction · 0.85
SetBrlMethod · 0.80
GetMovlGpMethod · 0.80
GetBrlTargetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…