Fix nasty foreign pointer issue which broke the stream cipher on Windows.