#include "wimlib/error.h"
#include "wimlib/lookup_table.h"
-#ifdef WITH_NTDLL
-# include <winternl.h>
-# include <ntstatus.h>
-NTSTATUS WINAPI
-NtSetSecurityObject(HANDLE Handle,
- SECURITY_INFORMATION SecurityInformation,
- PSECURITY_DESCRIPTOR SecurityDescriptor);
-#endif
-
static int
win32_start_extract(const wchar_t *path, struct apply_ctx *ctx)
{
stream_path = alloca(sizeof(wchar_t) *
(wcslen(path) + 1 +
wcslen(stream_name) + 1));
- swprintf(stream_path, L"%ls:%ls", path, stream_name);
+ tsprintf(stream_path, L"%ls:%ls", path, stream_name);
}
h = CreateFile(stream_path, FILE_WRITE_DATA, 0, NULL,
ret = 0;
if (!lte)
goto out_close_handle;
- ret = extract_wim_resource(lte, wim_resource_size(lte),
- win32_extract_wim_chunk, h);
+ ret = extract_stream(lte, lte->size, win32_extract_wim_chunk, h);
out_close_handle:
if (!CloseHandle(h))
goto error;
unsigned long len = *len_p;
const struct wim_lookup_table_entry *lte = import_ctx->lte;
- len = min(len, wim_resource_size(lte) - import_ctx->offset);
+ len = min(len, lte->size - import_ctx->offset);
- if (read_partial_wim_resource_into_buf(lte, len, import_ctx->offset, data))
+ if (read_partial_wim_stream_into_buf(lte, len, import_ctx->offset, data))
return ERROR_READ_FAULT;
import_ctx->offset += len;
PSECURITY_DESCRIPTOR desc)
{
#ifdef WITH_NTDLL
- return RtlNtStatusToDosError(NtSetSecurityObject(h, info, desc));
-#else
+ if (func_NtSetSecurityObject) {
+ return (*func_RtlNtStatusToDosError)(
+ (*func_NtSetSecurityObject)(h, info, desc));
+ }
+#endif
if (SetFileSecurity(path, info, desc))
return ERROR_SUCCESS;
else
return GetLastError();
-#endif
}
static int
h = INVALID_HANDLE_VALUE;
#ifdef WITH_NTDLL
- h = win32_open_existing_file(path, MAXIMUM_ALLOWED);
- if (h == INVALID_HANDLE_VALUE) {
- ERROR_WITH_ERRNO("Can't open %ls (%u)", path, GetLastError());
- goto error;
+ if (func_NtSetSecurityObject) {
+ h = win32_open_existing_file(path, MAXIMUM_ALLOWED);
+ if (h == INVALID_HANDLE_VALUE) {
+ ERROR_WITH_ERRNO("Can't open %ls (%u)", path, GetLastError());
+ goto error;
+ }
}
#endif
ctx->no_security_descriptors++;
break;
}
+ SetLastError(err);
goto error;
}
ret = 0;
out_close:
#ifdef WITH_NTDLL
- CloseHandle(h);
+ if (func_NtSetSecurityObject)
+ CloseHandle(h);
#endif
return ret;
.root_directory_is_special = 1,
.requires_final_set_attributes_pass = 1,
.extract_encrypted_stream_creates_file = 1,
+ .requires_short_name_reordering = 1, /* TODO: check if this is really needed */
};
#endif /* __WIN32__ */