Dec 14 2011

Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

Category: Visual StudioCrashingDutchman @ 10:36

Some time ago I ran into an issue where somewhere in the software an error was raised, 'Attempted to read or write protected memory. This is often an indication that other memory has been corrupted'. A quick search revealed that a possible solution might be to turn off Data Execution Prevention (DEP).

After following the steps to switch off DEP for this software, I was challenged with a message saying 'this program must run with data execution prevention (DEP) enabled. You cannot turn off DEP for this program'. Then I found this site (that was offline later) showing how to alter your executable so that it isn't DEP compliant anymore.

open up the Visual Studio command prompt, browse to your exe location and type:

editbin.exe /NXCOMPAT:NO YourProgram.exe

After applying this ' fix' you should be able to turn off DEP for just this software with these steps:

  1. Right click My Computer and click Properties
  2. Click the Advanced tab
  3. Click the Settings button in the Performance section
  4. Make sure the radio button labeled ´Turn on DEP for all processes and services except the ones I select´ is checked
  5. Click Add at the bottom of the list
  6. Browse to the executable that is throwing the error and select it
  7. Make sure the checkbox next to the executables name in the list is selected and click OK

Tags: