+ * wimlib_overwrite() sets this by default, since the WIM remains, logically,
+ * the same file.
+ */
+#define WIMLIB_WRITE_FLAG_RETAIN_GUID 0x00000800
+
+/**
+ * When writing streams in the resulting WIM file, pack multiple streams into a
+ * single compressed resource instead of compressing them independently. This
+ * is also known as creating a "solid archive". This tends to produce a better
+ * compression ratio at the cost of much slower random access.
+ *
+ * WIM files created with this flag are only compatible with wimlib v1.6.0 or
+ * later, WIMGAPI Windows 8 or later, and DISM Windows 8.1 or later. WIM files
+ * created with this flag use a different version number in their header (3584
+ * instead of 68864) and are also called "ESD files".
+ *
+ * If this flag is passed to wimlib_overwrite(), any new data streams will be
+ * written in solid mode. Use both ::WIMLIB_WRITE_FLAG_REBUILD and
+ * ::WIMLIB_WRITE_FLAG_RECOMPRESS to force the entire WIM file be rebuilt with
+ * all streams recompressed in solid mode.
+ *
+ * Currently, new solid blocks will, by default, be written using LZMS
+ * compression with 64 MiB (67108864 byte) chunks. Use
+ * wimlib_set_output_pack_compression_type() and/or
+ * wimlib_set_output_pack_chunk_size() to change this. This is independent of
+ * the WIM's main compression type and chunk size; you can have a WIM that
+ * nominally uses LZX compression and 32768 byte chunks but actually contains
+ * LZMS-compressed solid blocks, for example. However, if including solid
+ * blocks, I suggest that you set the WIM's main compression type to LZMS as
+ * well, either by creating the WIM with
+ * ::wimlib_create_new_wim(::WIMLIB_COMPRESSION_TYPE_LZMS, ...) or by calling
+ * ::wimlib_set_output_compression_type(..., ::WIMLIB_COMPRESSION_TYPE_LZMS).
+ *
+ * This flag will be set by default when writing or overwriting a WIM file that
+ * either already contains packed streams, or has had packed streams exported
+ * into it and the WIM's main compression type is LZMS.
+ */
+#define WIMLIB_WRITE_FLAG_PACK_STREAMS 0x00001000
+
+/** @} */
+/** @ingroup G_general
+ * @{ */
+
+/** Assume that strings are represented in UTF-8, even if this is not the
+ * locale's character encoding. This flag is ignored on Windows, where wimlib
+ * always uses UTF-16LE. */
+#define WIMLIB_INIT_FLAG_ASSUME_UTF8 0x00000001
+
+/** Windows-only: do not attempt to acquire additional privileges (currently
+ * SeBackupPrivilege, SeRestorePrivilege, SeSecurityPrivilege, and
+ * SeTakeOwnershipPrivilege) when initializing the library. This is intended
+ * for the case where the calling program manages these privileges itself.
+ * Note: no error is issued if privileges cannot be acquired, although related
+ * errors may be reported later, depending on if the operations performed
+ * actually require additional privileges or not. */
+#define WIMLIB_INIT_FLAG_DONT_ACQUIRE_PRIVILEGES 0x00000002
+
+/** Windows only: If ::WIMLIB_INIT_FLAG_DONT_ACQUIRE_PRIVILEGES not specified,
+ * return ::WIMLIB_ERR_INSUFFICIENT_PRIVILEGES if privileges that may be needed
+ * to read all possible data and metadata for a capture operation could not be
+ * acquired. Can be combined with ::WIMLIB_INIT_FLAG_STRICT_APPLY_PRIVILEGES.
+ */
+#define WIMLIB_INIT_FLAG_STRICT_CAPTURE_PRIVILEGES 0x00000004
+
+/** Windows only: If ::WIMLIB_INIT_FLAG_DONT_ACQUIRE_PRIVILEGES not specified,
+ * return ::WIMLIB_ERR_INSUFFICIENT_PRIVILEGES if privileges that may be needed
+ * to restore all possible data and metadata for an apply operation could not be
+ * acquired. Can be combined with ::WIMLIB_INIT_FLAG_STRICT_CAPTURE_PRIVILEGES.
+ */
+#define WIMLIB_INIT_FLAG_STRICT_APPLY_PRIVILEGES 0x00000008
+
+/** Default to interpreting WIM paths case sensitively (default on UNIX-like
+ * systems). */
+#define WIMLIB_INIT_FLAG_DEFAULT_CASE_SENSITIVE 0x00000010
+
+/** Default to interpreting WIM paths case insensitively (default on Windows).
+ * This does not apply to mounted images. */
+#define WIMLIB_INIT_FLAG_DEFAULT_CASE_INSENSITIVE 0x00000020
+
+/** @} */
+/** @ingroup G_nonstandalone_wims
+ * @{ */
+
+/** For wimlib_reference_resource_files(), enable shell-style filename globbing.
+ * Ignored by wimlib_reference_resources(). */
+#define WIMLIB_REF_FLAG_GLOB_ENABLE 0x00000001
+
+/** For wimlib_reference_resource_files(), issue an error
+ * (::WIMLIB_ERR_GLOB_HAD_NO_MATCHES) if a glob did not match any files. The
+ * default behavior without this flag is to issue no error at that point, but
+ * then attempt to open the glob as a literal path, which of course will fail
+ * anyway if no file exists at that path. No effect if
+ * ::WIMLIB_REF_FLAG_GLOB_ENABLE is not also specified. Ignored by
+ * wimlib_reference_resources(). */
+#define WIMLIB_REF_FLAG_GLOB_ERR_ON_NOMATCH 0x00000002
+
+/** @} */
+/** @ingroup G_modifying_wims
+ * @{ */
+
+/** The specific type of update to perform. */
+enum wimlib_update_op {
+ /** Add a new file or directory tree to the WIM image in a
+ * certain location. */
+ WIMLIB_UPDATE_OP_ADD = 0,
+
+ /** Delete a file or directory tree from the WIM image. */
+ WIMLIB_UPDATE_OP_DELETE,
+
+ /** Rename a file or directory tree in the WIM image. */
+ WIMLIB_UPDATE_OP_RENAME,
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_ADD operation. */
+struct wimlib_add_command {
+ /** Filesystem path to the file or directory tree to add. */
+ wimlib_tchar *fs_source_path;
+
+ /** Destination path in the WIM image. Use ::WIMLIB_WIM_ROOT_PATH to
+ * specify the root directory of the WIM image. */
+ wimlib_tchar *wim_target_path;
+
+ /** Path to capture configuration file to use, or @c NULL for default.
+ */
+ wimlib_tchar *config_file;
+
+ /** Bitwise OR of WIMLIB_ADD_FLAG_* flags. */
+ int add_flags;
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_DELETE operation. */
+struct wimlib_delete_command {
+
+ /** Path, specified from the root of the WIM image, for the file or
+ * directory tree within the WIM image to be deleted. */
+ wimlib_tchar *wim_path;
+
+ /** Bitwise OR of WIMLIB_DELETE_FLAG_* flags. */
+ int delete_flags;
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_RENAME operation. */
+struct wimlib_rename_command {
+
+ /** Path, specified from the root of the WIM image, for the source file
+ * or directory tree within the WIM image. */
+ wimlib_tchar *wim_source_path;
+
+ /** Path, specified from the root of the WIM image, for the destination
+ * file or directory tree within the WIM image. */
+ wimlib_tchar *wim_target_path;
+
+ /** Reserved; set to 0. */
+ int rename_flags;
+};
+
+/** Specification of an update to perform on a WIM image. */
+struct wimlib_update_command {
+
+ enum wimlib_update_op op;
+
+ union {
+ struct wimlib_add_command add;
+ struct wimlib_delete_command delete_; /* Underscore is for C++
+ compatibility. */
+ struct wimlib_rename_command rename;
+ };
+};
+
+/** @} */
+/** @ingroup G_general
+ * @{ */
+
+/**
+ * Possible values of the error code returned by many functions in wimlib.
+ *
+ * See the documentation for each wimlib function to see specifically what error
+ * codes can be returned by a given function, and what they mean.
+ */
+enum wimlib_error_code {
+ WIMLIB_ERR_SUCCESS = 0,
+ WIMLIB_ERR_ALREADY_LOCKED = 1,
+ WIMLIB_ERR_DECOMPRESSION = 2,
+ WIMLIB_ERR_FUSE = 6,
+ WIMLIB_ERR_GLOB_HAD_NO_MATCHES = 8,
+ WIMLIB_ERR_ICONV_NOT_AVAILABLE = 9,
+ WIMLIB_ERR_IMAGE_COUNT = 10,
+ WIMLIB_ERR_IMAGE_NAME_COLLISION = 11,
+ WIMLIB_ERR_INSUFFICIENT_PRIVILEGES = 12,
+ WIMLIB_ERR_INTEGRITY = 13,
+ WIMLIB_ERR_INVALID_CAPTURE_CONFIG = 14,
+ WIMLIB_ERR_INVALID_CHUNK_SIZE = 15,
+ WIMLIB_ERR_INVALID_COMPRESSION_TYPE = 16,
+ WIMLIB_ERR_INVALID_HEADER = 17,
+ WIMLIB_ERR_INVALID_IMAGE = 18,
+ WIMLIB_ERR_INVALID_INTEGRITY_TABLE = 19,
+ WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY = 20,
+ WIMLIB_ERR_INVALID_METADATA_RESOURCE = 21,
+ WIMLIB_ERR_INVALID_MULTIBYTE_STRING = 22,
+ WIMLIB_ERR_INVALID_OVERLAY = 23,
+ WIMLIB_ERR_INVALID_PARAM = 24,
+ WIMLIB_ERR_INVALID_PART_NUMBER = 25,
+ WIMLIB_ERR_INVALID_PIPABLE_WIM = 26,
+ WIMLIB_ERR_INVALID_REPARSE_DATA = 27,
+ WIMLIB_ERR_INVALID_RESOURCE_HASH = 28,
+ WIMLIB_ERR_INVALID_UTF16_STRING = 30,
+ WIMLIB_ERR_INVALID_UTF8_STRING = 31,
+ WIMLIB_ERR_IS_DIRECTORY = 32,
+ WIMLIB_ERR_IS_SPLIT_WIM = 33,
+ WIMLIB_ERR_LIBXML_UTF16_HANDLER_NOT_AVAILABLE = 34,
+ WIMLIB_ERR_LINK = 35,
+ WIMLIB_ERR_METADATA_NOT_FOUND = 36,
+ WIMLIB_ERR_MKDIR = 37,
+ WIMLIB_ERR_MQUEUE = 38,
+ WIMLIB_ERR_NOMEM = 39,
+ WIMLIB_ERR_NOTDIR = 40,
+ WIMLIB_ERR_NOTEMPTY = 41,
+ WIMLIB_ERR_NOT_A_REGULAR_FILE = 42,
+ WIMLIB_ERR_NOT_A_WIM_FILE = 43,
+ WIMLIB_ERR_NOT_PIPABLE = 44,
+ WIMLIB_ERR_NO_FILENAME = 45,
+ WIMLIB_ERR_NTFS_3G = 46,
+ WIMLIB_ERR_OPEN = 47,
+ WIMLIB_ERR_OPENDIR = 48,
+ WIMLIB_ERR_PATH_DOES_NOT_EXIST = 49,
+ WIMLIB_ERR_READ = 50,
+ WIMLIB_ERR_READLINK = 51,
+ WIMLIB_ERR_RENAME = 52,
+ WIMLIB_ERR_REPARSE_POINT_FIXUP_FAILED = 54,
+ WIMLIB_ERR_RESOURCE_NOT_FOUND = 55,
+ WIMLIB_ERR_RESOURCE_ORDER = 56,
+ WIMLIB_ERR_SET_ATTRIBUTES = 57,
+ WIMLIB_ERR_SET_REPARSE_DATA = 58,
+ WIMLIB_ERR_SET_SECURITY = 59,
+ WIMLIB_ERR_SET_SHORT_NAME = 60,
+ WIMLIB_ERR_SET_TIMESTAMPS = 61,
+ WIMLIB_ERR_SPLIT_INVALID = 62,
+ WIMLIB_ERR_STAT = 63,
+ WIMLIB_ERR_UNEXPECTED_END_OF_FILE = 65,
+ WIMLIB_ERR_UNICODE_STRING_NOT_REPRESENTABLE = 66,
+ WIMLIB_ERR_UNKNOWN_VERSION = 67,
+ WIMLIB_ERR_UNSUPPORTED = 68,
+ WIMLIB_ERR_UNSUPPORTED_FILE = 69,
+ WIMLIB_ERR_WIM_IS_READONLY = 71,
+ WIMLIB_ERR_WRITE = 72,
+ WIMLIB_ERR_XML = 73,
+ WIMLIB_ERR_WIM_IS_ENCRYPTED = 74,
+ WIMLIB_ERR_WIMBOOT = 75,
+ WIMLIB_ERR_ABORTED_BY_PROGRESS = 76,
+ WIMLIB_ERR_UNKNOWN_PROGRESS_STATUS = 77,
+ WIMLIB_ERR_MKNOD = 78,
+ WIMLIB_ERR_MOUNTED_IMAGE_IS_BUSY = 79,
+ WIMLIB_ERR_NOT_A_MOUNTPOINT = 80,
+ WIMLIB_ERR_NOT_PERMITTED_TO_UNMOUNT = 81,
+};
+
+
+/** Used to indicate no WIM image or an invalid WIM image. */
+#define WIMLIB_NO_IMAGE 0
+
+/** Used to specify all images in the WIM. */
+#define WIMLIB_ALL_IMAGES (-1)
+
+/** @} */
+
+/**
+ * @ingroup G_modifying_wims
+ *
+ * Appends an empty image to a WIM file. This empty image will initially
+ * contain no files or directories, although if written without further
+ * modifications, a root directory will be created automatically for it. After
+ * calling this function, you can use wimlib_update_image() to add files to the
+ * new WIM image. This gives you slightly more control over making the new
+ * image compared to calling wimlib_add_image() or
+ * wimlib_add_image_multisource() directly.
+ *
+ * @param wim
+ * Pointer to the ::WIMStruct for the WIM file to which the image is to be