]> wimlib.net Git - wimlib/commitdiff
win32_apply.c: Fallback to RtlDosPathNameToNtPathName_U()
authorEric Biggers <ebiggers3@gmail.com>
Thu, 22 May 2014 16:53:38 +0000 (11:53 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 22 May 2014 16:54:17 +0000 (11:54 -0500)
RtlDosPathNameToNtPathName_U_WithStatus() is not available on Windows XP.

include/wimlib/win32_common.h
src/win32_apply.c
src/win32_common.c

index d9a4ff30cc68487635b91af15f10f62a4027d204..2921caaa2796b4c85a4220f7a32f00b6d5d69f95 100644 (file)
@@ -128,6 +128,12 @@ typedef struct _RTL_RELATIVE_NAME_U {
        PRTLP_CURDIR_REF CurDirRef;
 } RTL_RELATIVE_NAME_U, *PRTL_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,
 extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus)
                (IN PCWSTR DosName,
                 OUT PUNICODE_STRING NtName,
index ee45acb4901fd79625903532bc205682917b272c..fcb2c001abd128e77861b021b5e8fbf8a87eccd5 100644 (file)
@@ -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).  */
 
 
        /* 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;
        if (!NT_SUCCESS(status)) {
                if (status == STATUS_NO_MEMORY) {
                        return WIMLIB_ERR_NOMEM;
index 7f0521e43ab1f1c46f0c131ff2f5840694988848..7016fe2a6c3d5644f29cdac1f995b9398b8486ed 100644 (file)
@@ -469,6 +469,12 @@ NTSTATUS (WINAPI *func_NtClose) (HANDLE Handle);
 
 DWORD (WINAPI *func_RtlNtStatusToDosError)(NTSTATUS status);
 
 
 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,
 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(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},
        },
 };
                {NULL, NULL},
        },
 };