RemoveDllDirectory function (libloaderapi.h)

Removes a directory that was added to the process DLL search path by using AddDllDirectory.


BOOL RemoveDllDirectory(


[in] Cookie

The cookie returned by AddDllDirectory when the directory was added to the search path.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


After RemoveDllDirectory returns, the cookie is no longer valid and should not be used.

Windows 7, Windows Server 2008 R2, Windows Vista and Windows Server 2008:  To call this function in an application, use the GetProcAddress function to retrieve its address from Kernel32.dll. KB2533623 must be installed on the target platform.


Requirement Value
Minimum supported client Windows 8 [desktop apps only],KB2533623 on Windows 7, Windows Server 2008 R2, Windows Vista, and Windows Server 2008
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header libloaderapi.h (include Windows.h)
DLL Kernel32.dll