none
The application failed to initialize properly(0xc0000142). click ok to terminate the application on XPe

    Question

  • Hello - I wrote an application in VB6 suppose 'APP_X'. which i am running every night using a service called 'WinService_Y' running as admin user. Now in APP_X, I am using net.exe to sync time with server.


    When the WinService_Y triggers the APP_X, it gives me the error saying:

    "The application failed to initialize properly(0xc0000142). click ok to terminate the application"


    Okay, title of the dialog box is Net.exe so i know this occured when APP_X is trying to execute Net.exe.




    P.S: This does not occur if i directly run the APP_X without using the WinService_Y

    APP_X is written in VB6 and WinService_Y is in C# .net framework 2.0

    APP_X is just not time sync there are tons of other things


    Sync time Code APP_X(sample):

    ---------------------------------------------------------------------------------

       sAppToRun = "net time " & "\\" & sBOServer & " /set /y"
        WriteLog "Trying to sync with admin account"
        Set objexec = objShell.Exec(sAppToRun)
        sOut = objexec.stdout.readall()
        If sOut = "" Then
           ShellAndWaitAsUser = CreateProcessAsUser(".", "Myuser", "MyPassword", Trim(sAppToRun))
           WriteLog "Timesync status on device"
           If ShellAndWaitAsUser Then
             WriteLog "TimeSync successfully"
           Else
             GoTo err
           End If
        Else
            sOut = Replace(sOut, Chr(13), vbNullString)
            WriteLog sOut
        End If
        Exit Sub

    ----------------------------------------------------------------------------------------



    Any help will be appericiated!


    Thanks!

    Thursday, February 23, 2017 4:46 PM

Answers