[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2883
  • Last Modified:

WaitForSingleObject returns WAIT_OBJECT_0

I'm calling CreateProcess(
   tzAppName,
   NULL,
   NULL,
   NULL,
   FALSE,
   0,
   NULL,
   NULL,
   &StartupInfo,
   &ProcessInfo );

and then

WaitForSingleObject( ProcessInfo.hHandle, INFINITE );

CreateProcess returns TRUE, and WaitForSingleObject
returns WAIT_OBJECT_0. Exectution continues
seemingly without pause. Which is bad, because I'm
waiting for the executable module to exit. Help says
WAIT_OBJECT_0 means "The state of the specified
object is signaled."

The app I'm launching is an internal Setup program, for
what that's worth. Anybody know what gives?
0
barrett
Asked:
barrett
1 Solution
 
jhanceCommented:
WAIT_OBJECT_0 means that what you were waiting for happened.  Your process finished.  My guess is that your process in not starting properly.  Use the GetExitCodeProcess function to find out what happened to your process and why it died so quickly.
0
 
flfmdllCommented:
Your new process is exiting with a signaled state. That's a given I suppose. Perhaps your exit or return value is 1 no matter what for this process. You can look into the code to change it. Something is not working in your new process, returning, and making your WaitForSingleObject think it is okay to continue. It seems your code for spawning it is okay.
0
 
barrettAuthor Commented:
As it turns out, the exe I was spawning was just a stub that launched another process. Once I got the name of the other mutex, everything was fine. Thanks for answering...
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

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