PspExitProcess(
IN BOOLEAN TrimAddressSpace,
IN PEPROCESS Process
)
{
ULONG ActualTime;
PAGED_CODE();
if (!Process->ExitProcessCalled && PspCreateProcessNotifyRoutineCount != 0) {
ULONG i;
That's interesting stuff (see
How Advanced Malware Bypasses Process Monitoring), but my question is a different one...
Apparently, ExitProcess does not release menus created with CreatePopupMenu
According to MSDN, the only time a menu is destroyed automatically is if it has been assigned to a window (during CreateWindowEx or with SetMenu)
or as a template with RegisterClassEx.
The point here is that MSDN is never clear about what "destroyed" really implies. Is it limited to the processes address space, so ExitProcess and wow, it's gone, or does it affect global resources that are NOT "destroyed" or "released" AFTER the ExitProcess. That is why I designed the launcher that creates fonts in an external exe - currently 1.6 Million fonts created, no effect on my system. So that confirms that
fonts fall into the category "ExitProcess and forget about it".
Attached the test for CreatePopupMenu, currently at 400,000 menus created, none explicitly destroyed, and no impact on my Win7-64's capacity to provide me with menus.
The interesting question here is indeed "what can cause the OS to run of resources?". Fonts and menus can be created in the Millions, provided they are not kept in memory - and ExitProcess does take care of removing them completely.
But I
have seen the OS in trouble in the past, with systemfixedfont replacing all other fonts, in my browser and other applications. It is definitely possible to tear down the system globally, but how exactly? Not releasing or destroying resources at the end of a program cannot be the cause 8)