added win32 terminal handler
minimal win32 compatibility shims