Q:

python pywintypes.OVERLAPPED().Offset throws OverflowError

I have an overlapped object like:
overlapped = pywintypes.OVERLAPPED()
overlapped.hEvent = win32event.CreateEvent(None, 0, 0, None)

then i read it in the loop like:
ret, p = win32file.ReadFile(somefile, buffer, overlapped)
win32event.WaitForSingleObject(self.overlapped.hEvent, win32event.INFINITE)
overlapped.Offset = overlapped.Offset + len(p)

after some time it throws OverflowError: python int too large to conver to C long. I know its because the file is too large that overflows the Offset, which only holds max number of 2,147,483,647. so do we avoid this?

A:

Use your own offset variable to store the offset. When setting the structure you have to split between two variables.
Basically:
overlapped.Offset = offset & 0xffffffff
overlapped.OffsetHigh = offset >> 32

