LoadLibrary function returns STATUS_DLL_NOT_FOUND error on impersonate thread in Windows

Applies to: Windows 10, version 2004, all editionsWindows Server, version 2004, all editionsWindows 10, version 1909, all editions


In Windows 10 and Windows Server version 1709 or later versions, 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, Windows Server 2016, Windows Server 2019, and Windows Server, version 1909 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.