summaryrefslogtreecommitdiff
path: root/filesys/fastfat/namesup.c
diff options
context:
space:
mode:
authorkarlf <[email protected]>2016-08-11 13:28:13 -0700
committerkarlf <[email protected]>2016-08-11 13:28:13 -0700
commit96eb96dfb613e4c745db6bd1f53a92fe7e2290fc (patch)
treead5f3ede5cbcd6b598677ce41bcf8318471bdd92 /filesys/fastfat/namesup.c
parent687b274aa38fd05c8c26e3068932121876d7f745 (diff)
Updated for "Windows 10 Anniversary Update" (Version 1607)
Diffstat (limited to 'filesys/fastfat/namesup.c')
-rw-r--r--filesys/fastfat/namesup.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/filesys/fastfat/namesup.c b/filesys/fastfat/namesup.c
index 662e4b4d..159b1c3d 100644
--- a/filesys/fastfat/namesup.c
+++ b/filesys/fastfat/namesup.c
@@ -27,6 +27,7 @@ Abstract:
#pragma alloc_text(PAGE, FatSelectNames)
#pragma alloc_text(PAGE, FatEvaluateNameCase)
#pragma alloc_text(PAGE, FatSpaceInName)
+#pragma alloc_text(PAGE, FatUnicodeRestoreShortNameCase)
#endif
@@ -1032,4 +1033,78 @@ Return Value:
return FALSE;
}
+VOID
+FatUnicodeRestoreShortNameCase(
+ IN PUNICODE_STRING ShortNameWithCase,
+ IN BOOLEAN LowerCase8,
+ IN BOOLEAN LowerCase3
+ )
+
+/*++
+
+Routine Description:
+
+ Given an 8.3 filename in a UNICODE_STRING, fix the case of the
+ name given the two 8do3 case flags.
+
+Arguments:
+
+ ShortNameWithCase - the UNICODE_STRING containing the short name.
+ LowerCase8, LowerCase3 - the flag indicating whether to downcase the 8dot3 name component.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ USHORT i;
+ UNICODE_STRING DownCaseSeg;
+
+ PAGED_CODE();
+
+ NT_ASSERT( ShortNameWithCase->Length <= 24 );
+
+ //
+ // Have to repair the case of the short name
+ //
+
+ for (i = 0; i < (ShortNameWithCase->Length/sizeof(WCHAR)) &&
+ ShortNameWithCase->Buffer[i] != L'.'; i++);
+
+ //
+ // Now pointing at the '.', or otherwise the end of name component
+ //
+
+ if (LowerCase8) {
+
+ DownCaseSeg.Buffer = ShortNameWithCase->Buffer;
+ DownCaseSeg.MaximumLength = DownCaseSeg.Length = i*sizeof(WCHAR);
+
+ RtlDowncaseUnicodeString(&DownCaseSeg, &DownCaseSeg, FALSE);
+ }
+
+ i++;
+
+ //
+ // Now pointing at first wchar of the extension.
+ //
+
+ if (LowerCase3) {
+
+ //
+ // It is not neccesarily the case that we can rely on the flag
+ // indicating that we really have an extension.
+ //
+
+ if ((i*sizeof(WCHAR)) < ShortNameWithCase->Length) {
+ DownCaseSeg.Buffer = &ShortNameWithCase->Buffer[i];
+ DownCaseSeg.MaximumLength = DownCaseSeg.Length = ShortNameWithCase->Length - i*sizeof(WCHAR);
+
+ RtlDowncaseUnicodeString(&DownCaseSeg, &DownCaseSeg, FALSE);
+ }
+ }
+
+}
+