]> wimlib.net Git - wimlib/blobdiff - src/wimlib_internal.h
refactor reparse point code; Win32: working extract rpfix
[wimlib] / src / wimlib_internal.h
index 1dfc43674cf3679bbfd569dfcf6827ee3a397586..4650f4d6c1c093e851388c3097128da858f6e7dc 100644 (file)
@@ -601,6 +601,73 @@ extern int
 do_ntfs_umount(struct _ntfs_volume *vol);
 #endif
 
 do_ntfs_umount(struct _ntfs_volume *vol);
 #endif
 
+/* reparse.c */
+
+/* Structured format for symbolic link, junction point, or mount point reparse
+ * data. */
+struct reparse_data {
+       /* Reparse point tag (see WIM_IO_REPARSE_TAG_* values) */
+       u32 rptag;
+
+       /* Length of reparse data, not including the 8-byte header (ReparseTag,
+        * ReparseDataLength, ReparseReserved) */
+       u16 rpdatalen;
+
+       /* ReparseReserved */
+       u16 rpreserved;
+
+       /* Flags (only for WIM_IO_REPARSE_TAG_SYMLINK reparse points).
+        * SYMBOLIC_LINK_RELATIVE means this is a relative symbolic link;
+        * otherwise should be set to 0. */
+#define SYMBOLIC_LINK_RELATIVE 0x00000001
+       u32 rpflags;
+
+       /* Pointer to the substitute name of the link (UTF-16LE). */
+       utf16lechar *substitute_name;
+
+       /* Pointer to the print name of the link (UTF-16LE). */
+       utf16lechar *print_name;
+
+       /* Number of bytes of the substitute name, not including null terminator
+        * if present */
+       u16 substitute_name_nbytes;
+
+       /* Number of bytes of the print name, not including null terminator if
+        * present */
+       u16 print_name_nbytes;
+};
+
+enum {
+       SUBST_NAME_IS_RELATIVE_LINK = -1,
+       SUBST_NAME_IS_VOLUME_JUNCTION = -2,
+       SUBST_NAME_IS_UNKNOWN = -3,
+};
+extern int
+parse_substitute_name(const utf16lechar *substitute_name,
+                     u16 substitute_name_nbytes,
+                     u32 rptag);
+
+extern int
+parse_reparse_data(const u8 *rpbuf, u16 rpbuflen, struct reparse_data *rpdata);
+
+extern int
+make_reparse_buffer(const struct reparse_data *rpdata, u8 *buf);
+
+extern int
+wim_inode_get_reparse_data(const struct wim_inode *inode, u8 *rpbuf);
+
+#ifndef __WIN32__
+ssize_t
+wim_inode_readlink(const struct wim_inode *inode, char *buf, size_t buf_len);
+
+extern int
+wim_inode_set_symlink(struct wim_inode *inode, const char *target,
+                     struct wim_lookup_table *lookup_table);
+#endif
+extern tchar *
+fixup_symlink(tchar *dest, u64 capture_root_ino, u64 capture_root_dev);
+
+
 /* resource.c */
 
 #define WIMLIB_RESOURCE_FLAG_RAW               0x1
 /* resource.c */
 
 #define WIMLIB_RESOURCE_FLAG_RAW               0x1
@@ -663,21 +730,6 @@ write_security_data(const struct wim_security_data *sd, u8 *p);
 extern void
 free_security_data(struct wim_security_data *sd);
 
 extern void
 free_security_data(struct wim_security_data *sd);
 
-/* symlink.c */
-
-#ifndef __WIN32__
-ssize_t
-inode_readlink(const struct wim_inode *inode, char *buf, size_t buf_len,
-              const WIMStruct *w, bool threadsafe);
-
-extern int
-inode_set_symlink(struct wim_inode *inode, const char *target,
-                 struct wim_lookup_table *lookup_table,
-                 struct wim_lookup_table_entry **lte_ret);
-#endif
-extern tchar *
-fixup_symlink(tchar *dest, u64 capture_root_ino, u64 capture_root_dev);
-
 /* verify.c */
 
 extern int
 /* verify.c */
 
 extern int