Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetLastError/CreateProcess bug on Vista/2008

131 views
Skip to first unread message

Corinna Vinschen

unread,
Apr 26, 2008, 11:55:08 AM4/26/08
to
Hi,

consider a situation in which you're trying to start a subsequent
application which depends on a DLL which is missing on the system.
Usually you get a GUI box telling you that a DLL is missing.

However, if you don't want that, because you want to handle all such
errors in the parent process (in your own framework), you can call
SetErrorMode(SEM_FAILCRITICALERRORS). So you have something along these
lines:

SetErrorMode (SEM_FAILCRITICALERRORS);
CreateProcess ("someprocess", "commandline", NULL, NULL, TRUE,
0, NULL, NULL, &si, &pi))
handle_potential_errors ();

If you do this on Windows XP, it works fine. No error box is opened.
Thus you can handle the problem in your own code. Nice!

If you do the same on Vista or Server 2008, you lost. Even though
SetErrorMode(SEM_FAILCRITICALERRORS) has been called, a box appears:

someprocess.exe has stopped working

Windows can check online for a solution to the problem.

-> Check online [...]
-> Close the program

V View problem details

And the problem details contains the well-known fact that a DLL
is missing and the status code is 0xc0000135.

To avoid this box on Vista/2008, you must call

SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);

in the parent process. This appears to be at least an unnecessary
and backward incompatible change, but actually I think this is a bug.

A DLL was missing. A missing DLL is *not* a general protection fault
and treating the status code STATUS_DLL_NOT_FOUND as a GP fault is...
a fault.

And it's a bug that the GUI box appears at all. If you set the error
mode to 0, *two* boxes appear on the screen, one to inform the user that

This application has failed to start because foo.dll was
not found. Re-installing the application may fix the problem.

and then, after the user has confirmed that box, the second box
described above appears.

Is there any chance that this can be fixed in Vista/2008?


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

Corinna Vinschen

unread,
Apr 26, 2008, 2:03:52 PM4/26/08
to
I screwed up the subject again. That should have been SetErrorMode,
not SetLastError. I hope that's clear from the body of the message.


Sorry,
Corinna

Jeffrey Tan[MSFT]

unread,
Apr 27, 2008, 11:21:30 PM4/27/08
to
Hi Corinna,

Yes, by searching in the internal database, I find that this is known
issue. This issue has been reported by several developers/testers
internally. The dialog you saw is popped up by the Windows Error
Report(WER) component. The WER owner confirms that he will consider to
change the behavior in the future so that WerFault.exe will be sensitive to
STATUS_DLL_INIT_FAILED when SetErrorMode(SEM_FAILCRITICALERRORS) is used.

Thank you for reporting this issue.

Best regards,
Jeffrey Tan
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

0 new messages