createprocess-windows icon indicating copy to clipboard operation
createprocess-windows copied to clipboard

Order of command line arguments matter when it comes to /runelevated and /w

Open electricbolt opened this issue 1 year ago • 0 comments

Just a quick note that the order for command line arguments matter when it comes to /runelevated and /w (wait for process to terminate). In my case I had the following:

createprocess.exe /v /runelevated /w signtool.exe sign /v /debug /fd SHA256 /tr "http://timestamp.acs.microsoft.com" /td SHA256 /dlib C:\Users\build\Microsoft.Trusted.Signing.Client.1.0.53\bin\x64\Azure.CodeSigning.Dlib.dll /dmdf metadata.json uninstaller.exe

and found that whilst the child createprocess.exe waited for the signtool.exe to terminate, the parent createprocess.exe terminated immediately and the children continued on. I was of course expecting /w to make the parent process wait as well. The answer is to swap the command line argument order:

createprocess.exe /v /w /runelevated signtool.exe sign /v /debug /fd SHA256 /tr "http://timestamp.acs.microsoft.com" /td SHA256 /dlib C:\Users\build\Microsoft.Trusted.Signing.Client.1.0.53\bin\x64\Azure.CodeSigning.Dlib.dll /dmdf metadata.json uninstaller.exe

Perhaps the README.md or the DumpSyntax() output could make this clearer? Thanks for such an amazing tool.

electricbolt avatar May 19 '24 02:05 electricbolt