Why does the access violation error message put the operation in quotation marks, redux
Recall that when an application crashes with an access violation, the error message says something like
The instruction at “XX” referenced memory at “YY”. The memory could not be “read”.
The word at the end is “read” or “written”, and we saw earlier that it is in quotation marks for localization reasons.
Okay, now some follow-up discussion:
The code that decides whether to use “read” or “written” was not updated to support the new access violation code added by Data Execution Prevention (DEP), also known as NX (no execute).
|0||unable to read|
|1||unable to write|
|8||unable to execute NEW|
The code assumes that any nonzero value means “unable to write”. Therefore, if you encounter a DEP violation, the error will say that “The memory could not be written” instead of “The memory could not be executed.”
Which is maybe a good thing, because it sounds scary when you say that memory couldn’t be executed. Like the firing squad didn’t show up or something.
In Windows Vista, all the quotation remarks were removed, so now the message just reads
The instruction at XX referenced memory at YY. The memory could not be read.
At least now it doesn’t look like a euphemism.
However, the words “read” and “written” are not localized. They are hard-coded in English. This means that in German, you would get
Die Anweisung in XX verweist auf Speicher YY. Der Vorgangkonnte nicht im Speicher durchgeführt werden.
with an English word (highlighted) inserted into the middle of a German sentence.