My application needs to determine whether it is running on Windows PE.
Neither the deprecated GetVersionEx function nor the preferred alternative Version Helper APIs offer any indication whether I am operating on WinPE, only indicating the version of the OS.
This reference lists the compatible APIs for WinPE, so I need to be able limit my app to those APIs.
How can I programmatically determine from my App whether I am on WinPE, and which PE version is running?
If you simply need to determine whether you are running WinPE or not, you can check for the presence of the key
MiniNTinHKLM\System\CurrentControlSet\ControlorHKLM\System\ControlSet001\Control. If it is present, you are on WinPE 2.x or higher.Cited in MSDN docs here, you can see which version of Windows PE youare running at the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE. That reference also gives a table of features and functionality each version will provide you.For very old versions of Windows/WinPE before 2.0, check the version of
%SYSTEMROOT%\SYSTEM32\FACTORY.EXE.