X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwin32_capture.c;h=586181020d00a3153f059a1a145e8282700999eb;hp=7f6df42e49393e65614ab512cfecdb1af17d0b25;hb=389f993fdf085a9bf120f8a17464e321d6e42898;hpb=e8c3ca2d1d0cac3d64985b45a9f654d2029a7518 diff --git a/src/win32_capture.c b/src/win32_capture.c index 7f6df42e..58618102 100644 --- a/src/win32_capture.c +++ b/src/win32_capture.c @@ -154,9 +154,10 @@ win32_encrypted_export_cb(unsigned char *_data, void *_ctx, unsigned long len) } } else { size_t len_to_copy = min(len, ctx->bytes_remaining); - memcpy(ctx->read_prefix_ctx_or_buf, data, len_to_copy); + ctx->read_prefix_ctx_or_buf = mempcpy(ctx->read_prefix_ctx_or_buf, + data, + len_to_copy); ctx->bytes_remaining -= len_to_copy; - ctx->read_prefix_ctx_or_buf += len_to_copy; } return ERROR_SUCCESS; } @@ -506,12 +507,10 @@ win32_capture_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p, const wchar_t *path) { struct reparse_data rpdata; - DWORD rpbuflen; int ret; enum rp_status rp_status; - rpbuflen = *rpbuflen_p; - ret = parse_reparse_data(rpbuf, rpbuflen, &rpdata); + ret = parse_reparse_data(rpbuf, *rpbuflen_p, &rpdata); if (ret) return -ret; @@ -519,7 +518,7 @@ win32_capture_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p, &rpdata.substitute_name_nbytes, capture_root_ino, capture_root_dev, - le32_to_cpu(*(u32*)rpbuf)); + le32_to_cpu(*(le32*)rpbuf)); if (rp_status & RP_FIXED) { wimlib_assert(rpdata.substitute_name_nbytes % 2 == 0); utf16lechar substitute_name_copy[rpdata.substitute_name_nbytes / 2]; @@ -535,7 +534,7 @@ win32_capture_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p, rpdata.print_name += 4; rpdata.print_name_nbytes -= 8; } - ret = make_reparse_buffer(&rpdata, rpbuf); + ret = make_reparse_buffer(&rpdata, rpbuf, rpbuflen_p); if (ret == 0) ret = rp_status; else @@ -612,7 +611,7 @@ win32_get_reparse_data(HANDLE hFile, const wchar_t *path, } rpbuflen = bytesReturned; - reparse_tag = le32_to_cpu(*(u32*)rpbuf); + reparse_tag = le32_to_cpu(*(le32*)rpbuf); if (params->add_flags & WIMLIB_ADD_FLAG_RPFIX && (reparse_tag == WIM_IO_REPARSE_TAG_SYMLINK || reparse_tag == WIM_IO_REPARSE_TAG_MOUNT_POINT)) @@ -1061,7 +1060,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, /* Reparse point: set the reparse data (which we read already) * */ inode->i_not_rpfixed = not_rpfixed; - inode->i_reparse_tag = le32_to_cpu(*(u32*)rpbuf); + inode->i_reparse_tag = le32_to_cpu(*(le32*)rpbuf); ret = inode_set_unnamed_stream(inode, rpbuf + 8, rpbuflen - 8, params->lookup_table); } else if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) {