Click to See Complete Forum and Search --> : problems with MapViewOfFile


Natali Levit
May 19th, 1999, 09:32 AM
the code :
short* sig = (short * ) MapViewOfFile (hCubeMapping,
FILE_MAP_COPY,
offset >> 32,
offset,
size);
works perfectly when offset = 0, but fails when offset is greater. I know that the offset must be a multiple of the allocation granularity (64K), but it returns NULL in any case. Please, help me to solve this problem

John Holifield
May 19th, 1999, 04:18 PM
Perhaps the problem is in your use of the Bitwise shift operator. I suspect that the dwFileOffsetHigh and dwFileOffsetLow aren't being set correctly. I think it works when offset is 0 because bit-shifting zero is still zero, however when you use a non-zero offset, the bitwise math is probably incorrect.

Good Luck.
John