Engine crashes

10/14/2010 14:24 Timo264#1
Hi,
my engine crashes all the time, when i inject this code.
SearchPattern ist from Bakabug
PHP Code:
void GetPattern()
{
    
DWORD destSize;
    
DWORD Address 0;
    
char Array[255];
    
char SAddress[10];
    
destSize=100;
    
GetPrivateProfileString("Search","Array","NULL",Array,destSize,".\\Load.ini"); 
    if (Array != 
"NULL")
    {
        
WritePrivateProfileString("Search","Found","1",".\\Load.ini");
        
DWORD Start;
        for (
Start 0x007FFFFF;Start <0x2FFFFFF;Start =+0x100000)
        {
            
Address SearchPattern(Array,Start,Start+0x100000);
            if (
Address != 0
            {
                
WritePrivateProfileString("Search","Found","2",".\\Load.ini");
                
itoa(AddressSAddress10);
                
WritePrivateProfileString("Search","Address",SAddress,".\\Load.ini");
                break;
            }
            
Sleep(20);
        }
        if (
Address 0)
            
WritePrivateProfileString("Search","Found","3",".\\Load.ini");
    }
    else 
        
WritePrivateProfileString("Search","Found","3",".\\Load.ini");

First i had only 1 big Search and i thought this would be the reaseon, so i splitted it into more smaller searches, but it still crashes.

After about 2-3 sec engine.exe stops working.
Anyone a Idea how to fix it?

Kind regards,
Timo
10/14/2010 16:32 Moe1992#2
Okay ich hab nicht viel Ahnung vom Programmieren, eigentlich nur Actionscript und Java, aber eins kommt mir komisch vor in der Zeile mit der for-Schleife:
"for (Start = 0x007FFFFF;Start <0x2FFFFFF;Start =+0x100000)"
müsste es beim 3. Teil nicht "Start += 0x100000" heißen, also den Operator += sein statt =+?
sag mir wenn ich falsch liege, ich dachte nur, den Operator gibts nicht :)

Edit: tell me if you're not German, I forgot you posted in Englisch. If so, I'll translate later :)
10/14/2010 16:37 MoepMeep#3
Not using Luca's SearchPattern is the only solution I know :p Too lazy to explain why.
Use Sandro's FingerPrint function instead, doing the same, but shouldn't crash :x
10/14/2010 21:34 Timo264#4
ok, ich hab jetzt Sandros SearchFingerPrint gefunden und steh vor dem problem, das ich nicht weiss wie man es benutzt.
er hat als beispiel:
PHP Code:
        SearchFingerprint(
                
"C745" "F8" "00007A44"    // MOV DWORD PTR SS:[EBP-8],0x447A0000
                
"8B4D" "0C"                // MOV ECX,DWORD PTR SS:[EBP+C]
                
"51"                    // PUSH ECX
                
"8B55" "08"                // MOV EDX,DWORD PTR SS:[EBP+8]
                
"52"                    // PUSH EDX
                
"E8" "GetHeigh"            // CALL GetHeightEx
                
"83C4" "08"                // ADD ESP,8
            
"#"    "D95D" "FC"                // FSTP DWORD PTR SS:[EBP-4]
                
"C705"                    // MOV..
                
,+0x10); 
da meckert mein compiler gleich mehrfach
1. char incompatibel mir Fingerprint
2. int incompatibel mit LPBYTE
3. 'SearchFingerprint': Funktion akzeptiert keine 2 Argumente

wie bring ich das ding mit nem string zum laufen?
10/14/2010 22:18 Thiesius#5
Crashing with 0xC0000005, right? Some memory regions aren't readable or doesn't exist.

Try to access non-existing chunk of memory. You will crash.
The SearchPattern doesn't have any countermeasure to skip non-existing or non-readable memory.

Think about it
10/14/2010 22:45 bloodx#6
1. wieso machst du bitte dieses Start oO? Luca's function läuft doch schon das ding durch also wozu diese For? oder versteh ich irgendwas falsch xD
2.
PHP Code:
bool bDataCompare(const BYTEpData, const BYTEbMask, const charszMask)
{
    for(;*
szMask;++szMask,++pData,++bMask)
        if(*
szMask=='x' && *pData!=*bMask )
            return 
false;
    return (*
szMask) == NULL;
}

DWORD dwFindPattern(DWORD dwAddress,DWORD dwLenBYTE *bMaskchar szMask) {
    for(
DWORD i=0;i<dwLen;i++)
        if( 
bDataCompare( (BYTE*)( dwAddress+),bMask,szMask) )
            return (
DWORD)(dwAddress+i);
    return 
NULL;
}

dwFindPattern(0x401000,0x2bc000,(BYTE*)"\x55\x8B\xEC\x83\xEC\x18\x83\x3D\x00\x00\x00\x00\x00\x00\x00\x33\xC0","xxxxxxxx???????xx"); 
diese Function benutzte ich nur noch viel kleiner und bewirkt das gleiche ;D

3.Sandro's Fingerprint warum sollte er sowas umständliches dafür benutzen?
10/14/2010 23:17 Timo264#7
1.Ich habe das Start eingebaut, um dem ganzen ding ein Sleep zu gönnen.
ich dachte erst es liegt daran.
2.engine crasht auch damit
3.weiss ich auch nicht :D
Ja moep, was soll ich damit?

kann es daran liegen, das ich 58720256 Bytes scanne?
sind ja doch ziemlich viele und er dann meckert?
10/15/2010 01:55 MoepMeep#8
Soweit ich weiß, schützt sich sandro's fingerprint vor nicht lesbarem speicher. Da der Threadersteller nicht in der Lage ist, dies selber zu tun, hat er wohl keine wahl ;>
Wäre ja auch zuviel verlangt, sich mit VirtualQuery den lesbaren Speicher rauszusuchen :/