+ /* Get the pointer to the previous entries NextEntryOffset */
+ NextEntryOffset = (PULONG)&Buffer[LastOffset];
+
+ /* Set the previous entries NextEntryOffset */
+ *NextEntryOffset = CurrentOffset - LastOffset;
+
+ /* Return the used buffer size */
+ *Size = CurrentOffset + InfoSize + NameLength;
+
+ /* Leave, if there is no space left in the buffer */
+ if (Status == STATUS_BUFFER_OVERFLOW)
+ return Status;
+
+ /* Leave, if we should return only one entry */
+ if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
+ return STATUS_SUCCESS;
+
+ /* Store the current offset for the next round */
+ LastOffset = CurrentOffset;