Skip to content

Commit

Permalink
Really check for Steam DRM now
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePLMonster committed Jul 6, 2018
1 parent 1077876 commit 809a1d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,20 @@ void LoadEverything()
static LONG RestoredOnce = 0;
void LoadPluginsAndRestoreIAT(uintptr_t retaddr)
{
if ( _InterlockedCompareExchange( &RestoredOnce, 1, 0 ) != 0 ) return;
bool calledFromBind = false;

//steam drm check
GetSections([&](PIMAGE_SECTION_HEADER pSection, size_t dwLoadOffset, DWORD dwPhysSize) {
auto dwStart = static_cast<uintptr_t>(dwLoadOffset + pSection->VirtualAddress);
auto dwEnd = dwStart + dwPhysSize;
if (retaddr >= dwStart && retaddr <= dwEnd)
return;
calledFromBind = true;
}, ".bind");

if ( calledFromBind ) return;

if ( _InterlockedCompareExchange( &RestoredOnce, 1, 0 ) != 0 ) return;

LoadEverything();

for (size_t i = 0; i < Kernel32ExportsNamesCount; i++)
Expand Down

0 comments on commit 809a1d1

Please sign in to comment.