|
Hi, my application terminated itself suddenly without any error messages even in VC debug enviroment. Sometimes it cause the PC restarted.
How to find the bug and solve this problem?
The platform is Windows 2000 Professional. And it is developed with Visual C++ 6.0 and Visual Basic 6.0. The user interface is developed with VB. And a dll is with VC.
Thanks
|
|
|
|
|
Faulty memory, this can cause spontanouse reboots and programs crashing with oany apparent reason.
|
|
|
|
|
This can happen with a simple stack 'overrun'.
Lets say you have a function with a char buf[20]; declaration. Then, you copy more than 20 chars to that array - you will overwrite other stack data - possibly the return address of the function - with just such highly unpredictable results.
|
|
|
|
|
I'd guess stack overrun too - its fairly easy to do, and can happen if you pass bad values to some windows functions.
Step through your program when you get to the 'bad' area (or use logging, with a flush after each write to your log file) and check carefully around the last thing you did.
Check for mismatched parameters on your Calls to the DLLs - its a risk area.
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
Hey Guys
Heres a problem for you guys, I have a shell extension i have written and i have a function that calls another function. When the called function returns it will crash explorer, but if i have an AfxMessageBox pop up in the called function then it doesn't crash explorer and the shell extension works fine. Does anyone have any idea whats going on or is it a WinXP bug.
Peter
|
|
|
|
|
Okay a quick amendment. It doesn't have to be an AfxMessageBox a MessageBox called in the called function stops it crashing as well. I must say this problem has completely confused me.
Oh by the way this works fine in ME,98 and 2K
Peter
|
|
|
|
|
I have a class that I am creating for general purpose Sockets class since I am not using MFC in my project. One of my functions on the server end is a called thread that has the accept() in it.
<br />
long ListenThread()<br />
{<br />
m_dwThreadCount++;<br />
m_bActive = true;<br />
<br />
while (m_bActive)<br />
{<br />
if ((m_sockListener = accept(m_socket, NULL, NULL)) == INVALID_SOCKET)<br />
{<br />
ATLTRACE("Error accepting client.\n");<br />
m_dwError = 1;<br />
}<br />
else {<br />
ATLTRACE("Connection accepted.\n");<br />
}<br />
}<br />
<br />
m_dwThreadCount--;<br />
<br />
return 0;<br />
}<br />
Anytime there is a connection accept() stops blocking and I do some work then based on m_bActive the loop starts again. Later in my code I have a function that sets m_bActive to false and trys to shutdown and close the socket. Since I have added the shutdown() with the closesocket(), accept() will stop blocking. A problem arises when I create the thread multiple times. Eventually something doesn't come back. Is there another way to get accept() to come back so I can gracefully terminate the thread and the object?
Thanks,
Clint
|
|
|
|
|
Try faking a connection on the local loopback (in your code, connect to 127.0.0.1 on the listening port). That should kick the accept into awareness, and you can take from there.
Kudos to Pr3zB0y and Tr0yB0y at DS for this one.
|
|
|
|
|
|
Hey. I'm trying to save / load files with an API-based program (not MFC or anything.) I've always used <fstream.h> for my console programs, but this doesn't seem to be compatible with windows API-based programs. ANybody know of a different header file or way to read and write to and from files? Thanks - Dave
|
|
|
|
|
oops...it got cut out in the last post because I had something in brackets...where I say "I always used for console" its supposed to be "I always used fstream.h for console-based programs"....yeah...
|
|
|
|
|
Use CreateFile, WriteFile and CloseHandle
Nish
a small sample goes below :-
HANDLE b=CreateFile(fpath,GENERIC_WRITE,0,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_HIDDEN,NULL);
sprintf(outbuff,"Hello World\r\n");
WriteFile(b,outbuff,strlen(outbuff),&count,0);
CloseHandle(b);
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
I see...what would &count be in this place? And what is the command for reading from a file...I'm guessing ReadFile().
|
|
|
|
|
put this before the code
DWORD count
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hello everyone,
I hope someone can help me! Recall that DoDataExchange is defined like this:
void CMyDlg::DoDataExchange(CDataExchange* pDX)
In my program, pDX is always garbage! For every single dialog in the program, every time it's called! This did not happen on my home computer but now I'm trying to run my application on a different computer and this is happening.
Any ideas? Naturally it leads to chaos, once the DDX routines start being called.
If anyone can help, I will be very grateful.
best regards,
Stephen Wilson
|
|
|
|
|
I have the good old problem of mixing ressource of DLL and main application.
Does anyone has a simple solution other than playing all the time with AfxGetRessource, AfxSetRessource, etc...
Jonathan de Halleux, Belgium.
|
|
|
|
|
Create a class where in constructor You will set new resource handler, and in destructor You will set the old one. You may want to override DoModal method (in case of dialogs of course). You may also include resource dll in CDynLinkLibrary - create "fully MFC" library. In such case, MFC will search for resource itself.
|
|
|
|
|
Thanks for the tip.
What about modeless dialogs ?
Jonathan de Halleux, Belgium.
|
|
|
|
|
Hi
This is a serious bug, could not find whether it has been discussed before.
Try this:
#include <stdio.h>
void main(void)
{
printf("\t\t\b\b\b");
}
Be warned it will restart your windows 2000 or XP machine.
Does anyone know why?
it's sure quicker than any other windows reset procedure that i've seen
cheers
Optic
|
|
|
|
|
There has been a couple of threads about it in here...
It's a known bug, and AFAIK there's also a hot-fix for it...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Does Service Pack 2 fix this problem?
I hope so
|
|
|
|
|
SP2 does not fix the program.
But if you crash you system running the program, who's fault is that.
The bug is stupid, but really can't do much to you.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
But if you crash you system running the program, who's fault is that.
The fault is clearly Microsofts. No user-mode program (not excercising Administrator rights) should obviously be allowed to take down the whole system, especially not in this uncontrolled way.
|
|
|
|
|
Hi, This is very confusing to me. I am getting a run time error while running my debug version of the program, please take a look at the message and see if you understand it and explain it to me in plainer english. Thank you.
<br />
Debug Error!<br />
File: i386\chkesp.c<br />
Line: 42<br />
<br />
The value of ESP was not properly saved across a function call. This is usually result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.<br />
|
|
|
|
|