I had nearly similar problem with this. FormatMessage Fails with error code 317
The difference is it is said as an answer that this is caused by "FORMAT_MESSAGE_FROM_SYSTEM"
but when I remove it it happens again.
I am trying to read from EventLog
in Windows Server 2003. But when I try to use FormatMessage
function I get 317
error.
Interestingly same code works for Windows Server 2008. How can I fix this or what can I use instead of FormatMessage
?
My code:
FormatMessage(FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
g_hResources, // handles DLL containing message table
MessageId,
0, // Default language
(LPWSTR) &pMessage,
0,
(va_list*)pArgs )
Good day to you..