ReactOS  0.4.15-dev-1054-gd029a62
ntstrsafe.h File Reference
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
Include dependency graph for ntstrsafe.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NTSTRSAFEAPI   static __inline NTSTATUS NTAPI
 
#define NTSTRSAFEVAPI   static __inline NTSTATUS __cdecl
 
#define NTSTRSAFE_INLINE_API   static __inline NTSTATUS NTAPI
 
#define NTSTRSAFE_MAX_CCH   2147483647
 
#define NTSTRSAFE_UNICODE_STRING_MAX_CCH   32767
 
#define STRSAFE_IGNORE_NULLS   0x00000100
 
#define STRSAFE_FILL_BEHIND_NULL   0x00000200
 
#define STRSAFE_FILL_ON_FAILURE   0x00000400
 
#define STRSAFE_NULL_ON_FAILURE   0x00000800
 
#define STRSAFE_NO_TRUNCATION   0x00001000
 
#define STRSAFE_IGNORE_NULL_UNICODE_STRINGS   0x00010000
 
#define STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED   0x00020000
 
#define STRSAFE_VALID_FLAGS   (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)
 
#define STRSAFE_UNICODE_STRING_VALID_FLAGS   (STRSAFE_VALID_FLAGS | STRSAFE_IGNORE_NULL_UNICODE_STRINGS | STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED)
 
#define STRSAFE_FILL_BYTE(x)   ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_BEHIND_NULL))
 
#define STRSAFE_FAILURE_BYTE(x)   ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_ON_FAILURE))
 
#define STRSAFE_GET_FILL_PATTERN(dwFlags)   ((int)((dwFlags) & 0x000000FF))
 
#define STRSAFE_FILL_BEHIND   STRSAFE_FILL_BEHIND_NULL
 
#define STRSAFE_ZERO_LENGTH_ON_FAILURE   STRSAFE_NULL_ON_FAILURE
 
#define RtlStringCopyWorkerA   RtlStringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;
 
#define RtlStringCopyWorkerW   RtlStringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;
 
#define RtlStringCopyExWorkerA   RtlStringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;
 
#define RtlStringCopyExWorkerW   RtlStringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;
 
#define RtlStringCatWorkerA   RtlStringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;
 
#define RtlStringCatWorkerW   RtlStringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;
 
#define RtlStringCatExWorkerA   RtlStringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;
 
#define RtlStringCatExWorkerW   RtlStringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;
 
#define RtlStringCatNWorkerA   RtlStringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA;
 
#define RtlStringCatNWorkerW   RtlStringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW;
 
#define RtlStringCatNExWorkerA   RtlStringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA;
 
#define RtlStringCatNExWorkerW   RtlStringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW;
 
#define RtlStringVPrintfWorkerA   RtlStringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;
 
#define RtlStringVPrintfWorkerW   RtlStringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;
 
#define RtlStringVPrintfExWorkerA   RtlStringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;
 
#define RtlStringVPrintfExWorkerW   RtlStringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;
 
#define RtlStringLengthWorkerA   RtlStringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA;
 
#define RtlStringLengthWorkerW   RtlStringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;
 

Typedefs

typedef charSTRSAFE_LPSTR
 
typedef const charSTRSAFE_LPCSTR
 
typedef wchar_tSTRSAFE_LPWSTR
 
typedef const wchar_tSTRSAFE_LPCWSTR
 
typedef _Null_terminated_ charNTSTRSAFE_PSTR
 
typedef _Null_terminated_ const charNTSTRSAFE_PCSTR
 
typedef _Null_terminated_ wchar_tNTSTRSAFE_PWSTR
 
typedef _Null_terminated_ const wchar_tNTSTRSAFE_PCWSTR
 
typedef ULONG STRSAFE_DWORD
 

Functions

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 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 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)
 
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)
 
NTSTRSAFEAPI RtlStringCchCopyA (_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)
 
NTSTRSAFEAPI RtlStringCbCopyA (_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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
NTSTRSAFEAPI RtlStringCbCopyNA (_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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
NTSTRSAFEAPI RtlStringCchCatA (_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)
 
NTSTRSAFEAPI RtlStringCbCatA (_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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
NTSTRSAFEVAPI RtlStringCchPrintfA (_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
 
NTSTRSAFEVAPI RtlStringCchPrintfW (_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
 
NTSTRSAFEVAPI RtlStringCbPrintfA (_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
 
NTSTRSAFEVAPI RtlStringCbPrintfW (_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
 
NTSTRSAFEVAPI 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,...)
 
NTSTRSAFEVAPI 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,...)
 
NTSTRSAFEVAPI 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,...)
 
NTSTRSAFEVAPI 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,...)
 
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)
 
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)
 
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)
 
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)
 
_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)
 
_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)
 
_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)
 
_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)
 
NTSTRSAFEAPI RtlpArrayVPrintfWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, size_t *pcchDestNewLen, va_list argList)
 
NTSTRSAFEAPI RtlpStringVPrintfWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, size_t *pcchDestNewLen, va_list argList)
 
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, va_list argList)
 
NTSTRSAFEAPI RtlpUnicodeStringValidate (_In_opt_ PCUNICODE_STRING SourceString, _In_ STRSAFE_DWORD dwFlags)
 
NTSTRSAFEAPI RtlUnicodeStringValidate (_In_opt_ PCUNICODE_STRING SourceString)
 
NTSTRSAFEAPI RtlUnicodeStringValidateEx (_In_opt_ PCUNICODE_STRING SourceString, _In_ STRSAFE_DWORD dwFlags)
 
NTSTRSAFEVAPI RtlUnicodeStringPrintf (_In_ PUNICODE_STRING DestinationString, _In_ NTSTRSAFE_PCWSTR pszFormat,...)
 
NTSTRSAFEVAPI RtlUnicodeStringPrintfEx (_In_opt_ PUNICODE_STRING DestinationString, _In_opt_ PUNICODE_STRING RemainingString, _In_ STRSAFE_DWORD dwFlags, _In_ NTSTRSAFE_PCWSTR pszFormat,...)
 

Macro Definition Documentation

◆ NTSTRSAFE_INLINE_API

#define NTSTRSAFE_INLINE_API   static __inline NTSTATUS NTAPI

Definition at line 20 of file ntstrsafe.h.

◆ NTSTRSAFE_MAX_CCH

#define NTSTRSAFE_MAX_CCH   2147483647

Definition at line 23 of file ntstrsafe.h.

◆ NTSTRSAFE_UNICODE_STRING_MAX_CCH

#define NTSTRSAFE_UNICODE_STRING_MAX_CCH   32767

Definition at line 27 of file ntstrsafe.h.

◆ NTSTRSAFEAPI

#define NTSTRSAFEAPI   static __inline NTSTATUS NTAPI

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 18 of file ntstrsafe.h.

◆ NTSTRSAFEVAPI

#define NTSTRSAFEVAPI   static __inline NTSTATUS __cdecl

Definition at line 19 of file ntstrsafe.h.

◆ RtlStringCatExWorkerA

#define RtlStringCatExWorkerA   RtlStringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 3325 of file ntstrsafe.h.

◆ RtlStringCatExWorkerW

#define RtlStringCatExWorkerW   RtlStringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 3326 of file ntstrsafe.h.

◆ RtlStringCatNExWorkerA

#define RtlStringCatNExWorkerA   RtlStringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA;

Definition at line 3329 of file ntstrsafe.h.

◆ RtlStringCatNExWorkerW

#define RtlStringCatNExWorkerW   RtlStringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW;

Definition at line 3330 of file ntstrsafe.h.

◆ RtlStringCatNWorkerA

#define RtlStringCatNWorkerA   RtlStringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA;

Definition at line 3327 of file ntstrsafe.h.

◆ RtlStringCatNWorkerW

#define RtlStringCatNWorkerW   RtlStringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW;

Definition at line 3328 of file ntstrsafe.h.

◆ RtlStringCatWorkerA

#define RtlStringCatWorkerA   RtlStringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 3323 of file ntstrsafe.h.

◆ RtlStringCatWorkerW

#define RtlStringCatWorkerW   RtlStringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 3324 of file ntstrsafe.h.

◆ RtlStringCopyExWorkerA

#define RtlStringCopyExWorkerA   RtlStringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 3321 of file ntstrsafe.h.

◆ RtlStringCopyExWorkerW

#define RtlStringCopyExWorkerW   RtlStringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 3322 of file ntstrsafe.h.

◆ RtlStringCopyWorkerA

#define RtlStringCopyWorkerA   RtlStringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 3319 of file ntstrsafe.h.

◆ RtlStringCopyWorkerW

#define RtlStringCopyWorkerW   RtlStringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 3320 of file ntstrsafe.h.

◆ RtlStringLengthWorkerA

#define RtlStringLengthWorkerA   RtlStringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA;

Definition at line 3335 of file ntstrsafe.h.

◆ RtlStringLengthWorkerW

#define RtlStringLengthWorkerW   RtlStringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;

Definition at line 3336 of file ntstrsafe.h.

◆ RtlStringVPrintfExWorkerA

#define RtlStringVPrintfExWorkerA   RtlStringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;

Definition at line 3333 of file ntstrsafe.h.

◆ RtlStringVPrintfExWorkerW

#define RtlStringVPrintfExWorkerW   RtlStringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;

Definition at line 3334 of file ntstrsafe.h.

◆ RtlStringVPrintfWorkerA

#define RtlStringVPrintfWorkerA   RtlStringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;

Definition at line 3331 of file ntstrsafe.h.

◆ RtlStringVPrintfWorkerW

#define RtlStringVPrintfWorkerW   RtlStringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;

Definition at line 3332 of file ntstrsafe.h.

◆ STRSAFE_FAILURE_BYTE

#define STRSAFE_FAILURE_BYTE (   x)    ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_ON_FAILURE))

Definition at line 43 of file ntstrsafe.h.

◆ STRSAFE_FILL_BEHIND

#define STRSAFE_FILL_BEHIND   STRSAFE_FILL_BEHIND_NULL

Definition at line 48 of file ntstrsafe.h.

◆ STRSAFE_FILL_BEHIND_NULL

#define STRSAFE_FILL_BEHIND_NULL   0x00000200

Definition at line 32 of file ntstrsafe.h.

◆ STRSAFE_FILL_BYTE

#define STRSAFE_FILL_BYTE (   x)    ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_BEHIND_NULL))

Definition at line 42 of file ntstrsafe.h.

◆ STRSAFE_FILL_ON_FAILURE

#define STRSAFE_FILL_ON_FAILURE   0x00000400

Definition at line 33 of file ntstrsafe.h.

◆ STRSAFE_GET_FILL_PATTERN

#define STRSAFE_GET_FILL_PATTERN (   dwFlags)    ((int)((dwFlags) & 0x000000FF))

Definition at line 45 of file ntstrsafe.h.

◆ STRSAFE_IGNORE_NULL_UNICODE_STRINGS

#define STRSAFE_IGNORE_NULL_UNICODE_STRINGS   0x00010000

Definition at line 36 of file ntstrsafe.h.

◆ STRSAFE_IGNORE_NULLS

#define STRSAFE_IGNORE_NULLS   0x00000100

Definition at line 31 of file ntstrsafe.h.

◆ STRSAFE_NO_TRUNCATION

#define STRSAFE_NO_TRUNCATION   0x00001000

Definition at line 35 of file ntstrsafe.h.

◆ STRSAFE_NULL_ON_FAILURE

#define STRSAFE_NULL_ON_FAILURE   0x00000800

Definition at line 34 of file ntstrsafe.h.

◆ STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED

#define STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED   0x00020000

Definition at line 37 of file ntstrsafe.h.

◆ STRSAFE_UNICODE_STRING_VALID_FLAGS

Definition at line 40 of file ntstrsafe.h.

◆ STRSAFE_VALID_FLAGS

#define STRSAFE_VALID_FLAGS   (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)

Definition at line 39 of file ntstrsafe.h.

◆ STRSAFE_ZERO_LENGTH_ON_FAILURE

#define STRSAFE_ZERO_LENGTH_ON_FAILURE   STRSAFE_NULL_ON_FAILURE

Definition at line 49 of file ntstrsafe.h.

Typedef Documentation

◆ NTSTRSAFE_PCSTR

Definition at line 57 of file ntstrsafe.h.

◆ NTSTRSAFE_PCWSTR

Definition at line 59 of file ntstrsafe.h.

◆ NTSTRSAFE_PSTR

Definition at line 56 of file ntstrsafe.h.

◆ NTSTRSAFE_PWSTR

Definition at line 58 of file ntstrsafe.h.

◆ STRSAFE_DWORD

Definition at line 61 of file ntstrsafe.h.

◆ STRSAFE_LPCSTR

Definition at line 52 of file ntstrsafe.h.

◆ STRSAFE_LPCWSTR

Definition at line 54 of file ntstrsafe.h.

◆ STRSAFE_LPSTR

typedef char* STRSAFE_LPSTR

Definition at line 51 of file ntstrsafe.h.

◆ STRSAFE_LPWSTR

Definition at line 53 of file ntstrsafe.h.

Function Documentation

◆ RtlpArrayVPrintfWorkerW()

NTSTRSAFEAPI RtlpArrayVPrintfWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszFormat,
size_t pcchDestNewLen,
va_list  argList 
)

Definition at line 2830 of file ntstrsafe.h.

2836 {
2838  int iRet = _vsnwprintf(pszDest, cchDest, pszFormat, argList);
2839 
2840  if ((iRet < 0) || (((size_t)iRet) > cchDest))
2841  {
2843  *pcchDestNewLen = cchDest;
2844  }
2845  else
2846  {
2847  *pcchDestNewLen = iRet;
2848  }
2849 
2850  return Status;
2851 }
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by RtlpStringVPrintfExWorkerW(), and RtlUnicodeStringPrintf().

◆ RtlpStringVPrintfExWorkerW()

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,
va_list  argList 
)

Definition at line 3017 of file ntstrsafe.h.

3027 {
3029  STRSAFE_LPWSTR pszDestEnd = pszDest;
3030  size_t cchRemaining = 0;
3031 
3032  if (dwFlags & (~STRSAFE_VALID_FLAGS))
3033  {
3035  }
3036  else
3037  {
3039  {
3040  if (!pszDest)
3041  {
3042  if ((cchDest != 0) || (cbDest != 0))
3044  }
3045 
3046  if (!pszFormat)
3047  pszFormat = L"";
3048  }
3049 
3050  if (NT_SUCCESS(Status))
3051  {
3052  if (cchDest == 0)
3053  {
3054  pszDestEnd = pszDest;
3055  cchRemaining = 0;
3056  if (*pszFormat != L'\0')
3057  {
3058  if (!pszDest)
3060  else
3062  }
3063  }
3064  else
3065  {
3066  size_t cchDestNewLen = 0;
3067 
3068  Status = RtlpArrayVPrintfWorkerW(pszDest, cchDest, pszFormat, &cchDestNewLen, argList);
3069  pszDestEnd = pszDest + cchDestNewLen;
3070  cchRemaining = cchDest - cchDestNewLen;
3071 
3072  if (NT_SUCCESS(Status) && (dwFlags & STRSAFE_FILL_BEHIND) && cchRemaining)
3073  {
3074  memset(pszDestEnd, STRSAFE_GET_FILL_PATTERN(dwFlags), (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
3075  }
3076 
3077  if (pcchDestNewLen)
3078  *pcchDestNewLen = cchDestNewLen;
3079  }
3080  }
3081  }
3082 
3083  if (!NT_SUCCESS(Status))
3084  {
3085  if (pszDest)
3086  {
3088  {
3089  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
3091  {
3092  pszDestEnd = pszDest;
3093  cchRemaining = cchDest;
3094  }
3095  else if (cchDest > 0)
3096  {
3097  pszDestEnd = pszDest + cchDest - 1;
3098  cchRemaining = 1;
3099  *pszDestEnd = L'\0';
3100  }
3101  }
3102 
3104  {
3105  if (cchDest > 0)
3106  {
3107  pszDestEnd = pszDest;
3108  cchRemaining = cchDest;
3109  *pszDestEnd = L'\0';
3110  }
3111  }
3112  }
3113  }
3114 
3116  {
3117  if (ppszDestEnd)
3118  *ppszDestEnd = pszDestEnd;
3119 
3120  if (pcchRemaining)
3121  *pcchRemaining = cchRemaining;
3122  }
3123 
3124  return Status;
3125 }
#define STRSAFE_FILL_BEHIND
Definition: ntstrsafe.h:48
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTRSAFEAPI RtlpArrayVPrintfWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, size_t *pcchDestNewLen, va_list argList)
Definition: ntstrsafe.h:2830
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39

Referenced by RtlStringVPrintfExWorkerW(), and RtlUnicodeStringPrintfEx().

◆ RtlpStringVPrintfWorkerW()

NTSTRSAFEAPI RtlpStringVPrintfWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszFormat,
size_t pcchDestNewLen,
va_list  argList 
)

Definition at line 2853 of file ntstrsafe.h.

2859 {
2861  size_t cchMax = cchDest - 1;
2862  int iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList);
2863 
2864  if ((iRet < 0) || (((size_t)iRet) > cchMax))
2865  {
2866  pszDest += cchMax;
2867  *pszDest = L'\0';
2869  }
2870  else if (((size_t)iRet) == cchMax)
2871  {
2872  pszDest += cchMax;
2873  *pszDest = L'\0';
2874  }
2875 
2876  if (pcchDestNewLen)
2877  *pcchDestNewLen = (iRet == -1) ? cchDest : iRet;
2878 
2879  return Status;
2880 }
LONG NTSTATUS
Definition: precomp.h:26
UINT cchMax
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by RtlStringVPrintfWorkerW().

◆ RtlpUnicodeStringValidate()

NTSTRSAFEAPI RtlpUnicodeStringValidate ( _In_opt_ PCUNICODE_STRING  SourceString,
_In_ STRSAFE_DWORD  dwFlags 
)

Definition at line 3199 of file ntstrsafe.h.

3202 {
3203  if (SourceString)
3204  {
3205  if (SourceString->Length % sizeof(WCHAR) != 0 ||
3206  SourceString->MaximumLength % sizeof(WCHAR) != 0 ||
3210  {
3211  return STATUS_INVALID_PARAMETER;
3212  }
3213  }
3214  else
3215  {
3216  if (!(dwFlags & STRSAFE_IGNORE_NULLS))
3217  return STATUS_INVALID_PARAMETER;
3218  }
3219 
3220  return STATUS_SUCCESS;
3221 }
#define NTSTRSAFE_UNICODE_STRING_MAX_CCH
Definition: ntstrsafe.h:27
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned short Length
Definition: sprintf.c:451
void * Buffer
Definition: sprintf.c:453
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
return STATUS_SUCCESS
Definition: btrfs.c:3014
unsigned short MaximumLength
Definition: sprintf.c:452

Referenced by RtlUnicodeStringValidate(), and RtlUnicodeStringValidateEx().

◆ RtlStringCatExWorkerA()

NTSTRSAFEAPI RtlStringCatExWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 2311 of file ntstrsafe.h.

2319 {
2321  STRSAFE_LPSTR pszDestEnd = pszDest;
2322  size_t cchRemaining = 0;
2323 
2324  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2325  {
2327  }
2328  else
2329  {
2330  size_t cchDestLength;
2332  {
2333  if (!pszDest)
2334  {
2335  if ((cchDest == 0) && (cbDest == 0))
2336  cchDestLength = 0;
2337  else
2339  }
2340  else
2341  {
2342  Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
2343  if (NT_SUCCESS(Status))
2344  {
2345  pszDestEnd = pszDest + cchDestLength;
2346  cchRemaining = cchDest - cchDestLength;
2347  }
2348  }
2349 
2350  if (!pszSrc)
2351  pszSrc = "";
2352  }
2353  else
2354  {
2355  Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
2356  if (NT_SUCCESS(Status))
2357  {
2358  pszDestEnd = pszDest + cchDestLength;
2359  cchRemaining = cchDest - cchDestLength;
2360  }
2361  }
2362 
2363  if (NT_SUCCESS(Status))
2364  {
2365  if (cchDest == 0)
2366  {
2367  if (*pszSrc != '\0')
2368  {
2369  if (!pszDest)
2371  else
2373  }
2374  }
2375  else
2376  {
2377  Status = RtlStringCopyExWorkerA(pszDestEnd, cchRemaining, (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)), pszSrc, &pszDestEnd, &cchRemaining, dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
2378  }
2379  }
2380  }
2381 
2382  if (!NT_SUCCESS(Status))
2383  {
2384  if (pszDest)
2385  {
2387  {
2388  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2390  {
2391  pszDestEnd = pszDest;
2392  cchRemaining = cchDest;
2393  }
2394  else if (cchDest > 0)
2395  {
2396  pszDestEnd = pszDest + cchDest - 1;
2397  cchRemaining = 1;
2398  *pszDestEnd = '\0';
2399  }
2400  }
2401 
2402  if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
2403  {
2404  pszDestEnd = pszDest;
2405  cchRemaining = cchDest;
2406  *pszDestEnd = '\0';
2407  }
2408  }
2409  }
2410 
2412  {
2413  if (ppszDestEnd)
2414  *ppszDestEnd = pszDestEnd;
2415 
2416  if (pcchRemaining)
2417  *pcchRemaining = cchRemaining;
2418  }
2419 
2420  return Status;
2421 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:3335
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:51
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:3321

◆ RtlStringCatExWorkerW()

NTSTRSAFEAPI RtlStringCatExWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 2423 of file ntstrsafe.h.

2431 {
2433  STRSAFE_LPWSTR pszDestEnd = pszDest;
2434  size_t cchRemaining = 0;
2435 
2436  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2437  {
2439  }
2440  else
2441  {
2442  size_t cchDestLength;
2444  {
2445  if (!pszDest)
2446  {
2447  if ((cchDest == 0) && (cbDest == 0))
2448  cchDestLength = 0;
2449  else
2451  }
2452  else
2453  {
2454  Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
2455  if (NT_SUCCESS(Status))
2456  {
2457  pszDestEnd = pszDest + cchDestLength;
2458  cchRemaining = cchDest - cchDestLength;
2459  }
2460  }
2461 
2462  if (!pszSrc)
2463  pszSrc = L"";
2464  }
2465  else
2466  {
2467  Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
2468  if (NT_SUCCESS(Status))
2469  {
2470  pszDestEnd = pszDest + cchDestLength;
2471  cchRemaining = cchDest - cchDestLength;
2472  }
2473  }
2474 
2475  if (NT_SUCCESS(Status))
2476  {
2477  if (cchDest == 0)
2478  {
2479  if (*pszSrc != L'\0')
2480  {
2481  if (!pszDest)
2483  else
2485  }
2486  }
2487  else
2488  {
2489  Status = RtlStringCopyExWorkerW(pszDestEnd, cchRemaining, (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), pszSrc, &pszDestEnd, &cchRemaining, dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
2490  }
2491  }
2492  }
2493 
2494  if (!NT_SUCCESS(Status))
2495  {
2496  if (pszDest)
2497  {
2499  {
2500  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2502  {
2503  pszDestEnd = pszDest;
2504  cchRemaining = cchDest;
2505  }
2506  else if (cchDest > 0)
2507  {
2508  pszDestEnd = pszDest + cchDest - 1;
2509  cchRemaining = 1;
2510  *pszDestEnd = L'\0';
2511  }
2512  }
2513 
2514  if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
2515  {
2516  pszDestEnd = pszDest;
2517  cchRemaining = cchDest;
2518  *pszDestEnd = L'\0';
2519  }
2520  }
2521  }
2522 
2524  {
2525  if (ppszDestEnd)
2526  *ppszDestEnd = pszDestEnd;
2527  if (pcchRemaining)
2528  *pcchRemaining = cchRemaining;
2529  }
2530 
2531  return Status;
2532 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:3336
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:3322
#define memset(x, y, z)
Definition: compat.h:39

◆ RtlStringCatNExWorkerA()

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 
)

Definition at line 2562 of file ntstrsafe.h.

2571 {
2573  STRSAFE_LPSTR pszDestEnd = pszDest;
2574  size_t cchRemaining = 0;
2575  size_t cchDestLength = 0;
2576 
2577  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2578  {
2580  }
2581  else if (cchToAppend > NTSTRSAFE_MAX_CCH)
2582  {
2584  }
2585  else
2586  {
2588  {
2589  if (!pszDest)
2590  {
2591  if ((cchDest == 0) && (cbDest == 0))
2592  cchDestLength = 0;
2593  else
2595  }
2596  else
2597  {
2598  Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
2599  if (NT_SUCCESS(Status))
2600  {
2601  pszDestEnd = pszDest + cchDestLength;
2602  cchRemaining = cchDest - cchDestLength;
2603  }
2604  }
2605 
2606  if (!pszSrc)
2607  pszSrc = "";
2608  }
2609  else
2610  {
2611  Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
2612  if (NT_SUCCESS(Status))
2613  {
2614  pszDestEnd = pszDest + cchDestLength;
2615  cchRemaining = cchDest - cchDestLength;
2616  }
2617  }
2618 
2619  if (NT_SUCCESS(Status))
2620  {
2621  if (cchDest == 0)
2622  {
2623  if ((cchToAppend != 0) && (*pszSrc != '\0'))
2624  {
2625  if (!pszDest)
2627  else
2629  }
2630  }
2631  else
2632  {
2633  Status = RtlStringCopyNExWorkerA(pszDestEnd, cchRemaining, (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)), pszSrc, cchToAppend, &pszDestEnd, &cchRemaining, dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
2634  }
2635  }
2636  }
2637 
2638  if (!NT_SUCCESS(Status))
2639  {
2640  if (pszDest)
2641  {
2643  {
2644  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2646  {
2647  pszDestEnd = pszDest;
2648  cchRemaining = cchDest;
2649  }
2650  else if (cchDest > 0)
2651  {
2652  pszDestEnd = pszDest + cchDest - 1;
2653  cchRemaining = 1;
2654  *pszDestEnd = '\0';
2655  }
2656  }
2657 
2658  if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
2659  {
2660  pszDestEnd = pszDest;
2661  cchRemaining = cchDest;
2662  *pszDestEnd = '\0';
2663  }
2664  }
2665  }
2666 
2668  {
2669  if (ppszDestEnd)
2670  *ppszDestEnd = pszDestEnd;
2671 
2672  if (pcchRemaining)
2673  *pcchRemaining = cchRemaining;
2674  }
2675 
2676  return Status;
2677 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:3335
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:51
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)
Definition: ntstrsafe.h:2034

◆ RtlStringCatNExWorkerW()

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 
)

Definition at line 2679 of file ntstrsafe.h.

2688 {
2690  STRSAFE_LPWSTR pszDestEnd = pszDest;
2691  size_t cchRemaining = 0;
2692  size_t cchDestLength = 0;
2693 
2694  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2695  {
2697  }
2698  else if (cchToAppend > NTSTRSAFE_MAX_CCH)
2699  {
2701  }
2702  else
2703  {
2705  {
2706  if (!pszDest)
2707  {
2708  if ((cchDest == 0) && (cbDest == 0))
2709  cchDestLength = 0;
2710  else
2712  }
2713  else
2714  {
2715  Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
2716  if (NT_SUCCESS(Status))
2717  {
2718  pszDestEnd = pszDest + cchDestLength;
2719  cchRemaining = cchDest - cchDestLength;
2720  }
2721  }
2722 
2723  if (!pszSrc)
2724  pszSrc = L"";
2725  }
2726  else
2727  {
2728  Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
2729  if (NT_SUCCESS(Status))
2730  {
2731  pszDestEnd = pszDest + cchDestLength;
2732  cchRemaining = cchDest - cchDestLength;
2733  }
2734  }
2735 
2736  if (NT_SUCCESS(Status))
2737  {
2738  if (cchDest == 0)
2739  {
2740  if ((cchToAppend != 0) && (*pszSrc != L'\0'))
2741  {
2742  if (!pszDest)
2744  else
2746  }
2747  }
2748  else
2749  {
2750  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)));
2751  }
2752  }
2753  }
2754 
2755  if (!NT_SUCCESS(Status))
2756  {
2757  if (pszDest)
2758  {
2760  {
2761  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2762 
2764  {
2765  pszDestEnd = pszDest;
2766  cchRemaining = cchDest;
2767  }
2768  else if (cchDest > 0)
2769  {
2770  pszDestEnd = pszDest + cchDest - 1;
2771  cchRemaining = 1;
2772  *pszDestEnd = L'\0';
2773  }
2774  }
2775 
2776  if ((dwFlags & STRSAFE_NULL_ON_FAILURE) && cchDest > 0)
2777  {
2778  pszDestEnd = pszDest;
2779  cchRemaining = cchDest;
2780  *pszDestEnd = L'\0';
2781  }
2782  }
2783  }
2784 
2786  {
2787  if (ppszDestEnd)
2788  *ppszDestEnd = pszDestEnd;
2789 
2790  if (pcchRemaining)
2791  *pcchRemaining = cchRemaining;
2792  }
2793 
2794  return Status;
2795 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:3336
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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)
Definition: ntstrsafe.h:2160
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39

◆ RtlStringCatNWorkerA()

NTSTRSAFEAPI RtlStringCatNWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToAppend 
)

Definition at line 2534 of file ntstrsafe.h.

2539 {
2540  size_t cchDestLength;
2541  NTSTATUS Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
2542  if (NT_SUCCESS(Status))
2543  Status = RtlStringCopyNWorkerA(pszDest + cchDestLength, cchDest - cchDestLength, pszSrc, cchToAppend);
2544 
2545  return Status;
2546 }
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:3335
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1968

◆ RtlStringCatNWorkerW()

NTSTRSAFEAPI RtlStringCatNWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToAppend 
)

Definition at line 2548 of file ntstrsafe.h.

2553 {
2554  size_t cchDestLength;
2555  NTSTATUS Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
2556  if (NT_SUCCESS(Status))
2557  Status = RtlStringCopyNWorkerW(pszDest + cchDestLength, cchDest - cchDestLength, pszSrc, cchToAppend);
2558 
2559  return Status;
2560 }
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:3336
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:2001

◆ RtlStringCatWorkerA()

NTSTRSAFEAPI RtlStringCatWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 2285 of file ntstrsafe.h.

2289 {
2290  size_t cchDestLength;
2291  NTSTATUS Status = RtlStringLengthWorkerA(pszDest, cchDest, &cchDestLength);
2292  if (NT_SUCCESS(Status))
2293  Status = RtlStringCopyWorkerA(pszDest + cchDestLength, cchDest - cchDestLength, pszSrc);
2294 
2295  return Status;
2296 }
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:3335
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:3319
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

◆ RtlStringCatWorkerW()

NTSTRSAFEAPI RtlStringCatWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 2298 of file ntstrsafe.h.

2302 {
2303  size_t cchDestLength;
2304  NTSTATUS Status = RtlStringLengthWorkerW(pszDest, cchDest, &cchDestLength);
2305  if (NT_SUCCESS(Status))
2306  Status = RtlStringCopyWorkerW(pszDest + cchDestLength, cchDest - cchDestLength, pszSrc);
2307 
2308  return Status;
2309 }
#define RtlStringCopyWorkerW
Definition: ntstrsafe.h:3320
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:3336
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

◆ RtlStringCbCatA()

NTSTRSAFEAPI RtlStringCbCatA ( _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cbDest,
_In_ NTSTRSAFE_PCSTR  pszSrc 
)

Definition at line 625 of file ntstrsafe.h.

629 {
630  if (cbDest > NTSTRSAFE_MAX_CCH)
632  return RtlStringCatWorkerA(pszDest, cbDest, pszSrc);
633 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatWorkerA
Definition: ntstrsafe.h:3323
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by FsOpenFile(), InitOperatingSystemList(), LoadAndBootWindows(), LoadModule(), LoadReactOSSetup(), LoadWindowsCore(), SetupLdrInitErrataInf(), WinLdrInitializePhase1(), WinLdrInitSystemHive(), WinLdrLoadNLSData(), WinLdrLoadSystemHive(), and WinLdrScanSystemHive().

◆ RtlStringCbCatExA()

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 
)

Definition at line 718 of file ntstrsafe.h.

725 {
727  size_t cchRemaining = 0;
728 
729  if (cbDest > NTSTRSAFE_MAX_CCH)
731  else
732  Status = RtlStringCatExWorkerA(pszDest, cbDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags);
733 
734  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
735  *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
736 
737  return Status;
738 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned char
Definition: typeof.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCatExWorkerA
Definition: ntstrsafe.h:3325

Referenced by ExpInitializeExecutive().

◆ RtlStringCbCatExW()

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 
)

Definition at line 741 of file ntstrsafe.h.

748 {
750  size_t cchDest = cbDest / sizeof(wchar_t);
751  size_t cchRemaining = 0;
752 
753  if (cchDest > NTSTRSAFE_MAX_CCH)
755  else
756  Status = RtlStringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags);
757 
758  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
759  *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
760 
761  return Status;
762 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RtlStringCatExWorkerW
Definition: ntstrsafe.h:3326
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbCatNA()

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 
)

Definition at line 819 of file ntstrsafe.h.

824 {
825  if (cbDest > NTSTRSAFE_MAX_CCH)
827 
828  return RtlStringCatNWorkerA(pszDest, cbDest, pszSrc, cbToAppend);
829 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerA
Definition: ntstrsafe.h:3327
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by LoadWindowsCore().

◆ RtlStringCbCatNExA()

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 
)

Definition at line 920 of file ntstrsafe.h.

928 {
930  size_t cchRemaining = 0;
931 
932  if (cbDest > NTSTRSAFE_MAX_CCH)
934  else
935  Status = RtlStringCatNExWorkerA(pszDest, cbDest, cbDest, pszSrc, cbToAppend, ppszDestEnd, &cchRemaining, dwFlags);
936 
937  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
938  *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
939 
940  return Status;
941 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned char
Definition: typeof.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define RtlStringCatNExWorkerA
Definition: ntstrsafe.h:3329
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbCatNExW()

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 
)

Definition at line 944 of file ntstrsafe.h.

952 {
954  size_t cchDest = cbDest / sizeof(wchar_t);
955  size_t cchToAppend = cbToAppend / sizeof(wchar_t);
956  size_t cchRemaining = 0;
957 
958  if (cchDest > NTSTRSAFE_MAX_CCH)
960  else
961  Status = RtlStringCatNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchToAppend, ppszDestEnd, &cchRemaining, dwFlags);
962 
963  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
964  *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
965 
966  return Status;
967 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCatNExWorkerW
Definition: ntstrsafe.h:3330

◆ RtlStringCbCatNW()

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 
)

Definition at line 832 of file ntstrsafe.h.

837 {
838  size_t cchDest = cbDest / sizeof(wchar_t);
839  size_t cchToAppend = cbToAppend / sizeof(wchar_t);
840 
841  if (cchDest > NTSTRSAFE_MAX_CCH)
843 
844  return RtlStringCatNWorkerW(pszDest, cchDest, pszSrc, cchToAppend);
845 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerW
Definition: ntstrsafe.h:3328
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by ArcPathNormalize().

◆ RtlStringCbCatW()

NTSTRSAFEAPI RtlStringCbCatW ( _Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cbDest,
_In_ NTSTRSAFE_PCWSTR  pszSrc 
)

Definition at line 636 of file ntstrsafe.h.

640 {
641  size_t cchDest = cbDest / sizeof(wchar_t);
642 
643  if (cchDest > NTSTRSAFE_MAX_CCH)
645 
646  return RtlStringCatWorkerW(pszDest, cchDest, pszSrc);
647 }
#define RtlStringCatWorkerW
Definition: ntstrsafe.h:3324
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by ArcPathNormalize(), and UserLoadKbdFile().

◆ RtlStringCbCopyA()

NTSTRSAFEAPI RtlStringCbCopyA ( _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cbDest,
_In_ NTSTRSAFE_PCSTR  pszSrc 
)

Definition at line 156 of file ntstrsafe.h.

160 {
161  size_t cchDest = cbDest / sizeof(char);
162 
163  if (cchDest > NTSTRSAFE_MAX_CCH)
164  {
165  if (cchDest > 0)
166  *pszDest = '\0';
167 
169  }
170  return RtlStringCopyWorkerA(pszDest, cbDest, pszSrc);
171 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:3319
unsigned char
Definition: typeof.h:29
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by DiskGetBootPath(), FsOpenFile(), InitOperatingSystemList(), KdbpDoCommand(), KdbpReadCommand(), LoadAndBootWindows(), LoadModule(), LoadReactOSSetup(), LoadWindowsCore(), MiSnapThunk(), Phase1InitializationDiscard(), SetupLdrInitErrataInf(), WinLdrInitializePhase1(), WinLdrInitSystemHive(), WinLdrLoadDeviceDriver(), WinLdrLoadNLSData(), WinLdrLoadSystemHive(), and WinLdrScanSystemHive().

◆ RtlStringCbCopyExA()

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 
)

Definition at line 270 of file ntstrsafe.h.

277 {
279  size_t cchDest = cbDest / sizeof(char);
280  size_t cchRemaining = 0;
281 
282  if (cchDest > NTSTRSAFE_MAX_CCH)
283  {
284  if (cchDest > 0)
285  *pszDest = '\0';
286 
288  }
289 
290  Status = RtlStringCopyExWorkerA(pszDest, cbDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags);
292  {
293  if (pcbRemaining)
294  *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
295  }
296  return Status;
297 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned char
Definition: typeof.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:3321

Referenced by DriverIoControl(), and ExpInitializeExecutive().

◆ RtlStringCbCopyExW()

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 
)

Definition at line 300 of file ntstrsafe.h.

307 {
309  size_t cchDest = cbDest / sizeof(wchar_t);
310  size_t cchRemaining = 0;
311 
312  if (cchDest > NTSTRSAFE_MAX_CCH)
313  {
314  if (cchDest > 0)
315  *pszDest = L'\0';
316 
318  }
319 
320  Status = RtlStringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags);
322  {
323  if (pcbRemaining)
324  *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
325  }
326  return Status;
327 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:3322

◆ RtlStringCbCopyNA()

NTSTRSAFEAPI RtlStringCbCopyNA ( _Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cbDest,
_In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR  pszSrc,
_In_ size_t  cbToCopy 
)

Definition at line 395 of file ntstrsafe.h.

400 {
401  size_t cchDest = cbDest / sizeof(char);
402  size_t cchToCopy = cbToCopy / sizeof(char);
403 
404  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
405  {
406  if (cchDest > 0)
407  *pszDest = '\0';
408 
410  }
411 
412  return RtlStringCopyNWorkerA(pszDest, cchDest, pszSrc, cchToCopy);
413 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned char
Definition: typeof.h:29
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1968

Referenced by ArcGetNextTokenA(), CmdLineParse(), LoadWindowsCore(), RamDiskInitialize(), and WinLdrInitializePhase1().

◆ RtlStringCbCopyNExA() [1/2]

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 
)

◆ RtlStringCbCopyNExA() [2/2]

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 
)

Definition at line 519 of file ntstrsafe.h.

527 {
529  size_t cchRemaining = 0;
530 
531  if (cbDest > NTSTRSAFE_MAX_CCH)
532  {
533  if ((pszDest != NULL) && (cbDest > 0))
534  *pszDest = L'\0';
535 
537  }
538 
539  Status = RtlStringCopyNExWorkerA(pszDest, cbDest, cbDest, pszSrc, cbToCopy, ppszDestEnd, &cchRemaining, dwFlags);
540  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
541  *pcbRemaining = cchRemaining;
542 
543  return Status;
544 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
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)
Definition: ntstrsafe.h:2034

◆ RtlStringCbCopyNExW()

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 
)

Definition at line 547 of file ntstrsafe.h.

555 {
557  size_t cchDest = cbDest / sizeof(wchar_t);
558  size_t cchToCopy = cbToCopy / sizeof(wchar_t);
559  size_t cchRemaining = 0;
560 
561  if (cchDest > NTSTRSAFE_MAX_CCH)
562  {
563  if ((pszDest != NULL) && (cbDest > 0))
564  *pszDest = L'\0';
565 
567  }
568 
569  Status = RtlStringCopyNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchToCopy, ppszDestEnd, &cchRemaining, dwFlags);
570  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
571  *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
572 
573  return Status;
574 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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)
Definition: ntstrsafe.h:2160
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by NtUserGetMonitorInfo().

◆ RtlStringCbCopyNW()

NTSTRSAFEAPI RtlStringCbCopyNW ( _Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cbDest,
_In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR  pszSrc,
_In_ size_t  cbToCopy 
)

Definition at line 416 of file ntstrsafe.h.

421 {
422  size_t cchDest = cbDest / sizeof(wchar_t);
423  size_t cchToCopy = cbToCopy / sizeof(wchar_t);
424 
425  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
426  {
427  if (cchDest > 0)
428  *pszDest = L'\0';
429 
431  }
432 
433  return RtlStringCopyNWorkerW(pszDest, cchDest, pszSrc, cchToCopy);
434 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static const WCHAR L[]
Definition: oid.c:1250
NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:2001
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by AddPartitionToDisk(), ArcGetNextTokenU(), ArcPathNormalize(), CheckForValidPEAndVendor(), CopyDeviceFindData(), CopyFindData(), EngpRegisterGraphicsDevice(), GetFileSystemNameByHandle(), IntResolveDesktop(), and UserpShowInformationBalloon().

◆ RtlStringCbCopyW()

NTSTRSAFEAPI RtlStringCbCopyW ( _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cbDest,
_In_ NTSTRSAFE_PCWSTR  pszSrc 
)

Definition at line 174 of file ntstrsafe.h.

178 {
179  size_t cchDest = cbDest / sizeof(wchar_t);
180 
181  if (cchDest > NTSTRSAFE_MAX_CCH)
182  {
183  if (cchDest > 0)
184  *pszDest = '\0';
185 
187  }
188  return RtlStringCopyWorkerW(pszDest, cchDest, pszSrc);
189 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerW
Definition: ntstrsafe.h:3320
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by DefaultProcessEntry(), EngpPopulateDeviceModeList(), FontFamilyFillInfo(), GetFontFamilyInfoForList(), HDA_PDOQueryId(), InferFileSystemByHandle(), IntLoadFontsInRegistry(), IntResolveDesktop(), JapaneseEra_Load(), KspStartBusDevice(), NLS_GetDateTimeFormatW(), PreparePartitionForFormatting(), ProcessLangEntry(), USBPORT_PdoPnP(), and UserEnumDisplayDevices().

◆ RtlStringCbLengthA()

Definition at line 1609 of file ntstrsafe.h.

1613 {
1614  NTSTATUS Status;
1615  size_t cchMax;
1616  size_t cchLength = 0;
1617  cchMax = cbMax / sizeof(char);
1618 
1619  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1621  else
1622  Status = RtlStringLengthWorkerA(psz, cchMax, &cchLength);
1623 
1624  if (pcbLength)
1625  {
1626  if (NT_SUCCESS(Status))
1627  {
1628  *pcbLength = cchLength * sizeof(char);
1629  }
1630  else
1631  {
1632  *pcbLength = 0;
1633  }
1634  }
1635 
1636  return Status;
1637 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:3335
unsigned char
Definition: typeof.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbLengthW()

Definition at line 1641 of file ntstrsafe.h.

1645 {
1646  NTSTATUS Status;
1647  size_t cchMax;
1648  size_t cchLength = 0;
1649  cchMax = cbMax / sizeof(wchar_t);
1650 
1651  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1653  else
1654  Status = RtlStringLengthWorkerW(psz, cchMax, &cchLength);
1655 
1656  if (pcbLength)
1657  {
1658  if (NT_SUCCESS(Status))
1659  {
1660  *pcbLength = cchLength * sizeof(wchar_t);
1661  }
1662  else
1663  {
1664  *pcbLength = 0;
1665  }
1666  }
1667 
1668  return Status;
1669 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:3336
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbPrintfA()

NTSTRSAFEVAPI RtlStringCbPrintfA ( _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cbDest,
_In_ _Printf_format_string_ NTSTRSAFE_PCSTR  pszFormat,
  ... 
)

Definition at line 1148 of file ntstrsafe.h.

1153 {
1154  NTSTATUS Status;
1155  va_list argList;
1156 
1157  if (cbDest > NTSTRSAFE_MAX_CCH)
1158  {
1159  if (cbDest > 0)
1160  *pszDest = '\0';
1161 
1162  return STATUS_INVALID_PARAMETER;
1163  }
1164 
1165  va_start(argList, pszFormat);
1166  Status = RtlStringVPrintfWorkerA(pszDest, cbDest, pszFormat, argList);
1167  va_end(argList);
1168 
1169  return Status;
1170 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
#define RtlStringVPrintfWorkerA
Definition: ntstrsafe.h:3331
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by check_backup_boot(), CheckFileSystemPage(), CreateFlopDeviceObject(), DetectBiosFloppyPeripheral(), DetectKeyboardPeripheral(), DetectSerialPorts(), DiskError(), DiskGetBootPath(), EditCustomBootReactOS(), ExpectRange(), ExpectRangeEntryList(), ExpInitializeExecutive(), ExpLoadBootSymbols(), HdlspDispatch(), InitOperatingSystemList(), LoadModule(), Phase1InitializationDiscard(), PropertyHandler_Private(), SpiScanDevice(), WinLdrInitErrataInf(), WinLdrLoadDeviceDriver(), and WinLdrScanRegistry().

◆ RtlStringCbPrintfExA()

NTSTRSAFEVAPI 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,
  ... 
)

Definition at line 1294 of file ntstrsafe.h.

1302 {
1303  NTSTATUS Status;
1304  size_t cchDest;
1305  size_t cchRemaining = 0;
1306 
1307  cchDest = cbDest / sizeof(char);
1308  if (cchDest > NTSTRSAFE_MAX_CCH)
1309  {
1310  if (cchDest > 0)
1311  *pszDest = '\0';
1312 
1313  return STATUS_INVALID_PARAMETER;
1314  }
1315 
1316  {
1317  va_list argList;
1318  va_start(argList, pszFormat);
1319  Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
1320  va_end(argList);
1321  }
1322 
1324  {
1325  if (pcbRemaining)
1326  {
1327  *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
1328  }
1329  }
1330 
1331  return Status;
1332 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:3333
unsigned char
Definition: typeof.h:29
char * va_list
Definition: acmsvcex.h:78
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by Phase1InitializationDiscard().

◆ RtlStringCbPrintfExW()

NTSTRSAFEVAPI 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,
  ... 
)

Definition at line 1335 of file ntstrsafe.h.

1343 {
1344  NTSTATUS Status;
1345  size_t cchDest;
1346  size_t cchRemaining = 0;
1347  cchDest = cbDest / sizeof(wchar_t);
1348 
1349  if (cchDest > NTSTRSAFE_MAX_CCH)
1350  {
1351  if (cchDest > 0)
1352  *pszDest = L'\0';
1353 
1354  return STATUS_INVALID_PARAMETER;
1355  }
1356 
1357  {
1358  va_list argList;
1359  va_start(argList, pszFormat);
1360  Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
1361  va_end(argList);
1362  }
1363 
1365  {
1366  if (pcbRemaining)
1367  {
1368  *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
1369  }
1370  }
1371  return Status;
1372 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:3334
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by GetSystemVersionString(), IsaFdoCreateDeviceIDs(), USBH_PdoQueryId(), USBPORT_GetDeviceHwIds(), and UserpFormatMessages().

◆ RtlStringCbPrintfW()

NTSTRSAFEVAPI RtlStringCbPrintfW ( _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cbDest,
_In_ _Printf_format_string_ NTSTRSAFE_PCWSTR  pszFormat,
  ... 
)

Definition at line 1173 of file ntstrsafe.h.

1178 {
1179  NTSTATUS Status;
1180  va_list argList;
1181  size_t cchDest = cbDest / sizeof(wchar_t);
1182 
1183  if (cchDest > NTSTRSAFE_MAX_CCH)
1184  {
1185  if (cchDest > 0)
1186  *pszDest = L'\0';
1187  return STATUS_INVALID_PARAMETER;
1188  }
1189 
1190  va_start(argList, pszFormat);
1191  Status = RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
1192  va_end(argList);
1193 
1194  return Status;
1195 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:3332
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by acpi_create_registry_table(), BuildUserModeWindowStationName(), ClasspLogSystemEventWithDeviceNumber(), CmpCreateControlSet(), CmpSetVersionData(), ConvertTickToDateTime(), DllMain(), EngpRegisterGraphicsDevice(), GetNextVolumeDevice(), GetSystemVersionString(), HDA_PDOQueryId(), IntLoadFontsInRegistry(), IntResolveDesktop(), IopGetParentIdPrefix(), ObtClose(), ObtCreateObjects(), ObtCreateObjectTypes(), ResolveArcNameManually(), ScsiFlopStartDevice(), USBH_CreateDevice(), USBPORT_AddDevice(), USBPORT_CreateLegacySymbolicLink(), USBPORT_CreatePdo(), USBPORT_PdoPnP(), UserCreateWinstaDirectory(), and UserpFormatMessages().

◆ RtlStringCbVPrintfA()

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 
)

Definition at line 1034 of file ntstrsafe.h.

1039 {
1040  if (cbDest > NTSTRSAFE_MAX_CCH)
1041  {
1042  if (cbDest > 0)
1043  *pszDest = '\0';
1044 
1045  return STATUS_INVALID_PARAMETER;
1046  }
1047 
1048  return RtlStringVPrintfWorkerA(pszDest, cbDest, pszFormat, argList);
1049 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerA
Definition: ntstrsafe.h:3331
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbVPrintfExA()

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 
)

Definition at line 1473 of file ntstrsafe.h.

1481 {
1482  NTSTATUS Status;
1483  size_t cchDest;
1484  size_t cchRemaining = 0;
1485  cchDest = cbDest / sizeof(char);
1486 
1487  if (cchDest > NTSTRSAFE_MAX_CCH)
1489  else
1490  Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
1491 
1493  {
1494  if (pcbRemaining)
1495  {
1496  *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
1497  }
1498  }
1499 
1500  return Status;
1501 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:3333
unsigned char
Definition: typeof.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbVPrintfExW()

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 
)

Definition at line 1504 of file ntstrsafe.h.

1512 {
1513  NTSTATUS Status;
1514  size_t cchDest;
1515  size_t cchRemaining = 0;
1516  cchDest = cbDest / sizeof(wchar_t);
1517 
1518  if (cchDest > NTSTRSAFE_MAX_CCH)
1520  else
1521  Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
1522 
1524  {
1525  if (pcbRemaining)
1526  {
1527  *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
1528  }
1529  }
1530 
1531  return Status;
1532 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:3334
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCbVPrintfW()

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 
)

Definition at line 1052 of file ntstrsafe.h.

1057 {
1058  size_t cchDest = cbDest / sizeof(wchar_t);
1059 
1060  if (cchDest > NTSTRSAFE_MAX_CCH)
1061  {
1062  if (cchDest > 0)
1063  *pszDest = L'\0';
1064  return STATUS_INVALID_PARAMETER;
1065  }
1066 
1067  return RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
1068 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:3332
static const WCHAR L[]
Definition: oid.c:1250
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCatA()

NTSTRSAFEAPI RtlStringCchCatA ( _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cchDest,
_In_ NTSTRSAFE_PCSTR  pszSrc 
)

Definition at line 589 of file ntstrsafe.h.

593 {
594  if (cchDest > NTSTRSAFE_MAX_CCH)
596 
597  return RtlStringCatWorkerA(pszDest, cchDest, pszSrc);
598 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatWorkerA
Definition: ntstrsafe.h:3323
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCatExA()

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 
)

Definition at line 668 of file ntstrsafe.h.

675 {
676  if (cchDest > NTSTRSAFE_MAX_CCH)
678 
679  return RtlStringCatExWorkerA(pszDest, cchDest, cchDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags);
680 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCatExWorkerA
Definition: ntstrsafe.h:3325

◆ RtlStringCchCatExW()

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 
)

Definition at line 683 of file ntstrsafe.h.

690 {
691  size_t cbDest = cchDest * sizeof(wchar_t);
692 
693  if (cchDest > NTSTRSAFE_MAX_CCH)
695 
696  return RtlStringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags);
697 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatExWorkerW
Definition: ntstrsafe.h:3326
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCatNA()

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 
)

Definition at line 779 of file ntstrsafe.h.

784 {
785  if (cchDest > NTSTRSAFE_MAX_CCH)
787 
788  return RtlStringCatNWorkerA(pszDest, cchDest, pszSrc, cchToAppend);
789 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerA
Definition: ntstrsafe.h:3327
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCatNExA()

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 
)

Definition at line 868 of file ntstrsafe.h.

876 {
877  if (cchDest > NTSTRSAFE_MAX_CCH)
879 
880  return RtlStringCatNExWorkerA(pszDest, cchDest, cchDest, pszSrc, cchToAppend, ppszDestEnd, pcchRemaining, dwFlags);
881 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RtlStringCatNExWorkerA
Definition: ntstrsafe.h:3329
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCatNExW()

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 
)

Definition at line 884 of file ntstrsafe.h.

892 {
893  if (cchDest > NTSTRSAFE_MAX_CCH)
895 
896  return RtlStringCatNExWorkerW(pszDest, cchDest, (cchDest * sizeof(wchar_t)), pszSrc, cchToAppend, ppszDestEnd, pcchRemaining, dwFlags);
897 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCatNExWorkerW
Definition: ntstrsafe.h:3330

◆ RtlStringCchCatNW()

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 
)

Definition at line 792 of file ntstrsafe.h.

797 {
798  if (cchDest > NTSTRSAFE_MAX_CCH)
800 
801  return RtlStringCatNWorkerW(pszDest, cchDest, pszSrc, cchToAppend);
802 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerW
Definition: ntstrsafe.h:3328
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCatW()

NTSTRSAFEAPI RtlStringCchCatW ( _Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cchDest,
_In_ NTSTRSAFE_PCWSTR  pszSrc 
)

Definition at line 601 of file ntstrsafe.h.

605 {
606  if (cchDest > NTSTRSAFE_MAX_CCH)
608 
609  return RtlStringCatWorkerW(pszDest, cchDest, pszSrc);
610 }
#define RtlStringCatWorkerW
Definition: ntstrsafe.h:3324
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by actctx_init(), AddBootStoreEntry(), ConcatPathsV(), GetSystemVersionString(), and RegCleanupRegistry().

◆ RtlStringCchCopyA()

NTSTRSAFEAPI RtlStringCchCopyA ( _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cchDest,
_In_ NTSTRSAFE_PCSTR  pszSrc 
)

Definition at line 110 of file ntstrsafe.h.

114 {
115  if (cchDest > NTSTRSAFE_MAX_CCH)
116  {
117  if (cchDest > 0)
118  *pszDest = '\0';
119 
121  }
122 
123  return RtlStringCopyWorkerA(pszDest, cchDest, pszSrc);
124 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:3319
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by DiskGenerateDeviceName(), GetPartTypeStringFromPartitionType(), and RtlIpv4AddressToStringExA().

◆ RtlStringCchCopyExA()

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 
)

Definition at line 210 of file ntstrsafe.h.

217 {
218  if (cchDest > NTSTRSAFE_MAX_CCH)
219  {
220  if (cchDest > 0)
221  *pszDest = '\0';
222 
224  }
225 
226  return RtlStringCopyExWorkerA(pszDest, cchDest, cchDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags);
227 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:3321

◆ RtlStringCchCopyExW()

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 
)

Definition at line 230 of file ntstrsafe.h.

237 {
238  size_t cbDest = cchDest * sizeof(wchar_t);
239 
240  if (cchDest > NTSTRSAFE_MAX_CCH)
241  {
242  if (cchDest > 0)
243  *pszDest = L'\0';
244 
246  }
247 
248  return RtlStringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags);
249 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:3322

◆ RtlStringCchCopyNA()

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 
)

Definition at line 345 of file ntstrsafe.h.

350 {
351  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
352  {
353  if (cchDest > 0)
354  *pszDest = '\0';
355 
357  }
358 
359  return RtlStringCopyNWorkerA(pszDest, cchDest, pszSrc, cchToCopy);
360 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1968

◆ RtlStringCchCopyNExA()

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 
)

Definition at line 457 of file ntstrsafe.h.

465 {
466  if (cchDest > NTSTRSAFE_MAX_CCH)
467  {
468  if (cchDest > 0)
469  *pszDest = '\0';
470 
472  }
473 
474  return RtlStringCopyNExWorkerA(pszDest, cchDest, cchDest, pszSrc, cchToCopy, ppszDestEnd, pcchRemaining, dwFlags);
475 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
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)
Definition: ntstrsafe.h:2034

◆ RtlStringCchCopyNExW()

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 
)

Definition at line 478 of file ntstrsafe.h.

486 {
487  if (cchDest > NTSTRSAFE_MAX_CCH)
488  {
489  if (cchDest > 0)
490  *pszDest = L'\0';
491 
493  }
494 
495  return RtlStringCopyNExWorkerW(pszDest, cchDest, cchDest * sizeof(wchar_t), pszSrc, cchToCopy, ppszDestEnd, pcchRemaining, dwFlags);
496 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
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)
Definition: ntstrsafe.h:2160
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchCopyNW()

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 
)

Definition at line 363 of file ntstrsafe.h.

368 {
369  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
370  {
371  if (cchDest > 0)
372  *pszDest = L'\0';
373 
375  }
376 
377  return RtlStringCopyNWorkerW(pszDest, cchDest, pszSrc, cchToCopy);
378 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static const WCHAR L[]
Definition: oid.c:1250
NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:2001
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by LoadAllocStringW().

◆ RtlStringCchCopyW()

◆ RtlStringCchLengthA()

_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 
)

Definition at line 1551 of file ntstrsafe.h.

1555 {
1556  NTSTATUS Status;
1557 
1558  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1560  else
1561  Status = RtlStringLengthWorkerA(psz, cchMax, pcchLength);
1562 
1563  if (!NT_SUCCESS(Status) && pcchLength)
1564  {
1565  *pcchLength = 0;
1566  }
1567 
1568  return Status;
1569 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:3335
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchLengthW()

_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 
)

Definition at line 1573 of file ntstrsafe.h.

1577 {
1578  NTSTATUS Status;
1579 
1580  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1582  else
1583  Status = RtlStringLengthWorkerW(psz, cchMax, pcchLength);
1584 
1585  if (!NT_SUCCESS(Status) && pcchLength)
1586  {
1587  *pcchLength = 0;
1588  }
1589 
1590  return Status;
1591 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:3336
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by IsValidComputerName().

◆ RtlStringCchPrintfA()

NTSTRSAFEVAPI RtlStringCchPrintfA ( _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cchDest,
_In_ _Printf_format_string_ NTSTRSAFE_PCSTR  pszFormat,
  ... 
)

Definition at line 1085 of file ntstrsafe.h.

1090 {
1091  NTSTATUS Status;
1092  va_list argList;
1093 
1094  if (cchDest > NTSTRSAFE_MAX_CCH)
1095  {
1096  if (cchDest > 0)
1097  *pszDest = '\0';
1098 
1099  return STATUS_INVALID_PARAMETER;
1100  }
1101 
1102  va_start(argList, pszFormat);
1103  Status = RtlStringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
1104  va_end(argList);
1105 
1106  return Status;
1107 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
#define RtlStringVPrintfWorkerA
Definition: ntstrsafe.h:3331
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by DiskGenerateDeviceName(), GetNTOSInstallationName(), GetSettingDescription(), ProgressTimeOutStringHandler(), and UpdateProgressPercentage().

◆ RtlStringCchPrintfExA()

NTSTRSAFEVAPI 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,
  ... 
)

Definition at line 1218 of file ntstrsafe.h.

1226 {
1227  NTSTATUS Status;
1228  va_list argList;
1229 
1230  if (cchDest > NTSTRSAFE_MAX_CCH)
1231  {
1232  if (cchDest > 0)
1233  *pszDest = '\0';
1234 
1235  return STATUS_INVALID_PARAMETER;
1236  }
1237 
1238  va_start(argList, pszFormat);
1239  Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cchDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
1240  va_end(argList);
1241 
1242  return Status;
1243 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:3333
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by RtlIpv4AddressToStringA(), and RtlIpv4AddressToStringExA().

◆ RtlStringCchPrintfExW()

NTSTRSAFEVAPI 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,
  ... 
)

Definition at line 1246 of file ntstrsafe.h.

1254 {
1255  NTSTATUS Status;
1256  size_t cbDest = cchDest * sizeof(wchar_t);
1257  va_list argList;
1258 
1259  if (cchDest > NTSTRSAFE_MAX_CCH)
1260  {
1261  if (cchDest > 0)
1262  *pszDest = L'\0';
1263  return STATUS_INVALID_PARAMETER;
1264  }
1265 
1266  va_start(argList, pszFormat);
1267  Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
1268  va_end(argList);
1269 
1270  return Status;
1271 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:3334
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by RtlIpv4AddressToStringExW(), RtlIpv4AddressToStringW(), RtlIpv6AddressToStringExW(), and RtlIpv6AddressToStringW().

◆ RtlStringCchPrintfW()

NTSTRSAFEVAPI RtlStringCchPrintfW ( _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cchDest,
_In_ _Printf_format_string_ NTSTRSAFE_PCWSTR  pszFormat,
  ... 
)

Definition at line 1110 of file ntstrsafe.h.

1115 {
1116  NTSTATUS Status;
1117  va_list argList;
1118 
1119  if (cchDest > NTSTRSAFE_MAX_CCH)
1120  {
1121  if (cchDest > 0)
1122  *pszDest = L'\0';
1123  return STATUS_INVALID_PARAMETER;
1124  }
1125 
1126  va_start(argList, pszFormat);
1127  Status = RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
1128  va_end(argList);
1129 
1130  return Status;
1131 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:3332
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

Referenced by AddDiskToList(), AddKbLayoutsToRegistry(), AddPartitionToDisk(), BootLoaderHarddiskMbrPage(), BootLoaderPage(), CheckFileSystemPage(), CheckForValidPEAndVendor(), CheckUnattendedSetup(), CreatePartitionList(), CreateRegistryFile(), DiskCreateFdo(), DiskCreateSymbolicLinks(), DiskDeleteSymbolicLinks(), DismountVolume(), EnumerateBiosDiskEntries(), EnumerateReactOSEntries(), FindNTOSInstallations(), FormatPartitionPage(), GetDisplayIdentifier(), GetDriverName(), GetSystemVersionString(), InitDestinationPaths(), InstallMbrBootCodeToDisk(), InstallSetupInfFile(), ProcessComputerFiles(), ProcessDisplayRegistry(), SelectPartitionPage(), SetBootStoreOptions(), SetMountedDeviceValue(), and WritePartitions().

◆ RtlStringCchVPrintfA()

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 
)

Definition at line 984 of file ntstrsafe.h.

989 {
990  if (cchDest > NTSTRSAFE_MAX_CCH)
991  {
992  if (cchDest > 0)
993  *pszDest = '\0';
994 
996  }
997 
998  return RtlStringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
999 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerA
Definition: ntstrsafe.h:3331
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchVPrintfExA()

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 
)

Definition at line 1395 of file ntstrsafe.h.

1403 {
1404  NTSTATUS Status;
1405 
1406  if (cchDest > NTSTRSAFE_MAX_CCH)
1407  {
1408  if (cchDest > 0)
1409  *pszDest = '\0';
1410 
1411  return STATUS_INVALID_PARAMETER;
1412  }
1413 
1414  {
1415  size_t cbDest;
1416  cbDest = cchDest * sizeof(char);
1417  Status = RtlStringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
1418  }
1419 
1420  return Status;
1421 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:3333
unsigned char
Definition: typeof.h:29
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchVPrintfExW()

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 
)

Definition at line 1424 of file ntstrsafe.h.

1432 {
1433  NTSTATUS Status;
1434 
1435  if (cchDest > NTSTRSAFE_MAX_CCH)
1436  {
1437  if (cchDest > 0)
1438  *pszDest = L'\0';
1439 
1440  return STATUS_INVALID_PARAMETER;
1441  }
1442 
1443  {
1444  size_t cbDest;
1445  cbDest = cchDest * sizeof(wchar_t);
1446  Status = RtlStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
1447  }
1448 
1449  return Status;
1450 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:3334
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCchVPrintfW()

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 
)

Definition at line 1002 of file ntstrsafe.h.

1007 {
1008  if (cchDest > NTSTRSAFE_MAX_CCH)
1009  {
1010  if (cchDest > 0)
1011  *pszDest = L'\0';
1012 
1013  return STATUS_INVALID_PARAMETER;
1014  }
1015 
1016  return RtlStringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
1017 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:3332
static const WCHAR L[]
Definition: oid.c:1250
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23

◆ RtlStringCopyExWorkerA()

NTSTRSAFEAPI RtlStringCopyExWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 1733 of file ntstrsafe.h.

1741 {
1743  STRSAFE_LPSTR pszDestEnd = pszDest;
1744  size_t cchRemaining = 0;
1745 
1746  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1747  {
1749  }
1750  else
1751  {
1753  {
1754  if (!pszDest)
1755  {
1756  if ((cchDest != 0) || (cbDest != 0))
1758  }
1759 
1760  if (!pszSrc)
1761  pszSrc = "";
1762  }
1763 
1764  if (NT_SUCCESS(Status))
1765  {
1766  if (cchDest == 0)
1767  {
1768  pszDestEnd = pszDest;
1769  cchRemaining = 0;
1770 
1771  if (*pszSrc != '\0')
1772  {
1773  if (!pszDest)
1775  else
1777  }
1778  }
1779  else
1780  {
1781  pszDestEnd = pszDest;
1782  cchRemaining = cchDest;
1783 
1784  while (cchRemaining && (*pszSrc != '\0'))
1785  {
1786  *pszDestEnd++ = *pszSrc++;
1787  cchRemaining--;
1788  }
1789 
1790  if (cchRemaining > 0)
1791  {
1793  {
1794  memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
1795  }
1796  }
1797  else
1798  {
1799  pszDestEnd--;
1800  cchRemaining++;
1802  }
1803 
1804  *pszDestEnd = '\0';
1805  }
1806  }
1807  }
1808 
1809  if (!NT_SUCCESS(Status))
1810  {
1811  if (pszDest)
1812  {
1814  {
1815  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
1817  {
1818  pszDestEnd = pszDest;
1819  cchRemaining = cchDest;
1820  }
1821  else if (cchDest > 0)
1822  {
1823  pszDestEnd = pszDest + cchDest - 1;
1824  cchRemaining = 1;
1825  *pszDestEnd = '\0';
1826  }
1827  }
1828 
1829  if ((dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) && cchDest > 0)
1830  {
1831  pszDestEnd = pszDest;
1832  cchRemaining = cchDest;
1833  *pszDestEnd = '\0';
1834  }
1835  }
1836  }
1837 
1839  {
1840  if (ppszDestEnd)
1841  *ppszDestEnd = pszDestEnd;
1842 
1843  if (pcchRemaining)
1844  *pcchRemaining = cchRemaining;
1845  }
1846 
1847  return Status;
1848 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:32
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:51

◆ RtlStringCopyExWorkerW()

NTSTRSAFEAPI RtlStringCopyExWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 1850 of file ntstrsafe.h.

1858 {
1860  STRSAFE_LPWSTR pszDestEnd = pszDest;
1861  size_t cchRemaining = 0;
1862 
1863  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1864  {
1866  }
1867  else
1868  {
1870  {
1871  if (!pszDest)
1872  {
1873  if ((cchDest != 0) || (cbDest != 0))
1875  }
1876 
1877  if (!pszSrc)
1878  pszSrc = L"";
1879  }
1880 
1881  if (NT_SUCCESS(Status))
1882  {
1883  if (cchDest == 0)
1884  {
1885  pszDestEnd = pszDest;
1886  cchRemaining = 0;
1887 
1888  if (*pszSrc != L'\0')
1889  {
1890  if (!pszDest)
1892  else
1894  }
1895  }
1896  else
1897  {
1898  pszDestEnd = pszDest;
1899  cchRemaining = cchDest;
1900 
1901  while (cchRemaining && (*pszSrc != L'\0'))
1902  {
1903  *pszDestEnd++ = *pszSrc++;
1904  cchRemaining--;
1905  }
1906 
1907  if (cchRemaining > 0)
1908  {
1910  {
1911  memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
1912  }
1913  }
1914  else
1915  {
1916  pszDestEnd--;
1917  cchRemaining++;
1919  }
1920 
1921  *pszDestEnd = L'\0';
1922  }
1923  }
1924  }
1925 
1926  if (!NT_SUCCESS(Status))
1927  {
1928  if (pszDest)
1929  {
1931  {
1932  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
1933 
1935  {
1936  pszDestEnd = pszDest;
1937  cchRemaining = cchDest;
1938  }
1939  else if (cchDest > 0)
1940  {
1941  pszDestEnd = pszDest + cchDest - 1;
1942  cchRemaining = 1;
1943  *pszDestEnd = L'\0';
1944  }
1945  }
1946 
1947  if ((dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) && cchDest > 0)
1948  {
1949  pszDestEnd = pszDest;
1950  cchRemaining = cchDest;
1951  *pszDestEnd = L'\0';
1952  }
1953  }
1954  }
1955 
1957  {
1958  if (ppszDestEnd)
1959  *ppszDestEnd = pszDestEnd;
1960 
1961  if (pcchRemaining)
1962  *pcchRemaining = cchRemaining;
1963  }
1964 
1965  return Status;
1966 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:32
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39

◆ RtlStringCopyNExWorkerA()

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 
)

Definition at line 2034 of file ntstrsafe.h.

2043 {
2045  STRSAFE_LPSTR pszDestEnd = pszDest;
2046  size_t cchRemaining = 0;
2047 
2048  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2049  {
2051  }
2052  else if (cchToCopy > NTSTRSAFE_MAX_CCH)
2053  {
2055  }
2056  else
2057  {
2059  {
2060  if (!pszDest)
2061  {
2062  if ((cchDest != 0) || (cbDest != 0))
2064  }
2065 
2066  if (!pszSrc)
2067  pszSrc = "";
2068  }
2069 
2070  if (NT_SUCCESS(Status))
2071  {
2072  if (cchDest == 0)
2073  {
2074  pszDestEnd = pszDest;
2075  cchRemaining = 0;
2076 
2077  if ((cchToCopy != 0) && (*pszSrc != '\0'))
2078  {
2079  if (!pszDest)
2081  else
2083  }
2084  }
2085  else
2086  {
2087  pszDestEnd = pszDest;
2088  cchRemaining = cchDest;
2089 
2090  while (cchRemaining && cchToCopy && (*pszSrc != '\0'))
2091  {
2092  *pszDestEnd++ = *pszSrc++;
2093  cchRemaining--;
2094  cchToCopy--;
2095  }
2096 
2097  if (cchRemaining > 0)
2098  {
2100  {
2101  memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
2102  }
2103  }
2104  else
2105  {
2106  pszDestEnd--;
2107  cchRemaining++;
2109  }
2110 
2111  *pszDestEnd = '\0';
2112  }
2113  }
2114  }
2115 
2116  if (!NT_SUCCESS(Status))
2117  {
2118  if (pszDest)
2119  {
2121  {
2122  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2124  {
2125  pszDestEnd = pszDest;
2126  cchRemaining = cchDest;
2127  }
2128  else if (cchDest > 0)
2129  {
2130  pszDestEnd = pszDest + cchDest - 1;
2131  cchRemaining = 1;
2132  *pszDestEnd = '\0';
2133  }
2134  }
2135 
2137  {
2138  if (cchDest > 0)
2139  {
2140  pszDestEnd = pszDest;
2141  cchRemaining = cchDest;
2142  *pszDestEnd = '\0';
2143  }
2144  }
2145  }
2146  }
2147 
2149  {
2150  if (ppszDestEnd)
2151  *ppszDestEnd = pszDestEnd;
2152 
2153  if (pcchRemaining)
2154  *pcchRemaining = cchRemaining;
2155  }
2156 
2157  return Status;
2158 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:32
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:51

Referenced by RtlStringCatNExWorkerA(), RtlStringCbCopyNExA(), and RtlStringCchCopyNExA().

◆ RtlStringCopyNExWorkerW()

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 
)

Definition at line 2160 of file ntstrsafe.h.

2169 {
2171  STRSAFE_LPWSTR pszDestEnd = pszDest;
2172  size_t cchRemaining = 0;
2173 
2174  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2175  {
2177  }
2178  else if (cchToCopy > NTSTRSAFE_MAX_CCH)
2179  {
2181  }
2182  else
2183  {
2185  {
2186  if (!pszDest)
2187  {
2188  if ((cchDest != 0) || (cbDest != 0))
2190  }
2191 
2192  if (!pszSrc)
2193  pszSrc = L"";
2194  }
2195 
2196  if (NT_SUCCESS(Status))
2197  {
2198  if (cchDest == 0)
2199  {
2200  pszDestEnd = pszDest;
2201  cchRemaining = 0;
2202 
2203  if ((cchToCopy != 0) && (*pszSrc != L'\0'))
2204  {
2205  if (!pszDest)
2207  else
2209  }
2210  }
2211  else
2212  {
2213  pszDestEnd = pszDest;
2214  cchRemaining = cchDest;
2215 
2216  while (cchRemaining && cchToCopy && (*pszSrc != L'\0'))
2217  {
2218  *pszDestEnd++ = *pszSrc++;
2219  cchRemaining--;
2220  cchToCopy--;
2221  }
2222 
2223  if (cchRemaining > 0)
2224  {
2226  {
2227  memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
2228  }
2229  }
2230  else
2231  {
2232  pszDestEnd--;
2233  cchRemaining++;
2235  }
2236 
2237  *pszDestEnd = L'\0';
2238  }
2239  }
2240  }
2241 
2242  if (!NT_SUCCESS(Status))
2243  {
2244  if (pszDest)
2245  {
2247  {
2248  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2250  {
2251  pszDestEnd = pszDest;
2252  cchRemaining = cchDest;
2253  }
2254  else if (cchDest > 0)
2255  {
2256  pszDestEnd = pszDest + cchDest - 1;
2257  cchRemaining = 1;
2258  *pszDestEnd = L'\0';
2259  }
2260  }
2262  {
2263  if (cchDest > 0)
2264  {
2265  pszDestEnd = pszDest;
2266  cchRemaining = cchDest;
2267  *pszDestEnd = L'\0';
2268  }
2269  }
2270  }
2271  }
2272 
2274  {
2275  if (ppszDestEnd)
2276  *ppszDestEnd = pszDestEnd;
2277 
2278  if (pcchRemaining)
2279  *pcchRemaining = cchRemaining;
2280  }
2281 
2282  return Status;
2283 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:23
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:32
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39

Referenced by RtlStringCatNExWorkerW(), RtlStringCbCopyNExW(), and RtlStringCchCopyNExW().

◆ RtlStringCopyNWorkerA()

NTSTRSAFEAPI RtlStringCopyNWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 1968 of file ntstrsafe.h.

1973 {
1975 
1976  if (cchDest == 0)
1977  {
1979  }
1980  else
1981  {
1982  while (cchDest && cchSrc && (*pszSrc != '\0'))
1983  {
1984  *pszDest++ = *pszSrc++;
1985  cchDest--;
1986  cchSrc--;
1987  }
1988 
1989  if (cchDest == 0)
1990  {
1991  pszDest--;
1993  }
1994 
1995  *pszDest = '\0';
1996  }
1997 
1998  return Status;
1999 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by RtlStringCatNWorkerA(), RtlStringCbCopyNA(), and RtlStringCchCopyNA().

◆ RtlStringCopyNWorkerW()

NTSTRSAFEAPI RtlStringCopyNWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 2001 of file ntstrsafe.h.

2006 {
2008 
2009  if (cchDest == 0)
2010  {
2012  }
2013  else
2014  {
2015  while (cchDest && cchToCopy && (*pszSrc != L'\0'))
2016  {
2017  *pszDest++ = *pszSrc++;
2018  cchDest--;
2019  cchToCopy--;
2020  }
2021 
2022  if (cchDest == 0)
2023  {
2024  pszDest--;
2026  }
2027 
2028  *pszDest = L'\0';
2029  }
2030 
2031  return Status;
2032 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by RtlStringCatNWorkerW(), RtlStringCbCopyNW(), and RtlStringCchCopyNW().

◆ RtlStringCopyWorkerA()

NTSTRSAFEAPI RtlStringCopyWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 1671 of file ntstrsafe.h.

1675 {
1677 
1678  if (cchDest == 0)
1679  {
1681  }
1682  else
1683  {
1684  while (cchDest && (*pszSrc != '\0'))
1685  {
1686  *pszDest++ = *pszSrc++;
1687  cchDest--;
1688  }
1689 
1690  if (cchDest == 0)
1691  {
1692  pszDest--;
1694  }
1695 
1696  *pszDest = '\0';
1697  }
1698 
1699  return Status;
1700 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ RtlStringCopyWorkerW()

NTSTRSAFEAPI RtlStringCopyWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 1702 of file ntstrsafe.h.

1706 {
1708 
1709  if (cchDest == 0)
1710  {
1712  }
1713  else
1714  {
1715  while (cchDest && (*pszSrc != L'\0'))
1716  {
1717  *pszDest++ = *pszSrc++;
1718  cchDest--;
1719  }
1720 
1721  if (cchDest == 0)
1722  {
1723  pszDest--;
1725  }
1726 
1727  *pszDest = L'\0';
1728  }
1729 
1730  return Status;
1731 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ RtlStringLengthWorkerA()

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 
)

Definition at line 3141 of file ntstrsafe.h.

3145 {
3147  size_t cchMaxPrev = cchMax;
3148 
3149  while (cchMax && (*psz != '\0'))
3150  {
3151  psz++;
3152  cchMax--;
3153  }
3154 
3155  if (cchMax == 0)
3157 
3158  if (pcchLength)
3159  {
3160  if (NT_SUCCESS(Status))
3161  *pcchLength = cchMaxPrev - cchMax;
3162  else
3163  *pcchLength = 0;
3164  }
3165 
3166  return Status;
3167 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ RtlStringLengthWorkerW()

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 
)

Definition at line 3170 of file ntstrsafe.h.

3174 {
3176  size_t cchMaxPrev = cchMax;
3177 
3178  while (cchMax && (*psz != L'\0'))
3179  {
3180  psz++;
3181  cchMax--;
3182  }
3183 
3184  if (cchMax == 0)
3186 
3187  if (pcchLength)
3188  {
3189  if (NT_SUCCESS(Status))
3190  *pcchLength = cchMaxPrev - cchMax;
3191  else
3192  *pcchLength = 0;
3193  }
3194 
3195  return Status;
3196 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ RtlStringVPrintfExWorkerA()

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 
)

Definition at line 2894 of file ntstrsafe.h.

2903 {
2905  STRSAFE_LPSTR pszDestEnd = pszDest;
2906  size_t cchRemaining = 0;
2907 
2908  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2909  {
2911  }
2912  else
2913  {
2915  {
2916  if (!pszDest)
2917  {
2918  if ((cchDest != 0) || (cbDest != 0))
2920  }
2921 
2922  if (!pszFormat)
2923  pszFormat = "";
2924  }
2925  if (NT_SUCCESS(Status))
2926  {
2927  if (cchDest == 0)
2928  {
2929  pszDestEnd = pszDest;
2930  cchRemaining = 0;
2931 
2932  if (*pszFormat != '\0')
2933  {
2934  if (!pszDest)
2936  else
2938  }
2939  }
2940  else
2941  {
2942  int iRet;
2943  size_t cchMax;
2944  cchMax = cchDest - 1;
2945  iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
2946  if ((iRet < 0) || (((size_t)iRet) > cchMax))
2947  {
2948  pszDestEnd = pszDest + cchMax;
2949  cchRemaining = 1;
2950  *pszDestEnd = '\0';
2952  }
2953  else if (((size_t)iRet) == cchMax)
2954  {
2955  pszDestEnd = pszDest + cchMax;
2956  cchRemaining = 1;
2957  *pszDestEnd = '\0';
2958  }
2959  else if (((size_t)iRet) < cchMax)
2960  {
2961  pszDestEnd = pszDest + iRet;
2962  cchRemaining = cchDest - iRet;
2963 
2965  {
2966  memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
2967  }
2968  }
2969  }
2970  }
2971  }
2972 
2973  if (!NT_SUCCESS(Status))
2974  {
2975  if (pszDest)
2976  {
2978  {
2979  memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
2981  {
2982  pszDestEnd = pszDest;
2983  cchRemaining = cchDest;
2984  }
2985  else if (cchDest > 0)
2986  {
2987  pszDestEnd = pszDest + cchDest - 1;
2988  cchRemaining = 1;
2989  *pszDestEnd = '\0';
2990  }
2991  }
2992 
2994  {
2995  if (cchDest > 0)
2996  {
2997  pszDestEnd = pszDest;
2998  cchRemaining = cchDest;
2999  *pszDestEnd = '\0';
3000  }
3001  }
3002  }
3003  }
3004 
3006  {
3007  if (ppszDestEnd)
3008  *ppszDestEnd = pszDestEnd;
3009 
3010  if (pcchRemaining)
3011  *pcchRemaining = cchRemaining;
3012  }
3013 
3014  return Status;
3015 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:45
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:39
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cchMax
Status
Definition: gdiplustypes.h:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:31
#define _vsnprintf
Definition: xmlstorage.h:202
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:32
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:51

◆ RtlStringVPrintfExWorkerW()

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 
)

Definition at line 3127 of file ntstrsafe.h.

3136 {
3137  return RtlpStringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, NULL, argList);
3138 }
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, va_list argList)
Definition: ntstrsafe.h:3017
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ RtlStringVPrintfWorkerA()

NTSTRSAFEAPI RtlStringVPrintfWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszFormat,
va_list  argList 
)

Definition at line 2797 of file ntstrsafe.h.

2802 {
2804 
2805  if (cchDest == 0)
2806  {
2808  }
2809  else
2810  {
2811  size_t cchMax = cchDest - 1;
2812  int iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
2813 
2814  if ((iRet < 0) || (((