public static (IntPtr cfId, string errString, int errorCode) ConnectToCfs(string host) { const int errStringLength = 1000; var errBuf = new byte[errStringLength]; uint errCode = 0; var cfId = Native.CfsConnect(host, out errCode, ref errBuf, errStringLength); if (cfId == IntPtr.Zero) { Console.WriteLine($"Ошибка соединения с мастер-сервисом: {errCode} - {EncodingUtil.Win1251BytesToUtf8(errBuf)}"); } return(cfId, EncodingUtil.Win1251BytesToUtf8(errBuf), Convert.ToInt32(errCode)); }