Using a Guard Page With a Memory Object

PVOID  pObject;                /* 32-bit linear pointer to memory object */

DosAllocMem(&pObject,          /* Allocate memory object                 */
            73727,             /* Size of memory object                  */
            PAG_READ |         /* Allow read access                      */
            PAG_WRITE);        /* Allow write access                     */

DosSetMem(pObject,             /* Set memory attributes for object       */
          8192L,               /* Two pages (8192 bytes)                 */
          PAG_DEFAULT |        /* Default attributes from allocation     */
          PAG_COMMIT);         /* Commit page                            */

DosSetMem(pObject+4096,        /* Set memory attributes for object       */
          1L,                  /* Two pages (8192 bytes)                 */
          PAG_DEFAULT |        /* Default attributes from allocation     */
          PAG_COMMIT  |        /* Commit page                            */
          PAG_GUARD);          /* Flag page as guard page                */


[Back: Committing Storage During Allocation]
[Next: Guard Page Exception Handler]