Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
search inside all forums
CPROG12Z hangs when spawned from windows service context
John C. Aug 23, 2017 at 06:50 AM (06:50 hours)
Staff: Mikhail A.

  • Software: CPROG12Z Version
    PC: Windows 7 Professional, SP1, 64-bit
    Command line: cprogz12.exe hideapp prog.cfg interface=USBMULTILINK port=USB1
    prog.cfg: GO

    When spawned from a windows service context CPROG12Z appears to do nothing and fails to terminate

    When run from a gui commandline shell CPROGZ12 runs and terminates successfully within 30 seconds

    The same user account is used in both cases.


    We are trying to integrate a PE Multilink BDM programmer in our automated test system and have recently purchased a license to run the command-line CPROG12Z from our automated test server/service for this purpose.


    • Additional info... I noticed when CPROG12Z is run from a command line terminal that an application icon flashes briefly in the toolbar despite specifying the "hideapp" option. This implies that this "command line" tool is actually still interacting with a window manager. I imagine this could account for its failure to run as a service?

  • Additonal info... I snapshot the CPROG12Z stack a few times and it appears to stuck here...

    0   ntoskrnl.exe!memset+0x64a
    1   ntoskrnl.exe!KeWaitForMultipleObjects+0xd52
    2   ntoskrnl.exe!KeWaitForSingleObject+0x19f
    3   ntoskrnl.exe!PoStartNextPowerIrp+0xbd4
    4   ntoskrnl.exe!PoStartNextPowerIrp+0x186d
    5   ntoskrnl.exe!KeWaitForMultipleObjects+0xf5d
    6   ntoskrnl.exe!KeWaitForMultipleObjects+0x26a
    7   win32k.sys!memset+0x7c97
    8   win32k.sys!memset+0x7d59
    9   win32k.sys!W32pArgumentTable+0xaa72
    10   ntoskrnl.exe!KeSynchronizeExecution+0x3a23
    11   wow64cpu.dll!TurboDispatchJumpAddressEnd+0x6c0
    12   wow64cpu.dll!TurboDispatchJumpAddressEnd+0x676
    13   wow64.dll!Wow64SystemServiceEx+0x1ce
    14   wow64.dll!Wow64LdrpInitialize+0x42a
    15   ntdll.dll!RtlUniform+0x6e6
    16   ntdll.dll!EtwEventSetInformation+0x1da09
    17   ntdll.dll!LdrInitializeThunk+0xe
    18   USER32.dll!WaitMessage+0x15
    19   cprog12z.exe+0x7997c
    20   cprog12z.exe+0x11f568
    21   cprog12z.exe+0x11f5d6
    22   cprog12z.exe+0x122073
    23   cprog12z.exe+0x19d656
    24   kernel32.dll!BaseThreadInitThunk+0x12
    25   ntdll.dll!RtlInitializeExceptionChain+0x63
    26   ntdll.dll!RtlInitializeExceptionChain+0x36

  • Additional info...

    I am launching CPROG12Z from a python 3.6 script:-

    import subprocess"cprogz12.exe hideapp prog.cfg interface=USBMULTILINK port=USB1")

    I tried specifying "shell=True". This made no apparent difference.

    I am now wondering if overriding any of the default CreateProcess lpStartupInfo settings might make any difference? I am not a windoze programmer so would need advice on suitable values.

  • Update...

    It seems python 3.6 only exposes a subset of lpStartupInfo fields. I have tried the following with no improvement:-

    import subprocess

    # Windows specific charm to try and hide window
    startupinfo = subprocess.STARTUPINFO()
    startupinfo.dwFlags = subprocess.STARTF_USESHOWWINDOW
    startupinfo.wShowWindow = subprocess.SW_HIDE"cprogz12.exe hideapp prog.cfg interface=USBMULTILINK port=USB1", startupinfo=startupinfo)

    It seems that we can not control lpDesktop nor lpTitle via python lib, so hoping that they are not the issue.

  • Dear John,

    Could you explain a little more about what you are trying to do?

    I ran the code you attached and CPROG12Z responds by performing the necessary actions, then seems to hang around for about a minute or so before terminating the process. I am not quite sure what you mean by running it as a Windows Service.

    Also, I noticed you are calling it as cprogz12.exe, while in general the executable is named cprog12z.exe. Just want to make sure that is not a cause for issue.


  • Mikhail,

    M> Could you explain a little more about what you are trying to do?

    We are trying to use cprog12z to program freescale chips in our automated test system.

    For reasons outside my control, test scripts are launched from microsoft VSTS "Private Agents" running on windows7 PCs [].

    These Agents run as windows services [].

    The Agent services launch cprog12z whenever new firmware has been built on the master server.

    M> Also, I noticed you are calling it as cprogz12.exe, while in general the executable is named cprog12z.exe. Just want to make sure that is not a cause for issue.

    "cprogz12.exe" was a typo just in this thread. I can see, using Process Explorer, that the cprog12z process gets started successfully by the Agent/Service, but it never terminates. The same command line fine when executed from a windows GUI session using the same windows user account as the Agent.


Add comment

   Want to comment? Please login or create a new PEmicro account.

© 2019 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement