mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 17:05:45 +00:00
[CONUTILS]: Fix build:
- Commit the *Puts functions. - Fix __stdcall that needs to be read __cdecl for variadic functions. svn path=/trunk/; revision=72931
This commit is contained in:
parent
cc5ded3854
commit
0b335753ce
2 changed files with 145 additions and 13 deletions
|
@ -532,23 +532,13 @@ ConWrite(
|
||||||
}
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
ConPrintfV(
|
ConPuts(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN LPWSTR szStr,
|
IN LPWSTR szStr)
|
||||||
IN va_list args) // arg_ptr
|
|
||||||
{
|
{
|
||||||
INT Len;
|
INT Len;
|
||||||
WCHAR bufFormatted[CON_RC_STRING_MAX_SIZE];
|
|
||||||
|
|
||||||
#if 1 /////////////////////////////////////////////////////////////////////// 0
|
Len = Stream->WriteFunc(Stream, szStr, wcslen(szStr));
|
||||||
PWSTR pEnd;
|
|
||||||
StringCchVPrintfExW(bufFormatted, ARRAYSIZE(bufFormatted), &pEnd, NULL, 0, szStr, args);
|
|
||||||
Len = pEnd - bufFormatted;
|
|
||||||
#else
|
|
||||||
StringCchVPrintfW(bufFormatted, ARRAYSIZE(bufFormatted), szStr, args);
|
|
||||||
Len = wcslen(bufFormatted);
|
|
||||||
#endif
|
|
||||||
Len = Stream->WriteFunc(Stream, bufFormatted, Len);
|
|
||||||
|
|
||||||
/* Fixup returned length in case of errors */
|
/* Fixup returned length in case of errors */
|
||||||
if (Len < 0)
|
if (Len < 0)
|
||||||
|
@ -558,6 +548,33 @@ ConPrintfV(
|
||||||
}
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
|
ConPrintfV(
|
||||||
|
IN PCON_STREAM Stream,
|
||||||
|
IN LPWSTR szStr,
|
||||||
|
IN va_list args) // arg_ptr
|
||||||
|
{
|
||||||
|
INT Len;
|
||||||
|
WCHAR bufSrc[CON_RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
|
#if 1 /////////////////////////////////////////////////////////////////////// 0
|
||||||
|
PWSTR pEnd;
|
||||||
|
StringCchVPrintfExW(bufSrc, ARRAYSIZE(bufSrc), &pEnd, NULL, 0, szStr, args);
|
||||||
|
Len = pEnd - bufSrc;
|
||||||
|
#else
|
||||||
|
StringCchVPrintfW(bufSrc, ARRAYSIZE(bufSrc), szStr, args);
|
||||||
|
Len = wcslen(bufSrc);
|
||||||
|
#endif
|
||||||
|
Len = Stream->WriteFunc(Stream, bufSrc, Len);
|
||||||
|
|
||||||
|
/* Fixup returned length in case of errors */
|
||||||
|
if (Len < 0)
|
||||||
|
Len = 0;
|
||||||
|
|
||||||
|
return Len;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT
|
||||||
|
__cdecl
|
||||||
ConPrintf(
|
ConPrintf(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN LPWSTR szStr,
|
IN LPWSTR szStr,
|
||||||
|
@ -579,6 +596,33 @@ ConPrintf(
|
||||||
return Len;
|
return Len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT
|
||||||
|
ConResPuts(
|
||||||
|
IN PCON_STREAM Stream,
|
||||||
|
IN UINT uID)
|
||||||
|
{
|
||||||
|
INT Len;
|
||||||
|
#if 0
|
||||||
|
WCHAR bufSrc[CON_RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
|
// NOTE: We may use the special behaviour where nBufMaxSize == 0
|
||||||
|
Len = K32LoadStringW(GetModuleHandleW(NULL), uID, bufSrc, ARRAYSIZE(bufSrc));
|
||||||
|
if (Len)
|
||||||
|
Len = ConPuts(Stream, bufSrc);
|
||||||
|
#else
|
||||||
|
PWCHAR szStr = NULL;
|
||||||
|
Len = K32LoadStringW(GetModuleHandleW(NULL), uID, (PWSTR)&szStr, 0);
|
||||||
|
if (Len)
|
||||||
|
Len = Stream->WriteFunc(Stream, szStr, Len);
|
||||||
|
|
||||||
|
/* Fixup returned length in case of errors */
|
||||||
|
if (Len < 0)
|
||||||
|
Len = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return Len;
|
||||||
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
ConResPrintfV(
|
ConResPrintfV(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
|
@ -597,6 +641,7 @@ ConResPrintfV(
|
||||||
}
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
|
__cdecl
|
||||||
ConResPrintf(
|
ConResPrintf(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN UINT uID,
|
IN UINT uID,
|
||||||
|
@ -612,6 +657,71 @@ ConResPrintf(
|
||||||
return Len;
|
return Len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT
|
||||||
|
ConMsgPuts(
|
||||||
|
IN PCON_STREAM Stream,
|
||||||
|
IN DWORD dwFlags,
|
||||||
|
IN LPCVOID lpSource OPTIONAL,
|
||||||
|
IN DWORD dwMessageId,
|
||||||
|
IN DWORD dwLanguageId)
|
||||||
|
{
|
||||||
|
INT Len;
|
||||||
|
DWORD dwLength = 0;
|
||||||
|
LPWSTR lpMsgBuf = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sanitize dwFlags. This version always ignore explicitely the inserts
|
||||||
|
* as we emulate the behaviour of the *puts function.
|
||||||
|
*/
|
||||||
|
dwFlags |= FORMAT_MESSAGE_ALLOCATE_BUFFER; // Always allocate an internal buffer.
|
||||||
|
dwFlags |= FORMAT_MESSAGE_IGNORE_INSERTS; // Ignore inserts for FormatMessage.
|
||||||
|
dwFlags &= ~FORMAT_MESSAGE_ARGUMENT_ARRAY;
|
||||||
|
|
||||||
|
dwFlags |= FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve the message string without appending extra newlines.
|
||||||
|
* Wrap in SEH to protect from invalid string parameters.
|
||||||
|
*/
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
dwLength = FormatMessageW(dwFlags,
|
||||||
|
lpSource,
|
||||||
|
dwMessageId,
|
||||||
|
dwLanguageId,
|
||||||
|
(LPWSTR)&lpMsgBuf,
|
||||||
|
0, NULL);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
Len = (INT)dwLength;
|
||||||
|
|
||||||
|
if (!lpMsgBuf)
|
||||||
|
{
|
||||||
|
// ASSERT(dwLength == 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ASSERT(dwLength != 0);
|
||||||
|
|
||||||
|
/* lpMsgBuf is NULL-terminated by FormatMessage */
|
||||||
|
// Len = ConPuts(Stream, lpMsgBuf);
|
||||||
|
Len = Stream->WriteFunc(Stream, lpMsgBuf, dwLength);
|
||||||
|
|
||||||
|
/* Fixup returned length in case of errors */
|
||||||
|
if (Len < 0)
|
||||||
|
Len = 0;
|
||||||
|
|
||||||
|
/* Free the buffer allocated by FormatMessage */
|
||||||
|
LocalFree(lpMsgBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Len;
|
||||||
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
ConMsgPrintf2V(
|
ConMsgPrintf2V(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
|
@ -739,6 +849,7 @@ ConMsgPrintfV(
|
||||||
}
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
|
__cdecl
|
||||||
ConMsgPrintf(
|
ConMsgPrintf(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN DWORD dwFlags,
|
IN DWORD dwFlags,
|
||||||
|
|
|
@ -170,6 +170,11 @@ ConWrite(
|
||||||
IN PTCHAR szStr,
|
IN PTCHAR szStr,
|
||||||
IN DWORD len);
|
IN DWORD len);
|
||||||
|
|
||||||
|
INT
|
||||||
|
ConPuts(
|
||||||
|
IN PCON_STREAM Stream,
|
||||||
|
IN LPWSTR szStr);
|
||||||
|
|
||||||
INT
|
INT
|
||||||
ConPrintfV(
|
ConPrintfV(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
|
@ -177,11 +182,17 @@ ConPrintfV(
|
||||||
IN va_list args); // arg_ptr
|
IN va_list args); // arg_ptr
|
||||||
|
|
||||||
INT
|
INT
|
||||||
|
__cdecl
|
||||||
ConPrintf(
|
ConPrintf(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN LPWSTR szStr,
|
IN LPWSTR szStr,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
|
INT
|
||||||
|
ConResPuts(
|
||||||
|
IN PCON_STREAM Stream,
|
||||||
|
IN UINT uID);
|
||||||
|
|
||||||
INT
|
INT
|
||||||
ConResPrintfV(
|
ConResPrintfV(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
|
@ -189,11 +200,20 @@ ConResPrintfV(
|
||||||
IN va_list args); // arg_ptr
|
IN va_list args); // arg_ptr
|
||||||
|
|
||||||
INT
|
INT
|
||||||
|
__cdecl
|
||||||
ConResPrintf(
|
ConResPrintf(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN UINT uID,
|
IN UINT uID,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
|
INT
|
||||||
|
ConMsgPuts(
|
||||||
|
IN PCON_STREAM Stream,
|
||||||
|
IN DWORD dwFlags,
|
||||||
|
IN LPCVOID lpSource OPTIONAL,
|
||||||
|
IN DWORD dwMessageId,
|
||||||
|
IN DWORD dwLanguageId);
|
||||||
|
|
||||||
INT
|
INT
|
||||||
ConMsgPrintf2V(
|
ConMsgPrintf2V(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
|
@ -213,6 +233,7 @@ ConMsgPrintfV(
|
||||||
IN va_list args); // arg_ptr
|
IN va_list args); // arg_ptr
|
||||||
|
|
||||||
INT
|
INT
|
||||||
|
__cdecl
|
||||||
ConMsgPrintf(
|
ConMsgPrintf(
|
||||||
IN PCON_STREAM Stream,
|
IN PCON_STREAM Stream,
|
||||||
IN DWORD dwFlags,
|
IN DWORD dwFlags,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue