Symptoms

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 on impersonate threads.

Cause

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 described in the preceding bullet point, this problem became more obvious in Windows 10 and Windows Server 2016 than in earlier versions of Windows.

Workaround

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

Status

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