From: Eric Biggers Date: Thu, 22 May 2014 16:53:38 +0000 (-0500) Subject: win32_apply.c: Fallback to RtlDosPathNameToNtPathName_U() X-Git-Tag: v1.7.0~120 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=f45c157ceb31b97c4393c57b65a0e9b8fc2a3630 win32_apply.c: Fallback to RtlDosPathNameToNtPathName_U() RtlDosPathNameToNtPathName_U_WithStatus() is not available on Windows XP. --- diff --git a/include/wimlib/win32_common.h b/include/wimlib/win32_common.h index d9a4ff30..2921caaa 100644 --- a/include/wimlib/win32_common.h +++ b/include/wimlib/win32_common.h @@ -128,6 +128,12 @@ typedef struct _RTL_RELATIVE_NAME_U { PRTLP_CURDIR_REF CurDirRef; } RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U; +extern BOOLEAN (WINAPI *func_RtlDosPathNameToNtPathName_U) + (IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName); + extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus) (IN PCWSTR DosName, OUT PUNICODE_STRING NtName, diff --git a/src/win32_apply.c b/src/win32_apply.c index ee45acb4..fcb2c001 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -517,9 +517,18 @@ prepare_target(struct list_head *dentry_list, struct win32_apply_ctx *ctx) /* Open handle to the target directory (possibly creating it). */ - status = (*func_RtlDosPathNameToNtPathName_U_WithStatus)(ctx->common.target, - &ctx->target_ntpath, - NULL, NULL); + if (func_RtlDosPathNameToNtPathName_U_WithStatus) { + status = (*func_RtlDosPathNameToNtPathName_U_WithStatus)(ctx->common.target, + &ctx->target_ntpath, + NULL, NULL); + } else { + if ((*func_RtlDosPathNameToNtPathName_U)(ctx->common.target, + &ctx->target_ntpath, + NULL, NULL)) + status = STATUS_SUCCESS; + else + status = STATUS_NO_MEMORY; + } if (!NT_SUCCESS(status)) { if (status == STATUS_NO_MEMORY) { return WIMLIB_ERR_NOMEM; diff --git a/src/win32_common.c b/src/win32_common.c index 7f0521e4..7016fe2a 100644 --- a/src/win32_common.c +++ b/src/win32_common.c @@ -469,6 +469,12 @@ NTSTATUS (WINAPI *func_NtClose) (HANDLE Handle); DWORD (WINAPI *func_RtlNtStatusToDosError)(NTSTATUS status); +BOOLEAN (WINAPI *func_RtlDosPathNameToNtPathName_U) + (IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName); + NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus) (IN PCWSTR DosName, OUT PUNICODE_STRING NtName, @@ -526,7 +532,8 @@ struct dll_spec ntdll_spec = { DLL_SYM(NtClose, true), DLL_SYM(RtlNtStatusToDosError, true), DLL_SYM(RtlCreateSystemVolumeInformationFolder, false), - DLL_SYM(RtlDosPathNameToNtPathName_U_WithStatus, true), + DLL_SYM(RtlDosPathNameToNtPathName_U, true), + DLL_SYM(RtlDosPathNameToNtPathName_U_WithStatus, false), /* Not present on XP */ {NULL, NULL}, }, };