64,643
社区成员
发帖
与我相关
我的任务
分享
HeapSetInformation
All applications should use the HeapSetInformation method and specify the HeapEnableTerminationOnCorruption setting to enable the terminate-on-corruption feature. Doing so ensures that heap corruptions do not go unnoticed and therefore do not introduce opportunities for security exploits. Failure codes from this call are ignored because a correct application can proceed successfully even in the unlikely event of failure.
Direct2D samples call the HeapSetInformation from the WinMain function. The following example shows a typical Direct2D WinMain function.
int WINAPI WinMain(
HINSTANCE /*hInstance*/,
HINSTANCE /*hPrevInstance*/,
LPSTR /*lpCmdLine*/,
int /*nCmdShow*/
)
{
// Ignore the return value because we want to run the program even in the
// unlikely event that HeapSetInformation fails.
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
if (SUCCEEDED(CoInitialize(NULL)))
{
{
DemoApp app;
if (SUCCEEDED(app.Initialize()))
{
app.RunMessageLoop();
}
}
CoUninitialize();
}
return 0;
}