question

JGarcia-7651 avatar image
0 Votes"
JGarcia-7651 asked LeilaKong-MSFT commented

0xC0000142 Errors from Tasks in Windows Task Scheduler

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.

I tried monitoring the task with Process Monitor, below is a snippet of the log output leading up to the exit code. I know that error code 0xC0000142 is STATUS_DLL_INIT_FAILED. Right before the failure, tzres.dll.mui and tzres.dll are the last files accessed. There are no failure messages with these files other than the FILE LOCKED WITH ONLY READERS - I believe this is for read-only access, but these files are also read-only access on the old server where the tasks are working...

90698-procmonlog.png

windows-server-2019
procmonlog.png (392.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered JGarcia-7651 commented

Can you run the program directly and it works? If it works then it isn't an issue with dependencies.

I cannot really read your image so I cannot say what is going on there. I know nothing about C++ Builder so I cannot answer to its dependencies but, again, if the app runs outside TS then it isn't a dependency issue. Until the app runs outside TS then it won't run inside TS.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I tried running the program in the commandline, it doesn't work either. I get the same 0xC0000142 error. For the image, you can view a larger image if you click the .png link under the image.

0 Votes 0 ·

So the issue isn't with TS or permissions but rather the app is likely missing dependencies. You could run Depends to see if there are any binaries missing but I suspect it will not report any issues.

As for the image, yes I can see the larger image. My point was that it isn't providing anything useful as everything is successful. The issue isn't with files or registry it appears.

My gut instinct is that you'll need to contact support for C++ Builder. I notice in their support docs they don't list Server 2019 as a supported target platform. Seems odd to me since Win 10 is supported.

0 Votes 0 ·

Ahhhh you are right - latest Windows Server version they support is 2016, did not notice that before. I will try contacting their support team, thanks for your help!

0 Votes 0 ·
LeilaKong-MSFT avatar image
0 Votes"
LeilaKong-MSFT answered LeilaKong-MSFT commented

Hello @JGarcia-7651 ,

Is there any update on your side? We're looking forward to your good news.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Nope, C++ Builder support has been slow to get back to me. They've asked me to try things I've already tried such as attempting to find missing dependencies with Process Monitor and Dependency Walker. Both apps show me missing import with DLLs, but most seem to do with system specific DLLs. Most of the errors have to do with SysWOW64 DLLs.

0 Votes 0 ·

Hello @JGarcia-7651 ,

Many thanks for your reply. We look forward to hearing from you later on.

Please understand due to security policy and from our professional level, we do not provide dump/log analysis. In addition, if this problem is more urgent for you I still recommend that you open a case to Microsoft for further professional help.
https://support.microsoft.com/en-us/help/4341255/support-for-busines

0 Votes 0 ·