You have assigned to NULL the
lpCurrentDirectory parameter, so the default running directory of your executable is the current directory of the calling process.
If the files to read are in another directory the code will fail. Moreover it will fail if a component is not found (
see[
^]). Because the function returns before the process has finished initialization if a required DLL cannot be located, or fails to initialize, the process is terminated.
You can supply the full path for files to open or you have to supply the current directory from where to run the application.