What does NTSTATUS 0xC0000161 (STATUS_ILLEGAL_CHARACTER) mean?

 
Previous Next
STATUS_ILL_FORMED_SERVICE_ENTRY STATUS_UNMAPPABLE_CHARACTER

STATUS_ILLEGAL_CHARACTER

Preserve the original code units: malformed input is different from an unmappable character

STATUS_ILLEGAL_CHARACTER covers invalid character data. The published NTSTATUS text explicitly mentions a multibyte lead byte without a required trail byte and the Unicode noncharacters 0xFFFF and 0xFFFE. The Unicode Standard requires conformant encoding-form conversion to treat ill-formed code-unit sequences as an error condition rather than interpret them as valid text.

This is not the same as STATUS_UNMAPPABLE_CHARACTER. A malformed UTF-8 or DBCS sequence is structurally invalid input; an unmappable character can be a perfectly valid Unicode character that the chosen target code page cannot represent. Preserve raw bytes, source encoding, and conversion flags so those cases remain distinguishable.

Windows conversion functions can be configured to reject invalid sequences. For example, MultiByteToWideChar documents MB_ERR_INVALID_CHARS for strict handling. Avoid pre-cleaning the string with lossy replacement before logging the failure, because the replacement character destroys the byte offset and sequence needed to find the producer of corrupt text.

What to inspect

  • The raw source bytes or UTF-16 code units and the first invalid offset before any replacement or normalization.
  • Declared source encoding/code page and strictness flags passed to the conversion function.
  • The component that produced or decoded the input immediately before the illegal sequence appeared.

References


Looking for a different code? Search another status or error code.