Exemple #1
0
EFI_STATUS
EFIAPI
ProcessModuleUnloadList (
  IN EFI_HANDLE        ImageHandle
  )
{
  return NetLibDefaultUnload (ImageHandle);
}
Exemple #2
0
/**
  Unloads an image.

  @param  ImageHandle           Handle that identifies the image to be unloaded.

  @retval EFI_SUCCESS           The image has been unloaded.
  @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.

**/
EFI_STATUS 
EFIAPI
DnsUnload (
  IN EFI_HANDLE  ImageHandle
  )
{
  EFI_STATUS  Status;

  LIST_ENTRY                      *Entry;
  DNS4_CACHE                      *ItemCache4;
  DNS4_SERVER_IP                  *ItemServerIp4;
  DNS6_CACHE                      *ItemCache6;
  DNS6_SERVER_IP                  *ItemServerIp6;

  ItemCache4    = NULL;
  ItemServerIp4 = NULL;
  ItemCache6    = NULL;
  ItemServerIp6 = NULL;
  
  //
  // Disconnect the driver specified by ImageHandle
  //
  Status = NetLibDefaultUnload(ImageHandle);
  if (EFI_ERROR (Status)) {
    return Status;
  }

  //
  // Free mDriverData.
  //
  if (mDriverData != NULL) {
    if (mDriverData->Timer != NULL) {
      gBS->CloseEvent (mDriverData->Timer);
    }
    
    while (!IsListEmpty (&mDriverData->Dns4CacheList)) {
      Entry = NetListRemoveHead (&mDriverData->Dns4CacheList);
      ItemCache4 = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
      if (ItemCache4->DnsCache.HostName != NULL) {
        FreePool (ItemCache4->DnsCache.HostName);
      }
      if (ItemCache4->DnsCache.IpAddress != NULL) {
        FreePool (ItemCache4->DnsCache.IpAddress);
      }
      FreePool (ItemCache4);
    }

    while (!IsListEmpty (&mDriverData->Dns4ServerList)) {
      Entry = NetListRemoveHead (&mDriverData->Dns4ServerList);
      ItemServerIp4 = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, AllServerLink);
      FreePool (ItemServerIp4);
    }

    while (!IsListEmpty (&mDriverData->Dns6CacheList)) {
      Entry = NetListRemoveHead (&mDriverData->Dns6CacheList);
      ItemCache6 = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
      if (ItemCache6->DnsCache.HostName != NULL) {
        FreePool (ItemCache6->DnsCache.HostName);
      }
      if (ItemCache6->DnsCache.IpAddress != NULL) {
        FreePool (ItemCache6->DnsCache.IpAddress);
      }
      FreePool (ItemCache6);
    }

    while (!IsListEmpty (&mDriverData->Dns6ServerList)) {
      Entry = NetListRemoveHead (&mDriverData->Dns6ServerList);
      ItemServerIp6 = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, AllServerLink);
      FreePool (ItemServerIp6);
    }
    
    FreePool (mDriverData);
  }
 
  return Status;
}