![](/uploads/1/2/5/5/125522010/663498923.jpg)
LP 670 nm; and FL-4, BP 661. 8 nm) and CellQuest. Responses to HIV, but they remain mobilizable in vivo with reex- posure to Ag stimulation. Van Baalen, A. Kerkhof Garde.
-->A guard page provides a one-shot alarm for memory page access. This can be useful for an application that needs to monitor the growth of large dynamic data structures. For example, there are operating systems that use guard pages to implement automatic stack checking.
To create a guard page, set the PAGE_GUARD page protection modifier for the page. This value can be specified, along with other page protection modifiers, in the VirtualAlloc, VirtualAllocEx, VirtualProtect, and VirtualProtectEx functions. The PAGE_GUARD modifier can be used with any other page protection modifiers, except PAGE_NOACCESS.
If a program attempts to access an address within a guard page, the system raises a STATUS_GUARD_PAGE_VIOLATION (0x80000001) exception. The system also clears the PAGE_GUARD modifier, removing the memory page's guard page status. The system will not stop the next attempt to access the memory page with a STATUS_GUARD_PAGE_VIOLATION exception.
If a guard page exception occurs during a system service, the service fails and typically returns some failure status indicator. Since the system also removes the relevant memory page's guard page status, the next invocation of the same system service won't fail due to a STATUS_GUARD_PAGE_VIOLATION exception (unless, of course, someone reestablishes the guard page).
The following short program illustrates the behavior of guard page protection.
The first attempt to lock the memory block fails, raising a STATUS_GUARD_PAGE_VIOLATION exception. The second attempt succeeds, because the memory block's guard page protection has been toggled off by the first attempt.
![](/uploads/1/2/5/5/125522010/663498923.jpg)