问题
There is a scheduled task that is attached to a custom event in the EventLog
, it executes the lines below:
reconnect.cmd
c:\windows\system32\rasphone -f "phone_book.pbk" -d "vpn_connection"
net stop my_windows_service
net start my_windows_service
The task ususally runs normally without errors. But sometimes it returns error The application failed to initialize properly (3221225794)
. The task is configured to run under system
account so it is supposed to have all required permissions to run that batch script.
Why do I keep getting this error? What can cause it and how do I debug it?
edit: start in option
The task uses "D:\"
as working directory/start in location. The reconnect.cmd script is located at "D:\"
. Can this be the cause?
回答1:
I posted this article earlier today on how to decode errors Error 2147463168 when trying to bind to an AD User Object
//
// MessageId: STATUS_DLL_INIT_FAILED
//
// MessageText:
//
// {DLL Initialization Failed}
// Initialization of the dynamic link library %hs failed. The process is terminating abnormally.
//
#define STATUS_DLL_INIT_FAILED ((NTSTATUS)0xC0000142L)
3221225794=0xC0000142 (use calculator)
This should identify which process (cmd or rasphone) and which dll.
You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:\
Start Windbg
. File menu - Symbol File Path and enter
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G C:\windows\system32\cmd.exe /k d:\batfile.bat
You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.
回答2:
Don't know why but running tasks under SYSTEM
account was the cause. When we changed the account simply to local admin
tasks ran flawlessly.
来源:https://stackoverflow.com/questions/25153262/getting-the-the-application-failed-to-initialize-properly-3221225794-error-exe