Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CoMaNdore

Strange Unhandled execption...

This topic is 5539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Unhandled exception at 0x77f966bc in SDLOGL_Engine.exe: 0xC0000022: } A process has requested access to an object, but has not been granted those access rights. this is the error that occurs even after i have commented out the entire main() function. like: int main(int argc, char *argv[]) { /* code here */ } and i am posetive that the error occures AFTER the end of main() any ideas on what i can look for *the thing i have to fix* ? and what does the error meen ?

Share this post


Link to post
Share on other sites
Advertisement
That tended to happen to me when I had linking problems; ie linking with the wrong CRT, or linking with some strange parameters.

Strangely, only a re-build of the project file (delete the .VCPROJ or the .MAK and make it from scratch again) seemed to get rid of it, so I never found out what the error was. And I hadn''t modified the linker options, anyways...

Share this post


Link to post
Share on other sites
Okay i tryed your idea now i get this error:



Unhandled exception at 0x77f966bc in DE_Engine.exe: 0xC0000008:
An invalid HANDLE was specified.



what can does this meen ?

Share this post


Link to post
Share on other sites
did some more width the debuger and the error is located here:

and im posetive that its after the last instruction in my main() loop


int __cdecl fclose (
FILE *stream
)
{
int result = EOF;

_ASSERTE(stream != NULL);

/* If stream is a string, simply clear flag and return EOF */
if (stream->_flag & _IOSTRG)
stream->_flag = 0; /* IS THIS REALLY NEEDED ??? */

/* Stream is a real file. */
else {
_lock_str(stream); // < - HERE IS THE ERROR !
__try {
result = _fclose_lk(stream);
}
__finally {
_unlock_str(stream);
}
}

return(result);
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You''re crashing in the C Runtime Library''s "fclose()", so it might be that a file is closed twice. Check that all fopen and fclose matches.

How does your call stack look at the moment of crash (debug menu, windows, "call stack"? It seems like you''re using VS.Net, so set the debugger to break on all execptions (debug menu, execptions, select win32 exceptions and set "when an exception is thrown" to "break into debugger" and run until you stop at the moment of crash.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Wouldn''t it be nice with a checkbox "No smileys in this post please"? ;-)

Share this post


Link to post
Share on other sites
stack:
ntdll.dll!77f966bc() // here is the yellow arrow
ntdll.dll!77f6a045()
ntdll.dll!77f5b2e6()
> msvcr70d.dll!fclose(_iobuf * stream=0x7c049588) Line 56 + 0x9 C // here is green arrow
DE_Engine.exe!_main() + 0x1b5 C
msvcr70d.dll!doexit(int code=, int quick=, int retcaller=) Line 366 C



Also i found out that if i comment out the ONLY function that i have that uses the fclose() i dont get the crash i cant understand why tho ... so im posting it here :


uint GTextureHandler::LoadTexture(const char *pszFile, int iTex )
{

t_Texture* tex = PopTexture();

FILE *fp;
BITMAPFILEHEADER bitmapFileHeader;
BITMAPINFOHEADER bitmapInfoHeader;
uint imageIdx = 0;
uchar tmpRGB;

fp = fopen(pszFile, "rb");
if (fp == NULL)
{
MsgBoxE("Missing texture file. \n Aborting " );
GQuit();
return( NULL );
}

fread(&bitmapFileHeader, sizeof(BITMAPFILEHEADER), 1, fp);

if (bitmapFileHeader.bfType != BMP_IMAGE_ID)
{
MsgBoxE("Wrong bmp type" );
fclose(fp);
return( NULL );
}

fread( &bitmapInfoHeader, sizeof(BITMAPINFOHEADER), 1, fp );
fseek( fp, bitmapFileHeader.bfOffBits, SEEK_SET );


tex->pData = (unsigned char*)malloc( bitmapInfoHeader.biSizeImage );
if( tex->pData == NULL )
{
MsgBoxE("Error allocatin memory for image" );
free( tex->pData );
fclose(fp);
return( NULL );
}


fread( tex->pData, 1, bitmapInfoHeader.biSizeImage, fp);
if( tex->pData == NULL)
{
MsgBoxE("ERROR: Cant read the img correctly" );
fclose( fp );
return( NULL );
}

for (imageIdx = 0; imageIdx < bitmapInfoHeader.biSizeImage; imageIdx+=3)
{
tmpRGB = tex->pData[imageIdx];
tex->pData[imageIdx] = tex->pData[imageIdx + 2];
tex->pData[imageIdx + 2] = tmpRGB;
}

fclose( fp );

tex->bUsed = true;
glGenTextures(1, &tex->iTex);
glBindTexture(GL_TEXTURE_2D,tex->iTex);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth,
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, tex->pData);

g_Textures[iTex] = tex->iTex;
/**/
return( iTex );
}


[edited by - CoMaNdore on August 16, 2003 11:33:41 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!