Why is %1 rarely substituted in “%1 is not a valid Win32 application.”

前端 未结 2 1144
醉梦人生
醉梦人生 2021-01-18 09:25

I\'m sure most Windows developers are familiar with this error message, usually when trying to mix 32- and 64-bit executables. In particular Python and Java can both get it.

2条回答
  •  情话喂你
    2021-01-18 10:16

    The caller is doing everything right. They are calling FormatMessage, passing along the FORMAT_MESSAGE_IGNORE_INSERTS flag1), like everyone should. The caller is not in control of the message that gets created, and has no way of knowing, that it should pass additional arguments, what types they should be or how many.

    This was an early design bug in the Windows error reporting system, and you'll see those placeholders in every well-behaved application.


    1) See The importance of the FORMAT_MESSAGE_IGNORE_INSERTS flag.

提交回复
热议问题