internal ScheduledJob(byte[] bytes) { #region FIXDLEN_DATA ProductVersion = (PRODUCT_VERSION)BitConverter.ToUInt16(bytes, 0x00); FileVersion = BitConverter.ToUInt16(bytes, 0x02); UUID = new Guid(BitConverter.ToInt32(bytes, 0x04), BitConverter.ToInt16(bytes, 0x08), BitConverter.ToInt16(bytes, 0x0A), NativeMethods.GetSubArray(bytes, 0x0C, 0x08)); ApplicationNameOffset = BitConverter.ToUInt16(bytes, 0x14); TriggerOffset = BitConverter.ToUInt16(bytes, 0x16); ErrorRetryCount = BitConverter.ToUInt16(bytes, 0x18); ErrorRetryInterval = BitConverter.ToUInt16(bytes, 0x1A); IdleDeadline = BitConverter.ToUInt16(bytes, 0x1C); IdleWait = BitConverter.ToUInt16(bytes, 0x1E); //Priority = (PRIORITY_CLASS)BitConverter.ToUInt32(bytes, 0x20); MaximumRuntime = BitConverter.ToUInt32(bytes, 0x24); ExitCode = BitConverter.ToUInt32(bytes, 0x28); Status = (STATUS)BitConverter.ToUInt32(bytes, 0x2C); Flags = (TASK_FLAG)BitConverter.ToUInt32(bytes, 0x30); #region RunTime short year = BitConverter.ToInt16(bytes, 0x34); short month = BitConverter.ToInt16(bytes, 0x36); short day = BitConverter.ToInt16(bytes, 0x3A); short hour = BitConverter.ToInt16(bytes, 0x3C); short minute = BitConverter.ToInt16(bytes, 0x3E); short second = BitConverter.ToInt16(bytes, 0x40); short milliseconds = BitConverter.ToInt16(bytes, 0x42); if (year != 0) { RunTime = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc); } else { RunTime = new DateTime(0); } #endregion RunTime #endregion FIXDLEN_DATA #region Variable-Length Data Section RunningInstanceCount = BitConverter.ToUInt16(bytes, 0x44); ApplicationNameLength = BitConverter.ToUInt16(bytes, ApplicationNameOffset); ApplicationName = Encoding.Unicode.GetString(bytes, ApplicationNameOffset + 0x02, ApplicationNameLength * 0x02).Split('\0')[0]; int parameterOffset = ApplicationNameOffset + 0x02 + (ApplicationNameLength * 2); ParameterLength = BitConverter.ToUInt16(bytes, parameterOffset); Parameters = Encoding.Unicode.GetString(bytes, parameterOffset, ParameterLength * 0x02).Split('\0')[0]; int workingdirectoryOffset = parameterOffset + 0x02 + (ParameterLength * 2); WorkingDirectoryLength = BitConverter.ToUInt16(bytes, workingdirectoryOffset); WorkingDirectory = Encoding.Unicode.GetString(bytes, workingdirectoryOffset, WorkingDirectoryLength * 2).Split('\0')[0]; int authorOffset = workingdirectoryOffset + 0x02 + (WorkingDirectoryLength * 2); AuthorLength = BitConverter.ToUInt16(bytes, authorOffset); Author = Encoding.Unicode.GetString(bytes, authorOffset, AuthorLength * 2).Split('\0')[0]; int commentOffset = authorOffset + 0x02 + (AuthorLength * 2); CommentLength = BitConverter.ToUInt16(bytes, commentOffset); Comment = Encoding.Unicode.GetString(bytes, commentOffset, CommentLength * 2).Split('\0')[0]; #region StartTime year = BitConverter.ToInt16(bytes, TriggerOffset + 0x06); month = BitConverter.ToInt16(bytes, TriggerOffset + 0x08); day = BitConverter.ToInt16(bytes, TriggerOffset + 0x0A); hour = BitConverter.ToInt16(bytes, TriggerOffset + 0x12); minute = BitConverter.ToInt16(bytes, TriggerOffset + 0x14); StartTime = new DateTime(year, month, day, hour, minute, 0, DateTimeKind.Utc); #endregion StartTime #endregion Variable-Length Data Section }