+ int ret;
+ if (!output_dir)
+ return WIMLIB_ERR_INVALID_PARAM;
+ if ((flags & (WIMLIB_EXTRACT_FLAG_SYMLINK | WIMLIB_EXTRACT_FLAG_HARDLINK))
+ == (WIMLIB_EXTRACT_FLAG_SYMLINK | WIMLIB_EXTRACT_FLAG_HARDLINK))
+ return WIMLIB_ERR_INVALID_PARAM;
+
+ ret = set_output_dir(w, output_dir);
+ if (ret != 0)
+ return ret;
+
+ if ((flags & WIMLIB_EXTRACT_FLAG_NTFS)) {
+ #ifdef WITH_NTFS_3G
+ unsigned long mnt_flags;
+ ret = ntfs_check_if_mounted(output_dir, &mnt_flags);
+ if (ret != 0) {
+ ERROR_WITH_ERRNO("NTFS-3g: Cannot determine if `%s' "
+ "is mounted", output_dir);
+ return WIMLIB_ERR_NTFS_3G;
+ }
+ if (!(mnt_flags & NTFS_MF_MOUNTED)) {
+ ERROR("NTFS-3g: Filesystem on `%s' is not mounted ",
+ output_dir);
+ }
+ if (mnt_flags & NTFS_MF_READONLY) {
+ ERROR("NTFS-3g: Filesystem on `%s' is mounted "
+ "read-only", output_dir);
+ return WIMLIB_ERR_NTFS_3G;
+ }
+ #else
+ ERROR("wimlib was compiled without support for NTFS-3g, so");
+ ERROR("we cannot extract a WIM image while preserving NTFS-");
+ ERROR("specific information");
+ return WIMLIB_ERR_UNSUPPORTED;
+ #endif