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

ShellExecuteEx randomly crashing

312 views
Skip to first unread message

Jason

unread,
Nov 13, 2002, 5:12:37 AM11/13/02
to
Hi I am not sure why, but ShellExecuteEx() crashes on some systems, but not
all, randomly. I know this usually seems to point to memory leaking or an
error in the way I call it, but I am positive that the way I'm calling it is
fine, and Ive even checked with Boundschecker for memory leaks and
overflows. Anyways I call it like this :-

SHELLEXECUTEINFO sh={0};

sh.cbSize=sizeof(SHELLEXECUTEINFO);

sh.fMask=SEE_MASK_INVOKEIDLIST;

sh.lpVerb="properties";

sh.lpFile=(char*)params;

sh.nShow=SW_SHOW;

ShellExecuteEx(&sh);

It is pretty much exactly as how MSDN says to do it. Unless I put this exact
code in a thread, it crashes everytime on Windows XP, but on other operating
systems it doesn't need to be in a sep. thread. Anyhow "params" cannot be
NULL as i test it just before this code segment. Any ideas? This is driving
me crazy. Is there another way to grab the properties of a file without
going through this crash prone method?

-Jason-

Lucian Wischik

unread,
Nov 13, 2002, 5:21:13 AM11/13/02
to
Jason <ja...@diamondcs.com.au> wrote:
>Hi I am not sure why, but ShellExecuteEx() crashes on some systems, but not
>all, randomly.
>It is pretty much exactly as how MSDN says to do it. Unless I put this exact
>code in a thread, it crashes everytime on Windows XP, but on other operating
>systems it doesn't need to be in a sep. thread. Anyhow "params" cannot be
>NULL as i test it just before this code segment. Any ideas?

I wrote your code, exacly as you had it (but with a real name instead of
params), and was unable to observe a crash under XP.

If you make a minimal program, which calls this stuff directly from
WinMain, can you make it crash in XP?

(My guess is that the rest of your procedure is corrupting the stack. By
creating it in a new thread you're giving a different stack so the
corruption doesn't spread.)

--
Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu

Jason

unread,
Nov 13, 2002, 10:09:07 PM11/13/02
to
I think it is stack based also. I removed all the local variables
ShellExecuteEx was using and made them global (so they can't go out of scope
when the user closes the properties dialog) and still a crash on XP. Btw I
couldnt get a crash to happen on XP if I just did that code, I had to put it
in a window'd application then after closing the dialog just play around
with the window a bit then crash... odd. I'll post back if I find the
problem.
-Jason-

"Lucian Wischik" <ljw...@cus.cam.ac.uk> wrote in message
news:aqt92p$bc7$1...@pegasus.csx.cam.ac.uk...

0 new messages