[NTOBJSHEX]
authorThomas Faber <thomas.faber@reactos.org>
Wed, 7 Oct 2015 10:23:06 +0000 (10:23 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Wed, 7 Oct 2015 10:23:06 +0000 (10:23 +0000)
- Correctly handle NULL ppidl in EnumerateNext as required by Skip() callers
- Don't reenumerate NT directories every time EnumerateNext is called from Skip()
CORE-10311 #resolve

svn path=/trunk/; revision=69462

reactos/dll/shellext/ntobjshex/ntobjenum.cpp

index 094a242..dd46289 100644 (file)
@@ -250,7 +250,8 @@ public:
             entry->cb += sizeof(WCHAR);
         }
 
             entry->cb += sizeof(WCHAR);
         }
 
-        *ppidl = (LPITEMIDLIST) entry;
+        if (ppidl)
+            *ppidl = (LPITEMIDLIST) entry;
         return S_OK;
     }
 
         return S_OK;
     }
 
@@ -409,7 +410,8 @@ public:
             entry->cb += entry->contentsLength + sizeof(WCHAR);
         }
 
             entry->cb += entry->contentsLength + sizeof(WCHAR);
         }
 
-        *ppidl = (LPITEMIDLIST) entry;
+        if (ppidl)
+            *ppidl = (LPITEMIDLIST) entry;
         return S_OK;
     }
 
         return S_OK;
     }
 
@@ -480,7 +482,8 @@ public:
 
         }
 
 
         }
 
-        *ppidl = (LPITEMIDLIST) entry;
+        if (ppidl)
+            *ppidl = (LPITEMIDLIST) entry;
         return S_OK;
     }
 
         return S_OK;
     }
 
@@ -596,12 +599,13 @@ public:
         if (!NT_SUCCESS(NtQueryDirectoryObject(m_directory, dirbuffer, 2048, TRUE, m_first, &m_enumContext, NULL)))
             return S_FALSE;
 
         if (!NT_SUCCESS(NtQueryDirectoryObject(m_directory, dirbuffer, 2048, TRUE, m_first, &m_enumContext, NULL)))
             return S_FALSE;
 
+        m_first = FALSE;
+
         // if ppidl is NULL, assume the caller was Skip(),
         // so we don't care about the info
         if (!ppidl)
             return S_OK;
 
         // if ppidl is NULL, assume the caller was Skip(),
         // so we don't care about the info
         if (!ppidl)
             return S_OK;
 
-        m_first = FALSE;
         POBJECT_DIRECTORY_INFORMATION info = (POBJECT_DIRECTORY_INFORMATION) dirbuffer;
 
         if (info->Name.Buffer)
         POBJECT_DIRECTORY_INFORMATION info = (POBJECT_DIRECTORY_INFORMATION) dirbuffer;
 
         if (info->Name.Buffer)