LoadLibrary function returns STATUS_DLL_NOT_FOUND error on impersonate thread in Windows

Applies to: Windows 10, version 1809Windows Server 2019, all versionsWindows 10, version 1803 More


In Windows Server 2016 or Windows 10, if you do not grant dynamic-link library (DLL) access to the process token itself when you use the LoadLibrary function to load the DLL, you receive a "STATUS_DLL_NOT_FOUND" error message on impersonate threads.


Note This behavior is by design in Windows.

This behavior occurs for the following reasons:

  • It's assumed that all Windows-based operating systems have access rights to the DLL that's referred to by the process token.
  • Regardless of the condition that's described in the preceding bullet point, this problem is more obvious in Windows 10 and Windows Server 2016 than in earlier versions of Windows.


To work around this issue, make sure that process tokens have access rights to all the executables that the process loads.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.