ReactOS  0.4.13-dev-257-gfabbd7c
strsafe.h File Reference
#include <_mingw_unicode.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <specstrings.h>
Include dependency graph for strsafe.h:

Go to the source code of this file.

Macros

#define _SIZE_T_DEFINED
 
#define _SSIZE_T_DEFINED
 
#define _WCHAR_T_DEFINED
 
#define _HRESULT_DEFINED
 
#define SUCCEEDED(hr)   ((HRESULT)(hr) >= 0)
 
#define FAILED(hr)   ((HRESULT)(hr) < 0)
 
#define S_OK   ((HRESULT)0x00000000L)
 
#define C_ASSERT(e)   extern void __C_ASSERT__(int [(e)?1:-1])
 
#define _STRSAFE_EXTERN_C   extern
 
#define WINAPI   __stdcall
 
#define STRSAFEAPI   static __inline HRESULT WINAPI
 
#define STRSAFE_INLINE_API   __CRT_INLINE HRESULT WINAPI
 
#define STRSAFE_MAX_CCH   2147483647
 
#define STRSAFE_IGNORE_NULLS   0x00000100
 
#define STRSAFE_FILL_BEHIND_NULL   0x00000200
 
#define STRSAFE_FILL_ON_FAILURE   0x00000400
 
#define STRSAFE_NULL_ON_FAILURE   0x00000800
 
#define STRSAFE_NO_TRUNCATION   0x00001000
 
#define STRSAFE_IGNORE_NULL_UNICODE_STRINGS   0x00010000
 
#define STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED   0x00020000
 
#define STRSAFE_VALID_FLAGS   (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)
 
#define STRSAFE_UNICODE_STRING_VALID_FLAGS   (STRSAFE_VALID_FLAGS | STRSAFE_IGNORE_NULL_UNICODE_STRINGS | STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED)
 
#define STRSAFE_FILL_BYTE(x)   ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_BEHIND_NULL))
 
#define STRSAFE_FAILURE_BYTE(x)   ((STRSAFE_DWORD)(((x) & 0x000000FF) | STRSAFE_FILL_ON_FAILURE))
 
#define STRSAFE_GET_FILL_PATTERN(dwFlags)   ((int)((dwFlags) & 0x000000FF))
 
#define STRSAFE_E_INSUFFICIENT_BUFFER   ((HRESULT)0x8007007AL)
 
#define STRSAFE_E_INVALID_PARAMETER   ((HRESULT)0x80070057L)
 
#define STRSAFE_E_END_OF_FILE   ((HRESULT)0x80070026L)
 
#define StringCchCopy   __MINGW_NAME_AW(StringCchCopy)
 
#define StringCbCopy   __MINGW_NAME_AW(StringCbCopy)
 
#define StringCchCopyEx   __MINGW_NAME_AW(StringCchCopyEx)
 
#define StringCbCopyEx   __MINGW_NAME_AW(StringCbCopyEx)
 
#define StringCchCopyN   __MINGW_NAME_AW(StringCchCopyN)
 
#define StringCbCopyN   __MINGW_NAME_AW(StringCbCopyN)
 
#define StringCchCopyNEx   __MINGW_NAME_AW(StringCchCopyNEx)
 
#define StringCbCopyNEx   __MINGW_NAME_AW(StringCbCopyNEx)
 
#define StringCchCat   __MINGW_NAME_AW(StringCchCat)
 
#define StringCbCat   __MINGW_NAME_AW(StringCbCat)
 
#define StringCchCatEx   __MINGW_NAME_AW(StringCchCatEx)
 
#define StringCbCatEx   __MINGW_NAME_AW(StringCbCatEx)
 
#define StringCchCatN   __MINGW_NAME_AW(StringCchCatN)
 
#define StringCbCatN   __MINGW_NAME_AW(StringCbCatN)
 
#define StringCchCatNEx   __MINGW_NAME_AW(StringCchCatNEx)
 
#define StringCbCatNEx   __MINGW_NAME_AW(StringCbCatNEx)
 
#define StringCchVPrintf   __MINGW_NAME_AW(StringCchVPrintf)
 
#define StringCbVPrintf   __MINGW_NAME_AW(StringCbVPrintf)
 
#define StringCchPrintf   __MINGW_NAME_AW(StringCchPrintf)
 
#define StringCbPrintf   __MINGW_NAME_AW(StringCbPrintf)
 
#define StringCchPrintfEx   __MINGW_NAME_AW(StringCchPrintfEx)
 
#define StringCbPrintfEx   __MINGW_NAME_AW(StringCbPrintfEx)
 
#define StringCchVPrintfEx   __MINGW_NAME_AW(StringCchVPrintfEx)
 
#define StringCbVPrintfEx   __MINGW_NAME_AW(StringCbVPrintfEx)
 
#define StringCchGets   __MINGW_NAME_AW(StringCchGets)
 
#define StringCbGets   __MINGW_NAME_AW(StringCbGets)
 
#define StringCchGetsEx   __MINGW_NAME_AW(StringCchGetsEx)
 
#define StringCbGetsEx   __MINGW_NAME_AW(StringCbGetsEx)
 
#define StringCchLength   __MINGW_NAME_AW(StringCchLength)
 
#define StringCbLength   __MINGW_NAME_AW(StringCbLength)
 
#define StringCopyWorkerA   StringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;
 
#define StringCopyWorkerW   StringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;
 
#define StringCopyExWorkerA   StringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;
 
#define StringCopyExWorkerW   StringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;
 
#define StringCatWorkerA   StringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;
 
#define StringCatWorkerW   StringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;
 
#define StringCatExWorkerA   StringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;
 
#define StringCatExWorkerW   StringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;
 
#define StringCatNWorkerA   StringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA;
 
#define StringCatNWorkerW   StringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW;
 
#define StringCatNExWorkerA   StringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA;
 
#define StringCatNExWorkerW   StringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW;
 
#define StringVPrintfWorkerA   StringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;
 
#define StringVPrintfWorkerW   StringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;
 
#define StringVPrintfExWorkerA   StringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;
 
#define StringVPrintfExWorkerW   StringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;
 
#define StringLengthWorkerA   StringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA;
 
#define StringLengthWorkerW   StringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;
 
#define StringGetsExWorkerA   StringGetsExWorkerA_instead_use_StringCchGetsA_or_StringCbGetsA
 
#define StringGetsExWorkerW   StringGetsExWorkerW_instead_use_StringCchGetsW_or_StringCbGetsW
 
#define STRSAFE_NO_DEPRECATE
 

Typedefs

typedef unsigned int size_t
 
typedef int ssize_t
 
typedef unsigned short wchar_t
 
typedef long HRESULT
 
typedef charSTRSAFE_LPSTR
 
typedef const charSTRSAFE_LPCSTR
 
typedef wchar_tSTRSAFE_LPWSTR
 
typedef const wchar_tSTRSAFE_LPCWSTR
 
typedef ULONG STRSAFE_DWORD
 

Functions

STRSAFEAPI StringCopyWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
 
STRSAFEAPI StringCopyWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
 
STRSAFEAPI StringCopyExWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCopyExWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCopyNWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
 
STRSAFEAPI StringCopyNWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
 
STRSAFEAPI StringCopyNExWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCopyNExWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCatWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
 
STRSAFEAPI StringCatWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
 
STRSAFEAPI StringCatExWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCatExWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCatNWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToAppend)
 
STRSAFEAPI StringCatNWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToAppend)
 
STRSAFEAPI StringCatNExWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, size_t cchToAppend, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCatNExWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cchToAppend, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringVPrintfWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat, va_list argList)
 
STRSAFEAPI StringVPrintfWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
 
STRSAFEAPI StringVPrintfExWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCSTR pszFormat, va_list argList)
 
STRSAFEAPI StringVPrintfExWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat, va_list argList)
 
STRSAFEAPI StringLengthWorkerA (STRSAFE_LPCSTR psz, size_t cchMax, size_t *pcchLength)
 
STRSAFEAPI StringLengthWorkerW (STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
 
STRSAFE_INLINE_API StringGetsExWorkerA (STRSAFE_LPSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFE_INLINE_API StringGetsExWorkerW (STRSAFE_LPWSTR pszDest, size_t cchDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCopyA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
 
STRSAFEAPI StringCchCopyW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
 
STRSAFEAPI StringCbCopyA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc)
 
STRSAFEAPI StringCbCopyW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
 
STRSAFEAPI StringCchCopyExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCopyExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCopyExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCopyExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCopyNA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
 
STRSAFEAPI StringCchCopyNW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
 
STRSAFEAPI StringCbCopyNA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, size_t cbToCopy)
 
STRSAFEAPI StringCbCopyNW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
 
STRSAFEAPI StringCchCopyNExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCopyNExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCopyNExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, size_t cbToCopy, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCopyNExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCatA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
 
STRSAFEAPI StringCchCatW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
 
STRSAFEAPI StringCbCatA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc)
 
STRSAFEAPI StringCbCatW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
 
STRSAFEAPI StringCchCatExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCatExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCatExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCatExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCatNA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToAppend)
 
STRSAFEAPI StringCchCatNW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToAppend)
 
STRSAFEAPI StringCbCatNA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, size_t cbToAppend)
 
STRSAFEAPI StringCbCatNW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToAppend)
 
STRSAFEAPI StringCchCatNExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToAppend, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchCatNExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToAppend, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCatNExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc, size_t cbToAppend, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCbCatNExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToAppend, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchVPrintfA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCchVPrintfW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCbVPrintfA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCbVPrintfW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCchPrintfA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
 
STRSAFEAPI StringCchPrintfW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
 
STRSAFEAPI StringCbPrintfA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat,...)
 
STRSAFEAPI StringCbPrintfW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
 
STRSAFEAPI StringCchPrintfExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCSTR pszFormat,...)
 
STRSAFEAPI StringCchPrintfExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
 
STRSAFEAPI StringCbPrintfExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCSTR pszFormat,...)
 
STRSAFEAPI StringCbPrintfExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
 
STRSAFEAPI StringCchVPrintfExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCchVPrintfExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCbVPrintfExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCSTR pszFormat, va_list argList)
 
STRSAFEAPI StringCbVPrintfExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat, va_list argList)
 
STRSAFE_INLINE_API StringCchGetsA (STRSAFE_LPSTR pszDest, size_t cchDest)
 
STRSAFE_INLINE_API StringCchGetsW (STRSAFE_LPWSTR pszDest, size_t cchDest)
 
STRSAFE_INLINE_API StringCbGetsA (STRSAFE_LPSTR pszDest, size_t cbDest)
 
STRSAFE_INLINE_API StringCbGetsW (STRSAFE_LPWSTR pszDest, size_t cbDest)
 
STRSAFE_INLINE_API StringCchGetsExA (STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFE_INLINE_API StringCchGetsExW (STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFE_INLINE_API StringCbGetsExA (STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFE_INLINE_API StringCbGetsExW (STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
 
STRSAFEAPI StringCchLengthA (STRSAFE_LPCSTR psz, size_t cchMax, size_t *pcchLength)
 
STRSAFEAPI StringCchLengthW (STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
 
STRSAFEAPI StringCbLengthA (STRSAFE_LPCSTR psz, size_t cbMax, size_t *pcbLength)
 
STRSAFEAPI StringCbLengthW (STRSAFE_LPCWSTR psz, size_t cbMax, size_t *pcbLength)
 

Macro Definition Documentation

◆ _HRESULT_DEFINED

#define _HRESULT_DEFINED

Definition at line 46 of file strsafe.h.

◆ _SIZE_T_DEFINED

#define _SIZE_T_DEFINED

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 21 of file strsafe.h.

◆ _SSIZE_T_DEFINED

#define _SSIZE_T_DEFINED

Definition at line 31 of file strsafe.h.

◆ _STRSAFE_EXTERN_C

#define _STRSAFE_EXTERN_C   extern

Definition at line 73 of file strsafe.h.

◆ _WCHAR_T_DEFINED

#define _WCHAR_T_DEFINED

Definition at line 41 of file strsafe.h.

◆ C_ASSERT

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

Definition at line 66 of file strsafe.h.

◆ FAILED

#define FAILED (   hr)    ((HRESULT)(hr) < 0)

Definition at line 55 of file strsafe.h.

◆ S_OK

#define S_OK   ((HRESULT)0x00000000L)

Definition at line 59 of file strsafe.h.

◆ StringCatExWorkerA

#define StringCatExWorkerA   StringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 1898 of file strsafe.h.

◆ StringCatExWorkerW

#define StringCatExWorkerW   StringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 1899 of file strsafe.h.

◆ StringCatNExWorkerA

#define StringCatNExWorkerA   StringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA;

Definition at line 1902 of file strsafe.h.

◆ StringCatNExWorkerW

#define StringCatNExWorkerW   StringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW;

Definition at line 1903 of file strsafe.h.

◆ StringCatNWorkerA

#define StringCatNWorkerA   StringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA;

Definition at line 1900 of file strsafe.h.

◆ StringCatNWorkerW

#define StringCatNWorkerW   StringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW;

Definition at line 1901 of file strsafe.h.

◆ StringCatWorkerA

#define StringCatWorkerA   StringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA;

Definition at line 1896 of file strsafe.h.

◆ StringCatWorkerW

#define StringCatWorkerW   StringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW;

Definition at line 1897 of file strsafe.h.

◆ StringCbCat

#define StringCbCat   __MINGW_NAME_AW(StringCbCat)

Definition at line 334 of file strsafe.h.

◆ StringCbCatEx

#define StringCbCatEx   __MINGW_NAME_AW(StringCbCatEx)

Definition at line 370 of file strsafe.h.

◆ StringCbCatN

#define StringCbCatN   __MINGW_NAME_AW(StringCbCatN)

Definition at line 416 of file strsafe.h.

◆ StringCbCatNEx

#define StringCbCatNEx   __MINGW_NAME_AW(StringCbCatNEx)

Definition at line 453 of file strsafe.h.

◆ StringCbCopy

#define StringCbCopy   __MINGW_NAME_AW(StringCbCopy)

Definition at line 155 of file strsafe.h.

◆ StringCbCopyEx

#define StringCbCopyEx   __MINGW_NAME_AW(StringCbCopyEx)

Definition at line 192 of file strsafe.h.

◆ StringCbCopyN

#define StringCbCopyN   __MINGW_NAME_AW(StringCbCopyN)

Definition at line 246 of file strsafe.h.

◆ StringCbCopyNEx

#define StringCbCopyNEx   __MINGW_NAME_AW(StringCbCopyNEx)

Definition at line 284 of file strsafe.h.

◆ StringCbGets

#define StringCbGets   __MINGW_NAME_AW(StringCbGets)

Definition at line 742 of file strsafe.h.

◆ StringCbGetsEx

#define StringCbGetsEx   __MINGW_NAME_AW(StringCbGetsEx)

Definition at line 796 of file strsafe.h.

◆ StringCbLength

#define StringCbLength   __MINGW_NAME_AW(StringCbLength)

Definition at line 856 of file strsafe.h.

◆ StringCbPrintf

#define StringCbPrintf   __MINGW_NAME_AW(StringCbPrintf)

Definition at line 544 of file strsafe.h.

◆ StringCbPrintfEx

#define StringCbPrintfEx   __MINGW_NAME_AW(StringCbPrintfEx)

Definition at line 600 of file strsafe.h.

◆ StringCbVPrintf

#define StringCbVPrintf   __MINGW_NAME_AW(StringCbVPrintf)

Definition at line 499 of file strsafe.h.

◆ StringCbVPrintfEx

#define StringCbVPrintfEx   __MINGW_NAME_AW(StringCbVPrintfEx)

Definition at line 676 of file strsafe.h.

◆ StringCchCat

#define StringCchCat   __MINGW_NAME_AW(StringCchCat)

Definition at line 317 of file strsafe.h.

◆ StringCchCatEx

#define StringCchCatEx   __MINGW_NAME_AW(StringCchCatEx)

Definition at line 352 of file strsafe.h.

◆ StringCchCatN

#define StringCchCatN   __MINGW_NAME_AW(StringCchCatN)

Definition at line 399 of file strsafe.h.

◆ StringCchCatNEx

#define StringCchCatNEx   __MINGW_NAME_AW(StringCchCatNEx)

Definition at line 436 of file strsafe.h.

◆ StringCchCopy

#define StringCchCopy   __MINGW_NAME_AW(StringCchCopy)

Definition at line 139 of file strsafe.h.

◆ StringCchCopyEx

#define StringCchCopyEx   __MINGW_NAME_AW(StringCchCopyEx)

Definition at line 173 of file strsafe.h.

◆ StringCchCopyN

#define StringCchCopyN   __MINGW_NAME_AW(StringCchCopyN)

Definition at line 227 of file strsafe.h.

◆ StringCchCopyNEx

#define StringCchCopyNEx   __MINGW_NAME_AW(StringCchCopyNEx)

Definition at line 267 of file strsafe.h.

◆ StringCchGets

#define StringCchGets   __MINGW_NAME_AW(StringCchGets)

Definition at line 713 of file strsafe.h.

◆ StringCchGetsEx

#define StringCchGetsEx   __MINGW_NAME_AW(StringCchGetsEx)

Definition at line 767 of file strsafe.h.

◆ StringCchLength

#define StringCchLength   __MINGW_NAME_AW(StringCchLength)

Definition at line 829 of file strsafe.h.

◆ StringCchPrintf

#define StringCchPrintf   __MINGW_NAME_AW(StringCchPrintf)

Definition at line 517 of file strsafe.h.

◆ StringCchPrintfEx

#define StringCchPrintfEx   __MINGW_NAME_AW(StringCchPrintfEx)

Definition at line 572 of file strsafe.h.

◆ StringCchVPrintf

#define StringCchVPrintf   __MINGW_NAME_AW(StringCchVPrintf)

Definition at line 482 of file strsafe.h.

◆ StringCchVPrintfEx

#define StringCchVPrintfEx   __MINGW_NAME_AW(StringCchVPrintfEx)

Definition at line 647 of file strsafe.h.

◆ StringCopyExWorkerA

#define StringCopyExWorkerA   StringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 1894 of file strsafe.h.

◆ StringCopyExWorkerW

#define StringCopyExWorkerW   StringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 1895 of file strsafe.h.

◆ StringCopyWorkerA

#define StringCopyWorkerA   StringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA;

Definition at line 1892 of file strsafe.h.

◆ StringCopyWorkerW

#define StringCopyWorkerW   StringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW;

Definition at line 1893 of file strsafe.h.

◆ StringGetsExWorkerA

#define StringGetsExWorkerA   StringGetsExWorkerA_instead_use_StringCchGetsA_or_StringCbGetsA

Definition at line 1910 of file strsafe.h.

◆ StringGetsExWorkerW

#define StringGetsExWorkerW   StringGetsExWorkerW_instead_use_StringCchGetsW_or_StringCbGetsW

Definition at line 1911 of file strsafe.h.

◆ StringLengthWorkerA

#define StringLengthWorkerA   StringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA;

Definition at line 1908 of file strsafe.h.

◆ StringLengthWorkerW

#define StringLengthWorkerW   StringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW;

Definition at line 1909 of file strsafe.h.

◆ StringVPrintfExWorkerA

#define StringVPrintfExWorkerA   StringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;

Definition at line 1906 of file strsafe.h.

◆ StringVPrintfExWorkerW

#define StringVPrintfExWorkerW   StringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;

Definition at line 1907 of file strsafe.h.

◆ StringVPrintfWorkerA

#define StringVPrintfWorkerA   StringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA;

Definition at line 1904 of file strsafe.h.

◆ StringVPrintfWorkerW

#define StringVPrintfWorkerW   StringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW;

Definition at line 1905 of file strsafe.h.

◆ STRSAFE_E_END_OF_FILE

#define STRSAFE_E_END_OF_FILE   ((HRESULT)0x80070026L)

Definition at line 105 of file strsafe.h.

◆ STRSAFE_E_INSUFFICIENT_BUFFER

#define STRSAFE_E_INSUFFICIENT_BUFFER   ((HRESULT)0x8007007AL)

Definition at line 103 of file strsafe.h.

◆ STRSAFE_E_INVALID_PARAMETER

#define STRSAFE_E_INVALID_PARAMETER   ((HRESULT)0x80070057L)

Definition at line 104 of file strsafe.h.

◆ STRSAFE_FAILURE_BYTE

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

Definition at line 98 of file strsafe.h.

◆ STRSAFE_FILL_BEHIND_NULL

#define STRSAFE_FILL_BEHIND_NULL   0x00000200

Definition at line 87 of file strsafe.h.

◆ STRSAFE_FILL_BYTE

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

Definition at line 97 of file strsafe.h.

◆ STRSAFE_FILL_ON_FAILURE

#define STRSAFE_FILL_ON_FAILURE   0x00000400

Definition at line 88 of file strsafe.h.

◆ STRSAFE_GET_FILL_PATTERN

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

Definition at line 100 of file strsafe.h.

◆ STRSAFE_IGNORE_NULL_UNICODE_STRINGS

#define STRSAFE_IGNORE_NULL_UNICODE_STRINGS   0x00010000

Definition at line 91 of file strsafe.h.

◆ STRSAFE_IGNORE_NULLS

#define STRSAFE_IGNORE_NULLS   0x00000100

Definition at line 86 of file strsafe.h.

◆ STRSAFE_INLINE_API

#define STRSAFE_INLINE_API   __CRT_INLINE HRESULT WINAPI

Definition at line 81 of file strsafe.h.

◆ STRSAFE_MAX_CCH

#define STRSAFE_MAX_CCH   2147483647

Definition at line 83 of file strsafe.h.

◆ STRSAFE_NO_DEPRECATE

#define STRSAFE_NO_DEPRECATE

Definition at line 1915 of file strsafe.h.

◆ STRSAFE_NO_TRUNCATION

#define STRSAFE_NO_TRUNCATION   0x00001000

Definition at line 90 of file strsafe.h.

◆ STRSAFE_NULL_ON_FAILURE

#define STRSAFE_NULL_ON_FAILURE   0x00000800

Definition at line 89 of file strsafe.h.

◆ STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED

#define STRSAFE_UNICODE_STRING_DEST_NULL_TERMINATED   0x00020000

Definition at line 92 of file strsafe.h.

◆ STRSAFE_UNICODE_STRING_VALID_FLAGS

Definition at line 95 of file strsafe.h.

◆ STRSAFE_VALID_FLAGS

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

Definition at line 94 of file strsafe.h.

◆ STRSAFEAPI

#define STRSAFEAPI   static __inline HRESULT WINAPI

Definition at line 80 of file strsafe.h.

◆ SUCCEEDED

#define SUCCEEDED (   hr)    ((HRESULT)(hr) >= 0)

Definition at line 51 of file strsafe.h.

◆ WINAPI

#define WINAPI   __stdcall

Definition at line 77 of file strsafe.h.

Typedef Documentation

◆ HRESULT

typedef long HRESULT

Definition at line 47 of file strsafe.h.

◆ size_t

typedef unsigned int size_t

Definition at line 26 of file strsafe.h.

◆ ssize_t

typedef int ssize_t

Definition at line 36 of file strsafe.h.

◆ STRSAFE_DWORD

Definition at line 112 of file strsafe.h.

◆ STRSAFE_LPCSTR

Definition at line 108 of file strsafe.h.

◆ STRSAFE_LPCWSTR

Definition at line 110 of file strsafe.h.

◆ STRSAFE_LPSTR

typedef char* STRSAFE_LPSTR

Definition at line 107 of file strsafe.h.

◆ STRSAFE_LPWSTR

Definition at line 109 of file strsafe.h.

◆ wchar_t

typedef unsigned short wchar_t

Definition at line 42 of file strsafe.h.

Function Documentation

◆ StringCatExWorkerA()

STRSAFEAPI StringCatExWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 1259 of file strsafe.h.

1259  {
1260  HRESULT hr = S_OK;
1261  STRSAFE_LPSTR pszDestEnd = pszDest;
1262  size_t cchRemaining = 0;
1264  else {
1265  size_t cchDestLength;
1267  if(!pszDest) {
1268  if((cchDest==0) && (cbDest==0)) cchDestLength = 0;
1270  } else {
1271  hr = StringLengthWorkerA(pszDest,cchDest,&cchDestLength);
1272  if(SUCCEEDED(hr)) {
1273  pszDestEnd = pszDest + cchDestLength;
1274  cchRemaining = cchDest - cchDestLength;
1275  }
1276  }
1277  if(!pszSrc) pszSrc = "";
1278  } else {
1279  hr = StringLengthWorkerA(pszDest,cchDest,&cchDestLength);
1280  if(SUCCEEDED(hr)) {
1281  pszDestEnd = pszDest + cchDestLength;
1282  cchRemaining = cchDest - cchDestLength;
1283  }
1284  }
1285  if(SUCCEEDED(hr)) {
1286  if(cchDest==0) {
1287  if(*pszSrc!='\0') {
1288  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1290  }
1291  } else hr = StringCopyExWorkerA(pszDestEnd,cchRemaining,(cchRemaining*sizeof(char)) + (cbDest % sizeof(char)),pszSrc,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
1292  }
1293  }
1294  if(FAILED(hr)) {
1295  if(pszDest) {
1297  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1299  pszDestEnd = pszDest;
1300  cchRemaining = cchDest;
1301  } else if(cchDest > 0) {
1302  pszDestEnd = pszDest + cchDest - 1;
1303  cchRemaining = 1;
1304  *pszDestEnd = '\0';
1305  }
1306  }
1308  if(cchDest > 0) {
1309  pszDestEnd = pszDest;
1310  cchRemaining = cchDest;
1311  *pszDestEnd = '\0';
1312  }
1313  }
1314  }
1315  }
1317  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1318  if(pcchRemaining) *pcchRemaining = cchRemaining;
1319  }
1320  return hr;
1321 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
#define StringLengthWorkerA
Definition: strsafe.h:1908
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
#define StringCopyExWorkerA
Definition: strsafe.h:1894
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringCatExWorkerW()

STRSAFEAPI StringCatExWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 1323 of file strsafe.h.

1323  {
1324  HRESULT hr = S_OK;
1325  STRSAFE_LPWSTR pszDestEnd = pszDest;
1326  size_t cchRemaining = 0;
1328  else {
1329  size_t cchDestLength;
1331  if(!pszDest) {
1332  if((cchDest==0) && (cbDest==0)) cchDestLength = 0;
1334  } else {
1335  hr = StringLengthWorkerW(pszDest,cchDest,&cchDestLength);
1336  if(SUCCEEDED(hr)) {
1337  pszDestEnd = pszDest + cchDestLength;
1338  cchRemaining = cchDest - cchDestLength;
1339  }
1340  }
1341  if(!pszSrc) pszSrc = L"";
1342  } else {
1343  hr = StringLengthWorkerW(pszDest,cchDest,&cchDestLength);
1344  if(SUCCEEDED(hr)) {
1345  pszDestEnd = pszDest + cchDestLength;
1346  cchRemaining = cchDest - cchDestLength;
1347  }
1348  }
1349  if(SUCCEEDED(hr)) {
1350  if(cchDest==0) {
1351  if(*pszSrc!=L'\0') {
1352  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1354  }
1355  } else hr = StringCopyExWorkerW(pszDestEnd,cchRemaining,(cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)),pszSrc,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
1356  }
1357  }
1358  if(FAILED(hr)) {
1359  if(pszDest) {
1361  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1363  pszDestEnd = pszDest;
1364  cchRemaining = cchDest;
1365  } else if(cchDest > 0) {
1366  pszDestEnd = pszDest + cchDest - 1;
1367  cchRemaining = 1;
1368  *pszDestEnd = L'\0';
1369  }
1370  }
1372  if(cchDest > 0) {
1373  pszDestEnd = pszDest;
1374  cchRemaining = cchDest;
1375  *pszDestEnd = L'\0';
1376  }
1377  }
1378  }
1379  }
1381  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1382  if(pcchRemaining) *pcchRemaining = cchRemaining;
1383  }
1384  return hr;
1385 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define StringCopyExWorkerW
Definition: strsafe.h:1895
#define StringLengthWorkerW
Definition: strsafe.h:1909
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringCatNExWorkerA()

STRSAFEAPI StringCatNExWorkerA ( 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 1403 of file strsafe.h.

1403  {
1404  HRESULT hr = S_OK;
1405  STRSAFE_LPSTR pszDestEnd = pszDest;
1406  size_t cchRemaining = 0;
1407  size_t cchDestLength = 0;
1409  else if(cchToAppend > STRSAFE_MAX_CCH) hr = STRSAFE_E_INVALID_PARAMETER;
1410  else {
1412  if(!pszDest) {
1413  if((cchDest==0) && (cbDest==0)) cchDestLength = 0;
1415  } else {
1416  hr = StringLengthWorkerA(pszDest,cchDest,&cchDestLength);
1417  if(SUCCEEDED(hr)) {
1418  pszDestEnd = pszDest + cchDestLength;
1419  cchRemaining = cchDest - cchDestLength;
1420  }
1421  }
1422  if(!pszSrc) pszSrc = "";
1423  } else {
1424  hr = StringLengthWorkerA(pszDest,cchDest,&cchDestLength);
1425  if(SUCCEEDED(hr)) {
1426  pszDestEnd = pszDest + cchDestLength;
1427  cchRemaining = cchDest - cchDestLength;
1428  }
1429  }
1430  if(SUCCEEDED(hr)) {
1431  if(cchDest==0) {
1432  if((cchToAppend!=0) && (*pszSrc!='\0')) {
1433  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1435  }
1436  } else hr = StringCopyNExWorkerA(pszDestEnd,cchRemaining,(cchRemaining*sizeof(char)) + (cbDest % sizeof(char)),pszSrc,cchToAppend,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
1437  }
1438  }
1439  if(FAILED(hr)) {
1440  if(pszDest) {
1442  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1444  pszDestEnd = pszDest;
1445  cchRemaining = cchDest;
1446  } else if(cchDest > 0) {
1447  pszDestEnd = pszDest + cchDest - 1;
1448  cchRemaining = 1;
1449  *pszDestEnd = '\0';
1450  }
1451  }
1453  if(cchDest > 0) {
1454  pszDestEnd = pszDest;
1455  cchRemaining = cchDest;
1456  *pszDestEnd = '\0';
1457  }
1458  }
1459  }
1460  }
1462  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1463  if(pcchRemaining) *pcchRemaining = cchRemaining;
1464  }
1465  return hr;
1466 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
#define StringLengthWorkerA
Definition: strsafe.h:1908
STRSAFEAPI StringCopyNExWorkerA(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: strsafe.h:1101
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringCatNExWorkerW()

STRSAFEAPI StringCatNExWorkerW ( 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 1468 of file strsafe.h.

1468  {
1469  HRESULT hr = S_OK;
1470  STRSAFE_LPWSTR pszDestEnd = pszDest;
1471  size_t cchRemaining = 0;
1472  size_t cchDestLength = 0;
1474  else if(cchToAppend > STRSAFE_MAX_CCH) hr = STRSAFE_E_INVALID_PARAMETER;
1475  else {
1477  if(!pszDest) {
1478  if((cchDest==0) && (cbDest==0)) cchDestLength = 0;
1480  } else {
1481  hr = StringLengthWorkerW(pszDest,cchDest,&cchDestLength);
1482  if(SUCCEEDED(hr)) {
1483  pszDestEnd = pszDest + cchDestLength;
1484  cchRemaining = cchDest - cchDestLength;
1485  }
1486  }
1487  if(!pszSrc) pszSrc = L"";
1488  } else {
1489  hr = StringLengthWorkerW(pszDest,cchDest,&cchDestLength);
1490  if(SUCCEEDED(hr)) {
1491  pszDestEnd = pszDest + cchDestLength;
1492  cchRemaining = cchDest - cchDestLength;
1493  }
1494  }
1495  if(SUCCEEDED(hr)) {
1496  if(cchDest==0) {
1497  if((cchToAppend!=0) && (*pszSrc!=L'\0')) {
1498  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1500  }
1501  } else hr = StringCopyNExWorkerW(pszDestEnd,cchRemaining,(cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)),pszSrc,cchToAppend,&pszDestEnd,&cchRemaining,dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
1502  }
1503  }
1504  if(FAILED(hr)) {
1505  if(pszDest) {
1507  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1509  pszDestEnd = pszDest;
1510  cchRemaining = cchDest;
1511  } else if(cchDest > 0) {
1512  pszDestEnd = pszDest + cchDest - 1;
1513  cchRemaining = 1;
1514  *pszDestEnd = L'\0';
1515  }
1516  }
1518  if(cchDest > 0) {
1519  pszDestEnd = pszDest;
1520  cchRemaining = cchDest;
1521  *pszDestEnd = L'\0';
1522  }
1523  }
1524  }
1525  }
1527  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1528  if(pcchRemaining) *pcchRemaining = cchRemaining;
1529  }
1530  return hr;
1531 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
STRSAFEAPI StringCopyNExWorkerW(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: strsafe.h:1172
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define StringLengthWorkerW
Definition: strsafe.h:1909
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringCatNWorkerA()

STRSAFEAPI StringCatNWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToAppend 
)

Definition at line 1387 of file strsafe.h.

1387  {
1388  HRESULT hr;
1389  size_t cchDestLength;
1390  hr = StringLengthWorkerA(pszDest,cchDest,&cchDestLength);
1391  if(SUCCEEDED(hr)) hr = StringCopyNWorkerA(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc,cchToAppend);
1392  return hr;
1393 }
HRESULT hr
Definition: shlfolder.c:183
#define StringLengthWorkerA
Definition: strsafe.h:1908
#define SUCCEEDED(hr)
Definition: strsafe.h:51
STRSAFEAPI StringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:1065
LONG HRESULT
Definition: typedefs.h:77

◆ StringCatNWorkerW()

STRSAFEAPI StringCatNWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToAppend 
)

Definition at line 1395 of file strsafe.h.

1395  {
1396  HRESULT hr;
1397  size_t cchDestLength;
1398  hr = StringLengthWorkerW(pszDest,cchDest,&cchDestLength);
1399  if(SUCCEEDED(hr)) hr = StringCopyNWorkerW(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc,cchToAppend);
1400  return hr;
1401 }
HRESULT hr
Definition: shlfolder.c:183
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
STRSAFEAPI StringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:1083
#define StringLengthWorkerW
Definition: strsafe.h:1909

◆ StringCatWorkerA()

STRSAFEAPI StringCatWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 1243 of file strsafe.h.

1243  {
1244  HRESULT hr;
1245  size_t cchDestLength;
1246  hr = StringLengthWorkerA(pszDest,cchDest,&cchDestLength);
1247  if(SUCCEEDED(hr)) hr = StringCopyWorkerA(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc);
1248  return hr;
1249 }
HRESULT hr
Definition: shlfolder.c:183
#define StringLengthWorkerA
Definition: strsafe.h:1908
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
#define StringCopyWorkerA
Definition: strsafe.h:1892

◆ StringCatWorkerW()

STRSAFEAPI StringCatWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 1251 of file strsafe.h.

1251  {
1252  HRESULT hr;
1253  size_t cchDestLength;
1254  hr = StringLengthWorkerW(pszDest,cchDest,&cchDestLength);
1255  if(SUCCEEDED(hr)) hr = StringCopyWorkerW(pszDest + cchDestLength,cchDest - cchDestLength,pszSrc);
1256  return hr;
1257 }
HRESULT hr
Definition: shlfolder.c:183
#define StringCopyWorkerW
Definition: strsafe.h:1893
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
#define StringLengthWorkerW
Definition: strsafe.h:1909

◆ StringCbCatA()

STRSAFEAPI StringCbCatA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 337 of file strsafe.h.

337  {
338  if(cbDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
339  return StringCatWorkerA(pszDest,cbDest,pszSrc);
340 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringCatWorkerA
Definition: strsafe.h:1896

Referenced by dump(), and register_service_exA().

◆ StringCbCatExA()

STRSAFEAPI StringCbCatExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 373 of file strsafe.h.

373  {
374  HRESULT hr;
375  size_t cchRemaining = 0;
377  else hr = StringCatExWorkerA(pszDest,cbDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
378  if((SUCCEEDED(hr) || hr == STRSAFE_E_INSUFFICIENT_BUFFER) && pcbRemaining)
379  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
380  return hr;
381 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCatExWorkerA
Definition: strsafe.h:1898

◆ StringCbCatExW()

STRSAFEAPI StringCbCatExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 383 of file strsafe.h.

383  {
384  HRESULT hr;
385  size_t cchDest = cbDest / sizeof(wchar_t);
386  size_t cchRemaining = 0;
387 
389  else hr = StringCatExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
390  if((SUCCEEDED(hr) || hr == STRSAFE_E_INSUFFICIENT_BUFFER) && pcbRemaining)
391  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
392  return hr;
393 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCatExWorkerW
Definition: strsafe.h:1899

◆ StringCbCatNA()

STRSAFEAPI StringCbCatNA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cbToAppend 
)

Definition at line 419 of file strsafe.h.

419  {
420  if(cbDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
421  return StringCatNWorkerA(pszDest,cbDest,pszSrc,cbToAppend);
422 }
#define StringCatNWorkerA
Definition: strsafe.h:1900
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83

◆ StringCbCatNExA()

STRSAFEAPI StringCbCatNExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cbToAppend,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 456 of file strsafe.h.

456  {
457  HRESULT hr;
458  size_t cchRemaining = 0;
460  else hr = StringCatNExWorkerA(pszDest,cbDest,cbDest,pszSrc,cbToAppend,ppszDestEnd,&cchRemaining,dwFlags);
461  if((SUCCEEDED(hr) || hr == STRSAFE_E_INSUFFICIENT_BUFFER) && pcbRemaining)
462  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
463  return hr;
464 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
#define StringCatNExWorkerA
Definition: strsafe.h:1902
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCbCatNExW()

STRSAFEAPI StringCbCatNExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cbToAppend,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 466 of file strsafe.h.

466  {
467  HRESULT hr;
468  size_t cchDest = cbDest / sizeof(wchar_t);
469  size_t cchToAppend = cbToAppend / sizeof(wchar_t);
470  size_t cchRemaining = 0;
472  else hr = StringCatNExWorkerW(pszDest,cchDest,cbDest,pszSrc,cchToAppend,ppszDestEnd,&cchRemaining,dwFlags);
473  if((SUCCEEDED(hr) || hr == STRSAFE_E_INSUFFICIENT_BUFFER) && pcbRemaining)
474  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
475  return hr;
476 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCatNExWorkerW
Definition: strsafe.h:1903

◆ StringCbCatNW()

STRSAFEAPI StringCbCatNW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cbToAppend 
)

Definition at line 424 of file strsafe.h.

424  {
425  size_t cchDest = cbDest / sizeof(wchar_t);
426  size_t cchToAppend = cbToAppend / sizeof(wchar_t);
427 
428  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
429  return StringCatNWorkerW(pszDest,cchDest,pszSrc,cchToAppend);
430 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned short wchar_t
Definition: strsafe.h:42
#define StringCatNWorkerW
Definition: strsafe.h:1901

Referenced by SdbpAppendLayer().

◆ StringCbCatW()

◆ StringCbCopyA()

STRSAFEAPI StringCbCopyA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 161 of file strsafe.h.

161  {
162  if(cbDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
163  return StringCopyWorkerA(pszDest,cbDest,pszSrc);
164 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringCopyWorkerA
Definition: strsafe.h:1892

Referenced by dump(), FakeVersion(), handle_readdir(), NSP_GetServiceByNameHeapAllocW(), readdir_add_dots(), service_process(), and xstrsaveA().

◆ StringCbCopyExA()

STRSAFEAPI StringCbCopyExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 198 of file strsafe.h.

198  {
199  HRESULT hr;
200  size_t cchRemaining = 0;
201  if(cbDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
202  hr = StringCopyExWorkerA(pszDest,cbDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
204  if(pcbRemaining)
205  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
206  }
207  return hr;
208 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
#define StringCopyExWorkerA
Definition: strsafe.h:1894
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCbCopyExW()

STRSAFEAPI StringCbCopyExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 210 of file strsafe.h.

210  {
211  HRESULT hr;
212  size_t cchDest = cbDest / sizeof(wchar_t);
213  size_t cchRemaining = 0;
214 
215  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
216  hr = StringCopyExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,&cchRemaining,dwFlags);
218  if(pcbRemaining)
219  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
220  }
221  return hr;
222 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCopyExWorkerW
Definition: strsafe.h:1895

Referenced by _LocalGetPrinterLevel0(), _LocalGetPrinterLevel1(), _LocalGetPrinterLevel2(), _LocalGetPrinterLevel4(), _LocalGetPrinterLevel5(), _MakePrinterSubKey(), GetNTObjectSymbolicLinkTarget(), CEnumNTDirectory::Initialize(), and StreamingDeviceSetupW().

◆ StringCbCopyNA()

STRSAFEAPI StringCbCopyNA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cbToCopy 
)

Definition at line 249 of file strsafe.h.

249  {
250  if(cbDest > STRSAFE_MAX_CCH || cbToCopy > STRSAFE_MAX_CCH)
252  return StringCopyNWorkerA(pszDest,cbDest,pszSrc,cbToCopy);
253 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
STRSAFEAPI StringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:1065

◆ StringCbCopyNExA()

STRSAFEAPI StringCbCopyNExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cbToCopy,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 287 of file strsafe.h.

287  {
288  HRESULT hr;
289  size_t cchRemaining = 0;
290  if(cbDest > STRSAFE_MAX_CCH)
292  else
293  hr = StringCopyNExWorkerA(pszDest,cbDest,cbDest,pszSrc,cbToCopy,ppszDestEnd,&cchRemaining,dwFlags);
294  if((SUCCEEDED(hr) || hr == STRSAFE_E_INSUFFICIENT_BUFFER) && pcbRemaining)
295  *pcbRemaining = cchRemaining;
296  return hr;
297 }
HRESULT hr
Definition: shlfolder.c:183
STRSAFEAPI StringCopyNExWorkerA(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: strsafe.h:1101
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCbCopyNExW()

STRSAFEAPI StringCbCopyNExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cbToCopy,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 299 of file strsafe.h.

299  {
300  HRESULT hr;
301  size_t cchDest;
302  size_t cchToCopy;
303  size_t cchRemaining = 0;
304  cchDest = cbDest / sizeof(wchar_t);
305  cchToCopy = cbToCopy / sizeof(wchar_t);
307  else hr = StringCopyNExWorkerW(pszDest,cchDest,cbDest,pszSrc,cchToCopy,ppszDestEnd,&cchRemaining,dwFlags);
308  if((SUCCEEDED(hr) || hr == STRSAFE_E_INSUFFICIENT_BUFFER) && pcbRemaining)
309  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
310  return hr;
311 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
STRSAFEAPI StringCopyNExWorkerW(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: strsafe.h:1172
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCbCopyNW()

STRSAFEAPI StringCbCopyNW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cbToCopy 
)

Definition at line 255 of file strsafe.h.

255  {
256  size_t cchDest = cbDest / sizeof(wchar_t);
257  size_t cchToCopy = cbToCopy / sizeof(wchar_t);
258  if(cchDest > STRSAFE_MAX_CCH || cchToCopy > STRSAFE_MAX_CCH)
260  return StringCopyNWorkerW(pszDest,cchDest,pszSrc,cchToCopy);
261 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned short wchar_t
Definition: strsafe.h:42
STRSAFEAPI StringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:1083

Referenced by CEnumRegRoot::EnumerateNext(), CEnumNTDirectory::EnumerateNext(), CRegistryFolder::FormatValueData(), LogfAllocAndBuildNewRecord(), MakeStrRetFromString(), CEnumRegKey::NextKey(), CEnumRegKey::NextValue(), CNtObjectFolder::ResolveSymLink(), SdbpBuildSignMediaId(), SdbpGetPermLayersInternal(), and SdbQueryDataExTagID().

◆ StringCbCopyW()

STRSAFEAPI StringCbCopyW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 166 of file strsafe.h.

166  {
167  size_t cchDest = cbDest / sizeof(wchar_t);
168  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
169  return StringCopyWorkerW(pszDest,cchDest,pszSrc);
170 }
#define StringCopyWorkerW
Definition: strsafe.h:1893
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned short wchar_t
Definition: strsafe.h:42

Referenced by CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >::BindToObject(), CDeviceNode::CDeviceNode(), CClassNode::ConvertResourceDescriptorToString(), CopySystemProfile(), CreateStandardProfile(), CreateUserProfileExW(), DoFileTypeIconLocation(), EditTypeDlg_OnChangeIcon(), EditTypeDlg_OnCommand(), EditTypeDlg_OnInitDialog(), EditTypeDlg_ReadClass(), EditTypeDlg_UpdateEntryIcon(), EnumPickIconResourceProc(), FakeVersion(), CRegistryFolder::FormatContentsForDisplay(), CRegistryFolder::FormatValueData(), GetDisplayNameFileAndID(), GetEventMessageFileDLL(), GetExplorerRegValueSet(), GetFileTypeIconsEx(), COpenWithList::GetName(), GetUserProfileDirectoryW(), CFileDefExt::InitGeneralPage(), InitPropertiesDlg(), IntEnumFontFamilies(), LoadBootIni(), COpenWithList::LoadFromProgIdKey(), LoadLogFile(), LoadSystemIni(), LoadUserProfileW(), NPEnumResource(), CInternetToolbar::OnMenuDropDown(), pBuildFileList(), pCDevSettings_AllocAndCopyString(), PlayLogonSoundThread(), ProcessCmdLine(), ProcessorDlgProc(), CNtObjectFolder::ResolveSymLink(), set_buffer(), SetFileTypeEntryDefaultIcon(), SH_ShowPropertiesDialog(), START_TEST(), Test_NtGdiAddFontResourceW(), TestGetUserObjectInfoW(), UpdateUsersShellFolderSettings(), WrapEnumFontFamiliesExW(), and xstrsave().

◆ StringCbGetsA()

STRSAFE_INLINE_API StringCbGetsA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest 
)

Definition at line 745 of file strsafe.h.

745  {
746  HRESULT hr;
747  size_t cchDest;
748  cchDest = cbDest / sizeof(char);
750  else hr = StringGetsExWorkerA(pszDest,cchDest,cbDest,NULL,NULL,0);
751  return hr;
752 }
#define StringGetsExWorkerA
Definition: strsafe.h:1910
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77

◆ StringCbGetsExA()

STRSAFE_INLINE_API StringCbGetsExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 799 of file strsafe.h.

799  {
800  HRESULT hr;
801  size_t cchDest;
802  size_t cchRemaining = 0;
803  cchDest = cbDest / sizeof(char);
805  else hr = StringGetsExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags);
807  if(pcbRemaining) *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
808  }
809  return hr;
810 }
#define StringGetsExWorkerA
Definition: strsafe.h:1910
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_E_END_OF_FILE
Definition: strsafe.h:105

◆ StringCbGetsExW()

STRSAFE_INLINE_API StringCbGetsExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 812 of file strsafe.h.

812  {
813  HRESULT hr;
814  size_t cchDest;
815  size_t cchRemaining = 0;
816  cchDest = cbDest / sizeof(wchar_t);
818  else hr = StringGetsExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags);
820  if(pcbRemaining) *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
821  }
822  return hr;
823 }
HRESULT hr
Definition: shlfolder.c:183
#define StringGetsExWorkerW
Definition: strsafe.h:1911
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_E_END_OF_FILE
Definition: strsafe.h:105

◆ StringCbGetsW()

STRSAFE_INLINE_API StringCbGetsW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest 
)

Definition at line 754 of file strsafe.h.

754  {
755  HRESULT hr;
756  size_t cchDest;
757  cchDest = cbDest / sizeof(wchar_t);
759  else hr = StringGetsExWorkerW(pszDest,cchDest,cbDest,NULL,NULL,0);
760  return hr;
761 }
HRESULT hr
Definition: shlfolder.c:183
#define StringGetsExWorkerW
Definition: strsafe.h:1911
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42

◆ StringCbLengthA()

STRSAFEAPI StringCbLengthA ( STRSAFE_LPCSTR  psz,
size_t  cbMax,
size_t pcbLength 
)

Definition at line 859 of file strsafe.h.

859  {
860  HRESULT hr;
861  size_t cchMax;
862  size_t cchLength = 0;
863  cchMax = cbMax / sizeof(char);
865  else hr = StringLengthWorkerA(psz,cchMax,&cchLength);
866  if(pcbLength) {
867  if(SUCCEEDED(hr)) {
868  *pcbLength = cchLength*sizeof(char);
869  } else {
870  *pcbLength = 0;
871  }
872  }
873  return hr;
874 }
HRESULT hr
Definition: shlfolder.c:183
#define StringLengthWorkerA
Definition: strsafe.h:1908
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax

Referenced by xstrsaveA().

◆ StringCbLengthW()

STRSAFEAPI StringCbLengthW ( STRSAFE_LPCWSTR  psz,
size_t  cbMax,
size_t pcbLength 
)

Definition at line 876 of file strsafe.h.

876  {
877  HRESULT hr;
878  size_t cchMax;
879  size_t cchLength = 0;
880  cchMax = cbMax / sizeof(wchar_t);
882  else hr = StringLengthWorkerW(psz,cchMax,&cchLength);
883  if(pcbLength) {
884  if(SUCCEEDED(hr)) {
885  *pcbLength = cchLength*sizeof(wchar_t);
886  } else {
887  *pcbLength = 0;
888  }
889  }
890  return hr;
891 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
unsigned short wchar_t
Definition: strsafe.h:42
#define StringLengthWorkerW
Definition: strsafe.h:1909

Referenced by xstrsave().

◆ StringCbPrintfA()

STRSAFEAPI StringCbPrintfA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszFormat,
  ... 
)

Definition at line 547 of file strsafe.h.

547  {
548  HRESULT hr;
549  va_list argList;
550  if(cbDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
551  va_start(argList,pszFormat);
552  hr = StringVPrintfWorkerA(pszDest,cbDest,pszFormat,argList);
553  va_end(argList);
554  return hr;
555 }
HRESULT hr
Definition: shlfolder.c:183
#define StringVPrintfWorkerA
Definition: strsafe.h:1904
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by dump(), QueryConfig2A(), and send_msg().

◆ StringCbPrintfExA()

STRSAFEAPI StringCbPrintfExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCSTR  pszFormat,
  ... 
)

Definition at line 603 of file strsafe.h.

603  {
604  HRESULT hr;
605  size_t cchDest;
606  size_t cchRemaining = 0;
607  cchDest = cbDest / sizeof(char);
609  else {
610  va_list argList;
611  va_start(argList,pszFormat);
612  hr = StringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
613  va_end(argList);
614  }
616  if(pcbRemaining) {
617  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
618  }
619  }
620  return hr;
621 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define va_end(ap)
Definition: acmsvcex.h:90
#define StringVPrintfExWorkerA
Definition: strsafe.h:1906
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define va_start(ap, A)
Definition: acmsvcex.h:91

◆ StringCbPrintfExW()

STRSAFEAPI StringCbPrintfExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCWSTR  pszFormat,
  ... 
)

Definition at line 623 of file strsafe.h.

623  {
624  HRESULT hr;
625  size_t cchDest;
626  size_t cchRemaining = 0;
627  cchDest = cbDest / sizeof(wchar_t);
629  else {
630  va_list argList;
631  va_start(argList,pszFormat);
632  hr = StringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
633  va_end(argList);
634  }
636  if(pcbRemaining) {
637  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
638  }
639  }
640  return hr;
641 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfExWorkerW
Definition: strsafe.h:1907
#define va_end(ap)
Definition: acmsvcex.h:90
#define SUCCEEDED(hr)
Definition: strsafe.h:51
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by pSaveImageAs().

◆ StringCbPrintfW()

STRSAFEAPI StringCbPrintfW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszFormat,
  ... 
)

Definition at line 557 of file strsafe.h.

557  {
558  HRESULT hr;
559  va_list argList;
560  size_t cchDest = cbDest / sizeof(wchar_t);
561  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
562  va_start(argList,pszFormat);
563  hr = StringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
564  va_end(argList);
565  return hr;
566 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
#define StringVPrintfWorkerW
Definition: strsafe.h:1905
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by COpenWithList::Add(), COpenWithList::AddAppToMRUList(), CDefaultContextMenu::AddStaticContextMenusToMenu(), BasepMoveFileDelayed(), CDefaultContextMenu::BrowserFlagsFromVerb(), CopyEventEntry(), CreateProfile(), EditTypeDlg_OnCommand(), EditTypeDlg_WriteClass(), EnumEventsThread(), EnumPickIconResourceProc(), COpenWithList::Execute(), CDrvDefExt::ExtraPageProc(), FileTypesDlg_AddExt(), FileTypesDlg_OnItemChanging(), CRegistryFolder::FormatValueData(), CDrvDefExt::GeneralPageProc(), CNetConnectionPropertyUi::GetDeviceInstanceID(), GetInterfaceNameInternal(), CFileDefExt::InitFileType(), COpenWithList::IsHidden(), CNetConnectionPropertyUi::LANPropertiesUIDlg(), COpenWithList::Load(), CNewMenu::LoadItem(), COpenWithList::LoadRecommendedFromHKCR(), COpenWithList::LoadRecommendedFromHKCU(), MAIN_SaveSettings(), MAIN_SetMainWindowTitle(), MakeService(), CNewMenu::NewItemByCommand(), CNewMenu::NewItemByNonCommand(), pLoadImageFromNode(), ProcessorDlgProc(), QueryConfig2W(), COpenWithList::SaveApp(), SaveSettings(), SdbpBuildSignMediaId(), service_process(), COpenWithList::SetDefaultHandler(), SH_GetTargetTypeByPath(), SHEmptyRecycleBinW(), START_TEST(), StartChild(), test_runner(), TestGetUserObjectInfoW(), and wmain().

◆ StringCbVPrintfA()

STRSAFEAPI StringCbVPrintfA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszFormat,
va_list  argList 
)

Definition at line 502 of file strsafe.h.

502  {
503  if(cbDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
504  return StringVPrintfWorkerA(pszDest,cbDest,pszFormat,argList);
505 }
#define StringVPrintfWorkerA
Definition: strsafe.h:1904
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83

Referenced by service_ok(), and service_trace().

◆ StringCbVPrintfExA()

STRSAFEAPI StringCbVPrintfExA ( STRSAFE_LPSTR  pszDest,
size_t  cbDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCSTR  pszFormat,
va_list  argList 
)

Definition at line 679 of file strsafe.h.

679  {
680  HRESULT hr;
681  size_t cchDest;
682  size_t cchRemaining = 0;
683  cchDest = cbDest / sizeof(char);
685  else hr = StringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
687  if(pcbRemaining) {
688  *pcbRemaining = (cchRemaining*sizeof(char)) + (cbDest % sizeof(char));
689  }
690  }
691  return hr;
692 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfExWorkerA
Definition: strsafe.h:1906
#define SUCCEEDED(hr)
Definition: strsafe.h:51
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCbVPrintfExW()

STRSAFEAPI StringCbVPrintfExW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcbRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCWSTR  pszFormat,
va_list  argList 
)

Definition at line 694 of file strsafe.h.

694  {
695  HRESULT hr;
696  size_t cchDest;
697  size_t cchRemaining = 0;
698  cchDest = cbDest / sizeof(wchar_t);
700  else hr = StringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,&cchRemaining,dwFlags,pszFormat,argList);
702  if(pcbRemaining) {
703  *pcbRemaining = (cchRemaining*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t));
704  }
705  }
706  return hr;
707 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfExWorkerW
Definition: strsafe.h:1907
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCbVPrintfW()

STRSAFEAPI StringCbVPrintfW ( STRSAFE_LPWSTR  pszDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszFormat,
va_list  argList 
)

Definition at line 507 of file strsafe.h.

507  {
508  size_t cchDest = cbDest / sizeof(wchar_t);
509  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
510  return StringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
511 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned short wchar_t
Definition: strsafe.h:42
#define StringVPrintfWorkerW
Definition: strsafe.h:1905

Referenced by BestFit_Write(), and WriteToLogPrintfV().

◆ StringCchCatA()

STRSAFEAPI StringCchCatA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 320 of file strsafe.h.

320  {
321  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
322  return StringCatWorkerA(pszDest,cchDest,pszSrc);
323 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringCatWorkerA
Definition: strsafe.h:1896

Referenced by check_for_files(), CheckForCurrentHostname(), config_init(), DnsQuery_W(), dprint_multi_addr(), GetComputerNameA(), nfs41_symlink_target(), referral_resolve(), RunShell(), SHStringFromGUIDA(), and START_TEST().

◆ StringCchCatExA()

STRSAFEAPI StringCchCatExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 355 of file strsafe.h.

355  {
356  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
357  return StringCatExWorkerA(pszDest,cchDest,cchDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
358 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCatExWorkerA
Definition: strsafe.h:1898

◆ StringCchCatExW()

STRSAFEAPI StringCchCatExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 360 of file strsafe.h.

360  {
361  size_t cbDest = cchDest*sizeof(wchar_t);
362  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
363  return StringCatExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
364 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCatExWorkerW
Definition: strsafe.h:1899

◆ StringCchCatNA()

STRSAFEAPI StringCchCatNA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToAppend 
)

Definition at line 402 of file strsafe.h.

402  {
403  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
404  return StringCatNWorkerA(pszDest,cchDest,pszSrc,cchToAppend);
405 }
#define StringCatNWorkerA
Definition: strsafe.h:1900
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83

◆ StringCchCatNExA()

STRSAFEAPI StringCchCatNExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToAppend,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 439 of file strsafe.h.

439  {
440  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
441  return StringCatNExWorkerA(pszDest,cchDest,cchDest,pszSrc,cchToAppend,ppszDestEnd,pcchRemaining,dwFlags);
442 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringCatNExWorkerA
Definition: strsafe.h:1902
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCchCatNExW()

STRSAFEAPI StringCchCatNExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToAppend,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 444 of file strsafe.h.

444  {
445  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
446  return StringCatNExWorkerW(pszDest,cchDest,(cchDest*sizeof(wchar_t)),pszSrc,cchToAppend,ppszDestEnd,pcchRemaining,dwFlags);
447 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCatNExWorkerW
Definition: strsafe.h:1903

◆ StringCchCatNW()

STRSAFEAPI StringCchCatNW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToAppend 
)

Definition at line 407 of file strsafe.h.

407  {
408  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
409  return StringCatNWorkerW(pszDest,cchDest,pszSrc,cchToAppend);
410 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringCatNWorkerW
Definition: strsafe.h:1901

Referenced by ReplaceSubstr().

◆ StringCchCatW()

◆ StringCchCopyA()

◆ StringCchCopyExA()

STRSAFEAPI StringCchCopyExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 179 of file strsafe.h.

179  {
180  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
181  return StringCopyExWorkerA(pszDest,cchDest,cchDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
182 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringCopyExWorkerA
Definition: strsafe.h:1894
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCchCopyExW()

STRSAFEAPI StringCchCopyExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 184 of file strsafe.h.

184  {
185  size_t cbDest;
186  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
187  cbDest = cchDest * sizeof(wchar_t);
188  return StringCopyExWorkerW(pszDest,cchDest,cbDest,pszSrc,ppszDestEnd,pcchRemaining,dwFlags);
189 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define StringCopyExWorkerW
Definition: strsafe.h:1895

Referenced by CZipFolder::_GetFileTimeString(), FormatByteSize(), FormatFileSizeWithBytes(), CFileDefExt::GetFileTimeString(), GetFileTimeString(), LoadEventSources(), CShellLink::OnInitDialog(), ReportProductInfoEvent(), SH_FormatByteSize(), and SH_FormatFileSizeWithBytes().

◆ StringCchCopyNA()

STRSAFEAPI StringCchCopyNA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 230 of file strsafe.h.

230  {
231  if(cchDest > STRSAFE_MAX_CCH || cchToCopy > STRSAFE_MAX_CCH)
233  return StringCopyNWorkerA(pszDest,cchDest,pszSrc,cchToCopy);
234 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
STRSAFEAPI StringCopyNWorkerA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:1065

Referenced by abs_path_copy(), abs_path_link(), config_load(), create_silly_rename(), DuplicateStringAEx(), name_cache_entry_rename(), name_cache_search(), nfs41_symlink_target(), and START_TEST().

◆ StringCchCopyNExA()

STRSAFEAPI StringCchCopyNExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToCopy,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 270 of file strsafe.h.

270  {
271  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
272  return StringCopyNExWorkerA(pszDest,cchDest,cchDest,pszSrc,cchToCopy,ppszDestEnd,pcchRemaining,dwFlags);
273 }
STRSAFEAPI StringCopyNExWorkerA(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: strsafe.h:1101
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCchCopyNExW()

STRSAFEAPI StringCchCopyNExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToCopy,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 275 of file strsafe.h.

275  {
276  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
277  return StringCopyNExWorkerW(pszDest,cchDest,cchDest * sizeof(wchar_t),pszSrc,cchToCopy,ppszDestEnd,pcchRemaining,dwFlags);
278 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
STRSAFEAPI StringCopyNExWorkerW(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: strsafe.h:1172
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCchCopyNW()

STRSAFEAPI StringCchCopyNW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 236 of file strsafe.h.

236  {
237  if(cchDest > STRSAFE_MAX_CCH || cchToCopy > STRSAFE_MAX_CCH)
239  return StringCopyNWorkerW(pszDest,cchDest,pszSrc,cchToCopy);
240 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
STRSAFEAPI StringCopyNWorkerW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:1083

Referenced by ApplyParameterStringsToMessage(), ConCfgReadUserSettings(), ConvertNtPathToWin32Path(), CreateConsoleFontEx(), CreateEnvironmentBlock(), DIALOG_Symbol(), DisplayUsage(), DuplicateStringWEx(), FontTypeChange(), GuiConsoleShowConsoleProperties(), GuiLoadFrontEnd(), CFileDefExt::InitFilePath(), InitFonts(), InitTTFontCache(), COpenWithList::LoadInfo(), SdbGUIDToString(), and wmain().

◆ StringCchCopyW()

STRSAFEAPI StringCchCopyW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 149 of file strsafe.h.

149  {
150  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
151  return StringCopyWorkerW(pszDest,cchDest,pszSrc);
152 }
#define StringCopyWorkerW
Definition: strsafe.h:1893
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83

Referenced by _FileOpCount(), _FileOpCountManager(), CBandSiteMenu::_ShowToolbarError(), AddItemToTreeView(), AllocEventLog(), ApplyParameterStringsToMessage(), CNetFolder::BindToObject(), ConCfgInitDefaultSettings(), ConvertNtPathToWin32Path(), copy_dir_to_dir(), CopyTextToClipboard(), CFileDefExt::CountFolderAndFiles(), CreateConsoleFontEx(), CreateOpenInfo(), CreateShortcut(), CISFBand::CreateSimpleToolbar(), CreateUserProfileExW(), Dde_OnExecute(), DoLoadIcons(), DuplicateStringW(), ElfCreateEventLogHandle(), EnumEventsThread(), FinishDlgProc(), FontTypeChange(), FormatFileSizeWithBytes(), CFileDefExt::GeneralPageProc(), GetAllUsersProfileDirectoryW(), GetApplicationString(), BtrfsContextMenu::GetCommandString(), CDefaultContextMenu::GetCommandString(), CZipFolder::GetCommandString(), CFSFolder::GetCustomViewInfo(), GetDefaultUserProfileDirectoryW(), GetEventCategory(), GetEventMessage(), GetEventUserName(), getIconLocationForDrive(), getIconLocationForFolder(), GetImmFileName(), GetProfilesDirectoryW(), GetServiceDescription(), GetSettingDescription(), GetSystemName(), GetUserProfileDirectoryW(), HACKISH_PathResolve(), COpenWithDialog::Init(), InitApplet(), CFileDefExt::InitFileAttr(), CFileDefExt::InitFolderCustomizePage(), InitLogging(), InstallEventSource(), IsValidConsoleFont(), LogfAllocAndBuildNewRecord(), LogfCreate(), LpkGetCharacterPlacement(), MainWndProc(), CLayerStringList::Next(), NPAddConnection3(), CFileDefExt::OnFolderCustApply(), CFileDefExt::OnFolderCustChangeIcon(), CShellLink::OnInitDialog(), OpenUserEventLogFile(), ParseCmdline(), pBuildFileList(), PickIconDlg(), PrintFilterInfo(), PrintVolumeInfo(), QueryFileDescription(), ScmAutoStartServices(), SdbGetAppPatchDir(), CGridView::SetFont(), CShellLink::SetTargetFromPIDLOrPath(), SETUP_CreateDevicesListFromEnumerator(), CDeviceNode::SetupNode(), CUserNotification::SetUpNotifyData(), SH_FormatFileSizeWithBytes(), SHELL32_GetCLSIDForDirectory(), ShellExecCmdLine(), SHExplorerParseCmdLine(), ShowCreateShortcutWizard(), START_TEST(), SummaryDlgProc(), Test_GetTextFaceAliasW(), Test_ProtectedFiles(), TestCommandLine(), TranslateConsoleName(), wcsrep(), WelcomeDlgProc(), wmain(), and WriteMinidump().

◆ StringCchGetsA()

STRSAFE_INLINE_API StringCchGetsA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest 
)

Definition at line 716 of file strsafe.h.

716  {
717  HRESULT hr;
719  else {
720  size_t cbDest;
721  cbDest = cchDest*sizeof(char);
722  hr = StringGetsExWorkerA(pszDest,cchDest,cbDest,NULL,NULL,0);
723  }
724  return hr;
725 }
#define StringGetsExWorkerA
Definition: strsafe.h:1910
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77

◆ StringCchGetsExA()

STRSAFE_INLINE_API StringCchGetsExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 770 of file strsafe.h.

770  {
771  HRESULT hr;
773  else {
774  size_t cbDest;
775  cbDest = cchDest*sizeof(char);
776  hr = StringGetsExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags);
777  }
778  return hr;
779 }
#define StringGetsExWorkerA
Definition: strsafe.h:1910
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCchGetsExW()

STRSAFE_INLINE_API StringCchGetsExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 781 of file strsafe.h.

781  {
782  HRESULT hr;
784  else {
785  size_t cbDest;
786  cbDest = cchDest*sizeof(wchar_t);
787  hr = StringGetsExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags);
788  }
789  return hr;
790 }
HRESULT hr
Definition: shlfolder.c:183
#define StringGetsExWorkerW
Definition: strsafe.h:1911
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ StringCchGetsW()

STRSAFE_INLINE_API StringCchGetsW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest 
)

Definition at line 727 of file strsafe.h.

727  {
728  HRESULT hr;
730  else {
731  size_t cbDest;
732  cbDest = cchDest*sizeof(wchar_t);
733  hr = StringGetsExWorkerW(pszDest,cchDest,cbDest,NULL,NULL,0);
734  }
735  return hr;
736 }
HRESULT hr
Definition: shlfolder.c:183
#define StringGetsExWorkerW
Definition: strsafe.h:1911
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42

◆ StringCchLengthA()

STRSAFEAPI StringCchLengthA ( STRSAFE_LPCSTR  psz,
size_t  cchMax,
size_t pcchLength 
)

Definition at line 832 of file strsafe.h.

832  {
833  HRESULT hr;
835  else hr = StringLengthWorkerA(psz,cchMax,pcchLength);
836  if(FAILED(hr) && pcchLength) {
837  *pcchLength = 0;
838  }
839  return hr;
840 }
HRESULT hr
Definition: shlfolder.c:183
#define StringLengthWorkerA
Definition: strsafe.h:1908
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax

Referenced by CheckForCurrentHostname(), DnsQuery_W(), and GetComputerNameA().

◆ StringCchLengthW()

STRSAFEAPI StringCchLengthW ( STRSAFE_LPCWSTR  psz,
size_t  cchMax,
size_t pcchLength 
)

Definition at line 842 of file strsafe.h.

842  {
843  HRESULT hr;
845  else hr = StringLengthWorkerW(psz,cchMax,pcchLength);
846  if(FAILED(hr) && pcchLength) {
847  *pcchLength = 0;
848  }
849  return hr;
850 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
#define StringLengthWorkerW
Definition: strsafe.h:1909

Referenced by OpenNetworkDatabase().

◆ StringCchPrintfA()

STRSAFEAPI StringCchPrintfA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszFormat,
  ... 
)

Definition at line 520 of file strsafe.h.

520  {
521  HRESULT hr;
522  va_list argList;
523  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
524  va_start(argList,pszFormat);
525  hr = StringVPrintfWorkerA(pszDest,cchDest,pszFormat,argList);
526  va_end(argList);
527  return hr;
528 }
HRESULT hr
Definition: shlfolder.c:183
#define StringVPrintfWorkerA
Definition: strsafe.h:1904
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by _ILGetFileType(), Chr2Str(), create_open_state(), format_abs_path(), idmap_filter(), nfs41_server_resolve(), safe_str(), SeiPrintFunctionName(), and verify_shima_imp().

◆ StringCchPrintfExA()

STRSAFEAPI StringCchPrintfExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCSTR  pszFormat,
  ... 
)

Definition at line 575 of file strsafe.h.

575  {
576  HRESULT hr;
577  va_list argList;
578  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
579  va_start(argList,pszFormat);
580  hr = StringVPrintfExWorkerA(pszDest,cchDest,cchDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
581  va_end(argList);
582  return hr;
583 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define va_end(ap)
Definition: acmsvcex.h:90
#define StringVPrintfExWorkerA
Definition: strsafe.h:1906
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by SeiDbgPrint(), ShimDbgPrint(), and Win32DbgPrint().

◆ StringCchPrintfExW()

STRSAFEAPI StringCchPrintfExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCWSTR  pszFormat,
  ... 
)

Definition at line 585 of file strsafe.h.

585  {
586  HRESULT hr;
587  size_t cbDest = cchDest * sizeof(wchar_t);
588  va_list argList;
589  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
590  va_start(argList,pszFormat);
591  hr = StringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
592  va_end(argList);
593  return hr;
594 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfExWorkerW
Definition: strsafe.h:1907
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by ACDBG_FN(), CExeDropHandler::Drop(), EnumEventsThread(), CFileDefExt::InitFileType(), CShellLink::OnInitDialog(), ReportProductInfoEvent(), and SH_GetTargetTypeByPath().

◆ StringCchPrintfW()

STRSAFEAPI StringCchPrintfW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszFormat,
  ... 
)

Definition at line 530 of file strsafe.h.

530  {
531  HRESULT hr;
532  va_list argList;
533  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
534  va_start(argList,pszFormat);
535  hr = StringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
536  va_end(argList);
537  return hr;
538 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
LONG HRESULT
Definition: typedefs.h:77
#define StringVPrintfWorkerW
Definition: strsafe.h:1905
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by CBandSiteMenu::_CreateMenuPart(), AddCodePage(), AddNTOSInstallationItem(), AppendSystemFamily(), CShellBrowser::BuildExplorerBandCategory(), ConvertNtPathToWin32Path(), CFileDefExt::CountFolderAndFiles(), DelScheme(), DrawTest(), EnumFontSizesProc(), FileCopyCallback(), FontProc(), FontSizeChange(), FontSizeList_SelectFontSize(), GetDefaultLayoutForLocale(), CRecycleBin::GetDetailsOf(), CZipFolder::GetDetailsOf(), GetDriveNameWithLetter(), GetEventCategory(), GetEventMessage(), GetInterfaceName(), GetSystemUptime(), InitApplet(), CFileDefExt::InitFileAttr(), CRegFolderEnum::Initialize(), InitializeFormatDriveDlg(), InputList_AddInputMethodToUserRegistry(), LayoutList_Create(), MainWndProc(), CNewMenu::NewItemByNonCommand(), OnClearRecentItems(), CFileDefExt::OnFolderCustApply(), OnInitDialog(), PrintDiskData(), PrintFilterInfo(), PrintPartitionData(), RegisterComponent(), RSetServiceStatus(), ScmCreateNewControlPipe(), ScmLoadService(), SdbGetFileAttributes(), SdbpGetStringAttr(), ShellExecCmdLine(), SHGetFolderPathAndSubDirW(), ShutdownOnInit(), START_TEST(), SummaryDlgProc(), test_ExpectFolders_imp(), TestStaticDestruct(), UnhandledExceptionFilter(), UnregisterComponent(), CDefView::UpdateStatusbar(), verify_shimw_imp(), WelcomeDlgProc(), WriteKeysSettings(), and wWinMain().

◆ StringCchVPrintfA()

STRSAFEAPI StringCchVPrintfA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszFormat,
va_list  argList 
)

Definition at line 485 of file strsafe.h.

485  {
486  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
487  return StringVPrintfWorkerA(pszDest,cchDest,pszFormat,argList);
488 }
#define StringVPrintfWorkerA
Definition: strsafe.h:1904
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83

◆ StringCchVPrintfExA()

STRSAFEAPI StringCchVPrintfExA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCSTR  pszFormat,
va_list  argList 
)

Definition at line 650 of file strsafe.h.

650  {
651  HRESULT hr;
653  else {
654  size_t cbDest;
655  cbDest = cchDest*sizeof(char);
656  hr = StringVPrintfExWorkerA(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
657  }
658  return hr;
659 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfExWorkerA
Definition: strsafe.h:1906
unsigned char
Definition: typeof.h:29
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by SeiDbgPrint(), ShimDbgPrint(), and Win32DbgPrint().

◆ StringCchVPrintfExW()

STRSAFEAPI StringCchVPrintfExW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags,
STRSAFE_LPCWSTR  pszFormat,
va_list  argList 
)

Definition at line 661 of file strsafe.h.

661  {
662  HRESULT hr;
664  else {
665  size_t cbDest;
666  cbDest = cchDest*sizeof(wchar_t);
667  hr = StringVPrintfExWorkerW(pszDest,cchDest,cbDest,ppszDestEnd,pcchRemaining,dwFlags,pszFormat,argList);
668  }
669  return hr;
670 }
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfExWorkerW
Definition: strsafe.h:1907
LONG HRESULT
Definition: typedefs.h:77
unsigned short wchar_t
Definition: strsafe.h:42
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by ACDBG_FN(), and ConPrintfV().

◆ StringCchVPrintfW()

STRSAFEAPI StringCchVPrintfW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszFormat,
va_list  argList 
)

Definition at line 490 of file strsafe.h.

490  {
491  if(cchDest > STRSAFE_MAX_CCH) return STRSAFE_E_INVALID_PARAMETER;
492  return StringVPrintfWorkerW(pszDest,cchDest,pszFormat,argList);
493 }
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define StringVPrintfWorkerW
Definition: strsafe.h:1905

Referenced by NFS41DbgPrint().

◆ StringCopyExWorkerA()

STRSAFEAPI StringCopyExWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCSTR  pszSrc,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 927 of file strsafe.h.

927  {
928  HRESULT hr = S_OK;
929  STRSAFE_LPSTR pszDestEnd = pszDest;
930  size_t cchRemaining = 0;
932  else {
934  if(!pszDest) {
935  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
936  }
937  if(!pszSrc) pszSrc = "";
938  }
939  if(SUCCEEDED(hr)) {
940  if(cchDest==0) {
941  pszDestEnd = pszDest;
942  cchRemaining = 0;
943  if(*pszSrc!='\0') {
944  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
946  }
947  } else {
948  pszDestEnd = pszDest;
949  cchRemaining = cchDest;
950  while(cchRemaining && (*pszSrc!='\0')) {
951  *pszDestEnd++ = *pszSrc++;
952  cchRemaining--;
953  }
954  if(cchRemaining > 0) {
956  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
957  }
958  } else {
959  pszDestEnd--;
960  cchRemaining++;
962  }
963  *pszDestEnd = '\0';
964  }
965  }
966  }
967  if(FAILED(hr)) {
968  if(pszDest) {
970  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
972  pszDestEnd = pszDest;
973  cchRemaining = cchDest;
974  } else if(cchDest > 0) {
975  pszDestEnd = pszDest + cchDest - 1;
976  cchRemaining = 1;
977  *pszDestEnd = '\0';
978  }
979  }
981  if(cchDest > 0) {
982  pszDestEnd = pszDest;
983  cchRemaining = cchDest;
984  *pszDestEnd = '\0';
985  }
986  }
987  }
988  }
990  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
991  if(pcchRemaining) *pcchRemaining = cchRemaining;
992  }
993  return hr;
994 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringCopyExWorkerW()

STRSAFEAPI StringCopyExWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPCWSTR  pszSrc,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 996 of file strsafe.h.

996  {
997  HRESULT hr = S_OK;
998  STRSAFE_LPWSTR pszDestEnd = pszDest;
999  size_t cchRemaining = 0;
1001  else {
1003  if(!pszDest) {
1004  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1005  }
1006  if(!pszSrc) pszSrc = L"";
1007  }
1008  if(SUCCEEDED(hr)) {
1009  if(cchDest==0) {
1010  pszDestEnd = pszDest;
1011  cchRemaining = 0;
1012  if(*pszSrc!=L'\0') {
1013  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1015  }
1016  } else {
1017  pszDestEnd = pszDest;
1018  cchRemaining = cchDest;
1019  while(cchRemaining && (*pszSrc!=L'\0')) {
1020  *pszDestEnd++ = *pszSrc++;
1021  cchRemaining--;
1022  }
1023  if(cchRemaining > 0) {
1025  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
1026  }
1027  } else {
1028  pszDestEnd--;
1029  cchRemaining++;
1031  }
1032  *pszDestEnd = L'\0';
1033  }
1034  }
1035  }
1036  if(FAILED(hr)) {
1037  if(pszDest) {
1039  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1041  pszDestEnd = pszDest;
1042  cchRemaining = cchDest;
1043  } else if(cchDest > 0) {
1044  pszDestEnd = pszDest + cchDest - 1;
1045  cchRemaining = 1;
1046  *pszDestEnd = L'\0';
1047  }
1048  }
1050  if(cchDest > 0) {
1051  pszDestEnd = pszDest;
1052  cchRemaining = cchDest;
1053  *pszDestEnd = L'\0';
1054  }
1055  }
1056  }
1057  }
1059  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1060  if(pcchRemaining) *pcchRemaining = cchRemaining;
1061  }
1062  return hr;
1063 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringCopyNExWorkerA()

STRSAFEAPI StringCopyNExWorkerA ( 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 1101 of file strsafe.h.

1101  {
1102  HRESULT hr = S_OK;
1103  STRSAFE_LPSTR pszDestEnd = pszDest;
1104  size_t cchRemaining = 0;
1106  else if(cchToCopy > STRSAFE_MAX_CCH) hr = STRSAFE_E_INVALID_PARAMETER;
1107  else {
1109  if(!pszDest) {
1110  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1111  }
1112  if(!pszSrc) pszSrc = "";
1113  }
1114  if(SUCCEEDED(hr)) {
1115  if(cchDest==0) {
1116  pszDestEnd = pszDest;
1117  cchRemaining = 0;
1118  if((cchToCopy!=0) && (*pszSrc!='\0')) {
1119  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1121  }
1122  } else {
1123  pszDestEnd = pszDest;
1124  cchRemaining = cchDest;
1125  while(cchRemaining && cchToCopy && (*pszSrc!='\0')) {
1126  *pszDestEnd++ = *pszSrc++;
1127  cchRemaining--;
1128  cchToCopy--;
1129  }
1130  if(cchRemaining > 0) {
1132  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
1133  }
1134  } else {
1135  pszDestEnd--;
1136  cchRemaining++;
1138  }
1139  *pszDestEnd = '\0';
1140  }
1141  }
1142  }
1143  if(FAILED(hr)) {
1144  if(pszDest) {
1146  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1148  pszDestEnd = pszDest;
1149  cchRemaining = cchDest;
1150  } else if(cchDest > 0) {
1151  pszDestEnd = pszDest + cchDest - 1;
1152  cchRemaining = 1;
1153  *pszDestEnd = '\0';
1154  }
1155  }
1157  if(cchDest > 0) {
1158  pszDestEnd = pszDest;
1159  cchRemaining = cchDest;
1160  *pszDestEnd = '\0';
1161  }
1162  }
1163  }
1164  }
1166  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1167  if(pcchRemaining) *pcchRemaining = cchRemaining;
1168  }
1169  return hr;
1170 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

Referenced by StringCatNExWorkerA(), StringCbCopyNExA(), and StringCchCopyNExA().

◆ StringCopyNExWorkerW()

STRSAFEAPI StringCopyNExWorkerW ( 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 1172 of file strsafe.h.

1172  {
1173  HRESULT hr = S_OK;
1174  STRSAFE_LPWSTR pszDestEnd = pszDest;
1175  size_t cchRemaining = 0;
1177  else if(cchToCopy > STRSAFE_MAX_CCH) hr = STRSAFE_E_INVALID_PARAMETER;
1178  else {
1180  if(!pszDest) {
1181  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1182  }
1183  if(!pszSrc) pszSrc = L"";
1184  }
1185  if(SUCCEEDED(hr)) {
1186  if(cchDest==0) {
1187  pszDestEnd = pszDest;
1188  cchRemaining = 0;
1189  if((cchToCopy!=0) && (*pszSrc!=L'\0')) {
1190  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1192  }
1193  } else {
1194  pszDestEnd = pszDest;
1195  cchRemaining = cchDest;
1196  while(cchRemaining && cchToCopy && (*pszSrc!=L'\0')) {
1197  *pszDestEnd++ = *pszSrc++;
1198  cchRemaining--;
1199  cchToCopy--;
1200  }
1201  if(cchRemaining > 0) {
1203  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
1204  }
1205  } else {
1206  pszDestEnd--;
1207  cchRemaining++;
1209  }
1210  *pszDestEnd = L'\0';
1211  }
1212  }
1213  }
1214  if(FAILED(hr)) {
1215  if(pszDest) {
1217  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1219  pszDestEnd = pszDest;
1220  cchRemaining = cchDest;
1221  } else if(cchDest > 0) {
1222  pszDestEnd = pszDest + cchDest - 1;
1223  cchRemaining = 1;
1224  *pszDestEnd = L'\0';
1225  }
1226  }
1228  if(cchDest > 0) {
1229  pszDestEnd = pszDest;
1230  cchRemaining = cchDest;
1231  *pszDestEnd = L'\0';
1232  }
1233  }
1234  }
1235  }
1237  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1238  if(pcchRemaining) *pcchRemaining = cchRemaining;
1239  }
1240  return hr;
1241 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_MAX_CCH
Definition: strsafe.h:83
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

Referenced by StringCatNExWorkerW(), StringCbCopyNExW(), and StringCchCopyNExW().

◆ StringCopyNWorkerA()

STRSAFEAPI StringCopyNWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 1065 of file strsafe.h.

1065  {
1066  HRESULT hr = S_OK;
1067  if(cchDest==0) hr = STRSAFE_E_INVALID_PARAMETER;
1068  else {
1069  while(cchDest && cchSrc && (*pszSrc!='\0')) {
1070  *pszDest++ = *pszSrc++;
1071  cchDest--;
1072  cchSrc--;
1073  }
1074  if(cchDest==0) {
1075  pszDest--;
1077  }
1078  *pszDest= '\0';
1079  }
1080  return hr;
1081 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
LONG HRESULT
Definition: typedefs.h:77

Referenced by StringCatNWorkerA(), StringCbCopyNA(), and StringCchCopyNA().

◆ StringCopyNWorkerW()

STRSAFEAPI StringCopyNWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc,
size_t  cchToCopy 
)

Definition at line 1083 of file strsafe.h.

1083  {
1084  HRESULT hr = S_OK;
1085  if(cchDest==0) hr = STRSAFE_E_INVALID_PARAMETER;
1086  else {
1087  while(cchDest && cchToCopy && (*pszSrc!=L'\0')) {
1088  *pszDest++ = *pszSrc++;
1089  cchDest--;
1090  cchToCopy--;
1091  }
1092  if(cchDest==0) {
1093  pszDest--;
1095  }
1096  *pszDest= L'\0';
1097  }
1098  return hr;
1099 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250

Referenced by StringCatNWorkerW(), StringCbCopyNW(), and StringCchCopyNW().

◆ StringCopyWorkerA()

STRSAFEAPI StringCopyWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszSrc 
)

Definition at line 893 of file strsafe.h.

893  {
894  HRESULT hr = S_OK;
895  if(cchDest==0) hr = STRSAFE_E_INVALID_PARAMETER;
896  else {
897  while(cchDest && (*pszSrc!='\0')) {
898  *pszDest++ = *pszSrc++;
899  cchDest--;
900  }
901  if(cchDest==0) {
902  pszDest--;
904  }
905  *pszDest= '\0';
906  }
907  return hr;
908 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
LONG HRESULT
Definition: typedefs.h:77

◆ StringCopyWorkerW()

STRSAFEAPI StringCopyWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszSrc 
)

Definition at line 910 of file strsafe.h.

910  {
911  HRESULT hr = S_OK;
912  if(cchDest==0) hr = STRSAFE_E_INVALID_PARAMETER;
913  else {
914  while(cchDest && (*pszSrc!=L'\0')) {
915  *pszDest++ = *pszSrc++;
916  cchDest--;
917  }
918  if(cchDest==0) {
919  pszDest--;
921  }
922  *pszDest= L'\0';
923  }
924  return hr;
925 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250

◆ StringGetsExWorkerA()

STRSAFE_INLINE_API StringGetsExWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 1749 of file strsafe.h.

1749  {
1750  HRESULT hr = S_OK;
1751  STRSAFE_LPSTR pszDestEnd = pszDest;
1752  size_t cchRemaining = 0;
1753 
1755  else {
1757  if(!pszDest) {
1758  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1759  }
1760  }
1761  if(SUCCEEDED(hr)) {
1762  if(cchDest <= 1) {
1763  pszDestEnd = pszDest;
1764  cchRemaining = cchDest;
1765  if(cchDest==1) *pszDestEnd = '\0';
1767  } else {
1768  pszDestEnd = pszDest;
1769  cchRemaining = cchDest;
1770  while(cchRemaining > 1) {
1771  char ch;
1772  int i = getc(stdin);
1773  if(i==EOF) {
1774  if(pszDestEnd==pszDest) hr = STRSAFE_E_END_OF_FILE;
1775  break;
1776  }
1777  ch = (char)i;
1778  if(ch=='\n') break;
1779  *pszDestEnd = ch;
1780  pszDestEnd++;
1781  cchRemaining--;
1782  }
1783  if(cchRemaining > 0) {
1785  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
1786  }
1787  }
1788  *pszDestEnd = '\0';
1789  }
1790  }
1791  }
1792  if(FAILED(hr)) {
1793  if(pszDest) {
1795  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1797  pszDestEnd = pszDest;
1798  cchRemaining = cchDest;
1799  } else if(cchDest > 0) {
1800  pszDestEnd = pszDest + cchDest - 1;
1801  cchRemaining = 1;
1802  *pszDestEnd = '\0';
1803  }
1804  }
1806  if(cchDest > 0) {
1807  pszDestEnd = pszDest;
1808  cchRemaining = cchDest;
1809  *pszDestEnd = '\0';
1810  }
1811  }
1812  }
1813  }
1815  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1816  if(pcchRemaining) *pcchRemaining = cchRemaining;
1817  }
1818  return hr;
1819 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
_Check_return_ _CRTIMP int __cdecl getc(_Inout_ FILE *_File)
FILE * stdin
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
unsigned char
Definition: typeof.h:29
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define STRSAFE_E_END_OF_FILE
Definition: strsafe.h:105
#define EOF
Definition: stdio.h:24
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringGetsExWorkerW()

STRSAFE_INLINE_API StringGetsExWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
size_t  cbDest,
STRSAFE_LPWSTR ppszDestEnd,
size_t pcchRemaining,
STRSAFE_DWORD  dwFlags 
)

Definition at line 1821 of file strsafe.h.

1821  {
1822  HRESULT hr = S_OK;
1823  STRSAFE_LPWSTR pszDestEnd = pszDest;
1824  size_t cchRemaining = 0;
1825  if(dwFlags & (~STRSAFE_VALID_FLAGS)) {
1827  } else {
1829  if(!pszDest) {
1830  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1831  }
1832  }
1833  if(SUCCEEDED(hr)) {
1834  if(cchDest <= 1) {
1835  pszDestEnd = pszDest;
1836  cchRemaining = cchDest;
1837  if(cchDest==1) *pszDestEnd = L'\0';
1839  } else {
1840  pszDestEnd = pszDest;
1841  cchRemaining = cchDest;
1842  while(cchRemaining > 1) {
1843  wchar_t ch = getwc(stdin);
1844  if(ch==WEOF) {
1845  if(pszDestEnd==pszDest) hr = STRSAFE_E_END_OF_FILE;
1846  break;
1847  }
1848  if(ch==L'\n') break;
1849  *pszDestEnd = ch;
1850  pszDestEnd++;
1851  cchRemaining--;
1852  }
1853  if(cchRemaining > 0) {
1855  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
1856  }
1857  }
1858  *pszDestEnd = L'\0';
1859  }
1860  }
1861  }
1862  if(FAILED(hr)) {
1863  if(pszDest) {
1865  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1867  pszDestEnd = pszDest;
1868  cchRemaining = cchDest;
1869  } else if(cchDest > 0) {
1870  pszDestEnd = pszDest + cchDest - 1;
1871  cchRemaining = 1;
1872  *pszDestEnd = L'\0';
1873  }
1874  }
1876  if(cchDest > 0) {
1877  pszDestEnd = pszDest;
1878  cchRemaining = cchDest;
1879  *pszDestEnd = L'\0';
1880  }
1881  }
1882  }
1883  }
1885  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1886  if(pcchRemaining) *pcchRemaining = cchRemaining;
1887  }
1888  return hr;
1889 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
FILE * stdin
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define getwc(_stm)
Definition: stdio.h:1107
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define WEOF
Definition: conio.h:185
#define STRSAFE_E_END_OF_FILE
Definition: strsafe.h:105
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringLengthWorkerA()

STRSAFEAPI StringLengthWorkerA ( STRSAFE_LPCSTR  psz,
size_t  cchMax,
size_t pcchLength 
)

Definition at line 1719 of file strsafe.h.

1719  {
1720  HRESULT hr = S_OK;
1721  size_t cchMaxPrev = cchMax;
1722  while(cchMax && (*psz!='\0')) {
1723  psz++;
1724  cchMax--;
1725  }
1727  if(pcchLength) {
1728  if(SUCCEEDED(hr)) *pcchLength = cchMaxPrev - cchMax;
1729  else *pcchLength = 0;
1730  }
1731  return hr;
1732 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax

◆ StringLengthWorkerW()

STRSAFEAPI StringLengthWorkerW ( STRSAFE_LPCWSTR  psz,
size_t  cchMax,
size_t pcchLength 
)

Definition at line 1734 of file strsafe.h.

1734  {
1735  HRESULT hr = S_OK;
1736  size_t cchMaxPrev = cchMax;
1737  while(cchMax && (*psz!=L'\0')) {
1738  psz++;
1739  cchMax--;
1740  }
1742  if(pcchLength) {
1743  if(SUCCEEDED(hr)) *pcchLength = cchMaxPrev - cchMax;
1744  else *pcchLength = 0;
1745  }
1746  return hr;
1747 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define SUCCEEDED(hr)
Definition: strsafe.h:51
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
static const WCHAR L[]
Definition: oid.c:1250

◆ StringVPrintfExWorkerA()

STRSAFEAPI StringVPrintfExWorkerA ( 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 1573 of file strsafe.h.

1573  {
1574  HRESULT hr = S_OK;
1575  STRSAFE_LPSTR pszDestEnd = pszDest;
1576  size_t cchRemaining = 0;
1578  else {
1580  if(!pszDest) {
1581  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1582  }
1583  if(!pszFormat) pszFormat = "";
1584  }
1585  if(SUCCEEDED(hr)) {
1586  if(cchDest==0) {
1587  pszDestEnd = pszDest;
1588  cchRemaining = 0;
1589  if(*pszFormat!='\0') {
1590  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1592  }
1593  } else {
1594  int iRet;
1595  size_t cchMax;
1596  cchMax = cchDest - 1;
1597  iRet = _vsnprintf(pszDest,cchMax,pszFormat,argList);
1598  if((iRet < 0) || (((size_t)iRet) > cchMax)) {
1599  pszDestEnd = pszDest + cchMax;
1600  cchRemaining = 1;
1601  *pszDestEnd = '\0';
1603  } else if(((size_t)iRet)==cchMax) {
1604  pszDestEnd = pszDest + cchMax;
1605  cchRemaining = 1;
1606  *pszDestEnd = '\0';
1607  } else if(((size_t)iRet) < cchMax) {
1608  pszDestEnd = pszDest + iRet;
1609  cchRemaining = cchDest - iRet;
1611  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(char)) + (cbDest % sizeof(char)));
1612  }
1613  }
1614  }
1615  }
1616  }
1617  if(FAILED(hr)) {
1618  if(pszDest) {
1620  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1622  pszDestEnd = pszDest;
1623  cchRemaining = cchDest;
1624  } else if(cchDest > 0) {
1625  pszDestEnd = pszDest + cchDest - 1;
1626  cchRemaining = 1;
1627  *pszDestEnd = '\0';
1628  }
1629  }
1631  if(cchDest > 0) {
1632  pszDestEnd = pszDest;
1633  cchRemaining = cchDest;
1634  *pszDestEnd = '\0';
1635  }
1636  }
1637  }
1638  }
1640  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1641  if(pcchRemaining) *pcchRemaining = cchRemaining;
1642  }
1643  return hr;
1644 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
#define _vsnprintf
Definition: xmlstorage.h:202
#define memset(x, y, z)
Definition: compat.h:39
char * STRSAFE_LPSTR
Definition: ntstrsafe.h:61
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringVPrintfExWorkerW()

STRSAFEAPI StringVPrintfExWorkerW ( 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 1646 of file strsafe.h.

1646  {
1647  HRESULT hr = S_OK;
1648  STRSAFE_LPWSTR pszDestEnd = pszDest;
1649  size_t cchRemaining = 0;
1651  else {
1653  if(!pszDest) {
1654  if((cchDest!=0) || (cbDest!=0)) hr = STRSAFE_E_INVALID_PARAMETER;
1655  }
1656  if(!pszFormat) pszFormat = L"";
1657  }
1658  if(SUCCEEDED(hr)) {
1659  if(cchDest==0) {
1660  pszDestEnd = pszDest;
1661  cchRemaining = 0;
1662  if(*pszFormat!=L'\0') {
1663  if(!pszDest) hr = STRSAFE_E_INVALID_PARAMETER;
1665  }
1666  } else {
1667  int iRet;
1668  size_t cchMax;
1669  cchMax = cchDest - 1;
1670  iRet = _vsnwprintf(pszDest,cchMax,pszFormat,argList);
1671  if((iRet < 0) || (((size_t)iRet) > cchMax)) {
1672  pszDestEnd = pszDest + cchMax;
1673  cchRemaining = 1;
1674  *pszDestEnd = L'\0';
1676  } else if(((size_t)iRet)==cchMax) {
1677  pszDestEnd = pszDest + cchMax;
1678  cchRemaining = 1;
1679  *pszDestEnd = L'\0';
1680  } else if(((size_t)iRet) < cchMax) {
1681  pszDestEnd = pszDest + iRet;
1682  cchRemaining = cchDest - iRet;
1684  memset(pszDestEnd + 1,STRSAFE_GET_FILL_PATTERN(dwFlags),((cchRemaining - 1)*sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)));
1685  }
1686  }
1687  }
1688  }
1689  }
1690  if(FAILED(hr)) {
1691  if(pszDest) {
1693  memset(pszDest,STRSAFE_GET_FILL_PATTERN(dwFlags),cbDest);
1695  pszDestEnd = pszDest;
1696  cchRemaining = cchDest;
1697  } else if(cchDest > 0) {
1698  pszDestEnd = pszDest + cchDest - 1;
1699  cchRemaining = 1;
1700  *pszDestEnd = L'\0';
1701  }
1702  }
1704  if(cchDest > 0) {
1705  pszDestEnd = pszDest;
1706  cchRemaining = cchDest;
1707  *pszDestEnd = L'\0';
1708  }
1709  }
1710  }
1711  }
1713  if(ppszDestEnd) *ppszDestEnd = pszDestEnd;
1714  if(pcchRemaining) *pcchRemaining = cchRemaining;
1715  }
1716  return hr;
1717 }
#define S_OK
Definition: strsafe.h:59
#define STRSAFE_IGNORE_NULLS
Definition: strsafe.h:86
HRESULT hr
Definition: shlfolder.c:183
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_NO_TRUNCATION
Definition: strsafe.h:90
#define STRSAFE_NULL_ON_FAILURE
Definition: strsafe.h:89
#define SUCCEEDED(hr)
Definition: strsafe.h:51
#define STRSAFE_FILL_ON_FAILURE
Definition: strsafe.h:88
#define STRSAFE_FILL_BEHIND_NULL
Definition: strsafe.h:87
#define FAILED(hr)
Definition: strsafe.h:55
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STRSAFE_GET_FILL_PATTERN(dwFlags)
Definition: strsafe.h:100
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_VALID_FLAGS
Definition: strsafe.h:94

◆ StringVPrintfWorkerA()

STRSAFEAPI StringVPrintfWorkerA ( STRSAFE_LPSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCSTR  pszFormat,
va_list  argList 
)

Definition at line 1533 of file strsafe.h.

1533  {
1534  HRESULT hr = S_OK;
1535  if(cchDest==0) hr = STRSAFE_E_INVALID_PARAMETER;
1536  else {
1537  int iRet;
1538  size_t cchMax;
1539  cchMax = cchDest - 1;
1540  iRet = _vsnprintf(pszDest,cchMax,pszFormat,argList);
1541  if((iRet < 0) || (((size_t)iRet) > cchMax)) {
1542  pszDest += cchMax;
1543  *pszDest = '\0';
1545  } else if(((size_t)iRet)==cchMax) {
1546  pszDest += cchMax;
1547  *pszDest = '\0';
1548  }
1549  }
1550  return hr;
1551 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
#define _vsnprintf
Definition: xmlstorage.h:202

◆ StringVPrintfWorkerW()

STRSAFEAPI StringVPrintfWorkerW ( STRSAFE_LPWSTR  pszDest,
size_t  cchDest,
STRSAFE_LPCWSTR  pszFormat,
va_list  argList 
)

Definition at line 1553 of file strsafe.h.

1553  {
1554  HRESULT hr = S_OK;
1555  if(cchDest==0) hr = STRSAFE_E_INVALID_PARAMETER;
1556  else {
1557  int iRet;
1558  size_t cchMax;
1559  cchMax = cchDest - 1;
1560  iRet = _vsnwprintf(pszDest,cchMax,pszFormat,argList);
1561  if((iRet < 0) || (((size_t)iRet) > cchMax)) {
1562  pszDest += cchMax;
1563  *pszDest = L'\0';
1565  } else if(((size_t)iRet)==cchMax) {
1566  pszDest += cchMax;
1567  *pszDest = L'\0';
1568  }
1569  }
1570  return hr;
1571 }
#define S_OK
Definition: strsafe.h:59
HRESULT hr
Definition: shlfolder.c:183
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)