Add check of desktop heap size.

Refactor Nightmare WinAPI structure.