RtlUnicodeStringValidateWorker - 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
RtlUnicodeStringValidateWorker(
        _In_opt_ PCUNICODE_STRING SourceString,
        _In_ const size_t cchMax,
        _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
RtlUnicodeStringValidateWorker(
        _In_opt_ PCUNICODE_STRING SourceString,
        _In_ const size_t cchMax,
        _In_ DWORD dwFlags)
{
    NTSTATUS status = STATUS_SUCCESS;

    if (SourceString || !(dwFlags & STRSAFE_IGNORE_NULLS))
    {
        if (((SourceString->Length % sizeof(wchar_t)) != 0)         ||
                ((SourceString->MaximumLength % sizeof(wchar_t)) != 0)  ||
                (SourceString->Length > SourceString->MaximumLength)    ||
                (SourceString->MaximumLength > (cchMax * sizeof(wchar_t))))
        {
            status = STATUS_INVALID_PARAMETER;
        }
        else if ((SourceString->Buffer == NULL) &&
                ((SourceString->Length != 0) || (SourceString->MaximumLength != 0)))
        {
            status = STATUS_INVALID_PARAMETER;
        }
    }

    return status;
}

#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 RtlUnicodeStringValidateWorker      RtlUnicodeStringValidateWorker_instead_use_RtlUnicodeStringValidate_or_RtlUnicodeStringValidateEx

#endif
#endif

View code on GitHub

No description available.