> For the complete documentation index, see [llms.txt](https://malwaresourcecode.com/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://malwaresourcecode.com/home/markdown/rtlinitansistring.md).

# RtlInitAnsiString

```
VOID RtlInitAnsiString(PANSI_STRING DestinationString, PCSTR SourceString)
{
    SIZE_T Size;

    if (SourceString)
    {
        Size = StringLengthA(SourceString);
        if (Size > (65535 - sizeof(CHAR))) Size = 65535 - sizeof(CHAR);
        DestinationString->Length = (USHORT)Size;
        DestinationString->MaximumLength = (USHORT)Size + sizeof(CHAR);
    }
    else
    {
        DestinationString->Length = 0;
        DestinationString->MaximumLength = 0;
    }

    DestinationString->Buffer = (PCHAR)SourceString;
}

```
