https://git.reactos.org/?p=reactos.git;a=commitdiff;h=331e3312095cc97feb986…
commit 331e3312095cc97feb9866155352d19847c8a7d3
Author: Colin Finck <colin(a)reactos.org>
AuthorDate: Mon Aug 19 15:58:30 2019 +0200
Commit: Colin Finck <colin(a)reactos.org>
CommitDate: Wed Aug 28 22:32:49 2019 +0200
[FORMATTING] Restore some kind of style to ntstrsafe.h, considering all comments in PR
#522 and #523.
---
sdk/include/ddk/ntstrsafe.h | 2450 ++++++++++++++++++++++++-------------------
1 file changed, 1355 insertions(+), 1095 deletions(-)
diff --git a/sdk/include/ddk/ntstrsafe.h b/sdk/include/ddk/ntstrsafe.h
index de2a4921f1f..ab338bc58a0 100644
--- a/sdk/include/ddk/ntstrsafe.h
+++ b/sdk/include/ddk/ntstrsafe.h
@@ -73,64 +73,65 @@ typedef _Null_terminated_ const wchar_t *NTSTRSAFE_PCWSTR;
typedef ULONG STRSAFE_DWORD;
-NTSTRSAFEAPI RtlStringCopyWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR
pszSrc);
-NTSTRSAFEAPI RtlStringCopyWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,STRSAFE_LPCWSTR
pszSrc);
-NTSTRSAFEAPI RtlStringCopyExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCSTR pszSrc,STRSAFE_LPSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCopyExWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCWSTR pszSrc,STRSAFE_LPWSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR
pszSrc,size_t cchToCopy);
-NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,STRSAFE_LPCWSTR
pszSrc,size_t cchToCopy);
-NTSTRSAFEAPI RtlStringCopyNExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCSTR pszSrc,size_t cchToCopy,STRSAFE_LPSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCopyNExWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCWSTR pszSrc,size_t cchToCopy,STRSAFE_LPWSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCatWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR
pszSrc);
-NTSTRSAFEAPI RtlStringCatWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,STRSAFE_LPCWSTR
pszSrc);
-NTSTRSAFEAPI RtlStringCatExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCSTR pszSrc,STRSAFE_LPSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCatExWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCWSTR pszSrc,STRSAFE_LPWSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCatNWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR
pszSrc,size_t cchToAppend);
-NTSTRSAFEAPI RtlStringCatNWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,STRSAFE_LPCWSTR
pszSrc,size_t cchToAppend);
-NTSTRSAFEAPI RtlStringCatNExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCSTR pszSrc,size_t cchToAppend,STRSAFE_LPSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringCatNExWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPCWSTR pszSrc,size_t cchToAppend,STRSAFE_LPWSTR *ppszDestEnd,size_t
*pcchRemaining,STRSAFE_DWORD dwFlags);
-NTSTRSAFEAPI RtlStringVPrintfWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR
pszFormat,va_list argList);
-NTSTRSAFEAPI RtlStringVPrintfWorkerW(STRSAFE_LPWSTR pszDest,size_t
cchDest,STRSAFE_LPCWSTR pszFormat,va_list argList);
-NTSTRSAFEAPI RtlStringVPrintfWorkerLenW(STRSAFE_LPWSTR pszDest,size_t
cchDest,STRSAFE_LPCWSTR pszFormat,size_t* pcchDestNewLen, va_list argList);
-NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,STRSAFE_DWORD
dwFlags,STRSAFE_LPCSTR pszFormat,va_list argList);
-NTSTRSAFEAPI RtlStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest,size_t cchDest,size_t
cbDest,STRSAFE_LPWSTR *ppszDestEnd,size_t *pcchRemaining,STRSAFE_DWORD
dwFlags,STRSAFE_LPCWSTR pszFormat,va_list argList);
+NTSTRSAFEAPI RtlStringCopyWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR
pszSrc);
+NTSTRSAFEAPI RtlStringCopyWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR
pszSrc);
+NTSTRSAFEAPI RtlStringCopyExWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest,
STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD
dwFlags);
+NTSTRSAFEAPI RtlStringCopyExWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining,
STRSAFE_DWORD dwFlags);
+NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR
pszSrc, size_t cchToCopy);
+NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest,
STRSAFE_LPCWSTR pszSrc, size_t cchToCopy);
+NTSTRSAFEAPI RtlStringCopyNExWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy, STRSAFE_LPSTR *ppszDestEnd, size_t
*pcchRemaining, STRSAFE_DWORD dwFlags);
+NTSTRSAFEAPI RtlStringCopyNExWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy, STRSAFE_LPWSTR *ppszDestEnd, size_t
*pcchRemaining, STRSAFE_DWORD dwFlags);
+NTSTRSAFEAPI RtlStringCatWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR
pszSrc);
+NTSTRSAFEAPI RtlStringCatWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR
pszSrc);
+NTSTRSAFEAPI RtlStringCatExWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest,
STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD
dwFlags);
+NTSTRSAFEAPI RtlStringCatExWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest,
STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD
dwFlags);
+NTSTRSAFEAPI RtlStringCatNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR
pszSrc, size_t cchToAppend);
+NTSTRSAFEAPI RtlStringCatNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR
pszSrc, size_t cchToAppend);
+NTSTRSAFEAPI RtlStringCatNExWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest,
STRSAFE_LPCSTR pszSrc, size_t cchToAppend, STRSAFE_LPSTR *ppszDestEnd, size_t
*pcchRemaining, STRSAFE_DWORD dwFlags);
+NTSTRSAFEAPI RtlStringCatNExWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPCWSTR pszSrc, size_t cchToAppend, STRSAFE_LPWSTR *ppszDestEnd, size_t
*pcchRemaining, STRSAFE_DWORD dwFlags);
+NTSTRSAFEAPI RtlStringVPrintfWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest,
STRSAFE_LPCSTR pszFormat, va_list argList);
+NTSTRSAFEAPI RtlStringVPrintfWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest,
STRSAFE_LPCWSTR pszFormat, va_list argList);
+NTSTRSAFEAPI RtlStringVPrintfWorkerLenW(STRSAFE_LPWSTR pszDest, size_t cchDest,
STRSAFE_LPCWSTR pszFormat, size_t* pcchDestNewLen, va_list argList);
+NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags,
STRSAFE_LPCSTR pszFormat, va_list argList);
+NTSTRSAFEAPI RtlStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags,
STRSAFE_LPCWSTR pszFormat, va_list argList);
NTSTRSAFEAPI RtlStringVPrintfExWorkerLenW(STRSAFE_LPWSTR pszDest, size_t cchDest, size_t
cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags,
STRSAFE_LPCWSTR pszFormat, size_t* pcchDestNewLen, va_list argList);
NTSTRSAFEAPI RtlUnicodeStringValidate(PCUNICODE_STRING SourceString);
NTSTRSAFEAPI
RtlStringLengthWorkerA(
- _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
- _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength);
+ _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
+ _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength);
NTSTRSAFEAPI
RtlStringLengthWorkerW(
- _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
- _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength);
+ _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
+ _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength);
NTSTRSAFEAPI
RtlStringCchCopyA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc);
NTSTRSAFEAPI
RtlStringCchCopyW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc);
NTSTRSAFEAPI
RtlStringCchCopyA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
@@ -139,108 +140,115 @@ RtlStringCchCopyA(
NTSTRSAFEAPI
RtlStringCchCopyW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringCopyWorkerW(pszDest,cchDest,pszSrc);
+ return RtlStringCopyWorkerW(pszDest, cchDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCbCopyA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc);
NTSTRSAFEAPI
RtlStringCbCopyW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc);
NTSTRSAFEAPI
RtlStringCbCopyA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc)
{
size_t cchDest = cbDest / sizeof(char);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringCopyWorkerA(pszDest,cbDest,pszSrc);
+ return RtlStringCopyWorkerA(pszDest, cbDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCbCopyW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc)
{
size_t cchDest = cbDest / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringCopyWorkerW(pszDest,cchDest,pszSrc);
+ return RtlStringCopyWorkerW(pszDest, cchDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCchCopyExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCopyExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCopyExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return
RtlStringCopyExWorkerA(pszDest,cchDest,cchDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
+
+ return RtlStringCopyExWorkerA(pszDest, cchDest, cchDest, pszSrc, ppszDestEnd,
pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCchCopyExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
size_t cbDest = cchDest * sizeof(wchar_t);
@@ -248,38 +256,39 @@ RtlStringCchCopyExW(
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- return
RtlStringCopyExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
+ return RtlStringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd,
pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCbCopyExA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCopyExW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCopyExA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchDest = cbDest / sizeof(char);
@@ -289,26 +298,27 @@ RtlStringCbCopyExA(
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- Status =
RtlStringCopyExWorkerA(pszDest,cbDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCopyExWorkerA(pszDest, cbDest, cbDest, pszSrc, ppszDestEnd,
&cchRemaining, dwFlags);
if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW)
{
if (pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
+ *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
}
return Status;
}
NTSTRSAFEAPI
RtlStringCbCopyExW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchDest = cbDest / sizeof(wchar_t);
@@ -318,95 +328,99 @@ RtlStringCbCopyExW(
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- Status =
RtlStringCopyExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+ Status = RtlStringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd,
&cchRemaining, dwFlags);
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+ *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t));
}
return Status;
}
NTSTRSAFEAPI
RtlStringCchCopyNA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToCopy);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToCopy);
NTSTRSAFEAPI
RtlStringCchCopyNW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToCopy);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToCopy);
NTSTRSAFEAPI
RtlStringCchCopyNA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToCopy)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToCopy)
{
if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringCopyNWorkerA(pszDest,cchDest,pszSrc,cchToCopy);
+ return RtlStringCopyNWorkerA(pszDest, cchDest, pszSrc, cchToCopy);
}
NTSTRSAFEAPI
RtlStringCchCopyNW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToCopy)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToCopy)
{
if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringCopyNWorkerW(pszDest,cchDest,pszSrc,cchToCopy);
+ return RtlStringCopyNWorkerW(pszDest, cchDest, pszSrc, cchToCopy);
}
NTSTRSAFEAPI
RtlStringCbCopyNA(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToCopy);
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToCopy);
NTSTRSAFEAPI
RtlStringCbCopyNW(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToCopy);
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToCopy);
NTSTRSAFEAPI
RtlStringCbCopyNA(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToCopy)
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToCopy)
{
- size_t cchDest = cbDest / sizeof(char);
+ size_t cchDest = cbDest / sizeof(char);
size_t cchToCopy = cbToCopy / sizeof(char);
if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
@@ -415,18 +429,19 @@ RtlStringCbCopyNA(
NTSTRSAFEAPI
RtlStringCbCopyNW(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToCopy)
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToCopy)
{
- size_t cchDest = cbDest / sizeof(wchar_t);
+ size_t cchDest = cbDest / sizeof(wchar_t);
size_t cchToCopy = cbToCopy / sizeof(wchar_t);
if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
@@ -435,38 +450,39 @@ RtlStringCbCopyNW(
NTSTRSAFEAPI
RtlStringCchCopyNExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToCopy,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToCopy,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCopyNExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToCopy,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToCopy,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCopyNExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToCopy,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToCopy,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
@@ -475,53 +491,54 @@ RtlStringCchCopyNExA(
NTSTRSAFEAPI
RtlStringCchCopyNExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToCopy,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToCopy,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringCopyNExWorkerW(pszDest,cchDest,cchDest * sizeof(wchar_t), pszSrc,
cchToCopy, ppszDestEnd, pcchRemaining, dwFlags);
+ return RtlStringCopyNExWorkerW(pszDest, cchDest, cchDest * sizeof(wchar_t), pszSrc,
cchToCopy, ppszDestEnd, pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCbCopyNExA(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToCopy,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToCopy,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCopyNExW(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToCopy,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToCopy,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCopyNExA(
- _Out_writes_bytes_(cbDest) STRSAFE_LPSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToCopy,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_bytes_(cbDest) STRSAFE_LPSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToCopy,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchRemaining = 0;
@@ -530,206 +547,219 @@ RtlStringCbCopyNExA(
{
if ((pszDest != NULL) && (cbDest > 0))
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- Status =
RtlStringCopyNExWorkerA(pszDest,cbDest,cbDest,pszSrc,cbToCopy,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCopyNExWorkerA(pszDest, cbDest, cbDest, pszSrc, cbToCopy,
ppszDestEnd, &cchRemaining, dwFlags);
if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) &&
pcbRemaining)
*pcbRemaining = cchRemaining;
+
return Status;
}
NTSTRSAFEAPI
RtlStringCbCopyNExW(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToCopy,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToCopy,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
- size_t cchDest;
- size_t cchToCopy;
+ size_t cchDest = cbDest / sizeof(wchar_t);
+ size_t cchToCopy = cbToCopy / sizeof(wchar_t);
size_t cchRemaining = 0;
- cchDest = cbDest / sizeof(wchar_t);
- cchToCopy = cbToCopy / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if ((pszDest != NULL) && (cbDest > 0))
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- Status =
RtlStringCopyNExWorkerW(pszDest,cchDest,cbDest,pszSrc,cchToCopy,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCopyNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchToCopy,
ppszDestEnd, &cchRemaining, dwFlags);
if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) &&
pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+ *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+
return Status;
}
NTSTRSAFEAPI
RtlStringCchCatA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc);
NTSTRSAFEAPI
RtlStringCchCatW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc);
NTSTRSAFEAPI
RtlStringCchCatA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatWorkerA(pszDest,cchDest,pszSrc);
+
+ return RtlStringCatWorkerA(pszDest, cchDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCchCatW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatWorkerW(pszDest,cchDest,pszSrc);
+
+ return RtlStringCatWorkerW(pszDest, cchDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCbCatA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc);
NTSTRSAFEAPI
RtlStringCbCatW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc);
NTSTRSAFEAPI
RtlStringCbCatA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc)
{
if (cbDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatWorkerA(pszDest,cbDest,pszSrc);
+ return RtlStringCatWorkerA(pszDest, cbDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCbCatW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc)
{
size_t cchDest = cbDest / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatWorkerW(pszDest,cchDest,pszSrc);
+
+ return RtlStringCatWorkerW(pszDest, cchDest, pszSrc);
}
NTSTRSAFEAPI
RtlStringCchCatExA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCatExW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCatExA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return
RtlStringCatExWorkerA(pszDest,cchDest,cchDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
+
+ return RtlStringCatExWorkerA(pszDest, cchDest, cchDest, pszSrc, ppszDestEnd,
pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCchCatExW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
-{
- size_t cbDest = cchDest*sizeof(wchar_t);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
+{
+ size_t cbDest = cchDest * sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return
RtlStringCatExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
+
+ return RtlStringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd,
pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCbCatExA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCatExW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCatExA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchRemaining = 0;
+
if (cbDest > NTSTRSAFE_MAX_CCH)
Status = STATUS_INVALID_PARAMETER;
else
- Status =
RtlStringCatExWorkerA(pszDest,cbDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCatExWorkerA(pszDest, cbDest, cbDest, pszSrc, ppszDestEnd,
&cchRemaining, dwFlags);
+
if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) &&
pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
+ *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
+
return Status;
}
NTSTRSAFEAPI
RtlStringCbCatExW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ NTSTRSAFE_PCWSTR pszSrc,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ NTSTRSAFE_PCWSTR pszSrc,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchDest = cbDest / sizeof(wchar_t);
@@ -738,510 +768,552 @@ RtlStringCbCatExW(
if (cchDest > NTSTRSAFE_MAX_CCH)
Status = STATUS_INVALID_PARAMETER;
else
- Status =
RtlStringCatExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd,
&cchRemaining, dwFlags);
+
if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) &&
pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+ *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+
return Status;
}
NTSTRSAFEAPI
RtlStringCchCatNA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToAppend);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToAppend);
NTSTRSAFEAPI
RtlStringCchCatNW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToAppend);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToAppend);
NTSTRSAFEAPI
RtlStringCchCatNA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToAppend)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToAppend)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatNWorkerA(pszDest,cchDest,pszSrc,cchToAppend);
+
+ return RtlStringCatNWorkerA(pszDest, cchDest, pszSrc, cchToAppend);
}
NTSTRSAFEAPI
RtlStringCchCatNW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToAppend)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToAppend)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatNWorkerW(pszDest,cchDest,pszSrc,cchToAppend);
+
+ return RtlStringCatNWorkerW(pszDest, cchDest, pszSrc, cchToAppend);
}
NTSTRSAFEAPI
RtlStringCbCatNA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToAppend);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToAppend);
NTSTRSAFEAPI
RtlStringCbCatNW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToAppend);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToAppend);
NTSTRSAFEAPI
RtlStringCbCatNA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToAppend)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToAppend)
{
if (cbDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatNWorkerA(pszDest,cbDest,pszSrc,cbToAppend);
+
+ return RtlStringCatNWorkerA(pszDest, cbDest, pszSrc, cbToAppend);
}
NTSTRSAFEAPI
RtlStringCbCatNW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToAppend)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToAppend)
{
size_t cchDest = cbDest / sizeof(wchar_t);
size_t cchToAppend = cbToAppend / sizeof(wchar_t);
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return RtlStringCatNWorkerW(pszDest,cchDest,pszSrc,cchToAppend);
+
+ return RtlStringCatNWorkerW(pszDest, cchDest, pszSrc, cchToAppend);
}
NTSTRSAFEAPI
RtlStringCchCatNExA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToAppend,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToAppend,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCatNExW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToAppend,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToAppend,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCchCatNExA(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cchToAppend,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cchToAppend,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return
RtlStringCatNExWorkerA(pszDest,cchDest,cchDest,pszSrc,cchToAppend,ppszDestEnd,pcchRemaining,dwFlags);
+
+ return RtlStringCatNExWorkerA(pszDest, cchDest, cchDest, pszSrc, cchToAppend,
ppszDestEnd, pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCchCatNExW(
- _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cchToAppend,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_reads_or_z_(cchToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cchToAppend,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
return STATUS_INVALID_PARAMETER;
- return
RtlStringCatNExWorkerW(pszDest,cchDest,(cchDest*sizeof(wchar_t)),pszSrc,cchToAppend,ppszDestEnd,pcchRemaining,dwFlags);
+
+ return RtlStringCatNExWorkerW(pszDest, cchDest, (cchDest * sizeof(wchar_t)), pszSrc,
cchToAppend, ppszDestEnd, pcchRemaining, dwFlags);
}
NTSTRSAFEAPI
RtlStringCbCatNExA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToAppend,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToAppend,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCatNExW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToAppend,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags);
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToAppend,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags);
NTSTRSAFEAPI
RtlStringCbCatNExA(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
- _In_ size_t cbToAppend,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCSTR pszSrc,
+ _In_ size_t cbToAppend,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchRemaining = 0;
+
if (cbDest > NTSTRSAFE_MAX_CCH)
Status = STATUS_INVALID_PARAMETER;
else
- Status =
RtlStringCatNExWorkerA(pszDest,cbDest,cbDest,pszSrc,cbToAppend,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCatNExWorkerA(pszDest, cbDest, cbDest, pszSrc, cbToAppend,
ppszDestEnd, &cchRemaining, dwFlags);
+
if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) &&
pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
+ *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
+
return Status;
}
NTSTRSAFEAPI
RtlStringCbCatNExW(
- _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
- _In_ size_t cbToAppend,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags)
+ _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc,
+ _In_ size_t cbToAppend,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags)
{
NTSTATUS Status;
size_t cchDest = cbDest / sizeof(wchar_t);
size_t cchToAppend = cbToAppend / sizeof(wchar_t);
size_t cchRemaining = 0;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
Status = STATUS_INVALID_PARAMETER;
else
- Status =
RtlStringCatNExWorkerW(pszDest,cchDest,cbDest,pszSrc,cchToAppend,ppszDestEnd,&cchRemaining,dwFlags);
+ Status = RtlStringCatNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchToAppend,
ppszDestEnd, &cchRemaining, dwFlags);
+
if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) &&
pcbRemaining)
- *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+ *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+
return Status;
}
NTSTRSAFEAPI
RtlStringCchVPrintfA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCchVPrintfW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCchVPrintfA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringVPrintfWorkerA(pszDest,cchDest,pszFormat,argList);
+ return RtlStringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
}
NTSTRSAFEAPI
RtlStringCchVPrintfW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList)
{
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
+
+ return RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
}
NTSTRSAFEAPI
RtlStringCbVPrintfA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCbVPrintfW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCbVPrintfA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList)
{
if (cbDest > NTSTRSAFE_MAX_CCH)
{
if (cbDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- return RtlStringVPrintfWorkerA(pszDest,cbDest,pszFormat,argList);
+
+ return RtlStringVPrintfWorkerA(pszDest, cbDest, pszFormat, argList);
}
NTSTRSAFEAPI
RtlStringCbVPrintfW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList)
{
size_t cchDest = cbDest / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
return STATUS_INVALID_PARAMETER;
}
- return RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
+
+ return RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
}
static __inline NTSTATUS
RtlStringCchPrintfA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCchPrintfW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCchPrintfA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...)
{
NTSTATUS Status;
va_list argList;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- va_start(argList,pszFormat);
- Status = RtlStringVPrintfWorkerA(pszDest,cchDest,pszFormat,argList);
+
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
va_end(argList);
+
return Status;
}
static __inline NTSTATUS
RtlStringCchPrintfW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...)
{
NTSTATUS Status;
va_list argList;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
return STATUS_INVALID_PARAMETER;
}
- va_start(argList,pszFormat);
- Status = RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
+
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
va_end(argList);
+
return Status;
}
static __inline NTSTATUS
RtlStringCbPrintfA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCbPrintfW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCbPrintfA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...)
{
NTSTATUS Status;
va_list argList;
+
if (cbDest > NTSTRSAFE_MAX_CCH)
{
if (cbDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- va_start(argList,pszFormat);
- Status = RtlStringVPrintfWorkerA(pszDest,cbDest,pszFormat,argList);
+
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfWorkerA(pszDest, cbDest, pszFormat, argList);
va_end(argList);
+
return Status;
}
static __inline NTSTATUS
RtlStringCbPrintfW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...)
{
NTSTATUS Status;
va_list argList;
size_t cchDest = cbDest / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
return STATUS_INVALID_PARAMETER;
}
- va_start(argList,pszFormat);
- Status = RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
+
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
va_end(argList);
+
return Status;
}
static __inline NTSTATUS
RtlStringCchPrintfExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCchPrintfExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCchPrintfExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...)
{
NTSTATUS Status;
va_list argList;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
- va_start(argList,pszFormat);
- Status =
RtlStringVPrintfExWorkerA(pszDest,cchDest,cchDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
+
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cchDest, ppszDestEnd,
pcchRemaining, dwFlags, pszFormat, argList);
va_end(argList);
+
return Status;
}
static __inline NTSTATUS
RtlStringCchPrintfExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...)
{
NTSTATUS Status;
size_t cbDest = cchDest * sizeof(wchar_t);
va_list argList;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
return STATUS_INVALID_PARAMETER;
}
- va_start(argList,pszFormat);
- Status =
RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
+
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd,
pcchRemaining, dwFlags, pszFormat, argList);
va_end(argList);
+
return Status;
}
static __inline NTSTATUS
RtlStringCbPrintfExA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCbPrintfExW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...);
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...);
static __inline NTSTATUS
RtlStringCbPrintfExA(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- ...)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ ...)
{
NTSTATUS Status;
size_t cchDest;
@@ -1252,39 +1324,43 @@ RtlStringCbPrintfExA(
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
{
va_list argList;
- va_start(argList,pszFormat);
- Status =
RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd,
&cchRemaining, dwFlags, pszFormat, argList);
va_end(argList);
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (pcbRemaining)
{
- *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
+ *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
}
}
+
return Status;
}
static __inline NTSTATUS
RtlStringCbPrintfExW(
- _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- ...)
+ _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ ...)
{
NTSTATUS Status;
size_t cchDest;
size_t cchRemaining = 0;
cchDest = cbDest / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
@@ -1294,15 +1370,16 @@ RtlStringCbPrintfExW(
{
va_list argList;
- va_start(argList,pszFormat);
- Status =
RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
+ va_start(argList, pszFormat);
+ Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd,
&cchRemaining, dwFlags, pszFormat, argList);
va_end(argList);
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (pcbRemaining)
{
- *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+ *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t));
}
}
return Status;
@@ -1310,149 +1387,161 @@ RtlStringCbPrintfExW(
NTSTRSAFEAPI
RtlStringCchVPrintfExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCchVPrintfExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCchVPrintfExA(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList)
{
NTSTATUS Status;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = '\0';
+
return STATUS_INVALID_PARAMETER;
}
{
size_t cbDest;
- cbDest = cchDest*sizeof(char);
- Status =
RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
+ cbDest = cchDest * sizeof(char);
+ Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd,
pcchRemaining, dwFlags, pszFormat, argList);
}
+
return Status;
}
NTSTRSAFEAPI
RtlStringCchVPrintfExW(
- _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cchDest,
- _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcchRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cchDest,
+ _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcchRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList)
{
NTSTATUS Status;
+
if (cchDest > NTSTRSAFE_MAX_CCH)
{
if (cchDest > 0)
*pszDest = L'\0';
+
return STATUS_INVALID_PARAMETER;
}
{
size_t cbDest;
- cbDest = cchDest*sizeof(wchar_t);
- Status =
RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
+ cbDest = cchDest * sizeof(wchar_t);
+ Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd,
pcchRemaining, dwFlags, pszFormat, argList);
}
+
return Status;
}
NTSTRSAFEAPI
RtlStringCbVPrintfExA(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCbVPrintfExW(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList);
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList);
NTSTRSAFEAPI
RtlStringCbVPrintfExA(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,
+ _In_ va_list argList)
{
NTSTATUS Status;
size_t cchDest;
size_t cchRemaining = 0;
cchDest = cbDest / sizeof(char);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
Status = STATUS_INVALID_PARAMETER;
else
- Status =
RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+ Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd,
&cchRemaining, dwFlags, pszFormat, argList);
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (pcbRemaining)
{
- *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
+ *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
}
}
+
return Status;
}
NTSTRSAFEAPI
RtlStringCbVPrintfExW(
- _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
- _In_ size_t cbDest,
- _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
- _Out_opt_ size_t *pcbRemaining,
- _In_ STRSAFE_DWORD dwFlags,
- _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
- _In_ va_list argList)
+ _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest,
+ _In_ size_t cbDest,
+ _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd,
+ _Out_opt_ size_t *pcbRemaining,
+ _In_ STRSAFE_DWORD dwFlags,
+ _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,
+ _In_ va_list argList)
{
NTSTATUS Status;
size_t cchDest;
size_t cchRemaining = 0;
cchDest = cbDest / sizeof(wchar_t);
+
if (cchDest > NTSTRSAFE_MAX_CCH)
Status = STATUS_INVALID_PARAMETER;
else
- Status =
RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+ Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd,
&cchRemaining, dwFlags, pszFormat, argList);
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (pcbRemaining)
{
- *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
+ *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t));
}
}
+
return Status;
}
@@ -1460,176 +1549,203 @@ RtlStringCbVPrintfExW(
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCchLengthA(
- _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=,
_String_length_(psz)) size_t *pcchLength);
+ _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(< , cchMax) _Deref_out_range_(<= ,
_String_length_(psz)) size_t *pcchLength);
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCchLengthW(
- _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=,
_String_length_(psz)) size_t *pcchLength);
+ _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(< , cchMax) _Deref_out_range_(<= ,
_String_length_(psz)) size_t *pcchLength);
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCchLengthA(
- _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=,
_String_length_(psz)) size_t *pcchLength)
+ _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(< , cchMax) _Deref_out_range_(<= ,
_String_length_(psz)) size_t *pcchLength)
{
NTSTATUS Status;
+
if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
Status = STATUS_INVALID_PARAMETER;
else
- Status = RtlStringLengthWorkerA(psz,cchMax,pcchLength);
+ Status = RtlStringLengthWorkerA(psz, cchMax, pcchLength);
+
if (!NT_SUCCESS(Status) && pcchLength)
{
*pcchLength = 0;
}
+
return Status;
}
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCchLengthW(
- _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=,
_String_length_(psz)) size_t *pcchLength)
+ _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(< , cchMax) _Deref_out_range_(<= ,
_String_length_(psz)) size_t *pcchLength)
{
NTSTATUS Status;
+
if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
Status = STATUS_INVALID_PARAMETER;
else
- Status = RtlStringLengthWorkerW(psz,cchMax,pcchLength);
+ Status = RtlStringLengthWorkerW(psz, cchMax, pcchLength);
+
if (!NT_SUCCESS(Status) && pcchLength)
{
*pcchLength = 0;
}
+
return Status;
}
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCbLengthA(
- _In_reads_or_z_(cbMax) STRSAFE_LPCSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbMax,
- _Out_opt_ _Deref_out_range_(<, cbMax) size_t *pcbLength);
+ _In_reads_or_z_(cbMax) STRSAFE_LPCSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbMax,
+ _Out_opt_ _Deref_out_range_(< , cbMax) size_t *pcbLength);
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCbLengthW(
- _In_reads_or_z_(cbMax / sizeof(wchar_t)) STRSAFE_LPCWSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbMax,
- _Out_opt_ _Deref_out_range_(<, cbMax - 1) size_t *pcbLength);
+ _In_reads_or_z_(cbMax / sizeof(wchar_t)) STRSAFE_LPCWSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbMax,
+ _Out_opt_ _Deref_out_range_(< , cbMax - 1) size_t *pcbLength);
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCbLengthA(
- _In_reads_or_z_(cbMax) STRSAFE_LPCSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbMax,
- _Out_opt_ _Deref_out_range_(<, cbMax) size_t *pcbLength)
+ _In_reads_or_z_(cbMax) STRSAFE_LPCSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(char)) size_t cbMax,
+ _Out_opt_ _Deref_out_range_(< , cbMax) size_t *pcbLength)
{
NTSTATUS Status;
size_t cchMax;
size_t cchLength = 0;
cchMax = cbMax / sizeof(char);
+
if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
Status = STATUS_INVALID_PARAMETER;
else
- Status = RtlStringLengthWorkerA(psz,cchMax,&cchLength);
+ Status = RtlStringLengthWorkerA(psz, cchMax, &cchLength);
+
if (pcbLength)
{
if (NT_SUCCESS(Status))
{
- *pcbLength = cchLength*sizeof(char);
+ *pcbLength = cchLength * sizeof(char);
}
else
{
*pcbLength = 0;
}
}
+
return Status;
}
_Must_inspect_result_
NTSTRSAFEAPI
RtlStringCbLengthW(
- _In_reads_or_z_(cbMax / sizeof(wchar_t)) STRSAFE_LPCWSTR psz,
- _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbMax,
- _Out_opt_ _Deref_out_range_(<, cbMax - 1) size_t *pcbLength)
+ _In_reads_or_z_(cbMax / sizeof(wchar_t)) STRSAFE_LPCWSTR psz,
+ _In_ _In_range_(1, NTSTRSAFE_MAX_CCH * sizeof(wchar_t)) size_t cbMax,
+ _Out_opt_ _Deref_out_range_(< , cbMax - 1) size_t *pcbLength)
{
NTSTATUS Status;
size_t cchMax;
size_t cchLength = 0;
cchMax = cbMax / sizeof(wchar_t);
+
if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
Status = STATUS_INVALID_PARAMETER;
else
- Status = RtlStringLengthWorkerW(psz,cchMax,&cchLength);
+ Status = RtlStringLengthWorkerW(psz, cchMax, &cchLength);
+
if (pcbLength)
{
if (NT_SUCCESS(Status))
{
- *pcbLength = cchLength*sizeof(wchar_t);
+ *pcbLength = cchLength * sizeof(wchar_t);
}
else
{
*pcbLength = 0;
}
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
STRSAFE_LPCSTR pszSrc)
{
NTSTATUS Status = STATUS_SUCCESS;
- if (cchDest==0)
+
+ if (cchDest == 0)
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
- while(cchDest && (*pszSrc!='\0'))
+ while (cchDest && (*pszSrc != '\0'))
{
*pszDest++ = *pszSrc++;
cchDest--;
}
- if (cchDest==0)
+
+ if (cchDest == 0)
{
pszDest--;
Status = STATUS_BUFFER_OVERFLOW;
}
- *pszDest= '\0';
+
+ *pszDest = '\0';
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
STRSAFE_LPCWSTR pszSrc)
{
NTSTATUS Status = STATUS_SUCCESS;
- if (cchDest==0)
+
+ if (cchDest == 0)
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
- while(cchDest && (*pszSrc!=L'\0'))
+ while (cchDest && (*pszSrc != L'\0'))
{
*pszDest++ = *pszSrc++;
cchDest--;
}
- if (cchDest==0)
+
+ if (cchDest == 0)
{
pszDest--;
Status = STATUS_BUFFER_OVERFLOW;
}
- *pszDest= L'\0';
+
+ *pszDest = L'\0';
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyExWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyExWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCSTR pszSrc,
@@ -1640,27 +1756,33 @@ NTSTRSAFEAPI RtlStringCopyExWorkerA(STRSAFE_LPSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
if (dwFlags & STRSAFE_IGNORE_NULLS)
{
if (!pszDest)
{
- if ((cchDest!=0) || (cbDest!=0))
+ if ((cchDest != 0) || (cbDest != 0))
Status = STATUS_INVALID_PARAMETER;
}
+
if (!pszSrc)
pszSrc = "";
}
+
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ if (cchDest == 0)
{
pszDestEnd = pszDest;
cchRemaining = 0;
- if (*pszSrc!='\0')
+
+ if (*pszSrc != '\0')
{
if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
@@ -1672,16 +1794,18 @@ NTSTRSAFEAPI RtlStringCopyExWorkerA(STRSAFE_LPSTR pszDest,
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
- while(cchRemaining && (*pszSrc!='\0'))
+
+ while (cchRemaining && (*pszSrc != '\0'))
{
*pszDestEnd++ = *pszSrc++;
cchRemaining--;
}
+
if (cchRemaining > 0)
{
if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
{
- memset(pszDestEnd +
1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest %
sizeof(char)));
+ memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags),
((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
}
}
else
@@ -1690,52 +1814,55 @@ NTSTRSAFEAPI RtlStringCopyExWorkerA(STRSAFE_LPSTR pszDest,
cchRemaining++;
Status = STATUS_BUFFER_OVERFLOW;
}
+
*pszDestEnd = '\0';
}
}
}
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = '\0';
- }
- }
- if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
- {
- if (cchDest > 0)
+ else if (cchDest > 0)
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
*pszDestEnd = '\0';
}
}
+
+ if ((dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
&& cchDest > 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+ *pszDestEnd = '\0';
+ }
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyExWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyExWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCWSTR pszSrc,
@@ -1746,27 +1873,33 @@ NTSTRSAFEAPI RtlStringCopyExWorkerW(STRSAFE_LPWSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPWSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
if (dwFlags & STRSAFE_IGNORE_NULLS)
{
if (!pszDest)
{
- if ((cchDest!=0) || (cbDest!=0))
+ if ((cchDest != 0) || (cbDest != 0))
Status = STATUS_INVALID_PARAMETER;
}
+
if (!pszSrc)
pszSrc = L"";
}
+
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ if (cchDest == 0)
{
pszDestEnd = pszDest;
cchRemaining = 0;
- if (*pszSrc!=L'\0')
+
+ if (*pszSrc != L'\0')
{
if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
@@ -1778,16 +1911,18 @@ NTSTRSAFEAPI RtlStringCopyExWorkerW(STRSAFE_LPWSTR pszDest,
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
- while(cchRemaining && (*pszSrc!=L'\0'))
+
+ while (cchRemaining && (*pszSrc != L'\0'))
{
*pszDestEnd++ = *pszSrc++;
cchRemaining--;
}
+
if (cchRemaining > 0)
{
if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
{
- memset(pszDestEnd +
1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t)));
+ memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags),
((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
}
}
else
@@ -1796,103 +1931,122 @@ NTSTRSAFEAPI RtlStringCopyExWorkerW(STRSAFE_LPWSTR pszDest,
cchRemaining++;
Status = STATUS_BUFFER_OVERFLOW;
}
+
*pszDestEnd = L'\0';
}
}
}
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = L'\0';
- }
- }
- if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
- {
- if (cchDest > 0)
+ else if (cchDest > 0)
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
*pszDestEnd = L'\0';
}
}
+
+ if ((dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
&& cchDest > 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+ *pszDestEnd = L'\0';
+ }
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyNWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
- STRSAFE_LPCSTR pszSrc,size_t cchSrc)
+ STRSAFE_LPCSTR pszSrc,
+ size_t cchSrc)
{
NTSTATUS Status = STATUS_SUCCESS;
- if (cchDest==0)
+
+ if (cchDest == 0)
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
- while(cchDest && cchSrc && (*pszSrc!='\0'))
+ while (cchDest && cchSrc && (*pszSrc != '\0'))
{
*pszDest++ = *pszSrc++;
cchDest--;
cchSrc--;
}
- if (cchDest==0)
+
+ if (cchDest == 0)
{
pszDest--;
Status = STATUS_BUFFER_OVERFLOW;
}
- *pszDest= '\0';
+
+ *pszDest = '\0';
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyNWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
STRSAFE_LPCWSTR pszSrc,
size_t cchToCopy)
{
NTSTATUS Status = STATUS_SUCCESS;
- if (cchDest==0)
+
+ if (cchDest == 0)
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
- while(cchDest && cchToCopy && (*pszSrc!=L'\0'))
+ while (cchDest && cchToCopy && (*pszSrc != L'\0'))
{
*pszDest++ = *pszSrc++;
cchDest--;
cchToCopy--;
}
- if (cchDest==0)
+
+ if (cchDest == 0)
{
pszDest--;
Status = STATUS_BUFFER_OVERFLOW;
}
- *pszDest= L'\0';
+
+ *pszDest = L'\0';
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyNExWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyNExWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCSTR pszSrc,
@@ -1904,84 +2058,95 @@ NTSTRSAFEAPI RtlStringCopyNExWorkerA(STRSAFE_LPSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ }
+ else if (cchToCopy > NTSTRSAFE_MAX_CCH)
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
- if (cchToCopy > NTSTRSAFE_MAX_CCH)
- Status = STATUS_INVALID_PARAMETER;
- else
+ {
+ if (dwFlags & STRSAFE_IGNORE_NULLS)
{
- if (dwFlags & STRSAFE_IGNORE_NULLS)
+ if (!pszDest)
{
- if (!pszDest)
- {
- if ((cchDest!=0) || (cbDest!=0))
- Status = STATUS_INVALID_PARAMETER;
- }
- if (!pszSrc)
- pszSrc = "";
+ if ((cchDest != 0) || (cbDest != 0))
+ Status = STATUS_INVALID_PARAMETER;
}
- if (NT_SUCCESS(Status))
- {
- if (cchDest==0)
- {
- pszDestEnd = pszDest;
- cchRemaining = 0;
- if ((cchToCopy!=0) && (*pszSrc!='\0'))
- {
- if (!pszDest)
- Status = STATUS_INVALID_PARAMETER;
- else
- Status = STATUS_BUFFER_OVERFLOW;
- }
- }
- else
+
+ if (!pszSrc)
+ pszSrc = "";
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (cchDest == 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = 0;
+
+ if ((cchToCopy != 0) && (*pszSrc != '\0'))
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
- while(cchRemaining && cchToCopy &&
(*pszSrc!='\0'))
- {
- *pszDestEnd++ = *pszSrc++;
- cchRemaining--;
- cchToCopy--;
- }
- if (cchRemaining > 0)
- {
- if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
- {
- memset(pszDestEnd +
1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest %
sizeof(char)));
- }
- }
+ if (!pszDest)
+ Status = STATUS_INVALID_PARAMETER;
else
- {
- pszDestEnd--;
- cchRemaining++;
Status = STATUS_BUFFER_OVERFLOW;
+ }
+ }
+ else
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+
+ while (cchRemaining && cchToCopy && (*pszSrc !=
'\0'))
+ {
+ *pszDestEnd++ = *pszSrc++;
+ cchRemaining--;
+ cchToCopy--;
+ }
+
+ if (cchRemaining > 0)
+ {
+ if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
+ {
+ memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags),
((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
}
- *pszDestEnd = '\0';
}
+ else
+ {
+ pszDestEnd--;
+ cchRemaining++;
+ Status = STATUS_BUFFER_OVERFLOW;
+ }
+
+ *pszDestEnd = '\0';
}
}
+ }
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = '\0';
- }
+ else if (cchDest > 0)
+ {
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
+ *pszDestEnd = '\0';
+ }
}
+
if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
{
if (cchDest > 0)
@@ -1993,17 +2158,21 @@ NTSTRSAFEAPI RtlStringCopyNExWorkerA(STRSAFE_LPSTR pszDest,
}
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCopyNExWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCopyNExWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCWSTR pszSrc,
@@ -2015,83 +2184,93 @@ NTSTRSAFEAPI RtlStringCopyNExWorkerW(STRSAFE_LPWSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPWSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
+ else if (cchToCopy > NTSTRSAFE_MAX_CCH)
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ }
else
- if (cchToCopy > NTSTRSAFE_MAX_CCH)
- Status = STATUS_INVALID_PARAMETER;
- else
+ {
+ if (dwFlags & STRSAFE_IGNORE_NULLS)
+ {
+ if (!pszDest)
+ {
+ if ((cchDest != 0) || (cbDest != 0))
+ Status = STATUS_INVALID_PARAMETER;
+ }
+
+ if (!pszSrc)
+ pszSrc = L"";
+ }
+
+ if (NT_SUCCESS(Status))
{
- if (dwFlags & STRSAFE_IGNORE_NULLS)
+ if (cchDest == 0)
{
- if (!pszDest)
+ pszDestEnd = pszDest;
+ cchRemaining = 0;
+
+ if ((cchToCopy != 0) && (*pszSrc != L'\0'))
{
- if ((cchDest!=0) || (cbDest!=0))
+ if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
+ else
+ Status = STATUS_BUFFER_OVERFLOW;
}
- if (!pszSrc)
- pszSrc = L"";
}
- if (NT_SUCCESS(Status))
+ else
{
- if (cchDest==0)
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+
+ while (cchRemaining && cchToCopy && (*pszSrc !=
L'\0'))
{
- pszDestEnd = pszDest;
- cchRemaining = 0;
- if ((cchToCopy!=0) && (*pszSrc!=L'\0'))
+ *pszDestEnd++ = *pszSrc++;
+ cchRemaining--;
+ cchToCopy--;
+ }
+
+ if (cchRemaining > 0)
+ {
+ if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
{
- if (!pszDest)
- Status = STATUS_INVALID_PARAMETER;
- else
- Status = STATUS_BUFFER_OVERFLOW;
+ memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags),
((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
}
}
else
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
- while(cchRemaining && cchToCopy &&
(*pszSrc!=L'\0'))
- {
- *pszDestEnd++ = *pszSrc++;
- cchRemaining--;
- cchToCopy--;
- }
- if (cchRemaining > 0)
- {
- if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
- {
- memset(pszDestEnd +
1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t)));
- }
- }
- else
- {
- pszDestEnd--;
- cchRemaining++;
- Status = STATUS_BUFFER_OVERFLOW;
- }
- *pszDestEnd = L'\0';
+ pszDestEnd--;
+ cchRemaining++;
+ Status = STATUS_BUFFER_OVERFLOW;
}
+
+ *pszDestEnd = L'\0';
}
}
+ }
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = L'\0';
- }
+ else if (cchDest > 0)
+ {
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
+ *pszDestEnd = L'\0';
+ }
}
if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
{
@@ -2104,41 +2283,47 @@ NTSTRSAFEAPI RtlStringCopyNExWorkerW(STRSAFE_LPWSTR pszDest,
}
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCatWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
STRSAFE_LPCSTR pszSrc)
{
- NTSTATUS Status;
size_t cchDestLength;
- Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
+ NTSTATUS Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
- Status = RtlStringCopyWorkerA(pszDest + cchDestLength,cchDest -
cchDestLength,pszSrc);
+ Status = RtlStringCopyWorkerA(pszDest + cchDestLength, cchDest - cchDestLength,
pszSrc);
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCatWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
STRSAFE_LPCWSTR pszSrc)
{
- NTSTATUS Status;
size_t cchDestLength;
- Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
+ NTSTATUS Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
- Status = RtlStringCopyWorkerW(pszDest + cchDestLength,cchDest -
cchDestLength,pszSrc);
+ Status = RtlStringCopyWorkerW(pszDest + cchDestLength, cchDest - cchDestLength,
pszSrc);
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatExWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCatExWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCSTR pszSrc,
@@ -2149,8 +2334,11 @@ NTSTRSAFEAPI RtlStringCatExWorkerA(STRSAFE_LPSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
size_t cchDestLength;
@@ -2158,37 +2346,39 @@ NTSTRSAFEAPI RtlStringCatExWorkerA(STRSAFE_LPSTR pszDest,
{
if (!pszDest)
{
- if ((cchDest==0) && (cbDest==0))
+ if ((cchDest == 0) && (cbDest == 0))
cchDestLength = 0;
else
Status = STATUS_INVALID_PARAMETER;
}
else
{
- Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
+ Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
pszDestEnd = pszDest + cchDestLength;
cchRemaining = cchDest - cchDestLength;
}
}
+
if (!pszSrc)
pszSrc = "";
}
else
{
- Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
+ Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
pszDestEnd = pszDest + cchDestLength;
cchRemaining = cchDest - cchDestLength;
}
}
+
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ if (cchDest == 0)
{
- if (*pszSrc!='\0')
+ if (*pszSrc != '\0')
{
if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
@@ -2197,51 +2387,55 @@ NTSTRSAFEAPI RtlStringCatExWorkerA(STRSAFE_LPSTR pszDest,
}
}
else
- Status =
RtlStringCopyExWorkerA(pszDestEnd,cchRemaining,(cchRemaining*sizeof(char)) + (cbDest %
sizeof(char)),pszSrc,&pszDestEnd,&cchRemaining,dwFlags &
(~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+ {
+ Status = RtlStringCopyExWorkerA(pszDestEnd, cchRemaining, (cchRemaining *
sizeof(char)) + (cbDest % sizeof(char)), pszSrc, &pszDestEnd, &cchRemaining,
dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+ }
}
}
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = '\0';
- }
- }
- if (dwFlags & STRSAFE_NULL_ON_FAILURE)
- {
- if (cchDest > 0)
+ else if (cchDest > 0)
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
*pszDestEnd = '\0';
}
}
+
+ if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+ *pszDestEnd = '\0';
+ }
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatExWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCatExWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCWSTR pszSrc,
@@ -2252,8 +2446,11 @@ NTSTRSAFEAPI RtlStringCatExWorkerW(STRSAFE_LPWSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPWSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
size_t cchDestLength;
@@ -2261,37 +2458,39 @@ NTSTRSAFEAPI RtlStringCatExWorkerW(STRSAFE_LPWSTR pszDest,
{
if (!pszDest)
{
- if ((cchDest==0) && (cbDest==0))
+ if ((cchDest == 0) && (cbDest == 0))
cchDestLength = 0;
else
Status = STATUS_INVALID_PARAMETER;
}
else
{
- Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
+ Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
pszDestEnd = pszDest + cchDestLength;
cchRemaining = cchDest - cchDestLength;
}
}
+
if (!pszSrc)
pszSrc = L"";
}
else
{
- Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
+ Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
pszDestEnd = pszDest + cchDestLength;
cchRemaining = cchDest - cchDestLength;
}
}
+
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ if (cchDest == 0)
{
- if (*pszSrc!=L'\0')
+ if (*pszSrc != L'\0')
{
if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
@@ -2300,77 +2499,82 @@ NTSTRSAFEAPI RtlStringCatExWorkerW(STRSAFE_LPWSTR pszDest,
}
}
else
- Status =
RtlStringCopyExWorkerW(pszDestEnd,cchRemaining,(cchRemaining*sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t)),pszSrc,&pszDestEnd,&cchRemaining,dwFlags &
(~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+ {
+ Status = RtlStringCopyExWorkerW(pszDestEnd, cchRemaining, (cchRemaining *
sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), pszSrc, &pszDestEnd, &cchRemaining,
dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+ }
}
}
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = L'\0';
- }
- }
- if (dwFlags & STRSAFE_NULL_ON_FAILURE)
- {
- if (cchDest > 0)
+ else if (cchDest > 0)
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
*pszDestEnd = L'\0';
}
}
+
+ if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+ *pszDestEnd = L'\0';
+ }
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatNWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCatNWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
STRSAFE_LPCSTR pszSrc,
size_t cchToAppend)
{
- NTSTATUS Status;
size_t cchDestLength;
- Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
+ NTSTATUS Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
- Status = RtlStringCopyNWorkerA(pszDest + cchDestLength,cchDest -
cchDestLength,pszSrc,cchToAppend);
+ Status = RtlStringCopyNWorkerA(pszDest + cchDestLength, cchDest - cchDestLength,
pszSrc, cchToAppend);
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatNWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCatNWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
STRSAFE_LPCWSTR pszSrc,
size_t cchToAppend)
{
- NTSTATUS Status;
size_t cchDestLength;
- Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
+ NTSTATUS Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
- Status = RtlStringCopyNWorkerW(pszDest + cchDestLength,cchDest -
cchDestLength,pszSrc,cchToAppend);
+ Status = RtlStringCopyNWorkerW(pszDest + cchDestLength, cchDest - cchDestLength,
pszSrc, cchToAppend);
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatNExWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringCatNExWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCSTR pszSrc,
@@ -2383,101 +2587,111 @@ NTSTRSAFEAPI RtlStringCatNExWorkerA(STRSAFE_LPSTR pszDest,
STRSAFE_LPSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
size_t cchDestLength = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
+ else if (cchToAppend > NTSTRSAFE_MAX_CCH)
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ }
else
- if (cchToAppend > NTSTRSAFE_MAX_CCH)
- Status = STATUS_INVALID_PARAMETER;
- else
+ {
+ if (dwFlags & STRSAFE_IGNORE_NULLS)
{
- if (dwFlags & STRSAFE_IGNORE_NULLS)
+ if (!pszDest)
{
- if (!pszDest)
- {
- if ((cchDest==0) && (cbDest==0))
- cchDestLength = 0;
- else
- Status = STATUS_INVALID_PARAMETER;
- }
+ if ((cchDest == 0) && (cbDest == 0))
+ cchDestLength = 0;
else
- {
- Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
- if (NT_SUCCESS(Status))
- {
- pszDestEnd = pszDest + cchDestLength;
- cchRemaining = cchDest - cchDestLength;
- }
- }
- if (!pszSrc)
- pszSrc = "";
+ Status = STATUS_INVALID_PARAMETER;
}
else
{
- Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
+ Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
pszDestEnd = pszDest + cchDestLength;
cchRemaining = cchDest - cchDestLength;
}
}
+
+ if (!pszSrc)
+ pszSrc = "";
+ }
+ else
+ {
+ Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ pszDestEnd = pszDest + cchDestLength;
+ cchRemaining = cchDest - cchDestLength;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (cchDest == 0)
+ {
+ if ((cchToAppend != 0) && (*pszSrc != '\0'))
{
- if ((cchToAppend!=0) && (*pszSrc!='\0'))
- {
- if (!pszDest)
- Status = STATUS_INVALID_PARAMETER;
- else
- Status = STATUS_BUFFER_OVERFLOW;
- }
+ if (!pszDest)
+ Status = STATUS_INVALID_PARAMETER;
+ else
+ Status = STATUS_BUFFER_OVERFLOW;
}
- else
- Status =
RtlStringCopyNExWorkerA(pszDestEnd,cchRemaining,(cchRemaining*sizeof(char)) + (cbDest %
sizeof(char)),pszSrc,cchToAppend,&pszDestEnd,&cchRemaining,dwFlags &
(~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+ }
+ else
+ {
+ Status = RtlStringCopyNExWorkerA(pszDestEnd, cchRemaining, (cchRemaining
* sizeof(char)) + (cbDest % sizeof(char)), pszSrc, cchToAppend, &pszDestEnd,
&cchRemaining, dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
}
}
+ }
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = '\0';
- }
- }
- if (dwFlags & (STRSAFE_NULL_ON_FAILURE))
- {
- if (cchDest > 0)
+ else if (cchDest > 0)
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
*pszDestEnd = '\0';
}
}
+
+ if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+ *pszDestEnd = '\0';
+ }
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringCatNExWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringCatNExWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPCWSTR pszSrc,
@@ -2490,153 +2704,165 @@ NTSTRSAFEAPI RtlStringCatNExWorkerW(STRSAFE_LPWSTR pszDest,
STRSAFE_LPWSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
size_t cchDestLength = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
+ else if (cchToAppend > NTSTRSAFE_MAX_CCH)
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ }
else
- if (cchToAppend > NTSTRSAFE_MAX_CCH)
- Status = STATUS_INVALID_PARAMETER;
- else
+ {
+ if (dwFlags & STRSAFE_IGNORE_NULLS)
{
- if (dwFlags & STRSAFE_IGNORE_NULLS)
+ if (!pszDest)
{
- if (!pszDest)
- {
- if ((cchDest==0) && (cbDest==0))
- cchDestLength = 0;
- else
- Status = STATUS_INVALID_PARAMETER;
- }
+ if ((cchDest == 0) && (cbDest == 0))
+ cchDestLength = 0;
else
- {
- Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
- if (NT_SUCCESS(Status))
- {
- pszDestEnd = pszDest + cchDestLength;
- cchRemaining = cchDest - cchDestLength;
- }
- }
- if (!pszSrc)
- pszSrc = L"";
+ Status = STATUS_INVALID_PARAMETER;
}
else
{
- Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
+ Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
pszDestEnd = pszDest + cchDestLength;
cchRemaining = cchDest - cchDestLength;
}
}
+
+ if (!pszSrc)
+ pszSrc = L"";
+ }
+ else
+ {
+ Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ pszDestEnd = pszDest + cchDestLength;
+ cchRemaining = cchDest - cchDestLength;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (cchDest == 0)
+ {
+ if ((cchToAppend != 0) && (*pszSrc != L'\0'))
{
- if ((cchToAppend!=0) && (*pszSrc!=L'\0'))
- {
- if (!pszDest)
- Status = STATUS_INVALID_PARAMETER;
- else
- Status = STATUS_BUFFER_OVERFLOW;
- }
+ if (!pszDest)
+ Status = STATUS_INVALID_PARAMETER;
+ else
+ Status = STATUS_BUFFER_OVERFLOW;
}
- else
- Status =
RtlStringCopyNExWorkerW(pszDestEnd,cchRemaining,(cchRemaining*sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t)),pszSrc,cchToAppend,&pszDestEnd,&cchRemaining,dwFlags &
(~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+ }
+ else
+ {
+ Status = RtlStringCopyNExWorkerW(pszDestEnd, cchRemaining, (cchRemaining
* sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), pszSrc, cchToAppend, &pszDestEnd,
&cchRemaining, dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
}
}
+ }
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = L'\0';
- }
- }
- if (dwFlags & (STRSAFE_NULL_ON_FAILURE))
- {
- if (cchDest > 0)
+ else if (cchDest > 0)
{
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
*pszDestEnd = L'\0';
}
}
+
+ if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
+ {
+ pszDestEnd = pszDest;
+ cchRemaining = cchDest;
+ *pszDestEnd = L'\0';
+ }
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringVPrintfWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringVPrintfWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
STRSAFE_LPCSTR pszFormat,
va_list argList)
{
NTSTATUS Status = STATUS_SUCCESS;
- if (cchDest==0)
+
+ if (cchDest == 0)
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
- int iRet;
- size_t cchMax;
- cchMax = cchDest - 1;
- iRet = _vsnprintf(pszDest,cchMax,pszFormat,argList);
+ size_t cchMax = cchDest - 1;
+ int iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
+
if ((iRet < 0) || (((size_t)iRet) > cchMax))
{
pszDest += cchMax;
*pszDest = '\0';
Status = STATUS_BUFFER_OVERFLOW;
}
- else
- if (((size_t)iRet)==cchMax)
- {
- pszDest += cchMax;
- *pszDest = '\0';
- }
+ else if (((size_t)iRet) == cchMax)
+ {
+ pszDest += cchMax;
+ *pszDest = '\0';
+ }
}
+
return Status;
}
-NTSTRSAFEAPI RtlpStringVPrintfWorkerW(STRSAFE_LPWSTR pszDest,
- size_t cchDest,
- STRSAFE_LPCWSTR pszFormat,
- size_t* pcchDestNewLen,
+NTSTRSAFEAPI RtlpStringVPrintfWorkerW(
+ STRSAFE_LPWSTR pszDest,
+ size_t cchDest,
+ STRSAFE_LPCWSTR pszFormat,
+ size_t* pcchDestNewLen,
va_list argList)
{
NTSTATUS Status = STATUS_SUCCESS;
- int iRet;
- size_t cchMax;
- cchMax = cchDest - 1;
- iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList);
- if ((iRet < 0) || (((size_t) iRet) > cchMax))
+ size_t cchMax = cchDest - 1;
+ int iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList);
+
+ if ((iRet < 0) || (((size_t)iRet) > cchMax))
{
pszDest += cchMax;
*pszDest = L'\0';
Status = STATUS_BUFFER_OVERFLOW;
}
- else
- if (((size_t) iRet) == cchMax)
- {
- pszDest += cchMax;
- *pszDest = L'\0';
- }
+ else if (((size_t)iRet) == cchMax)
+ {
+ pszDest += cchMax;
+ *pszDest = L'\0';
+ }
if (pcchDestNewLen)
*pcchDestNewLen = (iRet == -1) ? cchDest : iRet;
@@ -2644,30 +2870,33 @@ NTSTRSAFEAPI RtlpStringVPrintfWorkerW(STRSAFE_LPWSTR pszDest,
return Status;
}
-NTSTRSAFEAPI RtlStringVPrintfWorkerW(STRSAFE_LPWSTR pszDest,
+NTSTRSAFEAPI RtlStringVPrintfWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
STRSAFE_LPCWSTR pszFormat,
va_list argList)
{
- if (cchDest==0)
+ if (cchDest == 0)
return STATUS_INVALID_PARAMETER;
return RtlpStringVPrintfWorkerW(pszDest, cchDest, pszFormat, NULL, argList);
}
-NTSTRSAFEAPI RtlStringVPrintfWorkerLenW(STRSAFE_LPWSTR pszDest,
- size_t cchDest,
- STRSAFE_LPCWSTR pszFormat,
- size_t* pcchDestNewLen,
+NTSTRSAFEAPI RtlStringVPrintfWorkerLenW(
+ STRSAFE_LPWSTR pszDest,
+ size_t cchDest,
+ STRSAFE_LPCWSTR pszFormat,
+ size_t* pcchDestNewLen,
va_list argList)
{
if (cchDest == 0 || pcchDestNewLen == 0)
return STATUS_INVALID_PARAMETER;
-
+
return RtlpStringVPrintfWorkerW(pszDest, cchDest, pszFormat, pcchDestNewLen,
argList);
}
-NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest,
+NTSTRSAFEAPI RtlStringVPrintfExWorkerA(
+ STRSAFE_LPSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPSTR *ppszDestEnd,
@@ -2679,27 +2908,32 @@ NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest,
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
if (dwFlags & STRSAFE_IGNORE_NULLS)
{
if (!pszDest)
{
- if ((cchDest!=0) || (cbDest!=0))
+ if ((cchDest != 0) || (cbDest != 0))
Status = STATUS_INVALID_PARAMETER;
}
+
if (!pszFormat)
pszFormat = "";
}
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ if (cchDest == 0)
{
pszDestEnd = pszDest;
cchRemaining = 0;
- if (*pszFormat!='\0')
+
+ if (*pszFormat != '\0')
{
if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
@@ -2712,7 +2946,7 @@ NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest,
int iRet;
size_t cchMax;
cchMax = cchDest - 1;
- iRet = _vsnprintf(pszDest,cchMax,pszFormat,argList);
+ iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
if ((iRet < 0) || (((size_t)iRet) > cchMax))
{
pszDestEnd = pszDest + cchMax;
@@ -2720,46 +2954,46 @@ NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest,
*pszDestEnd = '\0';
Status = STATUS_BUFFER_OVERFLOW;
}
- else
- if (((size_t)iRet)==cchMax)
+ else if (((size_t)iRet) == cchMax)
+ {
+ pszDestEnd = pszDest + cchMax;
+ cchRemaining = 1;
+ *pszDestEnd = '\0';
+ }
+ else if (((size_t)iRet) < cchMax)
+ {
+ pszDestEnd = pszDest + iRet;
+ cchRemaining = cchDest - iRet;
+
+ if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
{
- pszDestEnd = pszDest + cchMax;
- cchRemaining = 1;
- *pszDestEnd = '\0';
+ memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags),
((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
}
- else
- if (((size_t)iRet) < cchMax)
- {
- pszDestEnd = pszDest + iRet;
- cchRemaining = cchDest - iRet;
- if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
- {
- memset(pszDestEnd +
1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest %
sizeof(char)));
- }
- }
+ }
}
}
}
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = '\0';
- }
+ else if (cchDest > 0)
+ {
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
+ *pszDestEnd = '\0';
+ }
}
+
if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
{
if (cchDest > 0)
@@ -2771,49 +3005,59 @@ NTSTRSAFEAPI RtlStringVPrintfExWorkerA(STRSAFE_LPSTR pszDest,
}
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlpStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest,
+
+NTSTRSAFEAPI RtlpStringVPrintfExWorkerW(
+ STRSAFE_LPWSTR pszDest,
size_t cchDest,
size_t cbDest,
STRSAFE_LPWSTR *ppszDestEnd,
size_t *pcchRemaining,
STRSAFE_DWORD dwFlags,
STRSAFE_LPCWSTR pszFormat,
- size_t* pcchDestNewLen,
+ size_t* pcchDestNewLen,
va_list argList)
{
NTSTATUS Status = STATUS_SUCCESS;
STRSAFE_LPWSTR pszDestEnd = pszDest;
size_t cchRemaining = 0;
+
if (dwFlags & (~STRSAFE_VALID_FLAGS))
+ {
Status = STATUS_INVALID_PARAMETER;
+ }
else
{
if (dwFlags & STRSAFE_IGNORE_NULLS)
{
if (!pszDest)
{
- if ((cchDest!=0) || (cbDest!=0))
+ if ((cchDest != 0) || (cbDest != 0))
Status = STATUS_INVALID_PARAMETER;
}
+
if (!pszFormat)
pszFormat = L"";
}
+
if (NT_SUCCESS(Status))
{
- if (cchDest==0)
+ if (cchDest == 0)
{
pszDestEnd = pszDest;
cchRemaining = 0;
- if (*pszFormat!=L'\0')
+ if (*pszFormat != L'\0')
{
if (!pszDest)
Status = STATUS_INVALID_PARAMETER;
@@ -2824,9 +3068,8 @@ NTSTRSAFEAPI RtlpStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest,
else
{
int iRet;
- size_t cchMax;
- cchMax = cchDest - 1;
- iRet = _vsnwprintf(pszDest,cchMax,pszFormat,argList);
+ size_t cchMax = cchDest - 1;
+ iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList);
if ((iRet < 0) || (((size_t)iRet) > cchMax))
{
pszDestEnd = pszDest + cchMax;
@@ -2834,48 +3077,47 @@ NTSTRSAFEAPI RtlpStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest,
*pszDestEnd = L'\0';
Status = STATUS_BUFFER_OVERFLOW;
}
- else
- if (((size_t)iRet)==cchMax)
+ else if (((size_t)iRet) == cchMax)
+ {
+ pszDestEnd = pszDest + cchMax;
+ cchRemaining = 1;
+ *pszDestEnd = L'\0';
+ }
+ else if (((size_t)iRet) < cchMax)
+ {
+ pszDestEnd = pszDest + iRet;
+ cchRemaining = cchDest - iRet;
+
+ if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
{
- pszDestEnd = pszDest + cchMax;
- cchRemaining = 1;
- *pszDestEnd = L'\0';
+ memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags),
((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
}
- else
- if (((size_t)iRet) < cchMax)
- {
- pszDestEnd = pszDest + iRet;
- cchRemaining = cchDest - iRet;
- if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
- {
- memset(pszDestEnd +
1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest %
sizeof(wchar_t)));
- }
- }
+ }
if (pcchDestNewLen)
*pcchDestNewLen = iRet == -1 ? cchDest : iRet;
}
}
}
+
if (!NT_SUCCESS(Status))
{
if (pszDest)
{
if (dwFlags & STRSAFE_FILL_ON_FAILURE)
{
- memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
- if (STRSAFE_GET_FILL_PATTERN(dwFlags)==0)
+ memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
+ if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
{
pszDestEnd = pszDest;
cchRemaining = cchDest;
}
- else
- if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
- *pszDestEnd = L'\0';
- }
+ else if (cchDest > 0)
+ {
+ pszDestEnd = pszDest + cchDest - 1;
+ cchRemaining = 1;
+ *pszDestEnd = L'\0';
+ }
}
if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
{
@@ -2888,36 +3130,41 @@ NTSTRSAFEAPI RtlpStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest,
}
}
}
- if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
+
+ if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_OVERFLOW))
{
if (ppszDestEnd)
*ppszDestEnd = pszDestEnd;
+
if (pcchRemaining)
*pcchRemaining = cchRemaining;
}
+
return Status;
}
-NTSTRSAFEAPI RtlStringVPrintfExWorkerW(STRSAFE_LPWSTR pszDest,
- size_t cchDest,
- size_t cbDest,
- STRSAFE_LPWSTR *ppszDestEnd,
- size_t *pcchRemaining,
- STRSAFE_DWORD dwFlags,
- STRSAFE_LPCWSTR pszFormat,
+NTSTRSAFEAPI RtlStringVPrintfExWorkerW(
+ STRSAFE_LPWSTR pszDest,
+ size_t cchDest,
+ size_t cbDest,
+ STRSAFE_LPWSTR *ppszDestEnd,
+ size_t *pcchRemaining,
+ STRSAFE_DWORD dwFlags,
+ STRSAFE_LPCWSTR pszFormat,
va_list argList)
{
return RtlpStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd,
pcchRemaining, dwFlags, pszFormat, NULL, argList);
}
-NTSTRSAFEAPI RtlStringVPrintfExWorkerLenW(STRSAFE_LPWSTR pszDest,
- size_t cchDest,
- size_t cbDest,
- STRSAFE_LPWSTR *ppszDestEnd,
- size_t *pcchRemaining,
- STRSAFE_DWORD dwFlags,
- STRSAFE_LPCWSTR pszFormat,
- size_t* pcchDestNewLen,
+NTSTRSAFEAPI RtlStringVPrintfExWorkerLenW(
+ STRSAFE_LPWSTR pszDest,
+ size_t cchDest,
+ size_t cbDest,
+ STRSAFE_LPWSTR *ppszDestEnd,
+ size_t *pcchRemaining,
+ STRSAFE_DWORD dwFlags,
+ STRSAFE_LPCWSTR pszFormat,
+ size_t* pcchDestNewLen,
va_list argList)
{
if (pcchDestNewLen == 0)
@@ -2929,19 +3176,22 @@ NTSTRSAFEAPI RtlStringVPrintfExWorkerLenW(STRSAFE_LPWSTR pszDest,
NTSTRSAFEAPI
RtlStringLengthWorkerA(
- _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
- _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength)
+ _In_reads_or_z_(cchMax) STRSAFE_LPCSTR psz,
+ _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength)
{
NTSTATUS Status = STATUS_SUCCESS;
size_t cchMaxPrev = cchMax;
- while(cchMax && (*psz!='\0'))
+
+ while (cchMax && (*psz != '\0'))
{
psz++;
cchMax--;
}
- if (cchMax==0)
+
+ if (cchMax == 0)
Status = STATUS_INVALID_PARAMETER;
+
if (pcchLength)
{
if (NT_SUCCESS(Status))
@@ -2949,24 +3199,28 @@ RtlStringLengthWorkerA(
else
*pcchLength = 0;
}
+
return Status;
}
NTSTRSAFEAPI
RtlStringLengthWorkerW(
- _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
- _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
- _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength)
+ _In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz,
+ _In_ _In_range_(<=, NTSTRSAFE_MAX_CCH) size_t cchMax,
+ _Out_opt_ _Deref_out_range_(<, cchMax) size_t *pcchLength)
{
NTSTATUS Status = STATUS_SUCCESS;
size_t cchMaxPrev = cchMax;
- while(cchMax && (*psz!=L'\0'))
+
+ while (cchMax && (*psz != L'\0'))
{
psz++;
cchMax--;
}
- if (cchMax==0)
+
+ if (cchMax == 0)
Status = STATUS_INVALID_PARAMETER;
+
if (pcchLength)
{
if (NT_SUCCESS(Status))
@@ -2974,11 +3228,13 @@ RtlStringLengthWorkerW(
else
*pcchLength = 0;
}
+
return Status;
}
NTSTRSAFEAPI
-RtlpUnicodeStringValidate(_In_opt_ PCUNICODE_STRING SourceString,
+RtlpUnicodeStringValidate(
+ _In_opt_ PCUNICODE_STRING SourceString,
_In_ STRSAFE_DWORD dwFlags)
{
if (SourceString)
@@ -3008,7 +3264,8 @@ RtlUnicodeStringValidate(_In_opt_ PCUNICODE_STRING SourceString)
}
NTSTRSAFEAPI
-RtlUnicodeStringValidateEx(_In_opt_ PCUNICODE_STRING SourceString,
+RtlUnicodeStringValidateEx(
+ _In_opt_ PCUNICODE_STRING SourceString,
_In_ STRSAFE_DWORD dwFlags)
{
if (dwFlags & ~(STRSAFE_UNICODE_STRING_VALID_FLAGS))
@@ -3017,11 +3274,13 @@ RtlUnicodeStringValidateEx(_In_opt_ PCUNICODE_STRING
SourceString,
return RtlpUnicodeStringValidate(SourceString, dwFlags);
}
-static
+static
NTSTATUS
__cdecl
-RtlUnicodeStringPrintf(_In_ PUNICODE_STRING DestinationString,
- _In_ NTSTRSAFE_PCWSTR pszFormat, ...)
+RtlUnicodeStringPrintf(
+ _In_ PUNICODE_STRING DestinationString,
+ _In_ NTSTRSAFE_PCWSTR pszFormat,
+ ...)
{
NTSTATUS Status;
size_t cchFinalLength;
@@ -3056,18 +3315,19 @@ RtlUnicodeStringPrintf(_In_ PUNICODE_STRING DestinationString,
return Status;
}
-static
+static
NTSTATUS
__cdecl
-RtlUnicodeStringPrintfEx(_In_opt_ PUNICODE_STRING DestinationString,
+RtlUnicodeStringPrintfEx(
+ _In_opt_ PUNICODE_STRING DestinationString,
_In_opt_ PUNICODE_STRING RemainingString,
_In_ STRSAFE_DWORD dwFlags,
_In_ NTSTRSAFE_PCWSTR pszFormat, ...)
{
- NTSTATUS Status;
- size_t cchFinalLength;
- size_t cchRemaining;
- va_list argList;
+ NTSTATUS Status;
+ size_t cchFinalLength;
+ size_t cchRemaining;
+ va_list argList;
va_start(argList, pszFormat);