/* Return the ModHandle and delete the entry in the array.  */
VOID* RemoveModHandle(IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
/* Return the ModHandle and delete the entry in the array.  */
VOID* RemoveModHandle(IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
{
  UINTN                   Index;
  PDB_NAME_TO_MOD_HANDLE  *Array;
  if (ImageContext->PdbPointer == NULL) {
    return NULL;
  }
  Array = mPdbNameModHandleArray;
  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
    if ((Array->PdbPointer != NULL) && (AsciiStrCmp (Array->PdbPointer, ImageContext->PdbPointer) == 0)) {
      HeapFree (GetProcessHeap (), 0, Array->PdbPointer);
      Array->PdbPointer = NULL;
      return Array->ModHandle;
    }
  }
  return NULL;
}