Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RenardDev committed Apr 1, 2024
1 parent e8b6a88 commit 637dc96
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Detours.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,29 @@ namespace Detours {
// UnLinkModule
// ----------------------------------------------------------------

bool UnLinkModule(PLDR_DATA_TABLE_ENTRY pDTE, PLINK_DATA pLinkData) {
if (!pDTE || !pLinkData) {
return false;
}

memset(pLinkData, 0, sizeof(LINK_DATA));

pLinkData->m_pDTE = pDTE;
pLinkData->m_pSavedInLoadOrderLinks = pDTE->InLoadOrderLinks.Blink->Flink;
pLinkData->m_pSavedInInitializationOrderLinks = pDTE->InInitializationOrderLinks.Blink->Flink;
pLinkData->m_pSavedInMemoryOrderLinks = pDTE->InMemoryOrderLinks.Blink->Flink;
pLinkData->m_pSavedHashLinks = pDTE->HashLinks.Blink->Flink;
pLinkData->m_pSavedNodeModuleLink = pDTE->NodeModuleLink.Blink->Flink;

UnLinkEntry(&pDTE->InLoadOrderLinks);
UnLinkEntry(&pDTE->InInitializationOrderLinks);
UnLinkEntry(&pDTE->InMemoryOrderLinks);
UnLinkEntry(&pDTE->HashLinks);
UnLinkEntry(&pDTE->NodeModuleLink);

return true;
}

bool UnLinkModule(void* pBaseAddress, PLINK_DATA pLinkData) {
if (!pBaseAddress || !pLinkData) {
return false;
Expand Down
1 change: 1 addition & 0 deletions Detours.h
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,7 @@ namespace Detours {
// UnLinkModule
// ----------------------------------------------------------------

bool UnLinkModule(PLDR_DATA_TABLE_ENTRY pDTE, PLINK_DATA pLinkData);
bool UnLinkModule(void* pBaseAddress, PLINK_DATA pLinkData);
bool UnLinkModule(HMODULE hModule, PLINK_DATA pLinkData);
bool UnLinkModuleA(const char* szModuleName, PLINK_DATA pLinkData);
Expand Down

0 comments on commit 637dc96

Please sign in to comment.