Unloadimage() – Intel Extensible Firmware Interface User Manual

Page 179

Advertising
background image

Services — Boot Services

Version 1.10

12/01/02

5-81

UnloadImage()

Summary

Unloads an image.

Prototype

typedef
EFI_STATUS
UnloadImage (

IN EFI_HANDLE

ImageHandle

);

Parameters

ImageHandle

Handle that identifies the image to be unloaded.

Description

The

UnloadImage()

function unloads a previously loaded image.

There are three possible scenarios. If the image has not been started, the function unloads the
image and returns

EFI_SUCCESS

.

If the image has been started and has an

Unload()

entry point, control is passed to that entry

point. If the image’s unload function returns

EFI_SUCCESS

, the image is unloaded; otherwise,

the error returned by the image’s unload function is returned to the caller. The image unload
function is responsible for freeing all allocated memory and ensuring that there are no references to
any freed memory, or to the image itself, before returning

EFI_SUCCESS

.

If the image has been started and does not have an

Unload()

entry point, the function returns

EFI_UNSUPPORTED

.

EFI 1.10 Extension

All of the protocols that were opened by

ImageHandle

using the boot service

OpenProtocol()

are automatically closed with the boot service

CloseProtocol()

. If all of

the open protocols are closed, then

EFI_SUCCESS

is returned. If any call to

CloseProtocol()

fails, then the error code from

CloseProtocol()

is returned.

Status Codes Returned

EFI_SUCCESS

The image has been unloaded.

EFI_UNSUPPORTED

The image has been started, and does not support unload.

EFI_INVALID_PARAMETER

ImageHandle

is not a valid image handle.

Exit code from Unload handler

Exit code from the image’s unload function.

Advertising