Пример #1
0
        public ShellItem0x30(byte[] buf)
            : base(buf)
        {
            int off = 0x04;

            Flags = unpack_byte(0x03);

            FileSize        = unpack_dword(off);
            off            += 4;
            ModifiedDate    = unpack_dosdate(off);
            off            += 4;
            FileAttributes  = unpack_word(off);
            off            += 2;
            ExtensionOffset = unpack_word(Size - 2);

            if (ExtensionOffset > Size)
            {
                throw new OverrunBufferException(ExtensionOffset, Size);
            }

            if ((Type & 0x04) != 0)
            {
                ShortName = unpack_wstring(off, ExtensionOffset - off);
            }
            else
            {
                ShortName = unpack_string(off, ExtensionOffset - off);
            }

            ExtensionBlockBEEF0004 ExtensionBlock = new ExtensionBlockBEEF0004(buf, ExtensionOffset + offset);

            ExtensionBlocks.Add(ExtensionBlock);
        }
Пример #2
0
        public void ExtensionBlockBEEF0004Test5()
        {
            ExtensionBlockBEEF0004 block = new ExtensionBlockBEEF0004(testBufferVersion9, testOffset);

            Assert.IsTrue(block.Fields.Count == 7);
            Assert.IsTrue(block.Fields.ContainsKey("Size"));
            Assert.IsTrue(block.Fields["Size"] as ushort? == block.Size);
            Assert.IsTrue(block.Size == testBufferVersion9.Length);
            Assert.IsTrue(block.Fields.ContainsKey("ExtensionVersion"));
            Assert.IsTrue(block.Fields["ExtensionVersion"] as ushort? == block.ExtensionVersion);
            Assert.IsTrue(block.ExtensionVersion == 9);
            Assert.IsTrue(block.Fields.ContainsKey("Signature"));
            Assert.IsTrue(block.Fields["Signature"] as uint? == block.Signature);
            Assert.IsTrue(block.Signature == 0xBEEF0004);
            Assert.IsTrue(block.Fields.ContainsKey("CreationDate"));
            Assert.IsTrue(block.Fields["CreationDate"] as DateTime? == block.CreationDate);
            Assert.IsTrue(block.CreationDate == new DateTime(1980, 5, 10, 21, 21, 20));
            Assert.IsTrue(block.Fields.ContainsKey("AccessedDate"));
            Assert.IsTrue(block.Fields["AccessedDate"] as DateTime? == block.AccessedDate);
            Assert.IsTrue(block.AccessedDate == new DateTime(1992, 4, 9, 0, 5, 22));
            Assert.IsTrue(block.Fields.ContainsKey("LongName"));
            Assert.IsTrue(block.Fields["LongName"] as string == block.LongName);
            Assert.IsTrue(block.LongName == "BEEF");
            Assert.IsTrue(block.Fields.ContainsKey("LocalizedName"));
            Assert.IsTrue(block.Fields["LocalizedName"] as string == block.LocalizedName);
            Assert.IsTrue(block.LocalizedName == "BAD");
        }
Пример #3
0
        public void ExtensionBlockBEEF0004Test1()
        {
            ExtensionBlockBEEF0004 block = new ExtensionBlockBEEF0004();

            Assert.IsTrue(block.Fields.Count == 0);
            Assert.IsTrue(block.Size == numericDefault);
            Assert.IsTrue(block.ExtensionVersion == numericDefault);
            Assert.IsTrue(block.Signature == numericDefault);
            Assert.IsTrue(block.CreationDate == dateDefault);
            Assert.IsTrue(block.AccessedDate == dateDefault);
            Assert.IsTrue(block.LongName == stringDefault);
            Assert.IsTrue(block.LocalizedName == stringDefault);
        }
Пример #4
0
        public ShellItem0x74(byte[] buf)
            : base(buf)
        {
            // Unknown - Empty ( 1 byte)
            // Unknown - size? - 2 bytes
            // CFSF - 4 bytes
            Signature = unpack_dword(0x06);
            // sub shell item data size - 2 bytes

            int off = 0x0A;

            SubItem = new FILEENTRY_FRAGMENT(buf, offset + off, this, 0x04);
            off    += SubItem.Size;

            off += 2; // Empty extension block?

            // 5e591a74-df96-48d3-8d67-1733bcee28ba
            DelegateItemIdentifier = unpack_guid(off);
            off += 16;
            ItemClassIdentifier = unpack_guid(off);
            off           += 16;
            ExtensionBlock = new ExtensionBlockBEEF0004(buf, offset + off);
            ExtensionBlocks.Add(ExtensionBlock);
        }
Пример #5
0
        public void ExtensionBlockBEEF0004Test()
        {
            ExtensionBlockBEEF0004 block = new ExtensionBlockBEEF0004()
            {
                CreationDate     = new DateTime(1000200020),
                AccessedDate     = new DateTime(1289012842900),
                LongName         = "EXTNS",
                LocalizedName    = "Hello, World!",
                Size             = 42,
                ExtensionVersion = 51,
                Signature        = 1000
            };

            Assert.IsTrue(block.Fields.Count == 7);
            Assert.IsTrue(block.Fields.ContainsKey("Size"));
            Assert.IsTrue(block.Fields["Size"] as ushort? == block.Size);
            Assert.IsTrue(block.Size == 42);
            Assert.IsTrue(block.Fields.ContainsKey("ExtensionVersion"));
            Assert.IsTrue(block.Fields["ExtensionVersion"] as ushort? == block.ExtensionVersion);
            Assert.IsTrue(block.ExtensionVersion == 51);
            Assert.IsTrue(block.Fields.ContainsKey("Signature"));
            Assert.IsTrue(block.Fields["Signature"] as uint? == block.Signature);
            Assert.IsTrue(block.Signature == 1000);
            Assert.IsTrue(block.Fields.ContainsKey("CreationDate"));
            Assert.IsTrue(block.Fields["CreationDate"] as DateTime? == block.CreationDate);
            Assert.IsTrue(block.CreationDate == new DateTime(1000200020));
            Assert.IsTrue(block.Fields.ContainsKey("AccessedDate"));
            Assert.IsTrue(block.Fields["AccessedDate"] as DateTime? == block.AccessedDate);
            Assert.IsTrue(block.AccessedDate == new DateTime(1289012842900));
            Assert.IsTrue(block.Fields.ContainsKey("LongName"));
            Assert.IsTrue(block.Fields["LongName"] as string == block.LongName);
            Assert.IsTrue(block.LongName == "EXTNS");
            Assert.IsTrue(block.Fields.ContainsKey("LocalizedName"));
            Assert.IsTrue(block.Fields["LocalizedName"] as string == block.LocalizedName);
            Assert.IsTrue(block.LocalizedName == "Hello, World!");
        }