Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

msvcirt.dll having a cow

Status
Not open for further replies.

Panthaur

IS-IT--Management
Jul 26, 2002
78
US
Hi All,

I'm having a really weird problem with a program I am working on. I have a program that runs fine 2-3 times, and anytime after that, it gives me one of the Windows XP Dialog box saying that it must shut down my program. The program in question is a console mode app which does a few things. It reads data from an INI file, it asks the user for some input, it reads and writes registry information, it communicates with a small robotic platform on the parallel port, and eventually writes out an INI file again.

What I seem to be narrowing the problem down to is that the program has no problems operating properly if I turn the registry reading and writing functions off, but if I turn them on, then when it comes to the following statement:

ofile.open("file.ini");

I get a lovely XP "PROGRAM HAS CAUSED A PROBLEM, WANT TO SEND A REPORT TO MS?". I looked in the detail section of that dialog box, and this is the information in the detail section:

Error signature:
AppName: foot_control.exe (the name of my console mode app)
AppVer: 0.0.0.0
ModName: msvcirt.dll
ModVer: 7.0.2600.0
Offset: 00004a65

That's how I know that it's something with msvcirt.dll. Now, if I reboot my computer, then run it, it will work 2-3 mores times, then continue screwing up again.

PLEASE HELP!

Thanks,
Panthaur
 
In a way yes, but not directly related to the keymessage length (though I'm dead against hardcoding buffer length into applications - You should first query how much buffer you need, then allocate the proper amount).

Consider this:
* What if RegQueryValueEx returns an error? You still proceed with strcpy
* What if data in registry is more than bufferLength? (see snippet from MSDN above)

/Per

if (typos) cout << &quot;My fingers are faster than my brain. Sorry for the typos.&quot;;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top