TerminateExtension Function

The TerminateExtension function unloads the ISAPI DLL. This optional entry-point function is called by IIS immediately before unloading the DLL from its process.

BOOL WINAPI TerminateExtension(
   DWORD dwFlags


  • dwFlags
    A DWORD that specifies whether IIS should unload the extension.




    Indicates that the server wants to unload the extension. The extension can return false if the server should not unload the extension; or return true otherwise.


    Indicates that the server is about to unload the extension. The extension cannot refuse.

Return Value

Return true if dwFlags included HSE_TERM_ADVISORY_UNLOAD and the extension can be unloaded; otherwise, false.

If dwFlags included HSE_TERM_ MUST_UNLOAD, then the extension will be unloaded by the server, and a return value will be ignored.


Because TerminateExtension is never called by IIS until all outstanding requests have been processed, it is not necessary to include code to wait for outstanding requests within TerminateExtension.

TerminateExtension provides a place to put code that cleans up threads or de-allocate resources that are allocated by the GetExtensionVersion Function function.


Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

Header: Declared in httpext.h.