struct wim_xattr_entry *entry = (void *)entries;
size_t entries_size;
struct wimlib_unix_data unix_data;
+#ifdef __WIN32__
+ const char *prefix = "";
+#else
const char *prefix = "user.";
+#endif
static const char capability_name[] = "security.capability";
bool generated_capability_xattr = false;
int value_len = rand32() % 64;
u8 *p;
+ #ifdef __WIN32__
+ if (value_len == 0)
+ value_len++;
+ #endif
+
entry->value_len = cpu_to_le16(value_len);
entry->flags = 0;
entry->name_len = strlen(prefix) + name_len;
p = mempcpy(entry->name, prefix, strlen(prefix));
- *p++ = 'a' + i;
+ *p++ = 'A' + i;
for (int j = 1; j < name_len; j++) {
do {
+ #ifdef __WIN32__
+ *p = 'A' + rand8() % 26;
+ #else
*p = rand8();
+ #endif
} while (*p == '\0');
p++;
}
}
}
-static int
-add_stream(struct wim_inode *inode, struct generation_context *ctx,
- int stream_type, const utf16lechar *stream_name,
- void *buffer, size_t size)
-{
- struct blob_descriptor *blob = NULL;
- struct wim_inode_stream *strm;
-
- if (size) {
- blob = new_blob_descriptor();
- if (!blob)
- goto err_nomem;
- blob->attached_buffer = buffer;
- blob->blob_location = BLOB_IN_ATTACHED_BUFFER;
- blob->size = size;
- }
-
- strm = inode_add_stream(inode, stream_type, stream_name, blob);
- if (unlikely(!strm))
- goto err_nomem;
-
- prepare_unhashed_blob(blob, inode, strm->stream_id,
- ctx->params->unhashed_blobs);
- return 0;
-
-err_nomem:
- free_blob_descriptor(blob);
- return WIMLIB_ERR_NOMEM;
-}
-
static noinline_for_stack int
set_random_reparse_point(struct wim_inode *inode, struct generation_context *ctx)
{
{
void *buffer = NULL;
size_t size;
+ int ret;
size = select_stream_size(ctx);
if (size) {
generate_data(buffer, size, ctx);
}
- return add_stream(inode, ctx, STREAM_TYPE_DATA, stream_name,
- buffer, size);
+ ret = 0;
+ if (!inode_add_stream_with_data(inode, STREAM_TYPE_DATA, stream_name,
+ buffer, size, ctx->params->blob_table))
+ ret = WIMLIB_ERR_NOMEM;
+ FREE(buffer);
+ return ret;
}
static int
if (!xattrs1 && !xattrs2) {
return 0;
} else if (xattrs1 && !xattrs2) {
- if (cmp_flags & (WIMLIB_CMP_FLAG_NTFS_3G_MODE |
- WIMLIB_CMP_FLAG_WINDOWS_MODE))
+ if (cmp_flags & WIMLIB_CMP_FLAG_NTFS_3G_MODE)
return 0;
ERROR("%"TS" unexpectedly lost its xattrs",
inode_any_full_path(inode1));