Submitted by: Slobodan Brcin of Belgrade, Serbia, and Montenegro
This article illustrates how the user can suppress system and application error messages from occurring on an embedded system. This is particularly useful when the embedded device is headless and there is no user interface with which to interact to dismiss the error or in cases where the embedded system is meant to be unattended and the system designer does not want users seeing or interacting with such error dialog boxes.
- For low-level filtering out visible notification of various errors use registry entry
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Windows\ErrorMode. - To prevent device-not-functioning errors during the boot, use registry entry
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Windows\NoPopupsOnBoot.
ErrorMode value descriptions:
0 - All messages are visible (default value).
1 - Only system messages are invisible. An example of this type of message is: "Virtual Memory Minimum Too Low."
2 - All messages are invisible. An example of this type of message is: "Unable to Locate Component" shown when application can't load DLL statically linked to it.
Additional requirement:
For the ErrorMode value to affect the component, event logging must be turned on.
Insight into what happens after the event is generated:
- winsrv!UserHardErrorEx - is the entry point for system and application errors.
- In all modes, system-originated hard errors are logged to the system log.
- Based on current ErrorMode value present during the event UserHardErrorEx decides whether to ignore a message or to call ProcessHardErrorRequest.
- If ProcessHardErrorRequest is called this means that the message should be presented to the user. How the message will be shown depends on the user shell handlers for each type of message.
The default behavior for winsrv.dll is to show a message box using the MessageBoxTimeoutW function. But for some types of messages the explorer shell offers another handling mechanism; instead of the message box it will show a notification balloon in system tray.
NoPopupsOnBoot:
Adding this value to your image prevents all pop-up messages from opening and notifying you a device is not functioning when you boot up Windows XP Embedded. The NoPopupsOnBoot value data type is REG_DWORD and the data value of 1 enables this option.
One example of this message is "At least one service failed to start."
Preventing messages of this type is not recommended, since they tell user that their device has started to malfunction.
NoInteractiveServices:
This value is used as a master switch to make all interactive services behave like ordinary services. Interactive services are very rare and they are covered by MSDN articles.
EnableDefaultReply:
This value is used for bypassing the creation of all types of MessageBox functions. Since its usage is well covered in the "Message Box Interception" section of Tareget Designer Help I won't explain it further here. (The complete Target Designer help is available on MSDN.)
EnableBalloonTips:
Like its name says, this value is used to enable and disable the notification area balloon tips. Explanation of this value can be found in the Windows XP Embedded tip, Popping "Balloons" in Embedded Images and in the Knowledge Base article, Disable Notification Area Balloon Tips in Windows XP.
Configuring registry values from Target Designer:
From the central panel in Target Designer, locate the component "Windows subsystem" and open Registry Data. ErrorMode and NoInteractiveServices values can be found on the right panel.
Key differences between values:
- ErrorMode simply tells the operating system to filter out certain notification messages. This does not influence user interface functionality in any way.
- EnableDefaultReply prevents all message boxes from showing. This switch simply returns the default value associated with message box, it does not care about message box origin or about multiple choice message boxes. This can have a heavy impact on applications that use message boxes to ask users for confirmation or cancellation of some operation.
When to use:
For unattended systems it is preferable to set all values to prevent all possible user interactions at all levels. For most embedded applications it is preferable to disable at least system originated messages by using ErrorMode value, since these notifications can often confuse users and make them wonder what they have done wrong.
These tips are for informational purposes and are provided only as a convenience. The entire risk of use or results in connection with the use of these tips remains with the user.