Exemplo n.º 1
0
        public MODULE(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.NameRecord        = new MODULENAME(ProjectInformation, Data);
            this.NameUnicodeRecord = new MODULENAMEUNICODE(Data);
            this.StreamNameRecord  = new MODULESTREAMNAME(ProjectInformation, Data);
            this.DocStringRecord   = new MODULEDOCSTRING(Data);
            this.OffsetRecord      = new MODULEOFFSET(Data);
            this.HelpContextRecord = new MODULEHELPCONTEXT(Data);
            this.CookieRecord      = new MODULECOOKIE(Data);
            this.TypeRecord        = new MODULETYPE(Data);

            if (Data.PeekUInt16() == (UInt16)0x0025)
            {
                this.ReadOnlyRecord = new MODULEREADONLY(Data);
            }

            if (Data.PeekUInt16() == (UInt16)0x0028)
            {
                this.PrivateRecord = new MODULEPRIVATE(Data);
            }

            this.Terminator = Data.ReadUInt16();
            this.Reserved   = Data.ReadUInt32();

            Validate();
        }
Exemplo n.º 2
0
        public REFERENCE(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.NameRecord = new REFERENCENAME(ProjectInformation, Data);

            var peek = Data.PeekUInt16();

            if (peek == 0x002F)
            {
                this.ReferenceRecord = new REFERENCECONTROL(ProjectInformation, Data);
            }
            else if (peek == 0x0033)
            {
                // todo: Test this, documentation says 0x0033 is REFERENCECONTROL too but this seems odd
                this.ReferenceRecord = new REFERENCEORIGINAL(Data);
            }
            else if (peek == 0x000D)
            {
                this.ReferenceRecord = new REFERENCEREGISTERED(Data);
            }
            else if (peek == 0x000E)
            {
                this.ReferenceRecord = new REFERENCEPROJECT(ProjectInformation, Data);
            }
            else
            {
                throw new WrongValueException("peek", peek, "0x002F, 0x0033, 0x000D or 0x000E");
            }

            Validate();
        }
        public REFERENCECONTROL(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.Id                  = Data.ReadUInt16();
            this.SizeTwiddled        = Data.ReadUInt32();
            this.SizeOfLibidTwiddled = Data.ReadUInt32();
            this.LibidTwiddled       = Data.ReadBytes(this.SizeOfLibidTwiddled);
            this.Reserved1           = Data.ReadUInt32();
            this.Reserved2           = Data.ReadUInt16();

            UInt16 peek = Data.PeekUInt16();

            if (peek == (UInt16)0x0016)
            {
                // REFERENCENAME record
                this.NameRecordExtended = new REFERENCENAME(ProjectInformation, Data);
            }

            this.Reserved3           = Data.ReadUInt16();
            this.SizeExtended        = Data.ReadUInt32();
            this.SizeOfLibidExtended = Data.ReadUInt32();
            this.LibidExtended       = Data.ReadBytes(this.SizeOfLibidExtended);
            this.Reserved4           = Data.ReadUInt32();
            this.Reserved5           = Data.ReadUInt16();
            this.OriginalTypeLib     = Data.ReadGuid();
            this.Cookie = Data.ReadUInt32();

            Validate();
        }
Exemplo n.º 4
0
        public MODULENAME(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
            : base(Data)
        {
            this.ProjectInformation = ProjectInformation;

            //this.Id = Data.ReadUInt16();
            //this.SizeOfModuleName = Data.ReadUInt32();
            //this.ModuleName = Data.ReadBytes(this.SizeOfModuleName);

            Validate();
        }
Exemplo n.º 5
0
        public REFERENCENAME(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.ProjectInformation = ProjectInformation;

            this.Id                = Data.ReadUInt16();
            this.SizeOfName        = Data.ReadUInt32();
            this.Name              = Data.ReadBytes(this.SizeOfName);
            this.Reserved          = Data.ReadUInt16();
            this.SizeOfNameUnicode = Data.ReadUInt32();
            this.NameUnicode       = Data.ReadBytes(this.SizeOfNameUnicode);

            Validate();
        }
Exemplo n.º 6
0
        public MODULESTREAMNAME(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.ProjectInformation = ProjectInformation;

            this.Id = Data.ReadUInt16();
            this.SizeOfStreamName        = Data.ReadUInt32();
            this.StreamName              = Data.ReadBytes(this.SizeOfStreamName);
            this.Reserved                = Data.ReadUInt16();
            this.SizeOfStreamNameUnicode = Data.ReadUInt32();
            this.StreamNameUnicode       = Data.ReadBytes(this.SizeOfStreamNameUnicode);

            Validate();
        }
        public PROJECTREFERENCES(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            var result = new List <REFERENCE>();

            // Read without progressing the pointer.
            // 0x000F indicates the beginning of a PROJECTMODULES Record, so we're done once we encounter that.
            while (Data.PeekUInt16() != 0x000F)
            {
                var reference = new REFERENCE(ProjectInformation, Data);
                result.Add(reference);
            }

            this.ReferenceArray = result.ToArray();
        }
Exemplo n.º 8
0
        public ModuleStream(PROJECTINFORMATION ProjectInformation, MODULE module, XlBinaryReader Data)
        {
            this.ProjectInformation = ProjectInformation;

            this.PerformanceCache = Data.ReadBytes(module.OffsetRecord.TextOffset);

            Byte[] rest      = Data.GetUnreadData();
            var    reader    = new XlBinaryReader(ref rest);
            var    container = new CompressedContainer(reader);
            var    buffer    = new DecompressedBuffer();

            container.Decompress(buffer);
            this.UncompressedSourceCode = buffer.GetData();
        }
Exemplo n.º 9
0
        public REFERENCEPROJECT(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.ProjectInformation = ProjectInformation;

            this.Id   = Data.ReadUInt16();
            this.Size = Data.ReadUInt32();
            this.SizeOfLibidAbsolute = Data.ReadUInt32();
            this.LibidAbsolute       = Data.ReadBytes(this.SizeOfLibidAbsolute);
            this.SizeOfLibidRelative = Data.ReadUInt32();
            this.LibidRelative       = Data.ReadBytes(this.SizeOfLibidRelative);
            this.MajorVersion        = Data.ReadUInt32();
            this.MinorVersion        = Data.ReadUInt16();

            Validate();
        }
Exemplo n.º 10
0
        public PROJECTMODULES(PROJECTINFORMATION ProjectInformation, XlBinaryReader Data)
        {
            this.Id    = Data.ReadUInt16();
            this.Size  = Data.ReadUInt32();
            this.Count = Data.ReadUInt16();
            this.ProjectCookieRecord = new PROJECTCOOKIE(Data);

            // Read Modules
            this.Modules = new MODULE[this.Count];
            for (int i = 0; i < this.Count; i++)
            {
                var module = new MODULE(ProjectInformation, Data);
                this.Modules[i] = module;
            }

            Validate();
        }
Exemplo n.º 11
0
 public string GetNameAsString(PROJECTINFORMATION ProjectInformation)
 {
     return(GetNameAsString(ProjectInformation.CodePageRecord));
 }
Exemplo n.º 12
0
 public string GetUncompressedSourceCodeAsString(PROJECTINFORMATION ProjectInformation)
 {
     return(GetUncompressedSourceCodeAsString(ProjectInformation.CodePageRecord));
 }
Exemplo n.º 13
0
 internal void SetUncompressetSourceCode(string code, PROJECTINFORMATION ProjectInformation)
 {
     SetUncompressetSourceCode(code, ProjectInformation.CodePageRecord);
 }
Exemplo n.º 14
0
 internal ModuleStream(PROJECTINFORMATION ProjectInformation, MODULE module, string SourceCode)
 {
     this.ProjectInformation = ProjectInformation;
     this.PerformanceCache   = new Byte[] { };
     SetUncompressetSourceCode(SourceCode, ProjectInformation.CodePageRecord);
 }
Exemplo n.º 15
0
 public DirStream(XlBinaryReader Data)
 {
     this.InformationRecord = new PROJECTINFORMATION(Data);
     this.ReferencesRecord  = new PROJECTREFERENCES(this.InformationRecord, Data);
     this.ModulesRecord     = new PROJECTMODULES(this.InformationRecord, Data);
 }