ntfs-capture.c
[wimlib] / src / ntfs-capture.c
1 /*
2  * ntfs-capture.c
3  *
4  * Capture a WIM image from a NTFS volume.  We capture everything we can,
5  * including security data and alternate data streams.  There should be no loss
6  * of information.
7  */
8
9 /*
10  * Copyright (C) 2012 Eric Biggers
11  *
12  * This file is part of wimlib, a library for working with WIM files.
13  *
14  * wimlib is free software; you can redistribute it and/or modify it under the
15  * terms of the GNU Lesser General Public License as published by the Free
16  * Software Foundation; either version 2.1 of the License, or (at your option)
17  * any later version.
18  *
19  * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
20  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21  * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
22  * details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with wimlib; if not, see http://www.gnu.org/licenses/.
26  */
27
28 #include "config.h"
29 #include "wimlib_internal.h"
30
31
32 #ifdef WITH_NTFS_3G
33 #include "dentry.h"
34 #include "lookup_table.h"
35 #include "io.h"
36 #include <ntfs-3g/layout.h>
37 #include <ntfs-3g/acls.h>
38 #include <ntfs-3g/attrib.h>
39 #include <ntfs-3g/misc.h>
40 #include <ntfs-3g/reparse.h>
41 #include <ntfs-3g/security.h>
42 #include <ntfs-3g/volume.h>
43 #include <stdlib.h>
44 #include <unistd.h>
45
46
47 WIMLIBAPI int wimlib_add_image_from_ntfs_volume(WIMStruct *w,
48                                                 const char *device,
49                                                 const char *name,
50                                                 const char *description,
51                                                 const char *flags_element,
52                                                 int flags)
53 {
54         int ret;
55
56         if (!device)
57                 return WIMLIB_ERR_INVALID_PARAM;
58         if (flags & (WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE)) {
59                 ERROR("Cannot dereference files when capturing directly from NTFS");
60                 return WIMLIB_ERR_INVALID_PARAM;
61         }
62         return 0;
63 }
64
65 #else /* WITH_NTFS_3G */
66 WIMLIBAPI int wimlib_add_image_from_ntfs_volume(WIMStruct *w,
67                                                 const char *device,
68                                                 const char *name,
69                                                 const char *description,
70                                                 const char *flags_element,
71                                                 int flags)
72 {
73         ERROR("wimlib was compiled without support for NTFS-3g, so");
74         ERROR("we cannot capture a WIM image directly from a NTFS volume");
75         return WIMLIB_ERR_UNSUPPORTED;
76 }
77 #endif /* WITH_NTFS_3G */