SetLastError(ERROR_FILE_NOT_FOUND); instead of errono=ENOENT; SetLastError(ERROR_INVALID_DATA); instead of errno=EINVAL;