0
votes

I am trying to use a function that requires a DWORD.

These are the specs:

dwFileOffsetHigh [in]

A high-order DWORD of the file offset where the view begins. dwFileOffsetLow [in]

A low-order DWORD of the file offset where the view is to begin. The combination of the high and low offsets must specify an offset within the file mapping. They must also match the memory allocation granularity of the system. That is, the offset must be a multiple of the allocation granularity. To obtain the memory allocation granularity of the system, use the GetSystemInfo function, which fills in the members of a SYSTEM_INFO structure.

The function fails for me with the error incorrect parameter.

unsigned long lByteStart=200959959;
unsigned long lByteLen=66964224;

MapViewOfFile( *phMapping, FILE_MAP_READ, 0, lByteStart, lByteLen );

I did not care about high or low or low because I did not understand it and simply hoped it would work.

Now that it doesn't work, could somebody perhaps tell me what I did wrong and what I need to do to do it correctly?

1

1 Answers

3
votes

The problem isn't the high/low part, you did that right. The problem is that 'the offset must be a multiple of the allocation granularity'. I don't think yours is.

A typical value for the allocation granularity is 4096 although you should check what it is on your system, as the quote says.