internal static ServiceTriggerInformation GetTriggerInformation(SERVICE_TRIGGER trigger) { switch (trigger.dwTriggerType) { case ServiceTriggerType.Custom: return(new EtwServiceTriggerInformation(trigger)); case ServiceTriggerType.CustomSystemStateChange: return(new WnfServiceTriggerInformation(trigger)); case ServiceTriggerType.NetworkEndpoint: { Guid sub_type = trigger.GetSubType(); if (sub_type == NAMED_PIPE_EVENT_GUID) { return(new NamedPipeServiceTriggerInformation(trigger)); } else if (sub_type == RPC_INTERFACE_EVENT_GUID) { return(new RpcInterfaceServiceTriggerInformation(trigger)); } } break; case ServiceTriggerType.FirewallPortEvent: return(new FirewallServiceTriggerInformation(trigger)); } return(new ServiceTriggerInformation(trigger)); }
internal ServiceTriggerInformation(SERVICE_TRIGGER trigger) { TriggerType = trigger.dwTriggerType; Action = trigger.dwAction; SubType = trigger.GetSubType(); SubTypeDescription = GetSubTypeDescription(); List <ServiceTriggerCustomData> data = new List <ServiceTriggerCustomData>(); if (trigger.pDataItems != IntPtr.Zero && trigger.cDataItems > 0) { SERVICE_TRIGGER_SPECIFIC_DATA_ITEM[] data_items; ReadArray(trigger.pDataItems, trigger.cDataItems, out data_items); for (int i = 0; i < data_items.Length; ++i) { data.Add(new ServiceTriggerCustomData(data_items[i])); } } CustomData = data.AsReadOnly(); }