I previously had many C++ .exe programs (developed with C++ Builder XE7) running as scheduled tasks in a Windows 2008 R2 Datacenter server. These tasks were being run by the SYSTEM account and I never had any issues with them before.
I recently imported these tasks to a new Windows 2019 Datacenter server and set these tasks up in the Task Scheduler. The same SYSTEM account is being used to run the tasks, but with the updated Windows Server, these tasks now give me a run result of 0xC0000142.
Most of the resources I found online say to increase the desktop heap size in the registry editor - I have done this multiple times and restarted the server after each increase, but I was still getting the same results with this method so I reset the desktop heap size back to the original value.
I also thought it had to do with missing C++ redistributables - the new server only had redistributables from 2015-2019, while the 2008 R2 server had these along with redistributables from 2013 and 2008. So I installed these extra redistributables but I still got the same result.
I have tried manually recreating the tasks, I tried running the tasks with different domain admin accounts, also played around with the "run only when user is logged in/run whether user is logged in or not" setting. All of these led to the same 0xC0000142 error.
Also, there were no errors being shown in Windows Task Scheduler history or in the Event Viewer.
Any extra tips/guidance would be much appreciated!
EDIT: Here is a snippet of the filtered Process Monitor logs leading up to the exit code and task failure.
EDIT 2: It's been over a month now and still running into these problems. I have upgraded C++ Builder to 10.4, moved my old code to the new IDE, and re-linked all the packages/include paths/library paths. I also took my original .exe I was working with and split it up into multiple tasks with multiple .exe files - now most of these split tasks are running, but some still give the 0xC0000142 code. I also tried to use this tool from GitHub - Dependencies App - to attempt to find out what exact DLL is failing, but it just points me to some core Windows system DLLs (api-ms-win-....dll, ext-ms-win-....dll). I feel this output is misleading, does anyone know of any better tools to determine missing DLLs?