Hello @Fan Young ,
Welcome to Microsoft Q&A!
According to the document,
For Win32 processes that are not running a packaged or protected process, calling this function will also affect the DLL search order of the children processes started from the process that has called the function.
This is by design. If you want to switch DLL directory in the win32 child process, you can only call SetDllDirectory
again.
"By the way, I could not remove the calling of SetDllDirectory in parent process or add a calling of SetDllDirectory in child process."
It is recommended to use AddDllDirectory to add multiple DLL directories.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.