[NET] NET HLPMSG: Fill inserts with '***' and print a proper error message if the desired message could not be found.

This commit is contained in:
Eric Kohl 2018-12-01 22:03:17 +01:00
parent f4d29a74aa
commit f5bd2c1f8d
3 changed files with 104 additions and 6 deletions

View file

@ -17,8 +17,11 @@ INT cmdHelpMsg(INT argc, WCHAR **argv)
HMODULE hMsgDll = NULL;
INT i;
LONG errNum;
LPWSTR endptr;
LPWSTR pBuffer;
PWSTR endptr;
PWSTR pBuffer;
PWSTR pInserts[10] = {L"***", L"***", L"***", L"***",
L"***", L"***", L"***", L"***",
L"***", NULL};
if (argc < 3)
{
@ -61,18 +64,22 @@ INT cmdHelpMsg(INT argc, WCHAR **argv)
}
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_IGNORE_INSERTS,
FORMAT_MESSAGE_ARGUMENT_ARRAY,
hMsgDll,
errNum,
LANG_USER_DEFAULT,
(LPWSTR)&pBuffer,
0,
NULL);
(va_list *)pInserts);
if (pBuffer)
{
ConPrintf(StdOut, L"\n%s\n", pBuffer);
LocalFree(pBuffer);
}
else
{
PrintErrorMessage(3871);
}
FreeLibrary(hMsgDll);
}
@ -80,18 +87,22 @@ INT cmdHelpMsg(INT argc, WCHAR **argv)
{
/* Retrieve the message string without appending extra newlines */
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
FORMAT_MESSAGE_ARGUMENT_ARRAY,
NULL,
errNum,
LANG_USER_DEFAULT,
(LPWSTR)&pBuffer,
0,
NULL);
(va_list *)pInserts);
if (pBuffer)
{
ConPrintf(StdOut, L"\n%s\n", pBuffer);
LocalFree(pBuffer);
}
else
{
PrintErrorMessage(3871);
}
}
return 0;