예제 #1
0
        // C2FORMAT.TXT line 139ff
        //METAFILE (importierte WMF-Grafik)
        //  INT           Type
        //  LONG[4]       left, top, right, bottom
        //  LONG          xProp (Soll-Seitenverhaeltnis)
        //  LONG          yProp
        //  INT[4]        reserviert
        //  BOOL          fMF (in capella 2.0 immer TRUE)
        //  if fMF
        //    METAFILEPICT mf
        //    DWORD size
        //    CHAR[size] Daten
        //  endif
        //end
        private void ReadMETAFILE(byte[] buffer, ref uint position)
        {
            Read(buffer, ref position, out INT type);
            var margin = new LONG[4];

            for (int i = 0; i < 4; i++)
            {
                Read(buffer, ref position, out margin[i]);
            }
            Read(buffer, ref position, out LONG propX);
            Read(buffer, ref position, out LONG propY);

            var reserviert = new INT[4];

            for (int i = 0; i < 4; i++)
            {
                Read(buffer, ref position, out reserviert[i]);
            }

            Read(buffer, ref position, out BOOL fMF);

            if (fMF)
            {
                this.ReadMETAFILEPICT(buffer, ref position);
                Read(buffer, ref position, out DWORD size);
                for (int i = 0; i < size; i++)
                {
                    Read(buffer, ref position, out CHAR datenDummy);
                }
            }
        }
예제 #2
0
 public BITMAPINFOHEADER(int width, int height)
 {
     biSize          = (uint)Marshal.SizeOf <BITMAPINFOHEADER>();
     biWidth         = width;
     biHeight        = -height;
     biPlanes        = 1;
     biBitCount      = 32;
     biCompression   = BI_RGB;
     biSizeImage     = 0;
     biXPelsPerMeter = 0;
     biYPelsPerMeter = 0;
     biClrUsed       = 0;
     biClrImportant  = 0;
 }
예제 #3
0
        protected LONG lfanew()
        {
            /* IMAGE_DOS_HEADER - winnt.h */

            var stream = reader.BaseStream;

            // 0x3c LONG e_lfanew;
            stream.Seek(0x3C, SeekOrigin.Begin);

            // File address of new exe header
            LONG e_lfanew = reader.ReadInt32();

            if (e_lfanew < stream.Length)
            {
                return(e_lfanew);
            }
            throw new PECorruptDataException();
        }
예제 #4
0
파일: API.cs 프로젝트: jpbruyere/opentk
 static extern LONG SetWindowLongInternal(HWND hWnd, GetWindowLongOffsets nIndex, LONG dwNewLong);
예제 #5
0
        protected TExInfo addrOfExport(LONG e_lfanew)
        {
            var stream = reader.BaseStream;

            /* IMAGE_NT_HEADERS */
            // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680336.aspx

            stream.Seek(e_lfanew, SeekOrigin.Begin);

            char[] sig = new char[4];
            reader.Read(sig, 0, sig.Length); // A 4-byte signature identifying the file as a PE image

            // The bytes are "PE\0\0"
            if (sig[0] != 'P' || sig[1] != 'E' || sig[2] != '\0' || sig[3] != '\0')
            {
                throw new PECorruptDataException();
            }

            /* IMAGE_FILE_HEADER */
            // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680313.aspx

            byte[] IMAGE_FILE_HEADER = new byte[20];
            reader.Read(IMAGE_FILE_HEADER, 0, IMAGE_FILE_HEADER.Length);

            dynamic ifh = NativeData
                          ._(IMAGE_FILE_HEADER)
                          .t <WORD, WORD>(null, "NumberOfSections")
                          .align <DWORD>(3)
                          .t <WORD, WORD>("SizeOfOptionalHeader")
                          .Raw.Type;

            /* IMAGE_OPTIONAL_HEADER */
            // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680339.aspx

            // move to NumberOfRvaAndSizes

            if (ifh.SizeOfOptionalHeader == 0xE0)  // IMAGE_OPTIONAL_HEADER32
            {
                stream.Seek(0x5C, SeekOrigin.Current);
            }
            else if (ifh.SizeOfOptionalHeader == 0xF0)  // IMAGE_OPTIONAL_HEADER64
            {
                stream.Seek(0x6C, SeekOrigin.Current);
            }
            else
            {
                // also known 0 for object files
                throw new PECorruptDataException($"SizeOfOptionalHeader: {ifh.SizeOfOptionalHeader}");
            }

            DWORD NumberOfRvaAndSizes = reader.ReadUInt32(); // The number of directory entries.

            /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
             *
             *  winnt.h Directory Entries:
             *
             #define IMAGE_DIRECTORY_ENTRY_EXPORT          0   // Export Directory
             #define IMAGE_DIRECTORY_ENTRY_IMPORT          1   // Import Directory
             #define IMAGE_DIRECTORY_ENTRY_RESOURCE        2   // Resource Directory
             *      ...
             */
            /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
            // IMAGE_DATA_DIRECTORY struct: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680305.aspx

            byte[] DIRECTORY_EXPORT = new byte[8];
            reader.Read(DIRECTORY_EXPORT, 0, DIRECTORY_EXPORT.Length);

            dynamic idd = NativeData
                          ._(DIRECTORY_EXPORT)
                          .t <DWORD>("VirtualAddress")
                          .t <DWORD>("Size")
                          .Raw.Type;

            // to the end of directories
            stream.Seek(8 * (NumberOfRvaAndSizes - 1), SeekOrigin.Current);

            return(new TExInfo()
            {
                VirtualAddress = idd.VirtualAddress,
                Size = idd.Size,
                NumberOfSections = ifh.NumberOfSections,
            });
        }
예제 #6
0
파일: Pts.cs 프로젝트: JianwenSun/cc
            FSCOMPOSITECOLUMNDETAILS*); /* OUT: composite column details                */

FSERR FSAPI FsQueryCompositeColumnFootnoteList(
            PFSCONTEXT,                 /* IN: ptr to FS context                        */
            PCFSCOMPOSITECOLUMN,        /* IN: ptr to composite column                  */
            LONG,                       /* IN: size of array of footnote tracks         */
            PFSTRACKDESCRIPTION,        /* OUT: array of track descriptions             */
            LONG*);                     /* OUT: actual number of footnotes              */
예제 #7
0
파일: Pts.cs 프로젝트: JianwenSun/cc
            FSENDNOTECOLUMNDETAILS*);   /* OUT: endnote column details                  */

FSERR FSAPI FsQuerySectionCompositeColumnList(
            PFSCONTEXT,                 /* IN: ptr to FS context                        */
            PCFSSECTION,                /* IN: ptr to section                           */
            LONG,                       /* IN: size of array of composite column descr. */
            PFSCOMPOSITECOLUMNDESCRIPTION,/* OUT: array of composite column descriptions    */
            LONG*);                     /* OUT: actual number of composite columns      */
예제 #8
0
파일: Pts.cs 프로젝트: JianwenSun/cc
            FSFOOTNOTECOLUMNDETAILS*);  /* OUT: footnote column details                 */

FSERR FSAPI FsQueryFootnoteColumnTrackList(
            PFSCONTEXT,                 /* IN: ptr to FS context                        */
            PCFSFOOTNOTECOLUMN,         /* IN: ptr to footnote column                   */
            LONG,                       /* IN: size of array of track descriptions      */
            PFSTRACKDESCRIPTION,        /* OUT: array of track descriptions             */
            LONG*);                     /* OUT: actual number of tracks                 */
예제 #9
0
파일: Pts.cs 프로젝트: JianwenSun/cc
            out FSPAGEDETAILS pPageDetails);    // OUT: page details

#if NEVER
FSERR FSAPI FsQueryPageFootnoteColumnList(
            PFSCONTEXT,                 /* IN: ptr to FS context                        */
            PCFSPAGE,                   /* IN: ptr to page                              */
            LONG,                       /* IN: size of array of footnote columns        */
            PFSFOOTNOTECOLUMNDESCRIPTION,/* OUT: array of footnote columns descriptions */
            LONG*);                     /* OUT: actual number of footnote columns       */
예제 #10
0
파일: Pts.cs 프로젝트: JianwenSun/cc
                        LONG*);         /* OUT: maximum number of 
                                                    possible intervals          */
FSERR FSAPI FsGetIntervals(
                        PFSCONTEXT,     /* IN: ptr to FS context                */
                        PCFSGEOM,       /* IN: pointer to geometry              */
                        FSWDIR,         /* IN: current direction                */
                        PCFSRECT,       /* IN: rect for the interval search     */
                        LONG,           /* IN: size of the interval array       */
                        PFSINTERVAL,    /* OUT: interval array                  */
                        LONG*);         /* OUT: actual number of intervals      */
예제 #11
0
파일: Pts.cs 프로젝트: JianwenSun/cc
            out int cFootnotes);                // OUT: number of footnotes

#if NEVER
FSERR FSAPI FsGetSubtrackFootnoteInfo(
                    PFSCONTEXT,         /* IN: ptr to FS context                        */
                    PFSSUBTRACK,        /* IN: ptr to subtrack                          */
                    LONG,               /* IN: size of FSFTNINFO array                  */
                    LONG,               /* IN: first index in FSFTNINFO array 
                                                to be used by this subtrack             */
                    FSWDIR*,            /* OUT: fswdir                                  */
                    PFSFTNINFO,         /* IN/OUT: array of footnote info               */
                    LONG*);             /* OUT: lim index used by this subtrack         */
예제 #12
0
 public SIZE(int cx, int cy) : this()
 {
     this.cx = cx;
     this.cy = cy;
 }
예제 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeDynamicRecordsRemoved() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSerializeDynamicRecordsRemoved()
        {
            _channel.reset();
            // Given
            NodeRecord before = new NodeRecord(12, false, 1, 2);

            before.InUse = true;
            IList <DynamicRecord> beforeDyn = singletonList(dynamicRecord(0, true, true, -1L, LONG.intValue(), new sbyte[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            before.SetLabelField(dynamicPointer(beforeDyn), beforeDyn);
            NodeRecord after = new NodeRecord(12, false, 2, 1);

            after.InUse = true;
            IList <DynamicRecord> dynamicRecords = singletonList(dynamicRecord(0, false, true, -1L, LONG.intValue(), new sbyte[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            after.SetLabelField(dynamicPointer(dynamicRecords), dynamicRecords);
            // When
            Command.NodeCommand cmd = new Command.NodeCommand(before, after);
            cmd.Serialize(_channel);
            Command.NodeCommand result = (Command.NodeCommand)_commandReader.read(_channel);
            // Then
            assertThat(result, equalTo(cmd));
            assertThat(result.Mode, equalTo(cmd.Mode));
            assertThat(result.Before, equalTo(cmd.Before));
            assertThat(result.After, equalTo(cmd.After));
            // And dynamic records should be the same
            assertThat(result.Before.DynamicLabelRecords, equalTo(cmd.Before.DynamicLabelRecords));
            assertThat(result.After.DynamicLabelRecords, equalTo(cmd.After.DynamicLabelRecords));
        }