Vista / XP msvcrt.dll error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a VC++ / .NET 2.0 solution built using VS 2005 SP1 under XP.
Everything has been working well there over the past year. I have recently
starting porting the app to Windows Vista (since it currently will not
execute properly there).

I installed VS 2005 SP1 and the hot fix SP for Vista on my Windows Vista
system and have rebuilt the entire solution there with everything working
well. This solution also builds a setup package that includes all
dependecies -- i.e. MS VC80 vcrt merge modules, etc.). The setup package
works perfectly and the software now runs under Vista. Now, when I go back
and install the app under Windows XP I get the following error when I start
up the exe after installation:

The procedure entry point _except_handler4_common could not be located in
the dynamic link library msvcrt.dll

This is frustrating since if I go back and build the identicle solution
under VS2005 SP1 under Windows XP the package installs and works great (but
then no longer works under Vista). What am I missing?

Thanks, -David
 
Hi David,

Based on my knowledge, _except_handler*(* can be 2, 3, 4) is an internal
exception handler of Microsoft VC++ compiler.

I have used windbg to dump the available handlers in msvcrt.dll on Win2003,
below is the result:
0:000> x msvcrt!_except_handler*
77bc6bbc msvcrt!__except_handler2 (void)
77bc6c74 msvcrt!_except_handler3 (void)

So the _except_handler4_common handler is not present in msvcrt.dll on
Win2003 machine. I assume it is the same as WinXP.(I will give a check on
WinXP machine tommorrow after going back to office)

By testing it Vista reveals, the Vista version of msvcrt.dll contains
_except_handler4_common symbol.

I then performed search in all the available Microsoft database and found
some records. Most of the records are related with certain Vista tools
being used on WinXP machine, which will generate the error your pasted.

I am not sure if this is a known issue yet, I will try to contact VC++ team
to ask for the best practise for this issue.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
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.
 
Thanks Jeffrey, I'll wait to see what you come up with because at this point
I am completely stumped as to how to resolve this issue. It's particularly
confusing since as I said, the source code/solution are identical under
VS2005 sp1, but they are obviously compiled very differently based on whether
your development system is running under Vista versus XP.

Best regards,
David
 
Hi David,

Sorry for letting you wait.

Yes, they confirmed that only CRT8 version of msvcrt.dll contains the
_except_handler4_common function. To use it, you need to install the CRT8
redist on XP:
http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-
9C99-220B62A191EE&displaylang=en

However, they thought that non-Windows developers (third parties as well as
MS non-Windows developers) are never supposed to use system32's msvcrt.dll.
That's only for Windows components. We believe you should be using
msvcr80.dll followed with VS2005.

To find out why your application is connecting to system32's msvcrt.dll,
you could use depends.exe to check just which binary is trying to access
msvcrt.dll. Or enable loader snaps and look at the output in the debugger.

I will wait for your further feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
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.
 
I already ran the "vcredist_x86.exe" code to make sure I had the most recent
msvcrt.dll installed, but still encountered the problem. Additionally, one
of the XP systems I am testing on (and encountering the problem) has VS 2005
w/ SP1 already installed, which from what I can understand would also ensure
the latest versions of runtimes being installed. I will try to install again
tomorrow and also run depends.exe as you suggest to see if I can provide any
other info. Thanks. -David
 
Hi David,

Thanks for your feedback!

Yes, I have checked this with several VC++ developers. Based on their
feedback, unless you've done something really strange, VC2005 will not
create binaries with a dependency on Vista's msvcrt.dll. VC2005 will create
binaries with a dependency on msvcr80.dll. vcredist_x86.exe only installs
msvcr80.dll, not msvcrt.dll.

The problem is not with the binary built with VC2005. The problem is with
some other binary on the your problematic machine. Something else has been
copied from a Vista machine to the problematic machine. Use depends.exe to
find out what DLL is causing a dependency on the Vista version of
msvcrt.dll.

Another developer also confirmed:
"Msvcrt.dll is an OS binary. It looks like your customer somehow compiles
against Vista msvcrt.lib. It is not a supported scenario."

I will wait for your further findings with depends.exe. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
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.
 
"Msvcrt.dll is an OS binary. It looks like your customer somehow compiles
against Vista msvcrt.lib. It is not a supported scenario."
Is Vista msvcrt.lib even publicly available?
 
JW- [Wed, 07 Mar 2007 19:20:20 +0900]:
Is Vista msvcrt.lib even publicly available?

Apps/code made with vs6/vc (and prior) use the
"OS binary" msvcrt.dll. vs6/vc used msvcrt.lib
as the import lib. It never used to be the
"OS binary". Lots of apps are made with vs6/vc.
Even today, quite a few (100s of 000s) prefer
vs6 as a dev platform over the newer ones.
No, one doesn't need a "Vista msvcrt.lib"; they
are all the same (as far as it needs to be),
otherwise none of those vs6/vc (and prior) apps
would run on Vista. They do.
 
JW- [Wed, 07 Mar 2007 19:20:20 +0900]:
Is Vista msvcrt.lib even publicly available?

Apps/code made with vs6/vc (and prior) use the
"OS binary" msvcrt.dll. vs6/vc used msvcrt.lib
as the import lib. It never used to be the
"OS binary". Lots of apps are made with vs6/vc.
Even today, quite a few (100s of 000s) prefer
vs6 as a dev platform over the newer ones.
No, one doesn't need a "Vista msvcrt.lib"; they
are all the same (as far as it needs to be),
otherwise none of those vs6/vc (and prior) apps
would run on Vista. They do.

The older msvcrt.lib would have no import for the suffix 4 exception handler
function, because it was introduced with vista.
 
BV [Fri, 9 Mar 2007 14:20:22 -0600]:
The older msvcrt.lib would have no import for the suffix 4 exception handler
function, because it was introduced with vista.

I've made import libraries in my time from
nothing but DLL files, back around the omf-
coff switch over. If someone wanted to make
an import library for some DLL, I'd assume he
still could. Most files today dwarf the RTL
so I'd sooner link static than do that (for
small files, I use the vc6 import lib).

07 02 18 23:23 5,632 zetup.exe

Made with vs8/link8, ref'ing msvcrt.dll.
File made/linked with the vs8 static lib:

07 03 09 14:38 50,176 zetup.exe

(Like I said, simple, so only a little RTL
got linked; no reference to any RTL DLL.)

Manifests turn out to be pretty ugly (hack)
so I go out of my way to avoid that mess.
 
BV [Fri, 9 Mar 2007 14:20:22 -0600]:
The older msvcrt.lib would have no import for the suffix 4 exception
handler
function, because it was introduced with vista.

I've made import libraries in my time from
nothing but DLL files, back around the omf-
coff switch over. If someone wanted to make
an import library for some DLL, I'd assume he
still could. Most files today dwarf the RTL

You can, but that would be a .lib matching the version of the .dll generated
from, hence a Vista msvcrt.lib.
so I'd sooner link static than do that (for
small files, I use the vc6 import lib).

07 02 18 23:23 5,632 zetup.exe

Made with vs8/link8, ref'ing msvcrt.dll.
File made/linked with the vs8 static lib:

07 03 09 14:38 50,176 zetup.exe

(Like I said, simple, so only a little RTL
got linked; no reference to any RTL DLL.)

still, the linker only puts import table entries for the functions
referenced by the objects, so how did _except_handler4_common get
referenced?
 
BV- [Fri, 9 Mar 2007 15:36:44 -0600]:
still, the linker only puts import table entries for the functions
referenced by the objects, so how did _except_handler4_common get
referenced?

I must not be following this thread as well
as you are.

* msvcrt.dll is used by all vc1-6 applications
that link to the msvcrt.dll

* vc7+ apps no longer use msvcrt.dll, but
rather use a version-specific msvcrt##.dll,
and requires a manifest

* Someone in this thread said msvcrt.dll is
a system dll, and apps, more or less, are
not to use it

This last statement is one that is not terribly
valid. The rest of the thread I wasn't following,
so I don't know how to answer your question.
 
Hi David,

How about this issue now? Have you managed to use dependency walker to find
out which binary is linking with the msvcrt.dll? If you still need any help
or have any concern, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
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.
 
* Someone in this thread said msvcrt.dll is
a system dll, and apps, more or less, are
not to use it

This last statement is one that is not terribly
valid. The rest of the thread I wasn't following,
so I don't know how to answer your question.

The original poster compiled an application under Vista, and it then
wouldn't run on XP because of a missing function in msvcrt.dll.
 
BV [Mon, 12 Mar 2007 09:33:37 -0500]:
The original poster compiled an application under Vista, and it then
wouldn't run on XP because of a missing function in msvcrt.dll.

Now that is pretty odd. The exception routine
looks like it's compiler-born, so if his app
is forceably linking to msvcrt.dll (like I do)
then that'll happen. But you have to go out
of your way to tell the linker to ignore the
default library:

#pragma comment(linker, "/NODEFAULTLIB:msvcrt80.lib")

and then include the old to resolve what you
have:

#pragma comment(lib, "/yohoho/vs6/msvcrt.lib")

He may have those two, somewhere. In this
case I'd switch to static linking, or find
a way to get the compiler to not reference
that particular exception handler.
 
#pragma comment(linker, "/NODEFAULTLIB:msvcrt80.lib")

The OP might use that as a trick to not link
to any embedded msvcrt.lib attribute, by adding

#pragma comment(linker, "/NODEFAULTLIB:msvcrt.lib")

to his project. It's worth a shot.
 
Hi Jeffrey!

I am not sure if this is still of interest, but I ran across a customer who
uses our software and had the very same problem.
As it turned out, he had copied a number of DLLs that were shipped with Visa
onto his XP system (and *please* don't ask me why people do this...). Among
those DLLs was the dwmapi.dll that had the fatal msvcrt.dll dependency to
the Vista version of msvcrt.dll which exports the _except_hander4...
Deleting that DLL solved the problem in his case.

Regards

Volker

url:http://www.ureader.com/msg/14523230.aspx

Volker:

Thank you so much for sharing this finding!!! After installing my
Creative Sound card that came with a pack of XP and Vista drivers ---
I had the :

The procedure entry point except handler4 common could not be located
in the dynamic link library msvcrt.dll

while using my Safari browser (when minimizing/maximizing windows) and
with Photoshop CS3 --- the programs ran okay --- but the error was a
great annoyance ----

After long hours of searching for solutions --- including XP repair
(which I avoided) --- I found your post!

I searched my drive and found of dwmapi.dll file in my system32
directory and renamed it (in case I needed to recover it.

Now the error is gone!!! In my case the error was called by the
dependency call in the dwmapi.dll .

I really, really, really appreciate you letting us know about this !!!

It's a bad situation when new software trys to accommodate more than
one operating system --- and the .dll dependencies conflict --- these
errors are truly a nasty situation!

Thanks again!!!
 
After I build a MFC project under vista using vs 2008, I install it under XP.
when i run it, error was happened:
The procedure entry point _except_handler4_common could not be located in
the dynamic link library msvcrt.dll

why?
 
A corrupt DirectX installation has been the cause of this error on many machines.
If you've installed the "DirectX 10 RC3 for XP" that is what is causing the problem.
Uninstall this and the error will go away.
The highest version of DirectX for XP that actually works without any errors is DirectX 9.0c
 
Back
Top