Link to home
Start Free TrialLog in
Avatar of Avishaya
Avishaya

asked on

Troubleshooting with converting code from WIN NT to WIN 2000

Hi
My name is Avishay abahel, and I m software engineer from Israel.

My question:
I m trying to run a software (contains com objects and multithreaded) which were written in WIN NT, on Windows 2000.
When I m run it with within the msdev(by pressing the F5 key), it’s running.
But, if I m trying to run the executable file, it fails in mode debug and release as follow:
1.     Mode debug: I m using the “MsgWaitForMultipleObjects” API function which I pass it an array of handles I have created. The ret code from this function is ok when it receives messages from the queue. But for the handles array the ret code is –1. I used the “GetLastError” function to figure out what is the problem and the message was: “Handle is invalid”. My question is: why the handle is valid when I m run the software through the msdev environment and invalid if I run the executable file from the explorer.
2.     Release mode: I have exception immediately after I m using the “PostThreadMessage” function.

Thanks for your help!
Avatar of jhance
jhance

One (or more) of your handles being passed to WaitForMultipleObjects() is probably NOT getting initialized.  You realize, I hope, that in DEBUG mode, there is really no such thing as an unititialized variable since the DEBUG library initializes everything for its own purposes.

So when you run DEBUG code OUTSIDE the debugger, you never get a truly uninitialized pointer or handle.  In RELEASE mode, you do and you get a crash.

Check the SOURCE of ALL of your HANDLES passed to WaitFor... and find out which one or ones you are neglecting to init.  That should do it...
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial