InitializeAsTaskWithoutSql(TmOikTaskOptions taskOptions, TmInitializeOptions options) { Native.CfsInitLibrary(); var taskArgs = Environment.GetCommandLineArgs(); taskArgs[0] = Native.GetOikTaskExecutable(taskArgs[0]); var startEventHandle = new IntPtr(); var stopEventHandle = new IntPtr(); Native.CfsPmonLocalRegisterProcess(taskArgs.Length, taskArgs, ref startEventHandle, ref stopEventHandle); Native.PlatformSetEvent(startEventHandle); SetUserCredentials(options.User, options.Password); var tmCid = Connect(options.Host, options.TmServer, options.ApplicationName, options.TmCallback, options.TmCallbackParameters); if (tmCid == 0) { throw new Exception("Нет связи с ТМ-сервером, ошибка " + GetLastError()); } return(tmCid, GetUserInfo(tmCid, options.TmServer), GetTmServerFeatures(tmCid), stopEventHandle); }