SCFUNC PVOID scGetModuleBase(const char *moduleName) { PPEB pPeb; PLIST_ENTRY head, entry; PLDR_DATA_TABLE_ENTRY module; #if defined(_M_IX86) pPeb = (PPEB) __readfsdword(0x30); #elif defined(_M_X64) pPeb = (PPEB) __readgsqword(0x60); #endif head = &pPeb->Ldr->InLoadOrderModuleList; entry = head->Flink; while (entry != head) { module = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList); if (scW2Anicmp(module->BaseDllName.Buffer, moduleName, scStrlen(moduleName)) == 0) return module->DllBase; entry = entry->Flink; } return NULL; }
void SCAssertFailed ( const scChar* assertStr, const scChar* file, int lineNum ) { scChar buf[256]; if ( scStrlen( assertStr ) + scStrlen( file ) + 4 < 256 ) wsprintf( buf, scString( "ASSERT FAILED \"%s\" file \"%s\" line #%d\n" ), assertStr, file, lineNum ); else scStrcpy( buf, scString( "ASSERT STRING TOO LONG!!!!\n" ) ); SCDebugStr( buf ); #if SCDEBUG < 1 raise( scERRassertFailed ); #else SCDebugBreak(); // set doit to true if you want to raise an exception int doit = 0; if ( doit ) raise( scERRassertFailed ); #endif }