View Single Post
Old Feb 1st, 2008, 5:28 PM   #4
dr.p
Programmer
 
dr.p's Avatar
 
Join Date: Feb 2006
Location: Ohio
Posts: 93
Rep Power: 3 dr.p is on a distinguished road
Re: Read Access Violation

Quote:
Originally Posted by Salem View Post
A breakpoint on the fwrite call would be a start.
Then examine the variables in detail.
That was how I found the line where the problem occurred.

Quote:
Originally Posted by Salem View Post
> this only happens when the bitmap is less than 4x4 pixels in size!
Are you taking into account the various ways in which bitmap data is padded/aligned to 4-byte boundaries.
More or less. I'm reading in the bitmaps as a whole, based on the header information. I did a separate test on my bitmap library to see if the read function was causing the problem, and it's not. My test app reads in the same 1x1 256bpp bitmap and divulges the necessary info perfectly.

This problem is... very odd. The BMPPKGFILE pointer passed to the WriteBmpPkgFile is correct, and the data in the memory it points to is also correct.

And fwrite even fails if I do this instead:
  DWORD dwcount = lpBmpPkg->dwCount;
    // write the dwCount member
  fwrite(&dwcount, sizeof(DWORD), 1, outfile);

And this:
  DWORD dwcount = 0x01;  //lpBmpPkg->dwCount;
    // write the dwCount member
  fwrite(&dwcount, sizeof(DWORD), 1, outfile);

Strange, no?
__________________
Neeley.org
dr.p is offline   Reply With Quote