Andrew,
thank you very much for finding a bug in my code.
I'll have to meditate signed/unsigned conversions for the next months.
Perhaps it's my lack of familiarity with the MS-Windows API that had me not find a signed equivalent of UINT32. Indeed there's none in windef.h. So I choose 'long'. But now I see basestd.h defines LONG32.
INT64 is not appropriate. getbuf_last should be of the same size than the other frame holding types. I once wrote a patch to turn all #frame holding entities from UINT64 into 32. Please rewrite the patch to use the LONG32 type, then you'll need no surprising cast.
If the loss of 1 bit worries you, the solution IMHO is not to go to INT64 rather than prevent a duration that large in Initialize. In shared mode, there's no 2s limit. My tests opened a 10s buffer. I've not tested anything larger. LONG32 leaves enough room for 10000 seconds at 200000fps.
Regards, Jörg Höhle