Index: trunk/src/lib/nt/kFsCache.c
===================================================================
--- trunk/src/lib/nt/kFsCache.c	(revision 3080)
+++ trunk/src/lib/nt/kFsCache.c	(revision 3082)
@@ -2748,6 +2748,6 @@
  *                              failed.
  * @param   ppLastAncestor      Where to return the last parent element found
- *                              (referenced) in case of error an path/file not
- *                              found problem.  Optional.
+ *                              (referenced) in case of error like an path/file
+ *                              not found problem.  Optional.
  */
 PKFSOBJ kFsCacheLookupRelativeToDirA(PKFSCACHE pCache, PKFSDIR pParent, const char *pszPath, KU32 cchPath, KU32 fFlags,
@@ -2795,5 +2795,9 @@
         { /* likely */ }
         else
+        {
+            if (ppLastAncestor)
+                *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj);
             return NULL;
+        }
 
         /*
@@ -2836,5 +2840,9 @@
             { /* likely */ }
             else
+            {
+                if (ppLastAncestor)
+                    *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj);
                 return NULL;
+            }
             return kFsCacheObjRetainInternal(pChild);
         }
@@ -2872,6 +2880,6 @@
     }
 
+    /* not reached */
     return NULL;
-
 }
 
@@ -2894,6 +2902,6 @@
  *                              failed.
  * @param   ppLastAncestor      Where to return the last parent element found
- *                              (referenced) in case of error an path/file not
- *                              found problem.  Optional.
+ *                              (referenced) in case of error like an path/file
+ *                              not found problem.  Optional.
  */
 PKFSOBJ kFsCacheLookupRelativeToDirW(PKFSCACHE pCache, PKFSDIR pParent, const wchar_t *pwszPath, KU32 cwcPath, KU32 fFlags,
@@ -2941,5 +2949,9 @@
         { /* likely */ }
         else
+        {
+            if (ppLastAncestor)
+                *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj);
             return NULL;
+        }
 
         /*
@@ -2982,5 +2994,9 @@
             { /* likely */ }
             else
+            {
+                if (ppLastAncestor)
+                    *ppLastAncestor = kFsCacheObjRetainInternal(&pParent->Obj);
                 return NULL;
+            }
             return kFsCacheObjRetainInternal(pChild);
         }
@@ -3020,5 +3036,4 @@
 
     return NULL;
-
 }
 
@@ -3097,4 +3112,6 @@
             || kFsCacheRefreshObj(pCache, pRoot, penmError))
             return kFsCacheObjRetainInternal(pRoot);
+        if (ppLastAncestor)
+            *ppLastAncestor = kFsCacheObjRetainInternal(pRoot);
         return NULL;
     }
@@ -3196,4 +3213,6 @@
             || kFsCacheRefreshObj(pCache, pRoot, penmError))
             return kFsCacheObjRetainInternal(pRoot);
+        if (ppLastAncestor)
+            *ppLastAncestor = kFsCacheObjRetainInternal(pRoot);
         return NULL;
     }
@@ -3514,5 +3533,5 @@
             || *penmError == KFSLOOKUPERROR_UNSUPPORTED )
             kFsCacheCreatePathHashTabEntryA(pCache, pFsObj, pchPath, cchPath, uHashPath, idxHashTab, fAbsolute,
-                                            pLastAncestor ? pLastAncestor->bObjType & KFSOBJ_F_USE_CUSTOM_GEN : 0, *penmError);
+                                            pLastAncestor ? pLastAncestor->fFlags & KFSOBJ_F_USE_CUSTOM_GEN : 0, *penmError);
         if (pLastAncestor)
             kFsCacheObjRelease(pCache, pLastAncestor);
@@ -3622,5 +3641,5 @@
             || *penmError == KFSLOOKUPERROR_UNSUPPORTED )
             kFsCacheCreatePathHashTabEntryW(pCache, pFsObj, pwcPath, cwcPath, uHashPath, idxHashTab, fAbsolute,
-                                            pLastAncestor ? pLastAncestor->bObjType & KFSOBJ_F_USE_CUSTOM_GEN : 0, *penmError);
+                                            pLastAncestor ? pLastAncestor->fFlags & KFSOBJ_F_USE_CUSTOM_GEN : 0, *penmError);
         if (pLastAncestor)
             kFsCacheObjRelease(pCache, pLastAncestor);
