]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: add AFSRetrieveParentPath()
authorPeter Scott <pscott@kerneldrivers.com>
Wed, 2 Nov 2011 14:18:09 +0000 (10:18 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 2 Nov 2011 18:04:24 +0000 (11:04 -0700)
Change-Id: Ic3da7f09f12f0e089b9561a542b2cf04ff61c98d
Reviewed-on: http://gerrit.openafs.org/5783
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h

index 3fa2e5922e8962a6656f9f7825da218e000037c8..56b2defc837f58f161de3201233c14d36d35e109 100644 (file)
@@ -8243,3 +8243,35 @@ try_exit:
 
     return ntStatus;
 }
+
+void
+AFSRetrieveParentPath( IN UNICODE_STRING *FullFileName,
+                       OUT UNICODE_STRING *ParentPath)
+{
+
+    USHORT usIndex = 0;
+
+    *ParentPath = *FullFileName;
+
+    //
+    // If the final character is a \, jump over it
+    //
+
+    if( ParentPath->Buffer[ (ParentPath->Length/sizeof( WCHAR)) - 1] == L'\\')
+    {
+        ParentPath->Length -= sizeof( WCHAR);
+    }
+
+    while( ParentPath->Buffer[ (ParentPath->Length/sizeof( WCHAR)) - 1] != L'\\')
+    {
+        ParentPath->Length -= sizeof( WCHAR);
+    }
+
+    //
+    // And the separator
+    //
+
+    ParentPath->Length -= sizeof( WCHAR);
+
+    return;
+}
\ No newline at end of file
index 24125fad3c9d7de5a506fc2e9e2a1f4e90bd2c9e..c51ae088574c28ca1bf9f037db4f40fe4399784a 100644 (file)
@@ -1342,6 +1342,10 @@ AFSValidNameFormat( IN UNICODE_STRING *FileName);
 NTSTATUS
 AFSCreateDefaultSecurityDescriptor( void);
 
+void
+AFSRetrieveParentPath( IN UNICODE_STRING *FullFileName,
+                       OUT UNICODE_STRING *ParentPath);
+
 //
 // AFSWorker.cpp Prototypes
 //