diff -r e27ea26b2685 -r d00a853ec547 extensions/sdktools/vglobals.cpp --- a/extensions/sdktools/vglobals.cpp Thu Dec 06 14:08:22 2007 +0000 +++ b/extensions/sdktools/vglobals.cpp Fri Dec 07 00:17:24 2007 +0000 @@ -83,18 +83,28 @@ } #endif +bool vcmp(const void *_addr1, const void *_addr2, size_t len) +{ + unsigned char *addr1 = (unsigned char *)_addr1; + unsigned char *addr2 = (unsigned char *)_addr2; + + for (size_t i=0; iFindPattern(engine, ISERVER_WIN_SIG, ISERVER_WIN_SIG_LEN)) - { - return; - } - int offset; void *vfunc = NULL; @@ -110,6 +120,12 @@ return; } + /* Check if we're on the expected function */ + if (!vcmp(vfunc, ISERVER_WIN_SIG, ISERVER_WIN_SIG_LEN)) + { + return; + } + /* Finally we have the interface we were looking for */ iserver = *reinterpret_cast(reinterpret_cast(vfunc) + offset); #else @@ -123,6 +139,11 @@ void **vtable = *reinterpret_cast(enginePatch->GetThisPtr() + info.thisptroffs + info.vtbloffs); vfunc = vtable[info.vtblindex]; } + /* Check if we're on the expected function */ + if (!vcmp(vfunc, ISERVER_WIN_SIG, ISERVER_WIN_SIG_LEN)) + { + return; + } iserver = *reinterpret_cast(reinterpret_cast(vfunc) + offset); #endif @@ -136,6 +157,6 @@ return; } - iserver = *reinterpret_cast(addr); + iserver = reinterpret_cast(addr); } #endif