Save the Win32 error code where necessary