Formatmessage

[DllImport("Kernel32.dll")][return: MarshalAs(UnmanagedType.U4)]
public static extern uint FormatMessage(uint dwFlags,
   IntPtr lpSource,
   uint dwMessageId,
   uint dwLanguageId,
   StringBuilder lpBuffer,
   uint nSize,
   IntPtr Arguments
);

Microsoft documentation: Link

Last updated