Data Execution Prevention, DEP



  • hat jemand erfahrung mit der DEP?
    bzw wie kann ich das DEP über die API ansteuern?
    für kleine hinweise wär ich dankbar!!



  • DWORD                               DEPFlags;
    BOOL                                permanent, fnSuccess;
    fnSuccess = GetProcessDEPPolicy(GetCurrentProcess(), &DEPFlags,   &permanent);
    if (!fnSuccess){
     printf("<ERROR> Cant Do DEP Process Policy!\n");
    }
     /// Disable DEP for this process 
    if(permanent){
    printf("<FATAL> Cant Change DEP for this process, so this exe will exit!\n\n");
    getc(stdin);
    return(false);
    }
     if(!SetProcessDEPPolicy(0)){
     printf("<ERROR> SetProcessDEPPolicy Failed with error code %08X\n",GetLastError()); 
     getc(stdin);
     return(false);
     }else{
     printf("     <SUCCESS> SetProcessDEPPolicy succeed, without an error!\n\n");
     }
    

    leider lässt das system keine ausnahmen zu, deshalb funktioniert der DEP change bei meinem process nicht, jemand ne ahnung wie ich das ändern könnt?



  • http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx

    There is one caveat that you should know; SetPRocessDEPPolicy often returns error 5 (Access Denied) but this error does not mean the operating system is denying access, it means you are attempt to change DEP policy in a way that is not appropriate. For example, if you link with /NXCOMPAT, and then use this API, you'll get the error. Or, if the operating system is configured to use DEP for all processes all the time no matter what, then you'll see the same error. Finally, you'll get an access denied error if you attempt to call SetPRocessDEPPolicy twice in one application; once the policy is set, it's set for the process lifetime.



  • punky schrieb:

    leider lässt das system keine ausnahmen zu, deshalb funktioniert der DEP change bei meinem process nicht, jemand ne ahnung wie ich das ändern könnt?

    Die Antwort kennst Du ja selber, oder?



  • naja habs jez ganz deaktiviert, für alle processe.


Anmelden zum Antworten