/* Don't use FILE_OPEN_REPARSE_POINT here; we want the extraction to
* happen at the directory "pointed to" by the reparse point. */
- status = (*func_NtCreateFile)(&ctx->h_target,
- FILE_TRAVERSE,
- &ctx->attr,
- &ctx->iosb,
- NULL,
- 0,
- FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_IF,
- FILE_DIRECTORY_FILE |
- FILE_OPEN_FOR_BACKUP_INTENT,
- NULL,
- 0);
+ status = NtCreateFile(&ctx->h_target,
+ FILE_TRAVERSE,
+ &ctx->attr,
+ &ctx->iosb,
+ NULL,
+ 0,
+ FILE_SHARE_VALID_FLAGS,
+ FILE_OPEN_IF,
+ FILE_DIRECTORY_FILE |
+ FILE_OPEN_FOR_BACKUP_INTENT,
+ NULL,
+ 0);
if (!NT_SUCCESS(status)) {
winnt_error(status, L"Can't open or create directory \"%ls\"",
ctx->common.target);
close_target_directory(struct win32_apply_ctx *ctx)
{
if (ctx->h_target) {
- (*func_NtClose)(ctx->h_target);
+ NtClose(ctx->h_target);
ctx->h_target = NULL;
ctx->attr.RootDirectory = NULL;
}
/* Get current attributes */
- status = (*func_NtQueryInformationFile)(h, &ctx->iosb,
- &info, sizeof(info),
- FileBasicInformation);
+ status = NtQueryInformationFile(h, &ctx->iosb, &info, sizeof(info),
+ FileBasicInformation);
if (NT_SUCCESS(status) &&
compressed == !!(info.FileAttributes & FILE_ATTRIBUTE_COMPRESSED))
{
ctx->pathbuf.Length = ((u8 *)end - (u8 *)ctx->pathbuf.Buffer);
/* Open the conflicting file (by short name). */
- status = (*func_NtOpenFile)(&h, GENERIC_WRITE | DELETE,
- &ctx->attr, &ctx->iosb,
- FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_REPARSE_POINT | FILE_OPEN_FOR_BACKUP_INTENT);
+ status = NtOpenFile(&h, GENERIC_WRITE | DELETE,
+ &ctx->attr, &ctx->iosb,
+ FILE_SHARE_VALID_FLAGS,
+ FILE_OPEN_REPARSE_POINT | FILE_OPEN_FOR_BACKUP_INTENT);
if (!NT_SUCCESS(status)) {
winnt_warning(status, L"Can't open \"%ls\"", current_path(ctx));
goto out;
/* Try to remove the short name on the conflicting file. */
retry:
- status = (*func_NtSetInformationFile)(h, &ctx->iosb, info, bufsize,
- FileShortNameInformation);
+ status = NtSetInformationFile(h, &ctx->iosb, info, bufsize,
+ FileShortNameInformation);
if (status == STATUS_INVALID_PARAMETER && !retried) {
retried = true;
goto retry;
}
- (*func_NtClose)(h);
+ NtClose(h);
out:
build_extraction_path(dentry, ctx);
return status;
memcpy(info->FileName, dentry->d_short_name, dentry->d_short_name_nbytes);
retry:
- status = (*func_NtSetInformationFile)(h, &ctx->iosb, info, bufsize,
- FileShortNameInformation);
+ status = NtSetInformationFile(h, &ctx->iosb, info, bufsize,
+ FileShortNameInformation);
if (NT_SUCCESS(status))
return 0;
ULONG CreateOptions,
struct win32_apply_ctx *ctx)
{
- return (*func_NtCreateFile)(FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ctx->attr,
- &ctx->iosb,
- AllocationSize,
- FileAttributes,
- FILE_SHARE_VALID_FLAGS,
- CreateDisposition,
- CreateOptions |
- FILE_OPEN_FOR_BACKUP_INTENT |
- FILE_OPEN_REPARSE_POINT,
- NULL,
- 0);
+ return NtCreateFile(FileHandle,
+ DesiredAccess | SYNCHRONIZE,
+ &ctx->attr,
+ &ctx->iosb,
+ AllocationSize,
+ FileAttributes,
+ FILE_SHARE_VALID_FLAGS,
+ CreateDisposition,
+ CreateOptions |
+ FILE_OPEN_FOR_BACKUP_INTENT |
+ FILE_OPEN_REPARSE_POINT,
+ NULL,
+ 0);
}
/* Like do_create_file(), but builds the extraction path of the @dentry first.
FILE_BASIC_INFORMATION basic_info =
{ .FileAttributes = FILE_ATTRIBUTE_NORMAL };
- status = (*func_NtSetInformationFile)(h, &ctx->iosb,
- &basic_info,
- sizeof(basic_info),
- FileBasicInformation);
+ status = NtSetInformationFile(h, &ctx->iosb, &basic_info,
+ sizeof(basic_info),
+ FileBasicInformation);
if (!NT_SUCCESS(status)) {
winnt_error(status, L"Can't reset attributes of \"%ls\" "
"to prepare for deletion", current_path(ctx));
- (*func_NtClose)(h);
+ NtClose(h);
return WIMLIB_ERR_SET_ATTRIBUTES;
}
FILE_DISPOSITION_INFORMATION disp_info =
{ .DoDeleteFile = TRUE };
- status = (*func_NtSetInformationFile)(h, &ctx->iosb,
- &disp_info,
- sizeof(disp_info),
- FileDispositionInformation);
+ status = NtSetInformationFile(h, &ctx->iosb, &disp_info,
+ sizeof(disp_info),
+ FileDispositionInformation);
if (!NT_SUCCESS(status)) {
winnt_error(status, L"Can't set delete-on-close "
"disposition on \"%ls\"", current_path(ctx));
- (*func_NtClose)(h);
+ NtClose(h);
return WIMLIB_ERR_SET_ATTRIBUTES;
}
}
- status = (*func_NtClose)(h);
+ status = NtClose(h);
if (unlikely(!NT_SUCCESS(status))) {
winnt_error(status, L"Error closing \"%ls\" after setting "
"delete-on-close disposition", current_path(ctx));
status = winnt_fsctl(h, FSCTL_SET_REPARSE_POINT,
rpbuf, rpbuflen, NULL, 0, NULL);
- (*func_NtClose)(h);
+ NtClose(h);
if (NT_SUCCESS(status))
return 0;
if (ret)
return ret;
- (*func_NtClose)(h);
+ NtClose(h);
}
}
if (!(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_NO_ATTRIBUTES)) {
FILE_BASIC_INFORMATION basic_info =
{ .FileAttributes = FILE_ATTRIBUTE_NORMAL };
- (*func_NtSetInformationFile)(h, &ctx->iosb, &basic_info,
- sizeof(basic_info),
- FileBasicInformation);
+ NtSetInformationFile(h, &ctx->iosb, &basic_info,
+ sizeof(basic_info),
+ FileBasicInformation);
}
/* Also try to remove the directory's DACL. This isn't supposed
.Sacl = 0,
.Dacl = 0,
};
- (*func_NtSetSecurityObject)(h, DACL_SECURITY_INFORMATION,
- (void *)&desc);
+ NtSetSecurityObject(h, DACL_SECURITY_INFORMATION,
+ (void *)&desc);
}
}
ret = adjust_compression_attribute(h, dentry, ctx);
out:
- (*func_NtClose)(h);
+ NtClose(h);
return ret;
}
return 0;
out_close:
- (*func_NtClose)(h);
+ NtClose(h);
out:
return ret;
}
* STATUS_INFO_LENGTH_MISMATCH when FileNameLength
* happens to be 2 */
- status = (*func_NtSetInformationFile)(h, &ctx->iosb,
- info, bufsize,
- FileLinkInformation);
+ status = NtSetInformationFile(h, &ctx->iosb, info, bufsize,
+ FileLinkInformation);
if (NT_SUCCESS(status))
return 0;
winnt_error(status, L"Failed to create link \"%ls\"",
if (ret)
return ret;
- (*func_NtClose)(h2);
+ NtClose(h2);
return 0;
}
}
if (!ret && unlikely(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_WIMBOOT))
ret = set_backed_from_wim(h, inode, ctx);
- (*func_NtClose)(h);
+ NtClose(h);
return ret;
}
close_handles(struct win32_apply_ctx *ctx)
{
for (unsigned i = 0; i < ctx->num_open_handles; i++)
- (*func_NtClose)(ctx->open_handles[i]);
+ NtClose(ctx->open_handles[i]);
}
/* Prepare to read the next blob, which has size @blob_size, into an in-memory
/* Allocate space for the data. */
alloc_info.AllocationSize.QuadPart = blob->size;
- (*func_NtSetInformationFile)(h, &ctx->iosb,
- &alloc_info, sizeof(alloc_info),
- FileAllocationInformation);
+ NtSetInformationFile(h, &ctx->iosb, &alloc_info, sizeof(alloc_info),
+ FileAllocationInformation);
return 0;
}
while (bytes_remaining) {
ULONG count = min(0xFFFFFFFF, bytes_remaining);
- status = (*func_NtWriteFile)(ctx->open_handles[i],
- NULL, NULL, NULL,
- &ctx->iosb, bufptr, count,
- NULL, NULL);
+ status = NtWriteFile(ctx->open_handles[i],
+ NULL, NULL, NULL,
+ &ctx->iosb, bufptr, count,
+ NULL, NULL);
if (!NT_SUCCESS(status)) {
winnt_error(status, L"Error writing data to target volume");
return WIMLIB_ERR_WRITE;
}
}
- (*func_NtClose)(h);
+ NtClose(h);
return status;
}
*/
retry:
- status = (*func_NtSetSecurityObject)(h, info, desc);
+ status = NtSetSecurityObject(h, info, desc);
if (NT_SUCCESS(status))
goto out_maybe_free_desc;
info.FileAttributes = FILE_ATTRIBUTE_NORMAL;
}
- status = (*func_NtSetInformationFile)(h, &ctx->iosb,
- &info, sizeof(info),
- FileBasicInformation);
+ status = NtSetInformationFile(h, &ctx->iosb, &info, sizeof(info),
+ FileBasicInformation);
/* On FAT volumes we get STATUS_INVALID_PARAMETER if we try to set
* attributes on the root directory. (Apparently because FAT doesn't
* actually have a place to store those attributes!) */
ret = do_apply_metadata_to_file(h, inode, ctx);
- (*func_NtClose)(h);
+ NtClose(h);
return ret;
}