mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 18:42:38 +00:00
translate the \\?\ prefix to \??\ in RtlDosPathNameToNtPathName_U
svn path=/trunk/; revision=20973
This commit is contained in:
parent
955b4987a2
commit
cb96a25169
1 changed files with 52 additions and 13 deletions
|
@ -690,9 +690,6 @@ RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName,
|
||||||
WCHAR fullname[MAX_PATH + 1];
|
WCHAR fullname[MAX_PATH + 1];
|
||||||
PWSTR Buffer = NULL;
|
PWSTR Buffer = NULL;
|
||||||
|
|
||||||
|
|
||||||
RtlAcquirePebLock ();
|
|
||||||
|
|
||||||
RtlInitUnicodeString (&us, DosPathName);
|
RtlInitUnicodeString (&us, DosPathName);
|
||||||
if (us.Length > 8)
|
if (us.Length > 8)
|
||||||
{
|
{
|
||||||
|
@ -700,15 +697,56 @@ RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName,
|
||||||
/* check for "\\?\" - allows to use very long filenames ( up to 32k ) */
|
/* check for "\\?\" - allows to use very long filenames ( up to 32k ) */
|
||||||
if (Buffer[0] == L'\\' && Buffer[1] == L'\\' &&
|
if (Buffer[0] == L'\\' && Buffer[1] == L'\\' &&
|
||||||
Buffer[2] == L'?' && Buffer[3] == L'\\')
|
Buffer[2] == L'?' && Buffer[3] == L'\\')
|
||||||
{
|
{
|
||||||
// if( f_77F68606( &us, ntname, shortname, nah ) )
|
/* allocate the new string and simply copy it */
|
||||||
// {
|
NtPathName->Length = us.Length;
|
||||||
// RtlReleasePebLock ();
|
NtPathName->MaximumLength = us.Length + sizeof(WCHAR);
|
||||||
// return TRUE;
|
NtPathName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
// }
|
0,
|
||||||
Buffer = NULL;
|
NtPathName->MaximumLength);
|
||||||
RtlReleasePebLock ();
|
if (NtPathName->Buffer == NULL)
|
||||||
return FALSE;
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy the string */
|
||||||
|
RtlCopyMemory(NtPathName->Buffer,
|
||||||
|
us.Buffer,
|
||||||
|
NtPathName->Length);
|
||||||
|
NtPathName->Buffer[us.Length / sizeof(WCHAR)] = L'\0';
|
||||||
|
|
||||||
|
/* change the \\?\ prefix to \??\ */
|
||||||
|
NtPathName->Buffer[1] = L'?';
|
||||||
|
|
||||||
|
if (NtFileNamePart != NULL)
|
||||||
|
{
|
||||||
|
PWSTR FilePart = NULL;
|
||||||
|
PWSTR s;
|
||||||
|
|
||||||
|
/* try to find the last separator */
|
||||||
|
s = NtPathName->Buffer + (NtPathName->Length / sizeof(WCHAR));
|
||||||
|
while (s != NtPathName->Buffer)
|
||||||
|
{
|
||||||
|
if (*s == L'\\')
|
||||||
|
{
|
||||||
|
FilePart = s + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s--;
|
||||||
|
}
|
||||||
|
|
||||||
|
*NtFileNamePart = FilePart;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DirectoryInfo != NULL)
|
||||||
|
{
|
||||||
|
DirectoryInfo->DosPath.Length = 0;
|
||||||
|
DirectoryInfo->DosPath.MaximumLength = 0;
|
||||||
|
DirectoryInfo->DosPath.Buffer = NULL;
|
||||||
|
DirectoryInfo->Handle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,10 +755,11 @@ RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName,
|
||||||
sizeof( fullname ) + MAX_PFX_SIZE);
|
sizeof( fullname ) + MAX_PFX_SIZE);
|
||||||
if (Buffer == NULL)
|
if (Buffer == NULL)
|
||||||
{
|
{
|
||||||
RtlReleasePebLock ();
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RtlAcquirePebLock ();
|
||||||
|
|
||||||
Size = RtlGetFullPathName_U (DosPathName,
|
Size = RtlGetFullPathName_U (DosPathName,
|
||||||
sizeof(fullname),
|
sizeof(fullname),
|
||||||
fullname,
|
fullname,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue