ReactOS  0.4.12-dev-712-ge6be187
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 C_ASSERT(e)   extern void __C_ASSERT__(int [(e)?1:-1])
 
#define _STRSAFE_EXTERN_C   extern
 
#define NTSTRSAFEAPI   static __inline NTSTATUS NTAPI
 
#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 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 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)
 
static __inline NTSTATUS RtlStringCchPrintfA (_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCchPrintfW (_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCbPrintfA (_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCbPrintfW (_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCchPrintfExA (_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd, _Out_opt_ size_t *pcchRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCchPrintfExW (_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PWSTR *ppszDestEnd, _Out_opt_ size_t *pcchRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCbPrintfExA (_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
 
static __inline NTSTATUS RtlStringCbPrintfExW (_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
 
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)
 

Macro Definition Documentation

◆ _STRSAFE_EXTERN_C

#define _STRSAFE_EXTERN_C   extern

Definition at line 29 of file ntstrsafe.h.

◆ C_ASSERT

#define C_ASSERT (   e)    extern void __C_ASSERT__(int [(e)?1:-1])

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 22 of file ntstrsafe.h.

◆ NTSTRSAFE_INLINE_API

#define NTSTRSAFE_INLINE_API   static __inline NTSTATUS NTAPI

Definition at line 33 of file ntstrsafe.h.

◆ NTSTRSAFE_MAX_CCH

#define NTSTRSAFE_MAX_CCH   2147483647

Definition at line 36 of file ntstrsafe.h.

◆ NTSTRSAFE_UNICODE_STRING_MAX_CCH

#define NTSTRSAFE_UNICODE_STRING_MAX_CCH   32767

Definition at line 40 of file ntstrsafe.h.

◆ NTSTRSAFEAPI

#define NTSTRSAFEAPI   static __inline NTSTATUS NTAPI

Definition at line 32 of file ntstrsafe.h.

◆ RtlStringCatExWorkerA

#define RtlStringCatExWorkerA   RtlStringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 2834 of file ntstrsafe.h.

◆ RtlStringCatExWorkerW

#define RtlStringCatExWorkerW   RtlStringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 2835 of file ntstrsafe.h.

◆ RtlStringCatNExWorkerA

#define RtlStringCatNExWorkerA   RtlStringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA;

Definition at line 2838 of file ntstrsafe.h.

◆ RtlStringCatNExWorkerW

#define RtlStringCatNExWorkerW   RtlStringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW;

Definition at line 2839 of file ntstrsafe.h.

◆ RtlStringCatNWorkerA

#define RtlStringCatNWorkerA   RtlStringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA;

Definition at line 2836 of file ntstrsafe.h.

◆ RtlStringCatNWorkerW

#define RtlStringCatNWorkerW   RtlStringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW;

Definition at line 2837 of file ntstrsafe.h.

◆ RtlStringCatWorkerA

#define RtlStringCatWorkerA   RtlStringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 2832 of file ntstrsafe.h.

◆ RtlStringCatWorkerW

#define RtlStringCatWorkerW   RtlStringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 2833 of file ntstrsafe.h.

◆ RtlStringCopyExWorkerA

#define RtlStringCopyExWorkerA   RtlStringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 2830 of file ntstrsafe.h.

◆ RtlStringCopyExWorkerW

#define RtlStringCopyExWorkerW   RtlStringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 2831 of file ntstrsafe.h.

◆ RtlStringCopyWorkerA

#define RtlStringCopyWorkerA   RtlStringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 2828 of file ntstrsafe.h.

◆ RtlStringCopyWorkerW

#define RtlStringCopyWorkerW   RtlStringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 2829 of file ntstrsafe.h.

◆ RtlStringLengthWorkerA

#define RtlStringLengthWorkerA   RtlStringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA;

Definition at line 2844 of file ntstrsafe.h.

◆ RtlStringLengthWorkerW

#define RtlStringLengthWorkerW   RtlStringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;

Definition at line 2845 of file ntstrsafe.h.

◆ RtlStringVPrintfExWorkerA

#define RtlStringVPrintfExWorkerA   RtlStringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;

Definition at line 2842 of file ntstrsafe.h.

◆ RtlStringVPrintfExWorkerW

#define RtlStringVPrintfExWorkerW   RtlStringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;

Definition at line 2843 of file ntstrsafe.h.

◆ RtlStringVPrintfWorkerA

#define RtlStringVPrintfWorkerA   RtlStringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;

Definition at line 2840 of file ntstrsafe.h.

◆ RtlStringVPrintfWorkerW

#define RtlStringVPrintfWorkerW   RtlStringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;

Definition at line 2841 of file ntstrsafe.h.

◆ STRSAFE_FAILURE_BYTE

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

Definition at line 56 of file ntstrsafe.h.

◆ STRSAFE_FILL_BEHIND_NULL

#define STRSAFE_FILL_BEHIND_NULL   0x00000200

Definition at line 45 of file ntstrsafe.h.

◆ STRSAFE_FILL_BYTE

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

Definition at line 55 of file ntstrsafe.h.

◆ STRSAFE_FILL_ON_FAILURE

#define STRSAFE_FILL_ON_FAILURE   0x00000400

Definition at line 46 of file ntstrsafe.h.

◆ STRSAFE_GET_FILL_PATTERN

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

Definition at line 58 of file ntstrsafe.h.

◆ STRSAFE_IGNORE_NULL_UNICODE_STRINGS

#define STRSAFE_IGNORE_NULL_UNICODE_STRINGS   0x00010000

Definition at line 49 of file ntstrsafe.h.

◆ STRSAFE_IGNORE_NULLS

#define STRSAFE_IGNORE_NULLS   0x00000100

Definition at line 44 of file ntstrsafe.h.

◆ STRSAFE_NO_TRUNCATION

#define STRSAFE_NO_TRUNCATION   0x00001000

Definition at line 48 of file ntstrsafe.h.

◆ STRSAFE_NULL_ON_FAILURE

#define STRSAFE_NULL_ON_FAILURE   0x00000800

Definition at line 47 of file ntstrsafe.h.

◆ STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED

#define STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED   0x00020000

Definition at line 50 of file ntstrsafe.h.

◆ STRSAFE_UNICODE_STRING_VALID_FLAGS

Definition at line 53 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 52 of file ntstrsafe.h.

Typedef Documentation

◆ NTSTRSAFE_PCSTR

Definition at line 67 of file ntstrsafe.h.

◆ NTSTRSAFE_PCWSTR

Definition at line 69 of file ntstrsafe.h.

◆ NTSTRSAFE_PSTR

Definition at line 66 of file ntstrsafe.h.

◆ NTSTRSAFE_PWSTR

Definition at line 68 of file ntstrsafe.h.

◆ STRSAFE_DWORD

Definition at line 71 of file ntstrsafe.h.

◆ STRSAFE_LPCSTR

Definition at line 62 of file ntstrsafe.h.

◆ STRSAFE_LPCWSTR

Definition at line 64 of file ntstrsafe.h.

◆ STRSAFE_LPSTR

typedef char* STRSAFE_LPSTR

Definition at line 61 of file ntstrsafe.h.

◆ STRSAFE_LPWSTR

Definition at line 63 of file ntstrsafe.h.

Function Documentation

◆ 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 2096 of file ntstrsafe.h.

2097 {
2099  STRSAFE_LPSTR pszDestEnd = pszDest;
2100  size_t cchRemaining = 0;
2101  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2103  else
2104  {
2105  size_t cchDestLength;
2107  {
2108  if (!pszDest)
2109  {
2110  if ((cchDest==0) && (cbDest==0))
2111  cchDestLength = 0;
2112  else
2114  }
2115  else
2116  {
2117  Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
2118  if (NT_SUCCESS(Status))
2119  {
2120  pszDestEnd = pszDest + cchDestLength;
2121  cchRemaining = cchDest - cchDestLength;
2122  }
2123  }
2124  if (!pszSrc)
2125  pszSrc = "";
2126  }
2127  else
2128  {
2129  Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
2130  if (NT_SUCCESS(Status))
2131  {
2132  pszDestEnd = pszDest + cchDestLength;
2133  cchRemaining = cchDest - cchDestLength;
2134  }
2135  }
2136  if (NT_SUCCESS(Status))
2137  {
2138  if (cchDest==0)
2139  {
2140  if (*pszSrc!='\0')
2141  {
2142  if (!pszDest)
2144  else
2146  }
2147  }
2148  else
2149  Status = RtlStringCopyExWorkerA(pszDestEnd,cchRemaining,(cchRemaining*sizeof(char)) + (cbDest % sizeof(char)),pszSrc,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
2150  }
2151  }
2152  if (!NT_SUCCESS(Status))
2153  {
2154  if (pszDest)
2155  {
2157  {
2158  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2160  {
2161  pszDestEnd = pszDest;
2162  cchRemaining = cchDest;
2163  }
2164  else
2165  if (cchDest > 0)
2166  {
2167  pszDestEnd = pszDest + cchDest - 1;
2168  cchRemaining = 1;
2169  *pszDestEnd = '\0';
2170  }
2171  }
2173  {
2174  if (cchDest > 0)
2175  {
2176  pszDestEnd = pszDest;
2177  cchRemaining = cchDest;
2178  *pszDestEnd = '\0';
2179  }
2180  }
2181  }
2182  }
2184  {
2185  if (ppszDestEnd)
2186  *ppszDestEnd = pszDestEnd;
2187  if (pcchRemaining)
2188  *pcchRemaining = cchRemaining;
2189  }
2190  return Status;
2191 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:2830

◆ 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 2193 of file ntstrsafe.h.

2194 {
2196  STRSAFE_LPWSTR pszDestEnd = pszDest;
2197  size_t cchRemaining = 0;
2198  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2200  else
2201  {
2202  size_t cchDestLength;
2204  {
2205  if (!pszDest)
2206  {
2207  if ((cchDest==0) && (cbDest==0))
2208  cchDestLength = 0;
2209  else
2211  }
2212  else
2213  {
2214  Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
2215  if (NT_SUCCESS(Status))
2216  {
2217  pszDestEnd = pszDest + cchDestLength;
2218  cchRemaining = cchDest - cchDestLength;
2219  }
2220  }
2221  if (!pszSrc)
2222  pszSrc = L"";
2223  }
2224  else
2225  {
2226  Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
2227  if (NT_SUCCESS(Status))
2228  {
2229  pszDestEnd = pszDest + cchDestLength;
2230  cchRemaining = cchDest - cchDestLength;
2231  }
2232  }
2233  if (NT_SUCCESS(Status))
2234  {
2235  if (cchDest==0)
2236  {
2237  if (*pszSrc!=L'\0')
2238  {
2239  if (!pszDest)
2241  else
2243  }
2244  }
2245  else
2246  Status = RtlStringCopyExWorkerW(pszDestEnd,cchRemaining,(cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)),pszSrc,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
2247  }
2248  }
2249  if (!NT_SUCCESS(Status))
2250  {
2251  if (pszDest)
2252  {
2254  {
2255  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2257  {
2258  pszDestEnd = pszDest;
2259  cchRemaining = cchDest;
2260  }
2261  else
2262  if (cchDest > 0)
2263  {
2264  pszDestEnd = pszDest + cchDest - 1;
2265  cchRemaining = 1;
2266  *pszDestEnd = L'\0';
2267  }
2268  }
2270  {
2271  if (cchDest > 0)
2272  {
2273  pszDestEnd = pszDest;
2274  cchRemaining = cchDest;
2275  *pszDestEnd = L'\0';
2276  }
2277  }
2278  }
2279  }
2281  {
2282  if (ppszDestEnd)
2283  *ppszDestEnd = pszDestEnd;
2284  if (pcchRemaining)
2285  *pcchRemaining = cchRemaining;
2286  }
2287  return Status;
2288 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:2831
#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 2310 of file ntstrsafe.h.

2311 {
2313  STRSAFE_LPSTR pszDestEnd = pszDest;
2314  size_t cchRemaining = 0;
2315  size_t cchDestLength = 0;
2316  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2318  else
2319  if (cchToAppend > NTSTRSAFE_MAX_CCH)
2321  else
2322  {
2324  {
2325  if (!pszDest)
2326  {
2327  if ((cchDest==0) && (cbDest==0))
2328  cchDestLength = 0;
2329  else
2331  }
2332  else
2333  {
2334  Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
2335  if (NT_SUCCESS(Status))
2336  {
2337  pszDestEnd = pszDest + cchDestLength;
2338  cchRemaining = cchDest - cchDestLength;
2339  }
2340  }
2341  if (!pszSrc)
2342  pszSrc = "";
2343  }
2344  else
2345  {
2346  Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
2347  if (NT_SUCCESS(Status))
2348  {
2349  pszDestEnd = pszDest + cchDestLength;
2350  cchRemaining = cchDest - cchDestLength;
2351  }
2352  }
2353  if (NT_SUCCESS(Status))
2354  {
2355  if (cchDest==0)
2356  {
2357  if ((cchToAppend!=0) && (*pszSrc!='\0'))
2358  {
2359  if (!pszDest)
2361  else
2363  }
2364  }
2365  else
2366  Status = RtlStringCopyNExWorkerA(pszDestEnd,cchRemaining,(cchRemaining*sizeof(char)) + (cbDest % sizeof(char)),pszSrc,cchToAppend,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
2367  }
2368  }
2369  if (!NT_SUCCESS(Status))
2370  {
2371  if (pszDest)
2372  {
2374  {
2375  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2377  {
2378  pszDestEnd = pszDest;
2379  cchRemaining = cchDest;
2380  }
2381  else
2382  if (cchDest > 0)
2383  {
2384  pszDestEnd = pszDest + cchDest - 1;
2385  cchRemaining = 1;
2386  *pszDestEnd = '\0';
2387  }
2388  }
2390  {
2391  if (cchDest > 0)
2392  {
2393  pszDestEnd = pszDest;
2394  cchRemaining = cchDest;
2395  *pszDestEnd = '\0';
2396  }
2397  }
2398  }
2399  }
2401  {
2402  if (ppszDestEnd)
2403  *ppszDestEnd = pszDestEnd;
2404  if (pcchRemaining)
2405  *pcchRemaining = cchRemaining;
2406  }
2407  return Status;
2408 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
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:1868

◆ 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 2410 of file ntstrsafe.h.

2411 {
2413  STRSAFE_LPWSTR pszDestEnd = pszDest;
2414  size_t cchRemaining = 0;
2415  size_t cchDestLength = 0;
2416  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2418  else
2419  if (cchToAppend > NTSTRSAFE_MAX_CCH)
2421  else
2422  {
2424  {
2425  if (!pszDest)
2426  {
2427  if ((cchDest==0) && (cbDest==0))
2428  cchDestLength = 0;
2429  else
2431  }
2432  else
2433  {
2434  Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
2435  if (NT_SUCCESS(Status))
2436  {
2437  pszDestEnd = pszDest + cchDestLength;
2438  cchRemaining = cchDest - cchDestLength;
2439  }
2440  }
2441  if (!pszSrc)
2442  pszSrc = L"";
2443  }
2444  else
2445  {
2446  Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
2447  if (NT_SUCCESS(Status))
2448  {
2449  pszDestEnd = pszDest + cchDestLength;
2450  cchRemaining = cchDest - cchDestLength;
2451  }
2452  }
2453  if (NT_SUCCESS(Status))
2454  {
2455  if (cchDest==0)
2456  {
2457  if ((cchToAppend!=0) && (*pszSrc!=L'\0'))
2458  {
2459  if (!pszDest)
2461  else
2463  }
2464  }
2465  else
2466  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)));
2467  }
2468  }
2469  if (!NT_SUCCESS(Status))
2470  {
2471  if (pszDest)
2472  {
2474  {
2475  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2477  {
2478  pszDestEnd = pszDest;
2479  cchRemaining = cchDest;
2480  }
2481  else
2482  if (cchDest > 0)
2483  {
2484  pszDestEnd = pszDest + cchDest - 1;
2485  cchRemaining = 1;
2486  *pszDestEnd = L'\0';
2487  }
2488  }
2490  {
2491  if (cchDest > 0)
2492  {
2493  pszDestEnd = pszDest;
2494  cchRemaining = cchDest;
2495  *pszDestEnd = L'\0';
2496  }
2497  }
2498  }
2499  }
2501  {
2502  if (ppszDestEnd)
2503  *ppszDestEnd = pszDestEnd;
2504  if (pcchRemaining)
2505  *pcchRemaining = cchRemaining;
2506  }
2507  return Status;
2508 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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:1972
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
return STATUS_SUCCESS
Definition: btrfs.c:2725
#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 2290 of file ntstrsafe.h.

2291 {
2292  NTSTATUS Status;
2293  size_t cchDestLength;
2294  Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
2295  if (NT_SUCCESS(Status))
2296  Status = RtlStringCopyNWorkerA(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc,cchToAppend);
2297  return Status;
2298 }
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1822

◆ RtlStringCatNWorkerW()

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

Definition at line 2300 of file ntstrsafe.h.

2301 {
2302  NTSTATUS Status;
2303  size_t cchDestLength;
2304  Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
2305  if (NT_SUCCESS(Status))
2306  Status = RtlStringCopyNWorkerW(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc,cchToAppend);
2307  return Status;
2308 }
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
NTSTRSAFEAPI RtlStringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1845

◆ RtlStringCatWorkerA()

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

Definition at line 2076 of file ntstrsafe.h.

2077 {
2078  NTSTATUS Status;
2079  size_t cchDestLength;
2080  Status = RtlStringLengthWorkerA(pszDest,cchDest,&cchDestLength);
2081  if (NT_SUCCESS(Status))
2082  Status = RtlStringCopyWorkerA(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc);
2083  return Status;
2084 }
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:2828
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24

◆ RtlStringCatWorkerW()

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

Definition at line 2086 of file ntstrsafe.h.

2087 {
2088  NTSTATUS Status;
2089  size_t cchDestLength;
2090  Status = RtlStringLengthWorkerW(pszDest,cchDest,&cchDestLength);
2091  if (NT_SUCCESS(Status))
2092  Status = RtlStringCopyWorkerW(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc);
2093  return Status;
2094 }
#define RtlStringCopyWorkerW
Definition: ntstrsafe.h:2829
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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 612 of file ntstrsafe.h.

616 {
617  if (cbDest > NTSTRSAFE_MAX_CCH)
619  return RtlStringCatWorkerA(pszDest,cbDest,pszSrc);
620 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatWorkerA
Definition: ntstrsafe.h:2832
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 700 of file ntstrsafe.h.

707 {
709  size_t cchRemaining = 0;
710  if (cbDest > NTSTRSAFE_MAX_CCH)
712  else
713  Status = RtlStringCatExWorkerA(pszDest,cbDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
714  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
715  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
716  return Status;
717 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned char
Definition: typeof.h:27
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCatExWorkerA
Definition: ntstrsafe.h:2834

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 720 of file ntstrsafe.h.

727 {
729  size_t cchDest = cbDest / sizeof(wchar_t);
730  size_t cchRemaining = 0;
731 
732  if (cchDest > NTSTRSAFE_MAX_CCH)
734  else
735  Status = RtlStringCatExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
736  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
737  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
738  return Status;
739 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#define RtlStringCatExWorkerW
Definition: ntstrsafe.h:2835
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 794 of file ntstrsafe.h.

799 {
800  if (cbDest > NTSTRSAFE_MAX_CCH)
802  return RtlStringCatNWorkerA(pszDest,cbDest,pszSrc,cbToAppend);
803 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerA
Definition: ntstrsafe.h:2836
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 891 of file ntstrsafe.h.

899 {
901  size_t cchRemaining = 0;
902  if (cbDest > NTSTRSAFE_MAX_CCH)
904  else
905  Status = RtlStringCatNExWorkerA(pszDest,cbDest,cbDest,pszSrc,cbToAppend,ppszDestEnd,&cchRemaining,dwFlags);
906  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
907  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
908  return Status;
909 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned char
Definition: typeof.h:27
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define RtlStringCatNExWorkerA
Definition: ntstrsafe.h:2838
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 912 of file ntstrsafe.h.

920 {
922  size_t cchDest = cbDest / sizeof(wchar_t);
923  size_t cchToAppend = cbToAppend / sizeof(wchar_t);
924  size_t cchRemaining = 0;
925  if (cchDest > NTSTRSAFE_MAX_CCH)
927  else
928  Status = RtlStringCatNExWorkerW(pszDest,cchDest,cbDest,pszSrc,cchToAppend,ppszDestEnd,&cchRemaining,dwFlags);
929  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
930  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
931  return Status;
932 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCatNExWorkerW
Definition: ntstrsafe.h:2839

◆ 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 806 of file ntstrsafe.h.

811 {
812  size_t cchDest = cbDest / sizeof(wchar_t);
813  size_t cchToAppend = cbToAppend / sizeof(wchar_t);
814 
815  if (cchDest > NTSTRSAFE_MAX_CCH)
817  return RtlStringCatNWorkerW(pszDest,cchDest,pszSrc,cchToAppend);
818 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerW
Definition: ntstrsafe.h:2837
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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 623 of file ntstrsafe.h.

627 {
628  size_t cchDest = cbDest / sizeof(wchar_t);
629  if (cchDest > NTSTRSAFE_MAX_CCH)
631  return RtlStringCatWorkerW(pszDest,cchDest,pszSrc);
632 }
#define RtlStringCatWorkerW
Definition: ntstrsafe.h:2833
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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 163 of file ntstrsafe.h.

167 {
168  size_t cchDest = cbDest / sizeof(char);
169  if (cchDest > NTSTRSAFE_MAX_CCH)
170  {
171  if (cchDest > 0)
172  *pszDest = '\0';
174  }
175  return RtlStringCopyWorkerA(pszDest,cbDest,pszSrc);
176 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:2828
unsigned char
Definition: typeof.h:27
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by KdbpDoCommand(), KdbpReadCommand(), MiSnapThunk(), and Phase1InitializationDiscard().

◆ 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';
287  }
288 
289  Status = RtlStringCopyExWorkerA(pszDest,cbDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
291  {
292  if (pcbRemaining)
293  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
294  }
295  return Status;
296 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned char
Definition: typeof.h:27
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:2830

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 299 of file ntstrsafe.h.

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

◆ 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 391 of file ntstrsafe.h.

396 {
397  size_t cchDest = cbDest / sizeof(char);
398  size_t cchToCopy = cbToCopy / sizeof(char);
399 
400  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
401  {
402  if (cchDest > 0)
403  *pszDest = '\0';
405  }
406 
407  return RtlStringCopyNWorkerA(pszDest, cchDest, pszSrc, cchToCopy);
408 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned char
Definition: typeof.h:27
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1822

Referenced by ArcGetNextTokenA().

◆ 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 511 of file ntstrsafe.h.

519 {
521  size_t cchRemaining = 0;
522 
523  if (cbDest > NTSTRSAFE_MAX_CCH)
524  {
525  if ((pszDest != NULL) && (cbDest > 0))
526  *pszDest = L'\0';
528  }
529 
530  Status = RtlStringCopyNExWorkerA(pszDest,cbDest,cbDest,pszSrc,cbToCopy,ppszDestEnd,&cchRemaining,dwFlags);
531  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
532  *pcbRemaining = cchRemaining;
533  return Status;
534 }
#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:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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:1868

◆ 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 537 of file ntstrsafe.h.

545 {
547  size_t cchDest;
548  size_t cchToCopy;
549  size_t cchRemaining = 0;
550  cchDest = cbDest / sizeof(wchar_t);
551  cchToCopy = cbToCopy / sizeof(wchar_t);
552  if (cchDest > NTSTRSAFE_MAX_CCH)
553  {
554  if ((pszDest != NULL) && (cbDest > 0))
555  *pszDest = L'\0';
557  }
558 
559  Status = RtlStringCopyNExWorkerW(pszDest,cchDest,cbDest,pszSrc,cchToCopy,ppszDestEnd,&cchRemaining,dwFlags);
560  if ((NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) && pcbRemaining)
561  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
562  return Status;
563 }
#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:24
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:1972
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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 411 of file ntstrsafe.h.

416 {
417  size_t cchDest = cbDest / sizeof(wchar_t);
418  size_t cchToCopy = cbToCopy / sizeof(wchar_t);
419 
420  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
421  {
422  if (cchDest > 0)
423  *pszDest = L'\0';
425  }
426 
427  return RtlStringCopyNWorkerW(pszDest, cchDest, pszSrc, cchToCopy);
428 }
#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:1845
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by _MyGetFileSystem(), AddPartitionToDisk(), ArcGetNextTokenU(), ArcPathNormalize(), CheckForValidPEAndVendor(), CopyDeviceFindData(), CopyFindData(), EngpRegisterGraphicsDevice(), 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 179 of file ntstrsafe.h.

183 {
184  size_t cchDest = cbDest / sizeof(wchar_t);
185  if (cchDest > NTSTRSAFE_MAX_CCH)
186  {
187  if (cchDest > 0)
188  *pszDest = '\0';
190  }
191  return RtlStringCopyWorkerW(pszDest,cchDest,pszSrc);
192 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerW
Definition: ntstrsafe.h:2829
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by DefaultProcessEntry(), FontFamilyFillInfo(), GetFileSystem(), IntResolveDesktop(), KspStartBusDevice(), ProcessLangEntry(), USBPORT_PdoPnP(), and UserEnumDisplayDevices().

◆ RtlStringCbLengthA()

Definition at line 1522 of file ntstrsafe.h.

1526 {
1527  NTSTATUS Status;
1528  size_t cchMax;
1529  size_t cchLength = 0;
1530  cchMax = cbMax / sizeof(char);
1531  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1533  else
1534  Status = RtlStringLengthWorkerA(psz,cchMax,&cchLength);
1535  if (pcbLength)
1536  {
1537  if (NT_SUCCESS(Status))
1538  {
1539  *pcbLength = cchLength*sizeof(char);
1540  }
1541  else
1542  {
1543  *pcbLength = 0;
1544  }
1545  }
1546  return Status;
1547 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
unsigned char
Definition: typeof.h:27
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ RtlStringCbLengthW()

Definition at line 1551 of file ntstrsafe.h.

1555 {
1556  NTSTATUS Status;
1557  size_t cchMax;
1558  size_t cchLength = 0;
1559  cchMax = cbMax / sizeof(wchar_t);
1560  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1562  else
1563  Status = RtlStringLengthWorkerW(psz,cchMax,&cchLength);
1564  if (pcbLength)
1565  {
1566  if (NT_SUCCESS(Status))
1567  {
1568  *pcbLength = cchLength*sizeof(wchar_t);
1569  }
1570  else
1571  {
1572  *pcbLength = 0;
1573  }
1574  }
1575  return Status;
1576 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ RtlStringCbPrintfA()

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

Definition at line 1099 of file ntstrsafe.h.

1104 {
1105  NTSTATUS Status;
1106  va_list argList;
1107  if (cbDest > NTSTRSAFE_MAX_CCH)
1108  {
1109  if (cbDest > 0)
1110  *pszDest = '\0';
1111  return STATUS_INVALID_PARAMETER;
1112  }
1113  va_start(argList,pszFormat);
1114  Status = RtlStringVPrintfWorkerA(pszDest,cbDest,pszFormat,argList);
1115  va_end(argList);
1116  return Status;
1117 }
#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:2840
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by CreateFlopDeviceObject(), ExpInitializeExecutive(), ExpLoadBootSymbols(), HdlspDispatch(), Phase1InitializationDiscard(), and PropertyHandler_Private().

◆ RtlStringCbPrintfExA()

static __inline NTSTATUS RtlStringCbPrintfExA ( _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cbDest,
_Outptr_opt_result_bytebuffer_ *pcbRemaining NTSTRSAFE_PSTR ppszDestEnd,
_Out_opt_ size_t pcbRemaining,
_In_ STRSAFE_DWORD  dwFlags,
_In_ _Printf_format_string_ NTSTRSAFE_PCSTR  pszFormat,
  ... 
)
static

Definition at line 1231 of file ntstrsafe.h.

1239 {
1240  NTSTATUS Status;
1241  size_t cchDest;
1242  size_t cchRemaining = 0;
1243 
1244  cchDest = cbDest / sizeof(char);
1245  if (cchDest > NTSTRSAFE_MAX_CCH)
1246  {
1247  if (cchDest > 0)
1248  *pszDest = '\0';
1249  return STATUS_INVALID_PARAMETER;
1250  }
1251 
1252  {
1253  va_list argList;
1254  va_start(argList,pszFormat);
1255  Status = RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
1256  va_end(argList);
1257  }
1259  {
1260  if (pcbRemaining)
1261  {
1262  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
1263  }
1264  }
1265  return Status;
1266 }
#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:2842
unsigned char
Definition: typeof.h:27
char * va_list
Definition: acmsvcex.h:78
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by Phase1InitializationDiscard().

◆ RtlStringCbPrintfExW()

static __inline NTSTATUS RtlStringCbPrintfExW ( _Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cbDest,
_Outptr_opt_result_bytebuffer_ *pcbRemaining NTSTRSAFE_PWSTR ppszDestEnd,
_Out_opt_ size_t pcbRemaining,
_In_ STRSAFE_DWORD  dwFlags,
_In_ _Printf_format_string_ NTSTRSAFE_PCWSTR  pszFormat,
  ... 
)
static

Definition at line 1269 of file ntstrsafe.h.

1277 {
1278  NTSTATUS Status;
1279  size_t cchDest;
1280  size_t cchRemaining = 0;
1281  cchDest = cbDest / sizeof(wchar_t);
1282  if (cchDest > NTSTRSAFE_MAX_CCH)
1283  {
1284  if (cchDest > 0)
1285  *pszDest = L'\0';
1286  return STATUS_INVALID_PARAMETER;
1287  }
1288 
1289  {
1290  va_list argList;
1291  va_start(argList,pszFormat);
1292  Status = RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
1293  va_end(argList);
1294  }
1296  {
1297  if (pcbRemaining)
1298  {
1299  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
1300  }
1301  }
1302  return Status;
1303 }
#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:24
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:2843
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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

◆ RtlStringCbPrintfW()

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

Definition at line 1120 of file ntstrsafe.h.

1125 {
1126  NTSTATUS Status;
1127  va_list argList;
1128  size_t cchDest = cbDest / sizeof(wchar_t);
1129  if (cchDest > NTSTRSAFE_MAX_CCH)
1130  {
1131  if (cchDest > 0)
1132  *pszDest = L'\0';
1133  return STATUS_INVALID_PARAMETER;
1134  }
1135  va_start(argList,pszFormat);
1136  Status = RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
1137  va_end(argList);
1138  return Status;
1139 }
#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:2841
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by acpi_create_registry_table(), BuildUserModeWindowStationName(), CmpCreateControlSet(), CmpSetVersionData(), DllMain(), GetSystemVersionString(), 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 996 of file ntstrsafe.h.

1001 {
1002  if (cbDest > NTSTRSAFE_MAX_CCH)
1003  {
1004  if (cbDest > 0)
1005  *pszDest = '\0';
1006  return STATUS_INVALID_PARAMETER;
1007  }
1008  return RtlStringVPrintfWorkerA(pszDest,cbDest,pszFormat,argList);
1009 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerA
Definition: ntstrsafe.h:2840
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by DbgP(), dprintk(), and print_error().

◆ 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 1398 of file ntstrsafe.h.

1406 {
1407  NTSTATUS Status;
1408  size_t cchDest;
1409  size_t cchRemaining = 0;
1410  cchDest = cbDest / sizeof(char);
1411  if (cchDest > NTSTRSAFE_MAX_CCH)
1413  else
1414  Status = RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
1416  {
1417  if (pcbRemaining)
1418  {
1419  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
1420  }
1421  }
1422  return Status;
1423 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:2842
unsigned char
Definition: typeof.h:27
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 1426 of file ntstrsafe.h.

1434 {
1435  NTSTATUS Status;
1436  size_t cchDest;
1437  size_t cchRemaining = 0;
1438  cchDest = cbDest / sizeof(wchar_t);
1439  if (cchDest > NTSTRSAFE_MAX_CCH)
1441  else
1442  Status = RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
1444  {
1445  if (pcbRemaining)
1446  {
1447  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
1448  }
1449  }
1450  return Status;
1451 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:2843
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 1012 of file ntstrsafe.h.

1017 {
1018  size_t cchDest = cbDest / sizeof(wchar_t);
1019  if (cchDest > NTSTRSAFE_MAX_CCH)
1020  {
1021  if (cchDest > 0)
1022  *pszDest = L'\0';
1023  return STATUS_INVALID_PARAMETER;
1024  }
1025  return RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
1026 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:2841
static const WCHAR L[]
Definition: oid.c:1250
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ RtlStringCchCatA()

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

Definition at line 578 of file ntstrsafe.h.

582 {
583  if (cchDest > NTSTRSAFE_MAX_CCH)
585  return RtlStringCatWorkerA(pszDest,cchDest,pszSrc);
586 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatWorkerA
Definition: ntstrsafe.h:2832
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 653 of file ntstrsafe.h.

660 {
661  if (cchDest > NTSTRSAFE_MAX_CCH)
663  return RtlStringCatExWorkerA(pszDest,cchDest,cchDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
664 }
#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:36
#define RtlStringCatExWorkerA
Definition: ntstrsafe.h:2834

◆ 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 667 of file ntstrsafe.h.

674 {
675  size_t cbDest = cchDest*sizeof(wchar_t);
676  if (cchDest > NTSTRSAFE_MAX_CCH)
678  return RtlStringCatExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
679 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatExWorkerW
Definition: ntstrsafe.h:2835
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 756 of file ntstrsafe.h.

761 {
762  if (cchDest > NTSTRSAFE_MAX_CCH)
764  return RtlStringCatNWorkerA(pszDest,cchDest,pszSrc,cchToAppend);
765 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerA
Definition: ntstrsafe.h:2836
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 841 of file ntstrsafe.h.

849 {
850  if (cchDest > NTSTRSAFE_MAX_CCH)
852  return RtlStringCatNExWorkerA(pszDest,cchDest,cchDest,pszSrc,cchToAppend,ppszDestEnd,pcchRemaining,dwFlags);
853 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RtlStringCatNExWorkerA
Definition: ntstrsafe.h:2838
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 856 of file ntstrsafe.h.

864 {
865  if (cchDest > NTSTRSAFE_MAX_CCH)
867  return RtlStringCatNExWorkerW(pszDest,cchDest,(cchDest*sizeof(wchar_t)),pszSrc,cchToAppend,ppszDestEnd,pcchRemaining,dwFlags);
868 }
#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:36
#define RtlStringCatNExWorkerW
Definition: ntstrsafe.h:2839

◆ 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 768 of file ntstrsafe.h.

773 {
774  if (cchDest > NTSTRSAFE_MAX_CCH)
776  return RtlStringCatNWorkerW(pszDest,cchDest,pszSrc,cchToAppend);
777 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCatNWorkerW
Definition: ntstrsafe.h:2837
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ RtlStringCchCatW()

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

Definition at line 589 of file ntstrsafe.h.

593 {
594  if (cchDest > NTSTRSAFE_MAX_CCH)
596  return RtlStringCatWorkerW(pszDest,cchDest,pszSrc);
597 }
#define RtlStringCatWorkerW
Definition: ntstrsafe.h:2833
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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 119 of file ntstrsafe.h.

123 {
124  if (cchDest > NTSTRSAFE_MAX_CCH)
125  {
126  if (cchDest > 0)
127  *pszDest = '\0';
129  }
130 
131  return RtlStringCopyWorkerA(pszDest, cchDest, pszSrc);
132 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:2828
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by 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 213 of file ntstrsafe.h.

220 {
221  if (cchDest > NTSTRSAFE_MAX_CCH)
222  {
223  if (cchDest > 0)
224  *pszDest = '\0';
226  }
227  return RtlStringCopyExWorkerA(pszDest,cchDest,cchDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
228 }
#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:36
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:2830

◆ 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 231 of file ntstrsafe.h.

238 {
239  size_t cbDest = cchDest * sizeof(wchar_t);
240 
241  if (cchDest > NTSTRSAFE_MAX_CCH)
242  {
243  if (cchDest > 0)
244  *pszDest = L'\0';
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:36
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:2831

◆ 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 343 of file ntstrsafe.h.

348 {
349  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
350  {
351  if (cchDest > 0)
352  *pszDest = '\0';
354  }
355 
356  return RtlStringCopyNWorkerA(pszDest,cchDest,pszSrc,cchToCopy);
357 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
NTSTRSAFEAPI RtlStringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: ntstrsafe.h:1822

◆ 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 451 of file ntstrsafe.h.

459 {
460  if (cchDest > NTSTRSAFE_MAX_CCH)
461  {
462  if (cchDest > 0)
463  *pszDest = '\0';
465  }
466 
467  return RtlStringCopyNExWorkerA(pszDest, cchDest, cchDest, pszSrc, cchToCopy, ppszDestEnd, pcchRemaining, dwFlags);
468 }
#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:36
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:1868

◆ 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 471 of file ntstrsafe.h.

479 {
480  if (cchDest > NTSTRSAFE_MAX_CCH)
481  {
482  if (cchDest > 0)
483  *pszDest = L'\0';
485  }
486 
487  return RtlStringCopyNExWorkerW(pszDest,cchDest,cchDest * sizeof(wchar_t), pszSrc, cchToCopy, ppszDestEnd, pcchRemaining, dwFlags);
488 }
#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:1972
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:36

◆ 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 360 of file ntstrsafe.h.

365 {
366  if (cchDest > NTSTRSAFE_MAX_CCH || cchToCopy > NTSTRSAFE_MAX_CCH)
367  {
368  if (cchDest > 0)
369  *pszDest = L'\0';
371  }
372 
373  return RtlStringCopyNWorkerW(pszDest,cchDest,pszSrc,cchToCopy);
374 }
#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:1845
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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 1470 of file ntstrsafe.h.

1474 {
1475  NTSTATUS Status;
1476  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1478  else
1479  Status = RtlStringLengthWorkerA(psz,cchMax,pcchLength);
1480  if (!NT_SUCCESS(Status) && pcchLength)
1481  {
1482  *pcchLength = 0;
1483  }
1484  return Status;
1485 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 1489 of file ntstrsafe.h.

1493 {
1494  NTSTATUS Status;
1495  if (!psz || (cchMax > NTSTRSAFE_MAX_CCH))
1497  else
1498  Status = RtlStringLengthWorkerW(psz,cchMax,pcchLength);
1499  if (!NT_SUCCESS(Status) && pcchLength)
1500  {
1501  *pcchLength = 0;
1502  }
1503  return Status;
1504 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ RtlStringCchPrintfA()

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

Definition at line 1043 of file ntstrsafe.h.

1048 {
1049  NTSTATUS Status;
1050  va_list argList;
1051  if (cchDest > NTSTRSAFE_MAX_CCH)
1052  {
1053  if (cchDest > 0)
1054  *pszDest = '\0';
1055  return STATUS_INVALID_PARAMETER;
1056  }
1057  va_start(argList,pszFormat);
1058  Status = RtlStringVPrintfWorkerA(pszDest,cchDest,pszFormat,argList);
1059  va_end(argList);
1060  return Status;
1061 }
#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:2840
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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

◆ RtlStringCchPrintfExA()

static __inline NTSTATUS RtlStringCchPrintfExA ( _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR  pszDest,
_In_ size_t  cchDest,
_Outptr_opt_result_buffer_ *pcchRemaining NTSTRSAFE_PSTR ppszDestEnd,
_Out_opt_ size_t pcchRemaining,
_In_ STRSAFE_DWORD  dwFlags,
_In_ _Printf_format_string_ NTSTRSAFE_PCSTR  pszFormat,
  ... 
)
static

Definition at line 1162 of file ntstrsafe.h.

1170 {
1171  NTSTATUS Status;
1172  va_list argList;
1173  if (cchDest > NTSTRSAFE_MAX_CCH)
1174  {
1175  if (cchDest > 0)
1176  *pszDest = '\0';
1177  return STATUS_INVALID_PARAMETER;
1178  }
1179  va_start(argList,pszFormat);
1180  Status = RtlStringVPrintfExWorkerA(pszDest,cchDest,cchDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
1181  va_end(argList);
1182  return Status;
1183 }
#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:2842
char * va_list
Definition: acmsvcex.h:78
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by RtlIpv4AddressToStringA(), and RtlIpv4AddressToStringExA().

◆ RtlStringCchPrintfExW()

static __inline NTSTATUS RtlStringCchPrintfExW ( _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cchDest,
_Outptr_opt_result_buffer_ *pcchRemaining NTSTRSAFE_PWSTR ppszDestEnd,
_Out_opt_ size_t pcchRemaining,
_In_ STRSAFE_DWORD  dwFlags,
_In_ _Printf_format_string_ NTSTRSAFE_PCWSTR  pszFormat,
  ... 
)
static

Definition at line 1186 of file ntstrsafe.h.

1194 {
1195  NTSTATUS Status;
1196  size_t cbDest = cchDest * sizeof(wchar_t);
1197  va_list argList;
1198  if (cchDest > NTSTRSAFE_MAX_CCH)
1199  {
1200  if (cchDest > 0)
1201  *pszDest = L'\0';
1202  return STATUS_INVALID_PARAMETER;
1203  }
1204  va_start(argList,pszFormat);
1205  Status = RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
1206  va_end(argList);
1207  return Status;
1208 }
#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
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:2843
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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

◆ RtlStringCchPrintfW()

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

Definition at line 1064 of file ntstrsafe.h.

1069 {
1070  NTSTATUS Status;
1071  va_list argList;
1072  if (cchDest > NTSTRSAFE_MAX_CCH)
1073  {
1074  if (cchDest > 0)
1075  *pszDest = L'\0';
1076  return STATUS_INVALID_PARAMETER;
1077  }
1078  va_start(argList,pszFormat);
1079  Status = RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
1080  va_end(argList);
1081  return Status;
1082 }
#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:2841
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

Referenced by _MyGetFileSystem(), AddDiskToList(), AddKbLayoutsToRegistry(), AddPartitionToDisk(), BootLoaderHarddiskMbrPage(), BootLoaderPage(), CheckFileSystemPage(), CheckForValidPEAndVendor(), CheckUnattendedSetup(), CreatePartitionList(), CreateRegistryFile(), 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 949 of file ntstrsafe.h.

954 {
955  if (cchDest > NTSTRSAFE_MAX_CCH)
956  {
957  if (cchDest > 0)
958  *pszDest = '\0';
960  }
961 
962  return RtlStringVPrintfWorkerA(pszDest,cchDest,pszFormat,argList);
963 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerA
Definition: ntstrsafe.h:2840
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 1326 of file ntstrsafe.h.

1334 {
1335  NTSTATUS Status;
1336  if (cchDest > NTSTRSAFE_MAX_CCH)
1337  {
1338  if (cchDest > 0)
1339  *pszDest = '\0';
1340  return STATUS_INVALID_PARAMETER;
1341  }
1342 
1343  {
1344  size_t cbDest;
1345  cbDest = cchDest*sizeof(char);
1346  Status = RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
1347  }
1348  return Status;
1349 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:2842
unsigned char
Definition: typeof.h:27
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 1352 of file ntstrsafe.h.

1360 {
1361  NTSTATUS Status;
1362  if (cchDest > NTSTRSAFE_MAX_CCH)
1363  {
1364  if (cchDest > 0)
1365  *pszDest = L'\0';
1366  return STATUS_INVALID_PARAMETER;
1367  }
1368 
1369  {
1370  size_t cbDest;
1371  cbDest = cchDest*sizeof(wchar_t);
1372  Status = RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
1373  }
1374  return Status;
1375 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:2843
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 966 of file ntstrsafe.h.

971 {
972  if (cchDest > NTSTRSAFE_MAX_CCH)
973  {
974  if (cchDest > 0)
975  *pszDest = L'\0';
977  }
978  return RtlStringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
979 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:2841
static const WCHAR L[]
Definition: oid.c:1250
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

◆ 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 1622 of file ntstrsafe.h.

1623 {
1625  STRSAFE_LPSTR pszDestEnd = pszDest;
1626  size_t cchRemaining = 0;
1627  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1629  else
1630  {
1632  {
1633  if (!pszDest)
1634  {
1635  if ((cchDest!=0) || (cbDest!=0))
1637  }
1638  if (!pszSrc)
1639  pszSrc = "";
1640  }
1641  if (NT_SUCCESS(Status))
1642  {
1643  if (cchDest==0)
1644  {
1645  pszDestEnd = pszDest;
1646  cchRemaining = 0;
1647  if (*pszSrc!='\0')
1648  {
1649  if (!pszDest)
1651  else
1653  }
1654  }
1655  else
1656  {
1657  pszDestEnd = pszDest;
1658  cchRemaining = cchDest;
1659  while(cchRemaining && (*pszSrc!='\0'))
1660  {
1661  *pszDestEnd++ = *pszSrc++;
1662  cchRemaining--;
1663  }
1664  if (cchRemaining > 0)
1665  {
1667  {
1668  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
1669  }
1670  }
1671  else
1672  {
1673  pszDestEnd--;
1674  cchRemaining++;
1676  }
1677  *pszDestEnd = '\0';
1678  }
1679  }
1680  }
1681  if (!NT_SUCCESS(Status))
1682  {
1683  if (pszDest)
1684  {
1686  {
1687  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1689  {
1690  pszDestEnd = pszDest;
1691  cchRemaining = cchDest;
1692  }
1693  else
1694  if (cchDest > 0)
1695  {
1696  pszDestEnd = pszDest + cchDest - 1;
1697  cchRemaining = 1;
1698  *pszDestEnd = '\0';
1699  }
1700  }
1702  {
1703  if (cchDest > 0)
1704  {
1705  pszDestEnd = pszDest;
1706  cchRemaining = cchDest;
1707  *pszDestEnd = '\0';
1708  }
1709  }
1710  }
1711  }
1713  {
1714  if (ppszDestEnd)
1715  *ppszDestEnd = pszDestEnd;
1716  if (pcchRemaining)
1717  *pcchRemaining = cchRemaining;
1718  }
1719  return Status;
1720 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:48
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:45
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61

◆ 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 1722 of file ntstrsafe.h.

1723 {
1725  STRSAFE_LPWSTR pszDestEnd = pszDest;
1726  size_t cchRemaining = 0;
1727  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1729  else
1730  {
1732  {
1733  if (!pszDest)
1734  {
1735  if ((cchDest!=0) || (cbDest!=0))
1737  }
1738  if (!pszSrc)
1739  pszSrc = L"";
1740  }
1741  if (NT_SUCCESS(Status))
1742  {
1743  if (cchDest==0)
1744  {
1745  pszDestEnd = pszDest;
1746  cchRemaining = 0;
1747  if (*pszSrc!=L'\0')
1748  {
1749  if (!pszDest)
1751  else
1753  }
1754  }
1755  else
1756  {
1757  pszDestEnd = pszDest;
1758  cchRemaining = cchDest;
1759  while(cchRemaining && (*pszSrc!=L'\0'))
1760  {
1761  *pszDestEnd++ = *pszSrc++;
1762  cchRemaining--;
1763  }
1764  if (cchRemaining > 0)
1765  {
1767  {
1768  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
1769  }
1770  }
1771  else
1772  {
1773  pszDestEnd--;
1774  cchRemaining++;
1776  }
1777  *pszDestEnd = L'\0';
1778  }
1779  }
1780  }
1781  if (!NT_SUCCESS(Status))
1782  {
1783  if (pszDest)
1784  {
1786  {
1787  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1789  {
1790  pszDestEnd = pszDest;
1791  cchRemaining = cchDest;
1792  }
1793  else
1794  if (cchDest > 0)
1795  {
1796  pszDestEnd = pszDest + cchDest - 1;
1797  cchRemaining = 1;
1798  *pszDestEnd = L'\0';
1799  }
1800  }
1802  {
1803  if (cchDest > 0)
1804  {
1805  pszDestEnd = pszDest;
1806  cchRemaining = cchDest;
1807  *pszDestEnd = L'\0';
1808  }
1809  }
1810  }
1811  }
1813  {
1814  if (ppszDestEnd)
1815  *ppszDestEnd = pszDestEnd;
1816  if (pcchRemaining)
1817  *pcchRemaining = cchRemaining;
1818  }
1819  return Status;
1820 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c: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:48
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:45
return STATUS_SUCCESS
Definition: btrfs.c:2725
#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 1868 of file ntstrsafe.h.

1869 {
1871  STRSAFE_LPSTR pszDestEnd = pszDest;
1872  size_t cchRemaining = 0;
1873  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1875  else
1876  if (cchToCopy > NTSTRSAFE_MAX_CCH)
1878  else
1879  {
1881  {
1882  if (!pszDest)
1883  {
1884  if ((cchDest!=0) || (cbDest!=0))
1886  }
1887  if (!pszSrc)
1888  pszSrc = "";
1889  }
1890  if (NT_SUCCESS(Status))
1891  {
1892  if (cchDest==0)
1893  {
1894  pszDestEnd = pszDest;
1895  cchRemaining = 0;
1896  if ((cchToCopy!=0) && (*pszSrc!='\0'))
1897  {
1898  if (!pszDest)
1900  else
1902  }
1903  }
1904  else
1905  {
1906  pszDestEnd = pszDest;
1907  cchRemaining = cchDest;
1908  while(cchRemaining && cchToCopy && (*pszSrc!='\0'))
1909  {
1910  *pszDestEnd++ = *pszSrc++;
1911  cchRemaining--;
1912  cchToCopy--;
1913  }
1914  if (cchRemaining > 0)
1915  {
1917  {
1918  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
1919  }
1920  }
1921  else
1922  {
1923  pszDestEnd--;
1924  cchRemaining++;
1926  }
1927  *pszDestEnd = '\0';
1928  }
1929  }
1930  }
1931  if (!NT_SUCCESS(Status))
1932  {
1933  if (pszDest)
1934  {
1936  {
1937  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1939  {
1940  pszDestEnd = pszDest;
1941  cchRemaining = cchDest;
1942  }
1943  else
1944  if (cchDest > 0)
1945  {
1946  pszDestEnd = pszDest + cchDest - 1;
1947  cchRemaining = 1;
1948  *pszDestEnd = '\0';
1949  }
1950  }
1952  {
1953  if (cchDest > 0)
1954  {
1955  pszDestEnd = pszDest;
1956  cchRemaining = cchDest;
1957  *pszDestEnd = '\0';
1958  }
1959  }
1960  }
1961  }
1963  {
1964  if (ppszDestEnd)
1965  *ppszDestEnd = pszDestEnd;
1966  if (pcchRemaining)
1967  *pcchRemaining = cchRemaining;
1968  }
1969  return Status;
1970 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:48
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:45
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61

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 1972 of file ntstrsafe.h.

1973 {
1975  STRSAFE_LPWSTR pszDestEnd = pszDest;
1976  size_t cchRemaining = 0;
1977  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1979  else
1980  if (cchToCopy > NTSTRSAFE_MAX_CCH)
1982  else
1983  {
1985  {
1986  if (!pszDest)
1987  {
1988  if ((cchDest!=0) || (cbDest!=0))
1990  }
1991  if (!pszSrc)
1992  pszSrc = L"";
1993  }
1994  if (NT_SUCCESS(Status))
1995  {
1996  if (cchDest==0)
1997  {
1998  pszDestEnd = pszDest;
1999  cchRemaining = 0;
2000  if ((cchToCopy!=0) && (*pszSrc!=L'\0'))
2001  {
2002  if (!pszDest)
2004  else
2006  }
2007  }
2008  else
2009  {
2010  pszDestEnd = pszDest;
2011  cchRemaining = cchDest;
2012  while(cchRemaining && cchToCopy && (*pszSrc!=L'\0'))
2013  {
2014  *pszDestEnd++ = *pszSrc++;
2015  cchRemaining--;
2016  cchToCopy--;
2017  }
2018  if (cchRemaining > 0)
2019  {
2021  {
2022  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
2023  }
2024  }
2025  else
2026  {
2027  pszDestEnd--;
2028  cchRemaining++;
2030  }
2031  *pszDestEnd = L'\0';
2032  }
2033  }
2034  }
2035  if (!NT_SUCCESS(Status))
2036  {
2037  if (pszDest)
2038  {
2040  {
2041  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2043  {
2044  pszDestEnd = pszDest;
2045  cchRemaining = cchDest;
2046  }
2047  else
2048  if (cchDest > 0)
2049  {
2050  pszDestEnd = pszDest + cchDest - 1;
2051  cchRemaining = 1;
2052  *pszDestEnd = L'\0';
2053  }
2054  }
2056  {
2057  if (cchDest > 0)
2058  {
2059  pszDestEnd = pszDest;
2060  cchRemaining = cchDest;
2061  *pszDestEnd = L'\0';
2062  }
2063  }
2064  }
2065  }
2067  {
2068  if (ppszDestEnd)
2069  *ppszDestEnd = pszDestEnd;
2070  if (pcchRemaining)
2071  *pcchRemaining = cchRemaining;
2072  }
2073  return Status;
2074 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c: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:48
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:45
return STATUS_SUCCESS
Definition: btrfs.c:2725
#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 1822 of file ntstrsafe.h.

1823 {
1825  if (cchDest==0)
1827  else
1828  {
1829  while(cchDest && cchSrc && (*pszSrc!='\0'))
1830  {
1831  *pszDest++ = *pszSrc++;
1832  cchDest--;
1833  cchSrc--;
1834  }
1835  if (cchDest==0)
1836  {
1837  pszDest--;
1839  }
1840  *pszDest= '\0';
1841  }
1842  return Status;
1843 }
#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:61
return STATUS_SUCCESS
Definition: btrfs.c:2725

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

◆ RtlStringCopyNWorkerW()

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

Definition at line 1845 of file ntstrsafe.h.

1846 {
1848  if (cchDest==0)
1850  else
1851  {
1852  while(cchDest && cchToCopy && (*pszSrc!=L'\0'))
1853  {
1854  *pszDest++ = *pszSrc++;
1855  cchDest--;
1856  cchToCopy--;
1857  }
1858  if (cchDest==0)
1859  {
1860  pszDest--;
1862  }
1863  *pszDest= L'\0';
1864  }
1865  return Status;
1866 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
return STATUS_SUCCESS
Definition: btrfs.c:2725

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

◆ RtlStringCopyWorkerA()

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

Definition at line 1578 of file ntstrsafe.h.

1579 {
1581  if (cchDest==0)
1583  else
1584  {
1585  while(cchDest && (*pszSrc!='\0'))
1586  {
1587  *pszDest++ = *pszSrc++;
1588  cchDest--;
1589  }
1590  if (cchDest==0)
1591  {
1592  pszDest--;
1594  }
1595  *pszDest= '\0';
1596  }
1597  return Status;
1598 }
#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:61
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ RtlStringCopyWorkerW()

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

Definition at line 1600 of file ntstrsafe.h.

1601 {
1603  if (cchDest==0)
1605  else
1606  {
1607  while(cchDest && (*pszSrc!=L'\0'))
1608  {
1609  *pszDest++ = *pszSrc++;
1610  cchDest--;
1611  }
1612  if (cchDest==0)
1613  {
1614  pszDest--;
1616  }
1617  *pszDest= L'\0';
1618  }
1619  return Status;
1620 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ 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 2779 of file ntstrsafe.h.

2783 {
2785  size_t cchMaxPrev = cchMax;
2786  while(cchMax && (*psz!='\0'))
2787  {
2788  psz++;
2789  cchMax--;
2790  }
2791  if (cchMax==0)
2793  if (pcchLength)
2794  {
2795  if (NT_SUCCESS(Status))
2796  *pcchLength = cchMaxPrev - cchMax;
2797  else
2798  *pcchLength = 0;
2799  }
2800  return Status;
2801 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ 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 2804 of file ntstrsafe.h.

2808 {
2810  size_t cchMaxPrev = cchMax;
2811  while(cchMax && (*psz!=L'\0'))
2812  {
2813  psz++;
2814  cchMax--;
2815  }
2816  if (cchMax==0)
2818  if (pcchLength)
2819  {
2820  if (NT_SUCCESS(Status))
2821  *pcchLength = cchMaxPrev - cchMax;
2822  else
2823  *pcchLength = 0;
2824  }
2825  return Status;
2826 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ 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 2564 of file ntstrsafe.h.

2565 {
2567  STRSAFE_LPSTR pszDestEnd = pszDest;
2568  size_t cchRemaining = 0;
2569  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2571  else
2572  {
2574  {
2575  if (!pszDest)
2576  {
2577  if ((cchDest!=0) || (cbDest!=0))
2579  }
2580  if (!pszFormat)
2581  pszFormat = "";
2582  }
2583  if (NT_SUCCESS(Status))
2584  {
2585  if (cchDest==0)
2586  {
2587  pszDestEnd = pszDest;
2588  cchRemaining = 0;
2589  if (*pszFormat!='\0')
2590  {
2591  if (!pszDest)
2593  else
2595  }
2596  }
2597  else
2598  {
2599  int iRet;
2600  size_t cchMax;
2601  cchMax = cchDest - 1;
2602  iRet = _vsnprintf(pszDest,cchMax,pszFormat,argList);
2603  if ((iRet < 0) || (((size_t)iRet) > cchMax))
2604  {
2605  pszDestEnd = pszDest + cchMax;
2606  cchRemaining = 1;
2607  *pszDestEnd = '\0';
2609  }
2610  else
2611  if (((size_t)iRet)==cchMax)
2612  {
2613  pszDestEnd = pszDest + cchMax;
2614  cchRemaining = 1;
2615  *pszDestEnd = '\0';
2616  }
2617  else
2618  if (((size_t)iRet) < cchMax)
2619  {
2620  pszDestEnd = pszDest + iRet;
2621  cchRemaining = cchDest - iRet;
2623  {
2624  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
2625  }
2626  }
2627  }
2628  }
2629  }
2630  if (!NT_SUCCESS(Status))
2631  {
2632  if (pszDest)
2633  {
2635  {
2636  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2638  {
2639  pszDestEnd = pszDest;
2640  cchRemaining = cchDest;
2641  }
2642  else
2643  if (cchDest > 0)
2644  {
2645  pszDestEnd = pszDest + cchDest - 1;
2646  cchRemaining = 1;
2647  *pszDestEnd = '\0';
2648  }
2649  }
2651  {
2652  if (cchDest > 0)
2653  {
2654  pszDestEnd = pszDest;
2655  cchRemaining = cchDest;
2656  *pszDestEnd = '\0';
2657  }
2658  }
2659  }
2660  }
2662  {
2663  if (ppszDestEnd)
2664  *ppszDestEnd = pszDestEnd;
2665  if (pcchRemaining)
2666  *pcchRemaining = cchRemaining;
2667  }
2668  return Status;
2669 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:48
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define _vsnprintf
Definition: xmlstorage.h:202
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:45
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61

◆ 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 2671 of file ntstrsafe.h.

2672 {
2674  STRSAFE_LPWSTR pszDestEnd = pszDest;
2675  size_t cchRemaining = 0;
2676  if (dwFlags & (~STRSAFE_VALID_FLAGS))
2678  else
2679  {
2681  {
2682  if (!pszDest)
2683  {
2684  if ((cchDest!=0) || (cbDest!=0))
2686  }
2687  if (!pszFormat)
2688  pszFormat = L"";
2689  }
2690  if (NT_SUCCESS(Status))
2691  {
2692  if (cchDest==0)
2693  {
2694  pszDestEnd = pszDest;
2695  cchRemaining = 0;
2696  if (*pszFormat!=L'\0')
2697  {
2698  if (!pszDest)
2700  else
2702  }
2703  }
2704  else
2705  {
2706  int iRet;
2707  size_t cchMax;
2708  cchMax = cchDest - 1;
2709  iRet = _vsnwprintf(pszDest,cchMax,pszFormat,argList);
2710  if ((iRet < 0) || (((size_t)iRet) > cchMax))
2711  {
2712  pszDestEnd = pszDest + cchMax;
2713  cchRemaining = 1;
2714  *pszDestEnd = L'\0';
2716  }
2717  else
2718  if (((size_t)iRet)==cchMax)
2719  {
2720  pszDestEnd = pszDest + cchMax;
2721  cchRemaining = 1;
2722  *pszDestEnd = L'\0';
2723  }
2724  else
2725  if (((size_t)iRet) < cchMax)
2726  {
2727  pszDestEnd = pszDest + iRet;
2728  cchRemaining = cchDest - iRet;
2730  {
2731  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
2732  }
2733  }
2734  }
2735  }
2736  }
2737  if (!NT_SUCCESS(Status))
2738  {
2739  if (pszDest)
2740  {
2742  {
2743  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
2745  {
2746  pszDestEnd = pszDest;
2747  cchRemaining = cchDest;
2748  }
2749  else
2750  if (cchDest > 0)
2751  {
2752  pszDestEnd = pszDest + cchDest - 1;
2753  cchRemaining = 1;
2754  *pszDestEnd = L'\0';
2755  }
2756  }
2758  {
2759  if (cchDest > 0)
2760  {
2761  pszDestEnd = pszDest;
2762  cchRemaining = cchDest;
2763  *pszDestEnd = L'\0';
2764  }
2765  }
2766  }
2767  }
2769  {
2770  if (ppszDestEnd)
2771  *ppszDestEnd = pszDestEnd;
2772  if (pcchRemaining)
2773  *pcchRemaining = cchRemaining;
2774  }
2775  return Status;
2776 }
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:46
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
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:48
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
#define STRSAFE_FILL_BEHIND_NULL
Definition: ntstrsafe.h:45
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39

◆ RtlStringVPrintfWorkerA()

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

Definition at line 2510 of file ntstrsafe.h.

2511 {
2513  if (cchDest==0)
2515  else
2516  {
2517  int iRet;
2518  size_t cchMax;
2519  cchMax = cchDest - 1;
2520  iRet = _vsnprintf(pszDest,cchMax,pszFormat,argList);
2521  if ((iRet < 0) || (((size_t)iRet) > cchMax))
2522  {
2523  pszDest += cchMax;
2524  *pszDest = '\0';
2526  }
2527  else
2528  if (((size_t)iRet)==cchMax)
2529  {
2530  pszDest += cchMax;
2531  *pszDest = '\0';
2532  }
2533  }
2534  return Status;
2535 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define _vsnprintf
Definition: xmlstorage.h:202
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ RtlStringVPrintfWorkerW()

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

Definition at line 2537 of file ntstrsafe.h.

2538 {
2540  if (cchDest==0)
2542  else
2543  {
2544  int iRet;
2545  size_t cchMax;
2546  cchMax = cchDest - 1;
2547  iRet = _vsnwprintf(pszDest,cchMax,pszFormat,argList);
2548  if ((iRet < 0) || (((size_t)iRet) > cchMax))
2549  {
2550  pszDest += cchMax;
2551  *pszDest = L'\0';
2553  }
2554  else
2555  if (((size_t)iRet)==cchMax)
2556  {
2557  pszDest += cchMax;
2558  *pszDest = L'\0';
2559  }
2560  }
2561  return Status;
2562 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
UINT cchMax
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
return STATUS_SUCCESS
Definition: btrfs.c:2725