Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Windows processes running with elevated privileges can disable paging by locking memory in place using VirtualLock() (Windows) [MSDN]:

Code Block
bgColor#CCCCFF
char *secret;

if (VirtualLock(secret, sizeof(secret)) != 0) {
    /* Handle error */
}

/* Create or otherwise obtain some sensitive data */
if (fgets(secret, sizeof(secret), stdin) == EOF) {
  /* Handle error */
}

...