Brief Q&A on the HeapEnableTerminationOnCorruption heap information flag
Question: What type of heaps are controlled by the
HeapEnableTerminationOnCorruption flag? Answer: Any user-mode heap created by the
HeapCreate function. This includes the process heap (
GetProcessHeap) but not the managed heap. Some components use
HeapCreate under the hood. If so, then those heaps would also be affected. Question: What versions of Windows support
HeapEnableTerminationOnCorruption? Answer: The flag was introduced in Windows Vista and Windows Server 2008. It is also available on Windows XP Service Pack 3. In table form:
Windows XP RTM, SP1, SP2
Windows Server 2000
Windows Server 2003
| Windows XP SP3|
| Windows Server 2008|
Windows Server 2008 R2
Question: For operating systems that support it, under what conditions will termination on corruption be enabled? Answer:
- For all 64-bit processes.
- For all 32-bit processes whose executable sets the subsystem major version to 6 or higher in the image header.
- If you call
Question: What is the effect of setting the subsystem major version in a DLL? Will that control whether termination on corruption is enabled for any heaps created by my DLL? Answer: No. For the purpose of rule 2 above, it is the major subsystem of the executable that decides whether termination on corruption. The major subsystem of any DLLs loaded by the process have no effect. This is consistent with other process decisions. Question: Can I enable termination on corruption for some heaps but not others? Answer: No. Turning on termination on corruption turns it on for all heaps in the process. Question: Can I disable termination on corruption after it has been enabled?
Answer: No. It is a one-way door.