/// <summary>
 /// Parse the OP_MOVE_and_OP_COPY_ActionData_forStandard structure.
 /// </summary>
 /// <param name="s">A stream containing the OP_MOVE_and_OP_COPY_ActionData_forStandard structure</param>
 public override void Parse(Stream s)
 {
     base.Parse(s);
     this.FolderInThisStore = ReadBoolean();
     this.StoreEIDSize      = ReadUshort();
     if (FolderInThisStore)
     {
         MAPIString storeEID = new MAPIString(Encoding.ASCII, "", StoreEIDSize);
         storeEID.Parse(s);
         this.StoreEID = storeEID;
     }
     else
     {
         StoreObjectEntryID storeEID = new StoreObjectEntryID();
         storeEID.Parse(s);
         this.StoreEID = storeEID;
     }
     this.FolderEIDSize = ReadUshort();
     if (FolderInThisStore)
     {
         ServerEid folderEID = new ServerEid();
         folderEID.Parse(s);
         this.FolderEID = folderEID;
     }
     else
     {
         this.FolderEID = ReadBytes(FolderEIDSize);
     }
 }
Example #2
0
        /// <summary>
        /// Parse the RopPublicFolderIsGhostedResponse structure.
        /// </summary>
        /// <param name="s">An stream containing RopPublicFolderIsGhostedResponse structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);

            this.RopId            = (RopIdType)ReadByte();
            this.InputHandleIndex = ReadByte();
            HelpMethod help = new HelpMethod();

            this.ReturnValue = help.FormatErrorCode(ReadUint());
            if ((ErrorCodes)ReturnValue == ErrorCodes.Success)
            {
                this.IsGhosted = ReadBoolean();
                if (this.IsGhosted == true)
                {
                    this.ServersCount      = ReadUshort();
                    this.CheapServersCount = ReadUshort();
                    List <MAPIString> tmpServers = new List <MAPIString>();
                    for (int i = 0; i < this.ServersCount; i++)
                    {
                        MAPIString subServer = new MAPIString(Encoding.ASCII);
                        subServer.Parse(s);
                        tmpServers.Add(subServer);
                    }
                    this.Servers = tmpServers.ToArray();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Parse the RopLogonResponse_PublicFolders structure.
        /// </summary>
        /// <param name="s">An stream containing RopLogonResponse_PublicFolders structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);

            this.RopId             = (RopIdType)ReadByte();
            this.OutputHandleIndex = ReadByte();
            HelpMethod help = new HelpMethod();

            this.ReturnValue = help.FormatErrorCode(ReadUint());
            if ((ErrorCodes)ReturnValue == ErrorCodes.Success)
            {
                this.LogonFlags = (LogonFlags)ReadByte();
                this.FolderIds  = new FolderID[13];
                for (int i = 0; i < 13; i++)
                {
                    FolderIds[i] = new FolderID();
                    FolderIds[i].Parse(s);
                }
                this.ReplId      = ReadUshort();
                this.ReplGuid    = ReadGuid();
                this.PerUserGuid = ReadGuid();
            }
            else if ((AdditionalErrorCodes)ReturnValue == AdditionalErrorCodes.WrongServer)
            {
                this.LogonFlags     = (LogonFlags)ReadByte();
                this.ServerNameSize = ReadByte();
                this.ServerName     = new MAPIString(Encoding.ASCII);
                this.ServerName.Parse(s);
            }
        }
        /// <summary>
        /// Parse the WStringArray_r payload of session.
        /// </summary>
        /// <param name="s">The stream to parse</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            byte temp = this.ReadByte();

            if (temp == 0xFF)
            {
                this.MagicNumber = temp;
            }
            else
            {
                s.Position -= 1;
            }

            this.CValues = this.ReadUint();
            List <MAPIString> temBytes = new List <MAPIString>();

            for (ulong i = 0; i < this.CValues; i++)
            {
                MAPIString tempByte = new MAPIString(Encoding.Unicode);
                tempByte.Parse(s);
                temBytes.Add(tempByte);
            }

            this.LppszW = temBytes.ToArray();
        }
Example #5
0
        /// <summary>
        /// Parse the StringsArray_r payload of session.
        /// </summary>
        /// <param name="s">The stream to parse</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            byte temp = this.ReadByte();

            if (temp == 0xFF)
            {
                this.HasValue = temp;
            }
            else
            {
                s.Position -= 1;
            }

            this.Count = this.ReadUint();
            List <MAPIString> temBytes = new List <MAPIString>();

            for (ulong i = 0; i < this.Count; i++)
            {
                MAPIString tempByte = new MAPIString(Encoding.ASCII);
                tempByte.Parse(s);
                temBytes.Add(tempByte);
            }

            this.Strings = temBytes.ToArray();
        }
Example #6
0
        /// <summary>
        /// Parse the RopGetReceiveFolderRequest structure.
        /// </summary>
        /// <param name="s">An stream containing RopGetReceiveFolderRequest structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);

            this.RopId            = (RopIdType)ReadByte();
            this.LogonId          = ReadByte();
            this.InputHandleIndex = ReadByte();
            this.MessageClass     = new MAPIString(Encoding.ASCII);
            this.MessageClass.Parse(s);
        }
        /// <summary>
        /// Parse the OP_MOVE_and_OP_COPY_ActionData_forExtended structure.
        /// </summary>
        /// <param name="s">A stream containing the OP_MOVE_and_OP_COPY_ActionData_forExtended structure</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.StoreEIDSize = ReadUint();
            this.StoreEID     = new MAPIString(Encoding.ASCII, "", (int)StoreEIDSize);
            this.StoreEID.Parse(s);
            this.FolderEIDSize = ReadUint();
            FolderEntryID folderEID = new FolderEntryID();

            this.FolderEID = folderEID;
            this.FolderEID.Parse(s);
        }
 /// <summary>
 /// Parse the PermanentEntryID payload of session.
 /// </summary>
 /// <param name="s">The stream to parse</param>
 public override void Parse(Stream s)
 {
     base.Parse(s);
     this.IDType            = ReadByte();
     this.R1                = ReadByte();
     this.R2                = ReadByte();
     this.R3                = ReadByte();
     this.ProviderUID       = ReadGuid();
     this.R4                = ReadUint();
     this.DisplayTypeString = (DisplayTypeValues)ReadUint();
     this.DistinguishedName = new MAPIString(Encoding.ASCII);
     this.DistinguishedName.Parse(s);
 }
        /// <summary>
        /// Parse the WString_r payload of session.
        /// </summary>
        /// <param name="s">The stream to parse</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            byte temp = ReadByte();

            if (temp == 0xFF)
            {
                this.MagicNumber = temp;
            }
            else
            {
                s.Position -= 1;
            }
            this.Value = new MAPIString(Encoding.Unicode);
            this.Value.Parse(s);
        }
Example #10
0
        /// <summary>
        /// Parse the RopLogonRequest structure.
        /// </summary>
        /// <param name="s">An stream containing RopLogonRequest structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);

            this.RopId             = (RopIdType)ReadByte();
            this.LogonId           = ReadByte();
            this.OutputHandleIndex = ReadByte();
            this.LogonFlags        = (LogonFlags)ReadByte();
            this.OpenFlags         = (OpenFlags)ReadUint();
            this.StoreState        = ReadUint();
            this.EssdnSize         = ReadUshort();
            if (this.EssdnSize > 0)
            {
                this.Essdn = new MAPIString(Encoding.ASCII);
                this.Essdn.Parse(s);
            }
        }
Example #11
0
        /// <summary>
        /// Parse the RopGetReceiveFolderResponse structure.
        /// </summary>
        /// <param name="s">An stream containing RopGetReceiveFolderResponse structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);

            this.RopId            = (RopIdType)ReadByte();
            this.InputHandleIndex = ReadByte();
            HelpMethod help = new HelpMethod();

            this.ReturnValue = help.FormatErrorCode(ReadUint());
            if ((ErrorCodes)ReturnValue == ErrorCodes.Success)
            {
                this.FolderId = new FolderID();
                this.FolderId.Parse(s);
                this.ExplicitMessageClass = new MAPIString(Encoding.ASCII);
                this.ExplicitMessageClass.Parse(s);
            }
        }
 /// <summary>
 /// Parse the NotificationData structure.
 /// </summary>
 /// <param name="s">An stream containing NotificationData structure.</param>
 public override void Parse(Stream s)
 {
     base.Parse(s);
     this.NotificationFlags = new NotificationFlags();
     this.NotificationFlags.Parse(s);
     if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified)
     {
         this.TableEventType = (TableEventTypeEnum)ReadUshort();
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowDeleted || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.TableRowFolderID = new FolderID();
         this.TableRowFolderID.Parse(s);
     }
     if ((((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowDeleted || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.TableRowMessageID = new MessageID();
         this.TableRowMessageID.Parse(s);
     }
     if ((((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowDeleted || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.TableRowInstance = ReadUint();
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.InsertAfterTableRowFolderID = new FolderID();
         this.InsertAfterTableRowFolderID.Parse(s);
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.InsertAfterTableRowID = new MessageID();
         this.InsertAfterTableRowID.Parse(s);
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.InsertAfterTableRowInstance = ReadUint();
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         this.TableRowDataSize = ReadUshort();
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (TableEventType == TableEventTypeEnum.TableRowAdded || TableEventType == TableEventTypeEnum.TableRowModified))
     {
         if (DecodingContext.PropertyTagsForNotify != null && DecodingContext.PropertyTagsForNotify.ContainsKey(this.NotificationHandle))
         {
             propertiesBySetColum = DecodingContext.PropertyTagsForNotify[this.NotificationHandle];
         }
         else
         {
             throw new MissingInformationException("Missing PropertyTags information for RopNotifyResponse", (ushort)RopIdType.RopNotify, new uint[] { 0, NotificationHandle });
         }
         this.TableRowData = new PropertyRow(propertiesBySetColum);
         this.TableRowData.Parse(s);
     }
     if (NotificationFlags.Value.NotificationType != NotificationTypesEnum.TableModified && NotificationFlags.Value.NotificationType != NotificationTypesEnum.Extended)
     {
         this.FolderId = new FolderID();
         this.FolderId.Parse(s);
     }
     if (NotificationFlags.Value.NotificationType != NotificationTypesEnum.TableModified && NotificationFlags.Value.NotificationType != NotificationTypesEnum.Extended && (((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0))
     {
         this.MessageId = new MessageID();
         this.MessageId.Parse(s);
     }
     if ((NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCreated || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectDeleted || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && ((((int)NotificationFlags.Value.NotificationDataAvailability) & 0xC000) == 0xC000 || (((int)NotificationFlags.Value.NotificationDataAvailability) & 0xC000) == 0))
     {
         this.ParentFolderId = new FolderID();
         this.ParentFolderId.Parse(s);
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied)
     {
         this.OldFolderId = new FolderID();
         this.OldFolderId.Parse(s);
     }
     if ((NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && (((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0))
     {
         this.OldMessageId = new MessageID();
         this.OldMessageId.Parse(s);
     }
     if ((NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && (((int)NotificationFlags.Value.NotificationDataAvailability & 0x8000) == 0))
     {
         this.OldParentFolderId = new MessageID();
         this.OldParentFolderId.Parse(s);
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCreated || NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectModified)
     {
         this.TagCount = ReadUshort();
         if (TagCount != 0x0000 && TagCount != 0xFFFF)
         {
             List <PropertyTag> listTags = new List <PropertyTag>();
             for (int i = 0; i < this.TagCount; i++)
             {
                 PropertyTag tempTag = new PropertyTag();
                 tempTag.Parse(s);
                 listTags.Add(tempTag);
             }
             this.Tags = listTags.ToArray();
         }
     }
     if (((int)NotificationFlags.Value.NotificationDataAvailability & 0x1000) != 0)
     {
         this.TotalMessageCount = ReadUint();
     }
     if (((int)NotificationFlags.Value.NotificationDataAvailability & 0x2000) != 0)
     {
         this.UnreadMessageCount = ReadUint();
     }
     if (NotificationFlags.Value.NotificationType == NotificationTypesEnum.NewMail)
     {
         this.MessageFlags = ReadUint();
         this.UnicodeFlag  = ReadByte();
         this.MessageClass = new MAPIString(Encoding.ASCII);
         this.MessageClass.Parse(s);
     }
 }
        /// <summary>
        /// Parse the NotificationData structure.
        /// </summary>
        /// <param name="s">A stream containing NotificationData structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.NotificationFlags = new NotificationFlags();
            this.NotificationFlags.Parse(s);

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified)
            {
                this.TableEventType = (TableEventTypeEnum)this.ReadUshort();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowDeleted || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowFolderID = new FolderID();
                this.TableRowFolderID.Parse(s);
            }

            if ((((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowDeleted || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowMessageID = new MessageID();
                this.TableRowMessageID.Parse(s);
            }

            if ((((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowDeleted || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowInstance = this.ReadUint();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.InsertAfterTableRowFolderID = new FolderID();
                this.InsertAfterTableRowFolderID.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.InsertAfterTableRowID = new MessageID();
                this.InsertAfterTableRowID.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.InsertAfterTableRowInstance = this.ReadUint();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowDataSize = this.ReadUshort();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                int parsingSessionID = MapiInspector.MAPIInspector.ParsingSession.id;
                if (!(DecodingContext.Notify_handlePropertyTags.Count > 0 && DecodingContext.Notify_handlePropertyTags.ContainsKey(this.notificationHandle) && DecodingContext.Notify_handlePropertyTags[this.notificationHandle].ContainsKey(parsingSessionID) &&
                      DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item1 == MapiInspector.MAPIInspector.ParsingSession.RequestHeaders.RequestPath &&
                      DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item2 == MapiInspector.MAPIInspector.ParsingSession.LocalProcess &&
                      DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item3 == MapiInspector.MAPIInspector.ParsingSession.RequestHeaders["X-ClientInfo"]))
                {
                    throw new MissingInformationException("Missing PropertyTags information for RopNotifyResponse", (ushort)RopIdType.RopNotify, new uint[] { this.IsEmptyMessageID(this.TableRowMessageID) ? (uint)0 : (uint)1, this.notificationHandle });
                }
                else
                {
                    this.propertiesBySetColum = DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item4;
                }

                this.TableRowData = new PropertyRow(this.propertiesBySetColum);
                this.TableRowData.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.TableModified && this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.Extended)
            {
                this.FolderId = new FolderID();
                this.FolderId.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.TableModified && this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.Extended && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0))
            {
                this.MessageId = new MessageID();
                this.MessageId.Parse(s);
            }

            if ((this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCreated || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectDeleted || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && ((((int)this.NotificationFlags.Value.NotificationDataAvailability) & 0xC000) == 0xC000 || (((int)this.NotificationFlags.Value.NotificationDataAvailability) & 0xC000) == 0))
            {
                this.ParentFolderId = new FolderID();
                this.ParentFolderId.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied)
            {
                this.OldFolderId = new FolderID();
                this.OldFolderId.Parse(s);
            }

            if ((this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0))
            {
                this.OldMessageId = new MessageID();
                this.OldMessageId.Parse(s);
            }

            if ((this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) == 0))
            {
                this.OldParentFolderId = new MessageID();
                this.OldParentFolderId.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCreated || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectModified)
            {
                this.TagCount = this.ReadUshort();

                if (this.TagCount != 0x0000 && this.TagCount != 0xFFFF)
                {
                    List <PropertyTag> listTags = new List <PropertyTag>();

                    for (int i = 0; i < this.TagCount; i++)
                    {
                        PropertyTag tempTag = new PropertyTag();
                        tempTag.Parse(s);
                        listTags.Add(tempTag);
                    }

                    this.Tags = listTags.ToArray();
                }
            }

            if (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x1000) != 0)
            {
                this.TotalMessageCount = this.ReadUint();
            }

            if (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x2000) != 0)
            {
                this.UnreadMessageCount = this.ReadUint();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.NewMail)
            {
                this.MessageFlags = this.ReadUint();
                this.UnicodeFlag  = this.ReadByte();
                this.MessageClass = new MAPIString(Encoding.ASCII);
                this.MessageClass.Parse(s);
            }
        }