From 42cac56e9d266f0709cec1c058df03f61b9c86a9 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 14 Jul 2011 15:33:29 +0000 Subject: [PATCH] [RTL]: Fix prototype of RtlDosPathNameToNtPathName_U and fix code to match the new prototype. [NDK]: Add RTL_RELATIVE_NAME_U which is the Windows 2003+ structure used instead of CURDIR for all relative path APIs. svn path=/trunk/; revision=52681 --- reactos/include/ndk/rtlfuncs.h | 14 +------------- reactos/include/ndk/rtltypes.h | 8 ++++++++ reactos/lib/rtl/path.c | 32 ++++++++++++++++---------------- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/reactos/include/ndk/rtlfuncs.h b/reactos/include/ndk/rtlfuncs.h index 6807128b626..58923d9a30c 100644 --- a/reactos/include/ndk/rtlfuncs.h +++ b/reactos/include/ndk/rtlfuncs.h @@ -2348,7 +2348,7 @@ RtlDosPathNameToNtPathName_U( IN PCWSTR DosPathName, OUT PUNICODE_STRING NtPathName, OUT PCWSTR *NtFileNamePart, - OUT CURDIR *DirectoryInfo + OUT PRTL_RELATIVE_NAME_U DirectoryInfo ); NTSYSAPI @@ -2379,18 +2379,6 @@ RtlGetFullPathName_U( OUT PWSTR *ShortName ); -NTSYSAPI -ULONG -NTAPI -RtlGetFullPathName_Ustr( - IN PUNICODE_STRING FileName, - IN ULONG Size, - IN PWSTR Buffer, - OUT PWSTR *ShortName, - OUT PBOOLEAN InvalidName, - OUT RTL_PATH_TYPE *PathType -); - NTSYSAPI ULONG NTAPI diff --git a/reactos/include/ndk/rtltypes.h b/reactos/include/ndk/rtltypes.h index 738a61eb94f..df8cea2f565 100644 --- a/reactos/include/ndk/rtltypes.h +++ b/reactos/include/ndk/rtltypes.h @@ -1017,6 +1017,14 @@ typedef struct _CURDIR HANDLE Handle; } CURDIR, *PCURDIR; +typedef struct _RTLP_CURDIR_REF *PRTLP_CURDIR_REF; +typedef struct _RTL_RELATIVE_NAME_U +{ + UNICODE_STRING RelativeName; + HANDLE ContainingDirectory; + PRTLP_CURDIR_REF CurDirRef; +} RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U; + typedef struct _RTL_DRIVE_LETTER_CURDIR { USHORT Flags; diff --git a/reactos/lib/rtl/path.c b/reactos/lib/rtl/path.c index 5e2b060c8cf..9e4f140da68 100644 --- a/reactos/lib/rtl/path.c +++ b/reactos/lib/rtl/path.c @@ -669,7 +669,7 @@ BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName, OUT PUNICODE_STRING NtPathName, OUT PCWSTR *NtFileNamePart, - OUT CURDIR *DirectoryInfo) + OUT PRTL_RELATIVE_NAME_U DirectoryInfo) { UNICODE_STRING us; PCURDIR cd; @@ -731,10 +731,10 @@ RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName, if (DirectoryInfo != NULL) { - DirectoryInfo->DosPath.Length = 0; - DirectoryInfo->DosPath.MaximumLength = 0; - DirectoryInfo->DosPath.Buffer = NULL; - DirectoryInfo->Handle = NULL; + DirectoryInfo->RelativeName.Length = 0; + DirectoryInfo->RelativeName.MaximumLength = 0; + DirectoryInfo->RelativeName.Buffer = NULL; + DirectoryInfo->ContainingDirectory = NULL; } return TRUE; @@ -804,7 +804,7 @@ RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName, /* Set name and handle structure if possible */ if (DirectoryInfo) { - memset (DirectoryInfo, 0, sizeof(CURDIR)); + memset (DirectoryInfo, 0, sizeof(RTL_RELATIVE_NAME_U)); cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); if (Type == 5 && cd->Handle) { @@ -812,10 +812,10 @@ RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName, if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) { Length = ((cd->DosPath.Length / sizeof(WCHAR)) - Offset) + ((Type == 1) ? 8 : 4); - DirectoryInfo->DosPath.Buffer = Buffer + Length; - DirectoryInfo->DosPath.Length = NtPathName->Length - (Length * sizeof(WCHAR)); - DirectoryInfo->DosPath.MaximumLength = DirectoryInfo->DosPath.Length; - DirectoryInfo->Handle = cd->Handle; + DirectoryInfo->RelativeName.Buffer = Buffer + Length; + DirectoryInfo->RelativeName.Length = NtPathName->Length - (Length * sizeof(WCHAR)); + DirectoryInfo->RelativeName.MaximumLength = DirectoryInfo->RelativeName.Length; + DirectoryInfo->ContainingDirectory = cd->Handle; } } } @@ -914,23 +914,23 @@ RtlDoesFileExists_U(IN PCWSTR FileName) OBJECT_ATTRIBUTES Attr; FILE_BASIC_INFORMATION Info; NTSTATUS Status; - CURDIR CurDir; + RTL_RELATIVE_NAME_U RelativeName; if (!RtlDosPathNameToNtPathName_U (FileName, &NtFileName, NULL, - &CurDir)) + &RelativeName)) return FALSE; - if (CurDir.DosPath.Length) - NtFileName = CurDir.DosPath; + if (RelativeName.RelativeName.Length) + NtFileName = RelativeName.RelativeName; else - CurDir.Handle = 0; + RelativeName.ContainingDirectory = 0; InitializeObjectAttributes (&Attr, &NtFileName, OBJ_CASE_INSENSITIVE, - CurDir.Handle, + RelativeName.ContainingDirectory, NULL); Status = ZwQueryAttributesFile (&Attr, &Info);