The TWUCloseSession function closes an update session that was opened by TWUOpenSession or TWUOpenUpdateURL. The connection is closed and all internal resources are released.

Note: This function does not delete any downloaded or temporary files; you must do so yourself using the Win32 API DeleteFile if required, or call TWUCleanupDownloads before closing the session.

URESULT TWUCloseSession(
    TWUHANDLE hSession

Delphi version:

function TWUCloseSession(
    hSession: TWUHANDLE


[Input] Handle to an open TWU session.

Return value

If the function succeeds, it returns ERROR_SUCCESS (0). If it fails, it returns a nonzero Win32 API error code. You can use TWUGetErrorMessage to retrieve the error message that corresponds to the error code.