From: Eric Biggers Date: Tue, 3 Nov 2015 05:30:01 +0000 (-0600) Subject: win32_apply.c: wait for FSCTL_SET_COMPRESSION to complete X-Git-Tag: v1.8.3~20 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=5cdef6bbf584ca679dbf43fbdaea4a3f7cfe9933 win32_apply.c: wait for FSCTL_SET_COMPRESSION to complete --- diff --git a/src/win32_apply.c b/src/win32_apply.c index 9ed563bb..c31d2668 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -1099,6 +1099,7 @@ adjust_compression_attribute(HANDLE h, const struct wim_dentry *dentry, FILE_BASIC_INFORMATION info; NTSTATUS status; USHORT compression_state; + DWORD bytes_returned; /* Get current attributes */ status = (*func_NtQueryInformationFile)(h, &ctx->iosb, @@ -1118,20 +1119,14 @@ adjust_compression_attribute(HANDLE h, const struct wim_dentry *dentry, else compression_state = COMPRESSION_FORMAT_NONE; - status = (*func_NtFsControlFile)(h, - NULL, - NULL, - NULL, - &ctx->iosb, - FSCTL_SET_COMPRESSION, - &compression_state, - sizeof(USHORT), - NULL, - 0); - if (NT_SUCCESS(status)) + /* Note: don't use NtFsControlFile() here unless prepared to handle + * STATUS_PENDING. */ + if (DeviceIoControl(h, FSCTL_SET_COMPRESSION, + &compression_state, sizeof(USHORT), NULL, 0, + &bytes_returned, NULL)) return 0; - winnt_error(status, L"Can't %s compression attribute on \"%ls\"", + win32_error(GetLastError(), L"Can't %s compression attribute on \"%ls\"", (compressed ? "set" : "clear"), current_path(ctx)); return WIMLIB_ERR_SET_ATTRIBUTES; }