Skip to main content
gamedev.net
🔒 Locked

Strange Unhandled execption...

Started by CoMaNdore 6 replies 1.4k views
Original Post
CoMaNdore
CoMaNdore
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 ?
Me
Wyrframe
Wyrframe
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...
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
CoMaNdore
CoMaNdore
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 ?
Me
CoMaNdore
CoMaNdore
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);
}
Me
CoMaNdore
CoMaNdore
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]
Me

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.