search.\r
@param SearchType Indicates the type of section to search for.\r
@param SectionInstance Indicates which instance of section to find.\r
- This is an in/out parameter to deal with\r
- recursions.\r
+ This is an in/out parameter and it is 1-based,\r
+ to deal with recursions.\r
@param SectionDefinitionGuid Guid of section definition\r
@param FoundChild Output indicating the child node that is found.\r
@param FoundStream Output indicating which section stream the child\r
EFI_STATUS ErrorStatus;\r
EFI_STATUS Status;\r
\r
+ ASSERT (*SectionInstance > 0);\r
+\r
CurrentChildNode = NULL;\r
ErrorStatus = EFI_NOT_FOUND;\r
\r
}\r
}\r
\r
+ //\r
+ // Type mismatch, or we haven't found the desired instance yet.\r
+ //\r
+ ASSERT (*SectionInstance > 0);\r
+\r
if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {\r
//\r
// If the current node is an encapsulating node, recurse into it...\r
&RecursedFoundStream,\r
AuthenticationStatus\r
);\r
- //\r
- // If the status is not EFI_SUCCESS, just save the error code and continue\r
- // to find the request child node in the rest stream.\r
- //\r
if (*SectionInstance == 0) {\r
+ //\r
+ // The recursive FindChildNode() call decreased (*SectionInstance) to\r
+ // zero.\r
+ //\r
ASSERT_EFI_ERROR (Status);\r
*FoundChild = RecursedChildNode;\r
*FoundStream = RecursedFoundStream;\r
return EFI_SUCCESS;\r
} else {\r
+ //\r
+ // If the status is not EFI_SUCCESS, just save the error code and\r
+ // continue to find the request child node in the rest stream.\r
+ //\r
ErrorStatus = Status;\r
}\r
} else if ((CurrentChildNode->Type == EFI_SECTION_GUID_DEFINED) && (SearchType != EFI_SECTION_GUID_DEFINED)) {\r