Access violation not caught/trapped by Visual Studio or Dr Watson


G

Greg B

Created a simple Win32 application (using Visual Studio wizard)...
Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
Pack 5.

At the start of 'WinMain' function, added the following two lines:

char* ptr = NULL;
*ptr = 'b';

Built the crashTestApp.exe in both Release and Debug configurations.
When trying to run the .exe in Windows Explorer on the same machine
(Windows XP, SP 1), get:

'crashTestApp.exe has encountered a problem and needs to close. We
are sorry for the inconvenience.' messagebox, with an option to Debug.
When I copy the crash executables (Debug and Release versions) onto a
clean Windows 2000 Server machine and run them, I get a similar
message box popping up (but by default it is Dr Watson, and therefore
I don't get a chance to debug). If I then install the same version of
Visual Studio (6.0, Enterprise edition) and Service Pack 5 for Visual
Studio on that machine and run the .exes again, I am once again able
to debug.

Now, this is where it is starting to get weird...

A friend of mine in United States has a Windows 2000 Server machine
(which happens to be hosting a Citrix Metaframe Server). He has
installed Microsoft Visual Studio 6.0 Professional (notice the
difference) and Service Pack 5 on that machine, and then obtained the
crash executables from me. But, when he attempts to execute them,
there is no message box popping up at all. 'Just-in-time debugging'
checkbox in Visual Studio Tools->Options->Debug tab is checked.
If we uncheck that box, close Visual Studio and run the crash
executables, once again nothing seems to occur (i.e. they are launched
and terminated quietly). Doesn't appear to be anything in the Event
Viewer either.

Interestingly enough, if my friend creates a simple Win32 app on his
machine and uses the same code for 'WinMain' (i.e. with the access
violation lines), builds it in Release/Debug modes and then tries
running it, everything works as expected (he gets a messagebox
notifying him of the access violation, and giving him a chance to
debug). If he then disables 'Just-in-time debugging' for Visual Studio
and runs his own-built application, then Dr Watson notification pops
up (and there's an appropriate message in the Event Viewer)

Now, could someone suggest as to why this is happening and how I can
go about solving this issue. Is the problem in the way I build my
executables? Is it the difference in the Visual Studio versions
(Enterprise vs Professional)? Is it because I'm building on XP and
he's running it on 2000 Server? Is it because of some (security)
policy settings on my friend's machine? Is it because I am 20 hours
ahead in the timezone and the binaries I've sent to him have
creation/modification date in the future? Is it because of some
permissions issue (i.e. the executable he builds himself he has rights
to debug, while for my one he doesn't?). Is it because Visual Studio
is installed in the Citrix Metaframe Server environment? (then again,
when I repeated the same steps with my local Citrix Metaframe server
setup, everything worked a treat)

I know I could probably attach a debugger to a running process but
that would be my last resort if everything else fails...

Any help/ideas would be much appreciated
regards,
Greg
 
Ad

Advertisements

U

Unforgiven

Greg B said:
Created a simple Win32 application (using Visual Studio wizard)...
Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
Pack 5.

This is off topic here. Try one of the microsoft.public.vc.* newsgroups.
 
J

John Harrison

Greg B said:
Created a simple Win32 application (using Visual Studio wizard)...
Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
Pack 5.

At the start of 'WinMain' function, added the following two lines:

char* ptr = NULL;
*ptr = 'b';

Built the crashTestApp.exe in both Release and Debug configurations.
When trying to run the .exe in Windows Explorer on the same machine
(Windows XP, SP 1), get:
[snip]

Any help/ideas would be much appreciated
regards,
Greg

The only C++ answer to your question is that you have invoked undefined
behaviour and therefore anything could happen. If you want a Windows answer
to your question ask on a Windows programming group such as

john
 
Ad

Advertisements

J

JKop

Greg B posted:
Created a simple Win32 application (using Visual Studio wizard)...
Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
Pack 5.

At the start of 'WinMain' function, added the following two lines:

char* ptr = NULL;
*ptr = 'b';

Built the crashTestApp.exe in both Release and Debug configurations.
When trying to run the .exe in Windows Explorer on the same machine
(Windows XP, SP 1), get:

'crashTestApp.exe has encountered a problem and needs to close. We
are sorry for the inconvenience.' messagebox, with an option to Debug.
When I copy the crash executables (Debug and Release versions) onto a
clean Windows 2000 Server machine and run them, I get a similar
message box popping up (but by default it is Dr Watson, and therefore
I don't get a chance to debug). If I then install the same version of
Visual Studio (6.0, Enterprise edition) and Service Pack 5 for Visual
Studio on that machine and run the .exes again, I am once again able
to debug.

Now, this is where it is starting to get weird...

A friend of mine in United States has a Windows 2000 Server machine
(which happens to be hosting a Citrix Metaframe Server). He has
installed Microsoft Visual Studio 6.0 Professional (notice the
difference) and Service Pack 5 on that machine, and then obtained the
crash executables from me. But, when he attempts to execute them,
there is no message box popping up at all. 'Just-in-time debugging'
checkbox in Visual Studio Tools->Options->Debug tab is checked.
If we uncheck that box, close Visual Studio and run the crash
executables, once again nothing seems to occur (i.e. they are launched
and terminated quietly). Doesn't appear to be anything in the Event
Viewer either.

Interestingly enough, if my friend creates a simple Win32 app on his
machine and uses the same code for 'WinMain' (i.e. with the access
violation lines), builds it in Release/Debug modes and then tries
running it, everything works as expected (he gets a messagebox
notifying him of the access violation, and giving him a chance to
debug). If he then disables 'Just-in-time debugging' for Visual Studio
and runs his own-built application, then Dr Watson notification pops
up (and there's an appropriate message in the Event Viewer)

Now, could someone suggest as to why this is happening and how I can
go about solving this issue. Is the problem in the way I build my
executables? Is it the difference in the Visual Studio versions
(Enterprise vs Professional)? Is it because I'm building on XP and
he's running it on 2000 Server? Is it because of some (security)
policy settings on my friend's machine? Is it because I am 20 hours
ahead in the timezone and the binaries I've sent to him have
creation/modification date in the future? Is it because of some
permissions issue (i.e. the executable he builds himself he has rights
to debug, while for my one he doesn't?). Is it because Visual Studio
is installed in the Citrix Metaframe Server environment? (then again,
when I repeated the same steps with my local Citrix Metaframe server
setup, everything worked a treat)

I know I could probably attach a debugger to a running process but
that would be my last resort if everything else fails...

Any help/ideas would be much appreciated
regards,
Greg

I'm new here and even I find that dumb. It's like hitting someone in
the head with a sledgehammer and then asking why or why not they're
spasming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top