Ejemplo n.º 1
0
        private byte[] GenerateLogicalFunction(int MaxLength, int NeededRegisters, int bData, int DataAddress, int DataSize)
        {
            IntPtr pTrashStruct = GenJunk(MaxLength, XTG_MASK.XMASK_LOGIC + XTG_MASK.XMASK_FUNCTION, NeededRegisters, bData, DataAddress, DataSize);

            TrashStruct TStruct = (TrashStruct)Marshal.PtrToStructure(pTrashStruct, typeof(TrashStruct));

            IntPtr pEntryPoint = (IntPtr)TStruct.EntryPoint;
            IntPtr pData       = (IntPtr)TStruct.DataAddr;

            byte[] pFunctionBuffer = new byte[TStruct.CodeSize];
            byte[] pDataBuffer     = new byte[DataSize];

            try
            {
                Marshal.Copy(pEntryPoint, pFunctionBuffer, 0, TStruct.CodeSize);
            }
            catch (ArgumentNullException) { return(null); }

            if (DataSize > 0)
            {
                try
                {
                    Marshal.Copy(pData, pDataBuffer, 0, DataSize);
                }
                catch (ArgumentNullException) { return(null); }
            }

            return(pFunctionBuffer);
        }
Ejemplo n.º 2
0
        private byte[] GenerateFPUTrash(int MaxLength)
        {
            IntPtr      pTrashStruct = GenJunkFPU(MaxLength);
            TrashStruct TStruct      = (TrashStruct)Marshal.PtrToStructure(pTrashStruct, typeof(TrashStruct));

            IntPtr pEntryPoint = (IntPtr)TStruct.EntryPoint;

            byte[] pTrashCode = new byte[TStruct.CodeSize];
            Marshal.Copy(pEntryPoint, pTrashCode, 0, TStruct.CodeSize);

            return(pTrashCode);
        }
Ejemplo n.º 3
0
        private byte[] GenerateLogicalTrash(int MaxLength, int NeededRegisters, int bData, int DataAddress, int DataSize)
        {
            IntPtr      pTrashStruct = GenJunk(MaxLength, 0, NeededRegisters, bData, DataAddress, DataSize);
            TrashStruct TStruct      = (TrashStruct)Marshal.PtrToStructure(pTrashStruct, typeof(TrashStruct));

            IntPtr pEntryPoint = (IntPtr)TStruct.EntryPoint;

            byte[] pTrashCode = new byte[TStruct.CodeSize];
            Marshal.Copy(pEntryPoint, pTrashCode, 0, TStruct.CodeSize);

            return(pTrashCode);
        }