Skip to content

Commit

Permalink
dpUnpatchAll()
Browse files Browse the repository at this point in the history
  • Loading branch information
i-saint committed Sep 1, 2013
1 parent de042ee commit a3e27ca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DynamicPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ dpAPI bool dpPatchByAddress(void *hook_addr)
dpAPI bool dpUnpatchByAddress(void *target_or_hook_addr)
{
return dpGetCurrentContext()->unpatchByAddress(target_or_hook_addr);
};
}

dpAPI void dpUnpatchAll()
{
return dpGetCurrentContext()->unpatchAll();
}

dpAPI void* dpGetUnpatched(void *target_or_hook_addr)
{
Expand Down
2 changes: 2 additions & 0 deletions DynamicPatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ dpAPI bool dpPatchAddressToName(const char *target_name, void *hook_addr);
dpAPI bool dpPatchAddressToAddress(void *target, void *hook_addr);
dpAPI bool dpPatchByAddress(void *hook_addr); // patches the host symbol that have same name of hook
dpAPI bool dpUnpatchByAddress(void *target_or_hook_addr);
dpAPI void dpUnpatchAll();
dpAPI void* dpGetUnpatched(void *target_or_hook_addr);
dpAPI void dpAddForceHostSymbolPattern(const char *pattern);

Expand Down Expand Up @@ -190,6 +191,7 @@ dpAPI const char* dpGetVCVarsPath();
#define dpPatchAddressToAddress(...)
#define dpPatchByAddress(...)
#define dpUnpatchByAddress(...)
#define dpUnpatchAll(...)
#define dpGetUnpatched(...)
#define dpAddForceHostSymbolPattern(...)

Expand Down
5 changes: 5 additions & 0 deletions dpContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ bool dpContext::unpatchByAddress(void *target_or_hook_addr)
return m_patcher->unpatchByAddress(target_or_hook_addr);
}

void dpContext::unpatchAll()
{
return m_patcher->unpatchAll();
}

void* dpContext::getUnpatched(void *target)
{
if(dpPatchData *pd = m_patcher->findPatchByAddress(target)) {
Expand Down
1 change: 1 addition & 0 deletions dpInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ class dpContext
bool patchAddressToAddress(void *target, void *hook);
bool patchByAddress(void *hook);
bool unpatchByAddress(void *target_or_hook_addr);
void unpatchAll();
void* getUnpatched(void *target_or_hook_addr);
void addForceHostSymbolPattern(const char *pattern);

Expand Down

0 comments on commit a3e27ca

Please sign in to comment.