port ProcessBuf to Windows (not finished)