I Have the following architecture :
Program A => CreateProcess 'program B' => Wait for program B to end => SQLConnect => Wait for SQLConnect to end => CreateProcess 'program B' => Wait for program B to end
My Program B is a very simple exe who basiclly only do a LoadLibrary
Before SQLConnect the LoadLibrary of program B succeed
After SQL Connect it fails with error 126 ERROR_MOD_NOT_FOUND
I Have no clue of what is going one here.
Program A is coded with WinDev, Program B is coded in C, Operating System is Windows 10 x64.
I would take any lead.
Thanks for your help.
The ODBC driver does a call to SetDllDirectory which change the dll path where windows is looking and leading LoadLibrary to fail.
Apparently this setup is inherited by the child process, even if it does not appear on the env.
An easy fix was to call a SetDllDirectory(NULL) at the begining of the child process.
Answered By – damjuve