prim.name.subject = dentry;
prim.name.old_name = dentry->file_name;
ret = record_update_primitive(j, prim);
- if (ret)
+ if (ret) {
+ FREE(new_name);
return ret;
+ }
dentry->file_name = new_name;
dentry->file_name_nbytes = new_name_nbytes;
if (ret)
goto out;
- ret = init_sd_set(sd_set, wim_security_data(wim));
+ ret = init_sd_set(sd_set, wim_get_current_security_data(wim));
if (ret)
goto out_destroy_inode_table;
if (!is_entire_image) {
if (add_flags & WIMLIB_ADD_FLAG_NTFS) {
- ERROR("Cannot add directly from a NTFS volume "
+ ERROR("Cannot add directly from an NTFS volume "
"when not capturing a full image!");
return WIMLIB_ERR_INVALID_PARAM;
}
out:
return ret;
}
+
+static int
+update1(WIMStruct *wim, int image, const struct wimlib_update_command *cmd)
+{
+ return wimlib_update_image(wim, image, cmd, 1, 0, NULL);
+}
+
+WIMLIBAPI int
+wimlib_delete_path(WIMStruct *wim, int image,
+ const tchar *path, int delete_flags)
+{
+ struct wimlib_update_command cmd;
+
+ cmd.op = WIMLIB_UPDATE_OP_DELETE;
+ cmd.delete_.wim_path = (tchar *)path;
+ cmd.delete_.delete_flags = delete_flags;
+
+ return update1(wim, image, &cmd);
+}
+
+WIMLIBAPI int
+wimlib_rename_path(WIMStruct *wim, int image,
+ const tchar *source_path, const tchar *dest_path)
+{
+ struct wimlib_update_command cmd;
+
+ cmd.op = WIMLIB_UPDATE_OP_RENAME;
+ cmd.rename.wim_source_path = (tchar *)source_path;
+ cmd.rename.wim_target_path = (tchar *)dest_path;
+ cmd.rename.rename_flags = 0;
+
+ return update1(wim, image, &cmd);
+}
+
+WIMLIBAPI int
+wimlib_add_tree(WIMStruct *wim, int image,
+ const tchar *fs_source_path, const tchar *wim_target_path,
+ int add_flags)
+{
+ struct wimlib_update_command cmd;
+
+ cmd.op = WIMLIB_UPDATE_OP_ADD;
+ cmd.add.fs_source_path = (tchar *)fs_source_path;
+ cmd.add.wim_target_path = (tchar *)wim_target_path;
+ cmd.add.add_flags = add_flags;
+ cmd.add.config_file = NULL;
+
+ return update1(wim, image, &cmd);
+}