RtlUnicodeStringExHandleOtherFlags - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTSTRSAFE_H_INCLUDED_
#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS

NTSTRSAFEWORKERDDI
RtlUnicodeStringExHandleOtherFlags(
        _Inout_updates_(cchDest) wchar_t* pszDest,
        _In_ size_t cchDest,
        _In_ size_t cchOriginalDestLength,
        _Out_ size_t* pcchNewDestLength,
        _Outptr_result_buffer_(*pcchRemaining) wchar_t** ppszDestEnd,
        _Out_ size_t* pcchRemaining,
        _In_ DWORD dwFlags);

#endif
#endif

View code on GitHub
#ifndef _NTSTRSAFE_H_INCLUDED_
// Below here are the worker functions that actually do the work
#if defined(NTSTRSAFE_LIB_IMPL) || !defined(NTSTRSAFE_LIB)
#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS

NTSTRSAFEWORKERDDI
    RtlUnicodeStringExHandleOtherFlags(
            _Inout_updates_(cchDest) wchar_t* pszDest,
            _In_ size_t cchDest,
            _In_ size_t cchOriginalDestLength,
            _Out_ size_t* pcchNewDestLength,
            _Outptr_result_buffer_(*pcchRemaining) wchar_t** ppszDestEnd,
            _Out_ size_t* pcchRemaining,
            _In_ DWORD dwFlags)
{
    if (dwFlags & STRSAFE_NO_TRUNCATION)
    {
        *ppszDestEnd = pszDest + cchOriginalDestLength;
        *pcchRemaining = cchDest - cchOriginalDestLength;

        *pcchNewDestLength = cchOriginalDestLength;
    }

    if (dwFlags & STRSAFE_FILL_ON_FAILURE)
    {
        size_t cbDest;

        // safe to multiply cchDest * sizeof(wchar_t) since cchDest < NTSTRSAFE_UNICODE_STRING_MAX_CCH and sizeof(wchar_t) is 2
        cbDest = cchDest * sizeof(wchar_t);

        memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);

        *ppszDestEnd = pszDest;
        *pcchRemaining = cchDest;

        *pcchNewDestLength = 0;
    }

    if (dwFlags & STRSAFE_ZERO_LENGTH_ON_FAILURE)
    {
        *ppszDestEnd = pszDest;
        *pcchRemaining = cchDest;

        *pcchNewDestLength = 0;
    }

    return STATUS_SUCCESS;
}

#endif
#endif
#endif

View code on GitHub
#ifndef _NTSTRSAFE_H_INCLUDED_
// Do not call these functions, they are worker functions for internal use within this file
#ifdef DEPRECATE_SUPPORTED
// ...
#else

#define RtlUnicodeStringExHandleOtherFlags  RtlUnicodeStringExHandleOtherFlags_do_not_call_this_function

#endif
#endif

View code on GitHub

No description available.