Home  >  Article  >  Backend Development  >  Windows Calculator application crashes due to WerFault inconsistency when launched from a service using CreateProcessAsUserW()

Windows Calculator application crashes due to WerFault inconsistency when launched from a service using CreateProcessAsUserW()

PHPz
PHPzforward
2024-02-05 22:51:071201browse

使用 CreateProcessAsUserW() 从服务启动时,Windows 计算器应用程序会因 WerFault 不一致而崩溃

Question content

The Windows service is written in Go and trying to create a calculator in the user context using CreateProcessAsUserW() process.

Its code is inspired by this gist:

https://gist.github.com/LiamHaworth/1ac37f7fb6018293fc43f86993db24fc#file-native-go

Most of the time, the Calculator application starts in the active user; however, sometimes the application fails to start without CreateProcessAsUserW() returning no error.

Inspection using Procmon revealed that upon launching the Calculator application, the application crashed and resorted to collecting a WerFault dump. Unfortunately, I don't see a detailed dump in the event log.

WerFault crash observed in ProcMon

Detailed stack traces of launching 3 similar calculator applications using CreateProcessAsUserW - the first two succeed, the third fails

This error is random in nature and does not make the application reliable. I'm very clueless on what/how to debug from here and would really appreciate any help.


Correct answer


The error appears to occur due to a wrong compilation environment, where binaries created with x64 are run on arm64. Thanks for everyone’s input

The above is the detailed content of Windows Calculator application crashes due to WerFault inconsistency when launched from a service using CreateProcessAsUserW(). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete