X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flookup_table.h;h=199ae347fa78a86f7fd4866b222d4ae8b973d84c;hb=fa151ff40338619c7dbbdc06c227754b6b94c2e1;hp=92428b124d9dff1ba9ab05f7e3c3084c3a02a75d;hpb=e1ec9c16b55adb6947b4d1ff46dc847430db4746;p=wimlib diff --git a/src/lookup_table.h b/src/lookup_table.h index 92428b12..199ae347 100644 --- a/src/lookup_table.h +++ b/src/lookup_table.h @@ -11,6 +11,10 @@ #define LOOKUP_FLAG_ADS_OK 0x00000001 #define LOOKUP_FLAG_DIRECTORY_OK 0x00000002 +#ifdef __WIN32__ +#include +#endif + /* The lookup table of a WIM file maps SHA1 message digests to streams of data. * Here, the in-memory structure is implemented as a hash table. @@ -32,9 +36,9 @@ struct wim_lookup_table { #ifdef WITH_NTFS_3G struct ntfs_location { - char *path_utf8; - char *stream_name_utf16; - u16 stream_name_utf16_num_chars; + mbchar *path; + utf16lechar *stream_name; + u16 stream_name_nchars; struct _ntfs_volume **ntfs_vol_p; bool is_reparse_point; }; @@ -77,6 +81,10 @@ enum resource_location { * point or not. @ntfs_loc points to a structure containing this * information. */ RESOURCE_IN_NTFS_VOLUME, + + /* Resource must be accessed using Win32 API (may be a named data + * stream) */ + RESOURCE_WIN32, }; /* @@ -146,15 +154,18 @@ struct wim_lookup_table_entry { * extraction mode. In these mode, all identical files are linked * together, and @extracted_file will be set to the filename of the * first extracted file containing this stream. */ - char *extracted_file; + mbchar *extracted_file; }; /* Pointers to somewhere where the stream is actually located. See the * comments for the @resource_location field above. */ union { WIMStruct *wim; - char *file_on_disk; - char *staging_file_name; + mbchar *file_on_disk; + mbchar *staging_file_name; + #ifdef __WIN32__ + wchar_t *win32_file_on_disk; + #endif u8 *attached_buffer; #ifdef WITH_NTFS_3G struct ntfs_location *ntfs_loc; @@ -164,6 +175,7 @@ struct wim_lookup_table_entry { /* @file_on_disk_fp and @attr are both used to cache file/stream * handles so we don't have re-open them on every read */ + /* Valid iff resource_location == RESOURCE_IN_FILE_ON_DISK */ FILE *file_on_disk_fp; #ifdef WITH_NTFS_3G @@ -171,6 +183,10 @@ struct wim_lookup_table_entry { struct _ntfs_attr *attr; #endif + #ifdef __WIN32__ + HANDLE win32_file_on_disk_fp; + #endif + /* Pointer to inode that contains the opened file descriptors to * this stream (valid iff resource_location == * RESOURCE_IN_STAGING_FILE) */ @@ -286,7 +302,7 @@ extern struct wim_lookup_table_entry * __lookup_resource(const struct wim_lookup_table *table, const u8 hash[]); extern int -lookup_resource(WIMStruct *w, const char *path, +lookup_resource(WIMStruct *w, const mbchar *path, int lookup_flags, struct wim_dentry **dentry_ret, struct wim_lookup_table_entry **lte_ret, u16 *stream_idx_ret); @@ -394,13 +410,13 @@ inode_stream_hash(const struct wim_inode *inode, unsigned stream_idx) } static inline u16 -inode_stream_name_len(const struct wim_inode *inode, unsigned stream_idx) +inode_stream_name_nbytes(const struct wim_inode *inode, unsigned stream_idx) { wimlib_assert(stream_idx <= inode->i_num_ads); if (stream_idx == 0) return 0; else - return inode->i_ads_entries[stream_idx - 1].stream_name_len; + return inode->i_ads_entries[stream_idx - 1].stream_name_nbytes; } static inline struct wim_lookup_table_entry * @@ -408,7 +424,7 @@ inode_unnamed_lte_resolved(const struct wim_inode *inode) { wimlib_assert(inode->i_resolved); for (unsigned i = 0; i <= inode->i_num_ads; i++) { - if (inode_stream_name_len(inode, i) == 0 && + if (inode_stream_name_nbytes(inode, i) == 0 && !is_zero_hash(inode_stream_hash_resolved(inode, i))) { return inode_stream_lte_resolved(inode, i); @@ -423,7 +439,7 @@ inode_unnamed_lte_unresolved(const struct wim_inode *inode, { wimlib_assert(!inode->i_resolved); for (unsigned i = 0; i <= inode->i_num_ads; i++) { - if (inode_stream_name_len(inode, i) == 0 && + if (inode_stream_name_nbytes(inode, i) == 0 && !is_zero_hash(inode_stream_hash_unresolved(inode, i))) { return inode_stream_lte_unresolved(inode, i, table);