- /* Build the path to the stream. For unnamed streams, this is simply
- * the path to the file. For named streams, this is the path to the
- * file, followed by a colon, followed by the stream name. */
- stream_path = build_stream_path(path, path_nchars,
- stream_name, stream_name_nchars);
- if (!stream_path)
- return WIMLIB_ERR_NOMEM;
-
- /* Set up the lookup table entry for the stream. */
- lte = new_lookup_table_entry();
- if (!lte) {
- FREE(stream_path);
- return WIMLIB_ERR_NOMEM;
- }
- lte->file_on_disk = stream_path;
- lte->resource_location = RESOURCE_IN_WINNT_FILE_ON_DISK;
- lte->size = stream_size;
- if ((inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED) && !ads_entry) {
- /* Special case for encrypted file. */
-
- /* OpenEncryptedFileRaw() expects Win32 name, not NT name.
- * Change \??\ into \\?\ */
- lte->file_on_disk[1] = L'\\';
- wimlib_assert(!wmemcmp(lte->file_on_disk, L"\\\\?\\", 4));
-
- u64 encrypted_size;
- int ret;
-
- ret = win32_get_encrypted_file_size(lte->file_on_disk,
- &encrypted_size);
- if (ret) {
- free_lookup_table_entry(lte);
- return ret;
- }
- lte->size = encrypted_size;
- lte->resource_location = RESOURCE_WIN32_ENCRYPTED;
- }
-
- if (ads_entry) {
- stream_id = ads_entry->stream_id;
- ads_entry->lte = lte;
- } else {
- stream_id = 0;
- inode->i_lte = lte;
- }
- add_unhashed_stream(lte, inode, stream_id, unhashed_streams);