From 3c0a7e515447a43531fc864440f0676d319c3c91 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 25 Aug 2012 17:34:01 -0500 Subject: [PATCH] ntfs-capture.c Stub for ntfs_add_image_from_ntfs_volume(). --- Makefile.am | 1 + src/ntfs-capture.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++ src/wimlib.h | 6 ++++ 3 files changed, 84 insertions(+) create mode 100644 src/ntfs-capture.c diff --git a/Makefile.am b/Makefile.am index 5d2d00e8..5a41cf95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,7 @@ libwim_la_SOURCES = \ src/modify.c \ src/mount.c \ src/ntfs-apply.c \ + src/ntfs-capture.c \ src/resource.c \ src/security.c \ src/security.h \ diff --git a/src/ntfs-capture.c b/src/ntfs-capture.c new file mode 100644 index 00000000..66b78c00 --- /dev/null +++ b/src/ntfs-capture.c @@ -0,0 +1,77 @@ +/* + * ntfs-capture.c + * + * Capture a WIM image from a NTFS volume. We capture everything we can, + * including security data and alternate data streams. There should be no loss + * of information. + */ + +/* + * Copyright (C) 2012 Eric Biggers + * + * This file is part of wimlib, a library for working with WIM files. + * + * wimlib is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with wimlib; if not, see http://www.gnu.org/licenses/. + */ + +#include "config.h" +#include "wimlib_internal.h" + + +#ifdef WITH_NTFS_3G +#include "dentry.h" +#include "lookup_table.h" +#include "io.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +WIMLIBAPI int wimlib_add_image_from_ntfs_volume(WIMStruct *w, + const char *device, + const char *name, + const char *description, + const char *flags_element, + int flags) +{ + int ret; + + if (!device) + return WIMLIB_ERR_INVALID_PARAM; + if (flags & (WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE)) { + ERROR("Cannot dereference files when capturing directly from NTFS"); + return WIMLIB_ERR_INVALID_PARAM; + } + return 0; +} + +#else /* WITH_NTFS_3G */ +WIMLIBAPI int wimlib_add_image_from_ntfs_volume(WIMStruct *w, + const char *device, + const char *name, + const char *description, + const char *flags_element, + int flags) +{ + ERROR("wimlib was compiled without support for NTFS-3g, so"); + ERROR("we cannot capture a WIM image directly from a NTFS volume"); + return WIMLIB_ERR_UNSUPPORTED; +} +#endif /* WITH_NTFS_3G */ diff --git a/src/wimlib.h b/src/wimlib.h index a379a42f..928f2401 100644 --- a/src/wimlib.h +++ b/src/wimlib.h @@ -408,6 +408,12 @@ extern int wimlib_add_image(WIMStruct *wim, const char *dir, const char *name, const char *description, const char *flags_element, int flags); +extern int wimlib_add_image_from_ntfs_volume(WIMStruct *w, const char *device, + const char *name, + const char *description, + const char *flags_element, + int flags); + extern int wimlib_apply_image_to_ntfs_volume(WIMStruct *w, int image, const char *device, int flags); -- 2.43.0