Windows: AFSProcessDFSLink to Dos Device
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 4 Dec 2012 18:27:59 +0000 (13:27 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 5 Dec 2012 20:14:57 +0000 (12:14 -0800)
Support msdfs links to <drive>:\<path>

Map them to IOMgr as \??\<drive>:\<path>

Change-Id: I110dd7e857d4b7984e75611787d2135bc97aaa39
Reviewed-on: http://gerrit.openafs.org/8601
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp

index f924c5a..dfce8a9 100644 (file)
@@ -4559,6 +4559,7 @@ AFSProcessDFSLink( IN AFSDirectoryCB *DirEntry,
     NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
     UNICODE_STRING uniReparseName;
     UNICODE_STRING uniMUPDeviceName;
+    UNICODE_STRING uniIOMgrDeviceName;
     AFSDirEnumEntry *pDirEntry = NULL;
 
     __Enter
@@ -4571,6 +4572,9 @@ AFSProcessDFSLink( IN AFSDirectoryCB *DirEntry,
         RtlInitUnicodeString( &uniMUPDeviceName,
                               L"\\Device\\MUP");
 
+        RtlInitUnicodeString( &uniIOMgrDeviceName,
+                              L"\\??\\");
+
         uniReparseName.Length = 0;
         uniReparseName.Buffer = NULL;
 
@@ -4689,18 +4693,32 @@ AFSProcessDFSLink( IN AFSDirectoryCB *DirEntry,
         // Start building the name
         //
 
-        RtlCopyMemory( uniReparseName.Buffer,
-                       uniMUPDeviceName.Buffer,
-                       uniMUPDeviceName.Length);
+        if ( DirEntry->NameInformation.TargetName.Buffer[ 0] != L'\\' &&
+             DirEntry->NameInformation.TargetName.Buffer[ 1] == L':')
+        {
 
-        uniReparseName.Length = uniMUPDeviceName.Length;
+            RtlCopyMemory( uniReparseName.Buffer,
+                           uniIOMgrDeviceName.Buffer,
+                           uniIOMgrDeviceName.Length);
 
-        if( DirEntry->NameInformation.TargetName.Buffer[ 0] != L'\\')
+            uniReparseName.Length = uniIOMgrDeviceName.Length;
+        }
+        else
         {
 
-            uniReparseName.Buffer[ uniReparseName.Length/sizeof( WCHAR)] = L'\\';
+            RtlCopyMemory( uniReparseName.Buffer,
+                           uniMUPDeviceName.Buffer,
+                           uniMUPDeviceName.Length);
+
+            uniReparseName.Length = uniMUPDeviceName.Length;
 
-            uniReparseName.Length += sizeof( WCHAR);
+            if( DirEntry->NameInformation.TargetName.Buffer[ 0] != L'\\')
+            {
+
+                uniReparseName.Buffer[ uniReparseName.Length/sizeof( WCHAR)] = L'\\';
+
+                uniReparseName.Length += sizeof( WCHAR);
+            }
         }
 
         RtlCopyMemory( &uniReparseName.Buffer[ uniReparseName.Length/sizeof( WCHAR)],