• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1569
  • Last Modified:

C++ ProcessShellCommand(params) issue with exception as "Unhandled exception at 0x7771b9bc (KernelBase.dll)". How to fix?

Hi there;

After converting my project from VS2008 to VS2010, my C++ program crashes in the very line;
ProcessShellCommand(params), simply crashes and when ignore during debugging, I end up with CInvalidArgException Class exception with the following message.

Unhandled exception at 0x7771b9bc (KernelBase.dll) in MyProgram.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0018f564..

What should I do? How can I fix this problem?

Kind regards.

P.S.
Addition;
The stack trace for this is as:

First-chance exception at 0x7771b9bc (KernelBase.dll) in MyProgram.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0018f564..
Unhandled exception at 0x7771b9bc (KernelBase.dll) in MyProgram.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0018f564..
The thread 'Win32 Thread' (0xfb4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x26a0) has exited with code 0 (0x0).
Detected memory leaks!
0
jazzIIIlove
Asked:
jazzIIIlove
  • 4
  • 3
2 Solutions
 
jkrCommented:
Well, what are the arguments that are being processed?
0
 
jazzIIIloveAuthor Commented:
Hi jkr, thanks for the interest:

Just, command line arguments as the program needs a command line argument indicating the path of the file that program uses during startup.

Kind regards.
0
 
jkrCommented:
Hm, that I assumed somehow ;o)

And in detail?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
jazzIIIloveAuthor Commented:
What other details do you need? The window is created after the parameter passing to ProcessShellCommand. Is this the case?

Kind regards.
0
 
jkrCommented:
Um, what would be nice is

- the actual parameters
- the snippet of code in question

Sorry, but my chrystal ball is on repair ;o)
0
 
jazzIIIloveAuthor Commented:
lol, u are absolutely right. I will check what i can for the code. The params is just a path to a configuration file for that C++ application.

Note that before conversion, it was OK.

I suspect as i draw the GUI for the program after passing param to that function. Could it be a reason for the crash?

Regards.
0
 
jkrCommented:
I actually suspect just some minor, yet hidden detail...
0
 
ZoppoCommented:
Hi jazzIIIlove,

there are some cases which cause a CInvalidArgException being thrown, i.e. accessing a MFC container (like i.e. CArray) with an index which is out of bounds or a file/socket operation with a NULL pointer or an empty file name string or COM error when accessing a none initialized interface or passing wrong parameters to AfxLoadString, ...

I guess a good way to find where you app crashs might be to set a breakpoint in the function AfxThrowInvalidArgException which is located near the end of <Program path>\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\except.cpp. I guess this function is called whenever a CInvalidArgException is thrown.

If this doesn't help I agree with jkr: Please post parts of the relevant code and the paramters you pass to ProcessShellCommand ... even helpful might be the calling stack shown in the debugger when the exception is thrown.

ZOPPO
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now