mirror of
https://github.com/reactos/reactos.git
synced 2024-10-19 23:50:05 +00:00
[RTL]: RtlGetFullPathName_Ustr: Do not upcase the drive letter in the source string (that should not be modified), but use a temporary variable.
svn path=/trunk/; revision=65533
This commit is contained in:
parent
a198ec0538
commit
20ac78114f
|
@ -598,35 +598,45 @@ RtlGetFullPathName_Ustr(
|
||||||
switch (*PathType)
|
switch (*PathType)
|
||||||
{
|
{
|
||||||
case RtlPathTypeUncAbsolute: /* \\foo */
|
case RtlPathTypeUncAbsolute: /* \\foo */
|
||||||
|
{
|
||||||
PrefixCut = RtlpSkipUNCPrefix(FileNameBuffer);
|
PrefixCut = RtlpSkipUNCPrefix(FileNameBuffer);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeLocalDevice: /* \\.\foo */
|
case RtlPathTypeLocalDevice: /* \\.\foo */
|
||||||
|
{
|
||||||
PrefixCut = 4;
|
PrefixCut = 4;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeDriveAbsolute: /* c:\foo */
|
case RtlPathTypeDriveAbsolute: /* c:\foo */
|
||||||
|
{
|
||||||
ASSERT(FileNameBuffer[1] == L':');
|
ASSERT(FileNameBuffer[1] == L':');
|
||||||
ASSERT(IS_PATH_SEPARATOR(FileNameBuffer[2]));
|
ASSERT(IS_PATH_SEPARATOR(FileNameBuffer[2]));
|
||||||
|
|
||||||
FileNameBuffer[0] = RtlUpcaseUnicodeChar(FileNameBuffer[0]);
|
Prefix = RtlUpcaseUnicodeChar(FileNameBuffer[0]);
|
||||||
Prefix = FileNameBuffer;
|
|
||||||
PrefixLength = 3 * sizeof(WCHAR);
|
PrefixLength = 3 * sizeof(WCHAR);
|
||||||
Source += 3;
|
Source += 3;
|
||||||
SourceLength -= 3 * sizeof(WCHAR);
|
SourceLength -= 3 * sizeof(WCHAR);
|
||||||
|
|
||||||
PrefixCut = 3;
|
PrefixCut = 3;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeDriveRelative: /* c:foo */
|
case RtlPathTypeDriveRelative: /* c:foo */
|
||||||
|
{
|
||||||
|
WCHAR CurDrive, NewDrive;
|
||||||
|
|
||||||
Source += 2;
|
Source += 2;
|
||||||
SourceLength -= 2 * sizeof(WCHAR);
|
SourceLength -= 2 * sizeof(WCHAR);
|
||||||
if (RtlUpcaseUnicodeChar(FileNameBuffer[0]) != RtlUpcaseUnicodeChar(CurDirName->Buffer[0]) ||
|
|
||||||
CurDirName->Buffer[1] != L':')
|
CurDrive = RtlUpcaseUnicodeChar(CurDirName->Buffer[0]);
|
||||||
|
NewDrive = RtlUpcaseUnicodeChar(FileNameBuffer[0]);
|
||||||
|
|
||||||
|
if ((NewDrive != CurDrive) || CurDirName->Buffer[1] != L':')
|
||||||
{
|
{
|
||||||
FileNameBuffer[0] = RtlUpcaseUnicodeChar(FileNameBuffer[0]);
|
|
||||||
EnvVarNameBuffer[0] = L'=';
|
EnvVarNameBuffer[0] = L'=';
|
||||||
EnvVarNameBuffer[1] = FileNameBuffer[0];
|
EnvVarNameBuffer[1] = NewDrive;
|
||||||
EnvVarNameBuffer[2] = L':';
|
EnvVarNameBuffer[2] = L':';
|
||||||
EnvVarNameBuffer[3] = UNICODE_NULL;
|
EnvVarNameBuffer[3] = UNICODE_NULL;
|
||||||
|
|
||||||
|
@ -670,7 +680,7 @@ RtlGetFullPathName_Ustr(
|
||||||
default:
|
default:
|
||||||
DPRINT1("RtlQueryEnvironmentVariable_U returned 0x%08lx\n", Status);
|
DPRINT1("RtlQueryEnvironmentVariable_U returned 0x%08lx\n", Status);
|
||||||
|
|
||||||
EnvVarNameBuffer[0] = FileNameBuffer[0];
|
EnvVarNameBuffer[0] = NewDrive;
|
||||||
EnvVarNameBuffer[1] = L':';
|
EnvVarNameBuffer[1] = L':';
|
||||||
EnvVarNameBuffer[2] = L'\\';
|
EnvVarNameBuffer[2] = L'\\';
|
||||||
EnvVarNameBuffer[3] = UNICODE_NULL;
|
EnvVarNameBuffer[3] = UNICODE_NULL;
|
||||||
|
@ -686,8 +696,10 @@ RtlGetFullPathName_Ustr(
|
||||||
}
|
}
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
DPRINT("RtlPathTypeDriveRelative - Using fall-through to RtlPathTypeRelative\n");
|
DPRINT("RtlPathTypeDriveRelative - Using fall-through to RtlPathTypeRelative\n");
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeRelative: /* foo */
|
case RtlPathTypeRelative: /* foo */
|
||||||
|
{
|
||||||
Prefix = CurDirName->Buffer;
|
Prefix = CurDirName->Buffer;
|
||||||
PrefixLength = CurDirName->Length;
|
PrefixLength = CurDirName->Length;
|
||||||
if (CurDirName->Buffer[1] != L':')
|
if (CurDirName->Buffer[1] != L':')
|
||||||
|
@ -699,8 +711,10 @@ RtlGetFullPathName_Ustr(
|
||||||
PrefixCut = 3;
|
PrefixCut = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeRooted: /* \xxx */
|
case RtlPathTypeRooted: /* \xxx */
|
||||||
|
{
|
||||||
if (CurDirName->Buffer[1] == L':')
|
if (CurDirName->Buffer[1] == L':')
|
||||||
{
|
{
|
||||||
// The path starts with "C:\"
|
// The path starts with "C:\"
|
||||||
|
@ -719,8 +733,10 @@ RtlGetFullPathName_Ustr(
|
||||||
Prefix = CurDirName->Buffer;
|
Prefix = CurDirName->Buffer;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeRootLocalDevice: /* \\. */
|
case RtlPathTypeRootLocalDevice: /* \\. */
|
||||||
|
{
|
||||||
Prefix = DeviceRootString.Buffer;
|
Prefix = DeviceRootString.Buffer;
|
||||||
PrefixLength = DeviceRootString.Length;
|
PrefixLength = DeviceRootString.Length;
|
||||||
Source += 3;
|
Source += 3;
|
||||||
|
@ -728,6 +744,7 @@ RtlGetFullPathName_Ustr(
|
||||||
|
|
||||||
PrefixCut = 4;
|
PrefixCut = 4;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RtlPathTypeUnknown:
|
case RtlPathTypeUnknown:
|
||||||
goto Quit;
|
goto Quit;
|
||||||
|
|
Loading…
Reference in a new issue