ReactOS  0.4.11-dev-195-gef016bf
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 char
NTSTRSAFE_PCSTR
 
typedef _Null_terminated_ wchar_tNTSTRSAFE_PWSTR
 
typedef _Null_terminated_
const wchar_t
NTSTRSAFE_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

#define _STRSAFE_EXTERN_C   extern

Definition at line 29 of file ntstrsafe.h.

#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.

Referenced by acpi_create_registry_table(), CHubController::Initialize(), KiAcquireGuardedMutex(), LdrpInitializeProcessCompat(), LocalLock(), RxCommonWrite(), and TestMessageHandler().

#define NTSTRSAFE_INLINE_API   static __inline NTSTATUS NTAPI

Definition at line 33 of file ntstrsafe.h.

#define NTSTRSAFE_UNICODE_STRING_MAX_CCH   32767

Definition at line 40 of file ntstrsafe.h.

#define NTSTRSAFEAPI   static __inline NTSTATUS NTAPI

Definition at line 32 of file ntstrsafe.h.

#define RtlStringCatExWorkerA   RtlStringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 2834 of file ntstrsafe.h.

Referenced by RtlStringCbCatExA(), and RtlStringCchCatExA().

#define RtlStringCatExWorkerW   RtlStringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 2835 of file ntstrsafe.h.

Referenced by RtlStringCbCatExW(), and RtlStringCchCatExW().

#define RtlStringCatNExWorkerA   RtlStringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA;

Definition at line 2838 of file ntstrsafe.h.

Referenced by RtlStringCbCatNExA(), and RtlStringCchCatNExA().

#define RtlStringCatNExWorkerW   RtlStringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW;

Definition at line 2839 of file ntstrsafe.h.

Referenced by RtlStringCbCatNExW(), and RtlStringCchCatNExW().

#define RtlStringCatNWorkerA   RtlStringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA;

Definition at line 2836 of file ntstrsafe.h.

Referenced by RtlStringCbCatNA(), and RtlStringCchCatNA().

#define RtlStringCatNWorkerW   RtlStringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW;

Definition at line 2837 of file ntstrsafe.h.

Referenced by RtlStringCbCatNW(), and RtlStringCchCatNW().

#define RtlStringCatWorkerA   RtlStringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 2832 of file ntstrsafe.h.

Referenced by RtlStringCbCatA(), and RtlStringCchCatA().

#define RtlStringCatWorkerW   RtlStringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 2833 of file ntstrsafe.h.

Referenced by RtlStringCbCatW(), and RtlStringCchCatW().

#define RtlStringCopyExWorkerA   RtlStringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 2830 of file ntstrsafe.h.

Referenced by RtlStringCatExWorkerA(), RtlStringCbCopyExA(), and RtlStringCchCopyExA().

#define RtlStringCopyExWorkerW   RtlStringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 2831 of file ntstrsafe.h.

Referenced by RtlStringCatExWorkerW(), RtlStringCbCopyExW(), and RtlStringCchCopyExW().

#define RtlStringCopyWorkerA   RtlStringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 2828 of file ntstrsafe.h.

Referenced by RtlStringCatWorkerA(), RtlStringCbCopyA(), and RtlStringCchCopyA().

#define RtlStringCopyWorkerW   RtlStringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 2829 of file ntstrsafe.h.

Referenced by RtlStringCatWorkerW(), RtlStringCbCopyW(), and RtlStringCchCopyW().

#define RtlStringLengthWorkerA   RtlStringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA;
#define RtlStringLengthWorkerW   RtlStringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;
#define RtlStringVPrintfExWorkerA   RtlStringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;
#define RtlStringVPrintfExWorkerW   RtlStringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;
#define RtlStringVPrintfWorkerA   RtlStringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;
#define RtlStringVPrintfWorkerW   RtlStringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;
#define STRSAFE_FAILURE_BYTE (   x)    ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_ON_FAILURE))

Definition at line 56 of file ntstrsafe.h.

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

Definition at line 55 of file ntstrsafe.h.

#define STRSAFE_IGNORE_NULL_UNICODE_STRINGS   0x00010000

Definition at line 49 of file ntstrsafe.h.

#define STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED   0x00020000

Definition at line 50 of file ntstrsafe.h.

Definition at line 53 of file ntstrsafe.h.

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

Typedef Documentation

Definition at line 67 of file ntstrsafe.h.

Definition at line 69 of file ntstrsafe.h.

Definition at line 66 of file ntstrsafe.h.

Definition at line 68 of file ntstrsafe.h.

Definition at line 71 of file ntstrsafe.h.

Definition at line 62 of file ntstrsafe.h.

Definition at line 64 of file ntstrsafe.h.

typedef char* STRSAFE_LPSTR

Definition at line 61 of file ntstrsafe.h.

Definition at line 63 of file ntstrsafe.h.

Function Documentation

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))
2102  Status = STATUS_INVALID_PARAMETER;
2103  else
2104  {
2105  size_t cchDestLength;
2107  {
2108  if (!pszDest)
2109  {
2110  if ((cchDest==0) && (cbDest==0))
2111  cchDestLength = 0;
2112  else
2113  Status = STATUS_INVALID_PARAMETER;
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)
2143  Status = STATUS_INVALID_PARAMETER;
2144  else
2145  Status = STATUS_BUFFER_OVERFLOW;
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  }
2183  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
LONG NTSTATUS
Definition: precomp.h:26
#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:49
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
return STATUS_SUCCESS
Definition: btrfs.c:2710
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:2830
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))
2199  Status = STATUS_INVALID_PARAMETER;
2200  else
2201  {
2202  size_t cchDestLength;
2204  {
2205  if (!pszDest)
2206  {
2207  if ((cchDest==0) && (cbDest==0))
2208  cchDestLength = 0;
2209  else
2210  Status = STATUS_INVALID_PARAMETER;
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)
2240  Status = STATUS_INVALID_PARAMETER;
2241  else
2242  Status = STATUS_BUFFER_OVERFLOW;
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  }
2280  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
static const WCHAR L[]
Definition: oid.c:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#define STRSAFE_IGNORE_NULLS
Definition: ntstrsafe.h:44
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
return STATUS_SUCCESS
Definition: btrfs.c:2710
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:2831
#define memset(x, y, z)
Definition: compat.h:39
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))
2317  Status = STATUS_INVALID_PARAMETER;
2318  else
2319  if (cchToAppend > NTSTRSAFE_MAX_CCH)
2320  Status = STATUS_INVALID_PARAMETER;
2321  else
2322  {
2324  {
2325  if (!pszDest)
2326  {
2327  if ((cchDest==0) && (cbDest==0))
2328  cchDestLength = 0;
2329  else
2330  Status = STATUS_INVALID_PARAMETER;
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)
2360  Status = STATUS_INVALID_PARAMETER;
2361  else
2362  Status = STATUS_BUFFER_OVERFLOW;
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  }
2400  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
LONG NTSTATUS
Definition: precomp.h:26
#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:49
#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:2710
#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
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))
2417  Status = STATUS_INVALID_PARAMETER;
2418  else
2419  if (cchToAppend > NTSTRSAFE_MAX_CCH)
2420  Status = STATUS_INVALID_PARAMETER;
2421  else
2422  {
2424  {
2425  if (!pszDest)
2426  {
2427  if ((cchDest==0) && (cbDest==0))
2428  cchDestLength = 0;
2429  else
2430  Status = STATUS_INVALID_PARAMETER;
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)
2460  Status = STATUS_INVALID_PARAMETER;
2461  else
2462  Status = STATUS_BUFFER_OVERFLOW;
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  }
2500  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
LONG NTSTATUS
Definition: precomp.h:26
#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:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
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 }
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
LONG NTSTATUS
Definition: precomp.h:26
#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
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 }
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
LONG NTSTATUS
Definition: precomp.h:26
#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
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 }
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
#define RtlStringCopyWorkerA
Definition: ntstrsafe.h:2828
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
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
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
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
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.

Referenced by ExpInitializeExecutive().

707 {
709  size_t cchRemaining = 0;
710  if (cbDest > NTSTRSAFE_MAX_CCH)
711  Status = STATUS_INVALID_PARAMETER;
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
unsigned char
Definition: typeof.h:27
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:49
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCatExWorkerA
Definition: ntstrsafe.h:2834
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)
733  Status = STATUS_INVALID_PARAMETER;
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:49
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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
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)
903  Status = STATUS_INVALID_PARAMETER;
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
unsigned char
Definition: typeof.h:27
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:49
#define RtlStringCatNExWorkerA
Definition: ntstrsafe.h:2838
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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)
926  Status = STATUS_INVALID_PARAMETER;
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:49
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCatNExWorkerW
Definition: ntstrsafe.h:2839
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.

Referenced by ArcPathNormalize().

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
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.

Referenced by ArcPathNormalize(), and UserLoadKbdFile().

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
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.

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

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
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.

Referenced by DriverIoControl(), and ExpInitializeExecutive().

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);
290  if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW)
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
unsigned char
Definition: typeof.h:27
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:49
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCopyExWorkerA
Definition: ntstrsafe.h:2830
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);
319  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
#define RtlStringCopyExWorkerW
Definition: ntstrsafe.h:2831
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.

Referenced by ArcGetNextTokenA().

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
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 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
smooth NULL
Definition: ftsmooth.c:416
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
static const WCHAR L[]
Definition: oid.c:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#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
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.

Referenced by NtUserGetMonitorInfo().

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
smooth NULL
Definition: ftsmooth.c:416
LONG NTSTATUS
Definition: precomp.h:26
#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:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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.

Referenced by ArcGetNextTokenU(), ArcPathNormalize(), CopyDeviceFindData(), CopyFindData(), EngpRegisterGraphicsDevice(), IntResolveDesktop(), TextIntRealizeFont(), and UserpShowInformationBalloon().

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:1087
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
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.

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

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

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))
1532  Status = STATUS_INVALID_PARAMETER;
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
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
unsigned char
Definition: typeof.h:27
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36

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))
1561  Status = STATUS_INVALID_PARAMETER;
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
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
LONG NTSTATUS
Definition: precomp.h:26
#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
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.

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

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
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG NTSTATUS
Definition: precomp.h:26
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
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.

Referenced by Phase1InitializationDiscard().

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  }
1258  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#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
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:49
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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.

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

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  }
1295  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
static const WCHAR L[]
Definition: oid.c:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
#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
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.

Referenced by acpi_create_registry_table(), BuildUserModeWindowStationName(), CmpCreateControlSet(), CmpSetVersionData(), DllMain(), GetSystemVersionString(), IntResolveDesktop(), IopGetParentIdPrefix(), ObtClose(), ObtCreateObjects(), ObtCreateObjectTypes(), ResolveArcNameManually(), USBH_CreateDevice(), USBPORT_AddDevice(), USBPORT_CreateLegacySymbolicLink(), USBPORT_CreatePdo(), USBPORT_PdoPnP(), UserCreateWinstaDirectory(), and UserpFormatMessages().

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
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:2841
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR L[]
Definition: oid.c:1087
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
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.

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

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
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)
1412  Status = STATUS_INVALID_PARAMETER;
1413  else
1414  Status = RtlStringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
1415  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:2842
unsigned char
Definition: typeof.h:27
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:49
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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)
1440  Status = STATUS_INVALID_PARAMETER;
1441  else
1442  Status = RtlStringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
1443  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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:49
#define RtlStringVPrintfExWorkerW
Definition: ntstrsafe.h:2843
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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:1087
#define wchar_t
Definition: wchar.h:102
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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
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
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
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
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
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
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
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.

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

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
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.

Referenced by GetPartTypeStringFromPartitionType(), and RtlIpv4AddressToStringExA().

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
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
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:1087
_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
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
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
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:1087
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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.

Referenced by LoadAllocStringW().

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:1087
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
NTSTRSAFEAPI RtlStringCchCopyW ( _Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR  pszDest,
_In_ size_t  cchDest,
_In_ NTSTRSAFE_PCWSTR  pszSrc 
)

Definition at line 135 of file ntstrsafe.h.

Referenced by actctx_init(), GetFontFamilyInfoForSubstitutes(), InstallFatBootcodeToFloppy(), RtlIpv4AddressToStringExW(), RtlIpv6AddressToStringExW(), SubstituteFontRecurse(), and TextIntRealizeFont().

139 {
140  if (cchDest > NTSTRSAFE_MAX_CCH)
141  {
142  if (cchDest > 0)
143  *pszDest = '\0';
145  }
146 
147  return RtlStringCopyWorkerW(pszDest,cchDest,pszSrc);
148 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RtlStringCopyWorkerW
Definition: ntstrsafe.h:2829
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
_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))
1477  Status = STATUS_INVALID_PARAMETER;
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
#define RtlStringLengthWorkerA
Definition: ntstrsafe.h:2844
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
_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))
1496  Status = STATUS_INVALID_PARAMETER;
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
#define RtlStringLengthWorkerW
Definition: ntstrsafe.h:2845
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
UINT cchMax
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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.

Referenced by ProgressTimeOutStringHandler(), and UpdateProgressPercentage().

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
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG NTSTATUS
Definition: precomp.h:26
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
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.

Referenced by RtlIpv4AddressToStringA(), and RtlIpv4AddressToStringExA().

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
#define va_end(ap)
Definition: acmsvcex.h:90
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:2842
char * va_list
Definition: acmsvcex.h:78
LONG NTSTATUS
Definition: precomp.h:26
_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
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.

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

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
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR L[]
Definition: oid.c:1087
_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
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.

Referenced by AddDiskToList(), CreatePartitionList(), EnumerateBiosDiskEntries(), GetDriverName(), GetSystemVersionString(), SetMountedDeviceValue(), and WritePartitions().

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
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define RtlStringVPrintfWorkerW
Definition: ntstrsafe.h:2841
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR L[]
Definition: oid.c:1087
Status
Definition: gdiplustypes.h:24
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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
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
#define RtlStringVPrintfExWorkerA
Definition: ntstrsafe.h:2842
unsigned char
Definition: typeof.h:27
LONG NTSTATUS
Definition: precomp.h:26
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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:1087
_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
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:1087
#define NTSTRSAFE_MAX_CCH
Definition: ntstrsafe.h:36
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))
1628  Status = STATUS_INVALID_PARAMETER;
1629  else
1630  {
1632  {
1633  if (!pszDest)
1634  {
1635  if ((cchDest!=0) || (cbDest!=0))
1636  Status = STATUS_INVALID_PARAMETER;
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)
1650  Status = STATUS_INVALID_PARAMETER;
1651  else
1652  Status = STATUS_BUFFER_OVERFLOW;
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++;
1675  Status = STATUS_BUFFER_OVERFLOW;
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  }
1712  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
LONG NTSTATUS
Definition: precomp.h:26
#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:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
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))
1728  Status = STATUS_INVALID_PARAMETER;
1729  else
1730  {
1732  {
1733  if (!pszDest)
1734  {
1735  if ((cchDest!=0) || (cbDest!=0))
1736  Status = STATUS_INVALID_PARAMETER;
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)
1750  Status = STATUS_INVALID_PARAMETER;
1751  else
1752  Status = STATUS_BUFFER_OVERFLOW;
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++;
1775  Status = STATUS_BUFFER_OVERFLOW;
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  }
1812  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
static const WCHAR L[]
Definition: oid.c:1087
_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:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
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.

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

1869 {
1871  STRSAFE_LPSTR pszDestEnd = pszDest;
1872  size_t cchRemaining = 0;
1873  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1874  Status = STATUS_INVALID_PARAMETER;
1875  else
1876  if (cchToCopy > NTSTRSAFE_MAX_CCH)
1877  Status = STATUS_INVALID_PARAMETER;
1878  else
1879  {
1881  {
1882  if (!pszDest)
1883  {
1884  if ((cchDest!=0) || (cbDest!=0))
1885  Status = STATUS_INVALID_PARAMETER;
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)
1899  Status = STATUS_INVALID_PARAMETER;
1900  else
1901  Status = STATUS_BUFFER_OVERFLOW;
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++;
1925  Status = STATUS_BUFFER_OVERFLOW;
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  }
1962  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
LONG NTSTATUS
Definition: precomp.h:26
#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:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
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.

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

1973 {
1975  STRSAFE_LPWSTR pszDestEnd = pszDest;
1976  size_t cchRemaining = 0;
1977  if (dwFlags & (~STRSAFE_VALID_FLAGS))
1978  Status = STATUS_INVALID_PARAMETER;
1979  else
1980  if (cchToCopy > NTSTRSAFE_MAX_CCH)
1981  Status = STATUS_INVALID_PARAMETER;
1982  else
1983  {
1985  {
1986  if (!pszDest)
1987  {
1988  if ((cchDest!=0) || (cbDest!=0))
1989  Status = STATUS_INVALID_PARAMETER;
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)
2003  Status = STATUS_INVALID_PARAMETER;
2004  else
2005  Status = STATUS_BUFFER_OVERFLOW;
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++;
2029  Status = STATUS_BUFFER_OVERFLOW;
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  }
2066  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
LONG NTSTATUS
Definition: precomp.h:26
#define STRSAFE_VALID_FLAGS
Definition: ntstrsafe.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
static const WCHAR L[]
Definition: oid.c:1087
_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:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
NTSTRSAFEAPI RtlStringCopyNWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 1822 of file ntstrsafe.h.

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

1823 {
1825  if (cchDest==0)
1826  Status = STATUS_INVALID_PARAMETER;
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--;
1838  Status = STATUS_BUFFER_OVERFLOW;
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:49
return STATUS_SUCCESS
Definition: btrfs.c:2710
NTSTRSAFEAPI RtlStringCopyNWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 1845 of file ntstrsafe.h.

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

1846 {
1848  if (cchDest==0)
1849  Status = STATUS_INVALID_PARAMETER;
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--;
1861  Status = STATUS_BUFFER_OVERFLOW;
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:1087
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
return STATUS_SUCCESS
Definition: btrfs.c:2710
NTSTRSAFEAPI RtlStringCopyWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 1578 of file ntstrsafe.h.

1579 {
1581  if (cchDest==0)
1582  Status = STATUS_INVALID_PARAMETER;
1583  else
1584  {
1585  while(cchDest && (*pszSrc!='\0'))
1586  {
1587  *pszDest++ = *pszSrc++;
1588  cchDest--;
1589  }
1590  if (cchDest==0)
1591  {
1592  pszDest--;
1593  Status = STATUS_BUFFER_OVERFLOW;
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:49
return STATUS_SUCCESS
Definition: btrfs.c:2710
NTSTRSAFEAPI RtlStringCopyWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 1600 of file ntstrsafe.h.

1601 {
1603  if (cchDest==0)
1604  Status = STATUS_INVALID_PARAMETER;
1605  else
1606  {
1607  while(cchDest && (*pszSrc!=L'\0'))
1608  {
1609  *pszDest++ = *pszSrc++;
1610  cchDest--;
1611  }
1612  if (cchDest==0)
1613  {
1614  pszDest--;
1615  Status = STATUS_BUFFER_OVERFLOW;
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:1087
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
return STATUS_SUCCESS
Definition: btrfs.c:2710
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)
2792  Status = STATUS_INVALID_PARAMETER;
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:2710
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)
2817  Status = STATUS_INVALID_PARAMETER;
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:1087
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2710
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))
2570  Status = STATUS_INVALID_PARAMETER;
2571  else
2572  {
2574  {
2575  if (!pszDest)
2576  {
2577  if ((cchDest!=0) || (cbDest!=0))
2578  Status = STATUS_INVALID_PARAMETER;
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)
2592  Status = STATUS_INVALID_PARAMETER;
2593  else
2594  Status = STATUS_BUFFER_OVERFLOW;
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';
2608  Status = STATUS_BUFFER_OVERFLOW;
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  }
2661  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
LONG NTSTATUS
Definition: precomp.h:26
#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:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
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))
2677  Status = STATUS_INVALID_PARAMETER;
2678  else
2679  {
2681  {
2682  if (!pszDest)
2683  {
2684  if ((cchDest!=0) || (cbDest!=0))
2685  Status = STATUS_INVALID_PARAMETER;
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)
2699  Status = STATUS_INVALID_PARAMETER;
2700  else
2701  Status = STATUS_BUFFER_OVERFLOW;
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';
2715  Status = STATUS_BUFFER_OVERFLOW;
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  }
2768  if (NT_SUCCESS(Status) || (Status==STATUS_BUFFER_OVERFLOW))
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
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: ntstrsafe.h:58
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
LONG NTSTATUS
Definition: precomp.h:26
#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:1087
_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:49
#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:2710
#define memset(x, y, z)
Definition: compat.h:39
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)
2514  Status = STATUS_INVALID_PARAMETER;
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';
2525  Status = STATUS_BUFFER_OVERFLOW;
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:49
#define _vsnprintf
Definition: xmlstorage.h:202
return STATUS_SUCCESS
Definition: btrfs.c:2710
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)
2541  Status = STATUS_INVALID_PARAMETER;
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';
2552  Status = STATUS_BUFFER_OVERFLOW;
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:1087
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:49
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
return STATUS_SUCCESS
Definition: btrfs.c:2710