FormatMessage Fails with error code 317

别来无恙 提交于 2019-12-24 19:06:47

问题


When I executed the following code piece it fails with error code 317. How can solve the issue? We are using Unicode Character Set for the project

  char* pszMessgeBuffer = NULL;
  FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
        FORMAT_MESSAGE_FROM_SYSTEM | 
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
        dwErrorId,
        0, // Default language
        (LPTSTR) &pszMessgeBuffer,
        0,
        NULL )

回答1:


Using the error code lookup tool from Visual Studio, 317 is described as

The system cannot find message text for message number 0x%1 in the message file for %2.

This means that a message description does not exist in the system for the previous error code. The MSDN documentation for FormatMessage with flag FORMAT_MESSAGE_FROM_SYSTEM states that:

Not all Windows Embedded CE–based devices will contain the system message-table resources. This is a selectable part of the Windows Embedded CE operating system and is often removed to conserve space.




回答2:


I think error 317 is the result of using Win32 function LsaNtStatusToWinError(87), where winstatus 87 means 'The parameter is incorrect'



来源:https://stackoverflow.com/questions/6264449/formatmessage-fails-with-error-code-317

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!