Bios NX/XD, Windows Data Execution Prevention (DEP) & LoadLibraryA & Error 998

Addr2CString (Cla$PushCString) can cause GPF in 2 cases:

  1. Value passed as a parameter is not valid address
  2. Passed address points to not 0-terminated string

PEEK must cause GPF in case (1) too. Because PEEK copies SIZE(destination variable) bytes from the memory pointed by passed address, value of the destination CSTRING variable should become broken in case (2).

Cla$PushCString pushes characters from passed address to first 0-character to the string stack. This values is popping from the stack to a destination variable if Addr2CString is using in the right side of assignment. Popping from the string stack can cause GPF only if destination address is wrong.