Changed DOS extended error handling to be based on SetLastError;