+ * @ingroup G_nonstandalone_wims
+ *
+ * Reference resources from other WIM files or split WIM parts. This function
+ * can be used on WIMs that are not standalone, such as split or "delta" WIMs,
+ * to load needed resources (that is, "streams" keyed by SHA1 message digest)
+ * from other files, before calling a function such as wimlib_extract_image()
+ * that requires the resources to be present.
+ *
+ * @param wim
+ * The ::WIMStruct for a WIM that contains metadata resources, but is not
+ * necessarily "standalone". In the case of split WIMs, this should be the
+ * first part, since only the first part contains the metadata resources.
+ * In the case of delta WIMs, this should be the delta WIM rather than the
+ * WIM on which it is based.
+ * @param resource_wimfiles_or_globs
+ * Array of paths to WIM files and/or split WIM parts to reference.
+ * Alternatively, when ::WIMLIB_REF_FLAG_GLOB_ENABLE is specified in @p
+ * ref_flags, these are treated as globs rather than literal paths. That
+ * is, using this function you can specify zero or more globs, each of
+ * which expands to one or more literal paths.
+ * @param count
+ * Number of entries in @p resource_wimfiles_or_globs.
+ * @param ref_flags
+ * Bitwise OR of ::WIMLIB_REF_FLAG_GLOB_ENABLE and/or
+ * ::WIMLIB_REF_FLAG_GLOB_ERR_ON_NOMATCH.
+ * @param open_flags
+ * Additional open flags, such as ::WIMLIB_OPEN_FLAG_CHECK_INTEGRITY, to
+ * pass to internal calls to wimlib_open_wim() on the reference files.
+ * @param progress_func
+ * Passed to internal calls to wimlib_open_wim() on the reference files.
+ *
+ * @return 0 on success; nonzero on error.
+ *
+ * @retval ::WIMLIB_ERR_GLOB_HAD_NO_MATCHES
+ * One of the specified globs did not match any paths (only with both
+ * ::WIMLIB_REF_FLAG_GLOB_ENABLE and ::WIMLIB_REF_FLAG_GLOB_ERR_ON_NOMATCH
+ * specified in @p ref_flags).
+ * @retval ::WIMLIB_ERR_NOMEM
+ * Failed to allocate memory.
+ * @retval ::WIMLIB_ERR_READ
+ * I/O or permissions error while processing a file glob.
+ *
+ * This function can additionally return most values that can be returned by
+ * wimlib_open_wim().
+ */
+extern int
+wimlib_reference_resource_files(WIMStruct *wim,
+ const wimlib_tchar * const *resource_wimfiles_or_globs,
+ unsigned count,
+ int ref_flags,
+ int open_flags,
+ wimlib_progress_func_t progress_func);
+
+/**
+ * @ingroup G_nonstandalone_wims
+ *
+ * Similar to wimlib_reference_resource_files(), but operates at a lower level
+ * where the caller must open the ::WIMStruct for each referenced file itself.
+ *
+ * @param wim
+ * The ::WIMStruct for a WIM that contains metadata resources, but is not
+ * necessarily "standalone". In the case of split WIMs, this should be the
+ * first part, since only the first part contains the metadata resources.
+ * @param resource_wims
+ * Array of pointers to the ::WIMStruct's for additional resource WIMs or
+ * split WIM parts to reference.
+ * @param num_resource_wims
+ * Number of entries in @p resource_wims.
+ * @param ref_flags
+ * Currently ignored (set to 0).
+ *
+ * @return 0 on success; nonzero on error. On success, the ::WIMStruct's of the
+ * @p resource_wims are referenced internally by @p wim and must not be freed
+ * with wimlib_free() or overwritten with wimlib_overwrite() until @p wim has
+ * been freed with wimlib_free(), or immediately before freeing @p wim with
+ * wimlib_free().
+ *
+ * @retval ::WIMLIB_ERR_INVALID_PARAM
+ * @p wim was @c NULL, or @p num_resource_wims was nonzero but @p
+ * resource_wims was @c NULL, or an entry in @p resource_wims was @p NULL.
+ * @retval ::WIMLIB_ERR_NOMEM
+ * Failed to allocate memory.
+ */
+extern int
+wimlib_reference_resources(WIMStruct *wim, WIMStruct **resource_wims,
+ unsigned num_resource_wims, int ref_flags);
+
+/**
+ * @ingroup G_modifying_wims
+ *
+ * Declares that a newly added image is mostly the same as a prior image, but
+ * captured at a later point in time, possibly with some modifications in the
+ * intervening time. This is designed to be used in incremental backups of the
+ * same filesystem or directory tree.
+ *
+ * This function compares the metadata of the directory tree of the newly added
+ * image against that of the old image. Any files that are present in both the
+ * newly added image and the old image and have timestamps that indicate they
+ * haven't been modified are deemed not to have been modified and have their
+ * SHA1 message digest copied from the old image. Because of this and because
+ * WIM uses single-instance streams, such files need not be read from the
+ * filesystem when the WIM is being written or overwritten. Note that these
+ * unchanged files will still be "archived" and will be logically present in the
+ * new image; the optimization is that they don't need to actually be read from
+ * the filesystem because the WIM already contains them.
+ *
+ * This function is provided to optimize incremental backups. The resulting WIM
+ * file will still be the same regardless of whether this function is called.
+ * (This is, however, assuming that timestamps have not been manipulated or
+ * unmaintained as to trick this function into thinking a file has not been
+ * modified when really it has. To partly guard against such cases, other
+ * metadata such as file sizes will be checked as well.)
+ *
+ * This function must be called after adding the new image (e.g. with
+ * wimlib_add_image()), but before writing the updated WIM file (e.g. with
+ * wimlib_overwrite()).
+ *
+ * @param wim
+ * Pointer to the ::WIMStruct for a WIM.
+ * @param new_image
+ * 1-based index in the WIM of the newly added image. This image can have
+ * been added with wimlib_add_image() or wimlib_add_image_multisource(), or
+ * wimlib_add_empty_image() followed by wimlib_update_image().
+ * @param template_wim
+ * The ::WIMStruct for the WIM containing the template image. This can be
+ * the same as @p wim, or it can be a different ::WIMStruct.
+ * @param template_image
+ * 1-based index in the WIM of a template image that reflects a prior state
+ * of the directory tree being captured.
+ * @param flags
+ * Reserved; must be 0.
+ * @param progress_func
+ * Currently ignored, but reserved for a function that will be called with
+ * information about the operation. Use NULL if no additional information
+ * is desired.
+ *
+ * @return 0 on success; nonzero on error.
+ *
+ * @retval ::WIMLIB_ERR_INVALID_IMAGE
+ * @p new_image and/or @p template_image were not a valid image indices in
+ * the WIM.
+ * @retval ::WIMLIB_ERR_METADATA_NOT_FOUND
+ * The specified ::WIMStruct did not actually contain the metadata resource
+ * for the new or template image; for example, it was a non-first part of a
+ * split WIM.
+ * @retval ::WIMLIB_ERR_NOMEM
+ * Failed to allocate needed memory.
+ * @retval ::WIMLIB_ERR_INVALID_PARAM
+ * @p new_image was equal to @p template_image, or @p new_image specified
+ * an image that had not been modified since opening the WIM.
+ *
+ * This function can additionally return ::WIMLIB_ERR_DECOMPRESSION,
+ * ::WIMLIB_ERR_INVALID_METADATA_RESOURCE, ::WIMLIB_ERR_METADATA_NOT_FOUND,
+ * ::WIMLIB_ERR_NOMEM, ::WIMLIB_ERR_READ, or
+ * ::WIMLIB_ERR_UNEXPECTED_END_OF_FILE, all of which indicate failure (for
+ * different reasons) to read the metadata resource for the template image.
+ */
+extern int
+wimlib_reference_template_image(WIMStruct *wim, int new_image,
+ WIMStruct *template_wim, int template_image,
+ int flags, wimlib_progress_func_t progress_func);
+
+/**
+ * @ingroup G_modifying_wims
+ *
+ * Rename the @p source_path to the @p dest_path in the specified @p image of
+ * the @p wim.
+ *
+ * This just builds an appropriate ::wimlib_rename_command and passes it to
+ * wimlib_update_image().