示例#1
1
 public static extern int VirtualAllocEx(int hProcess, int lpAddress, int dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
        /// <summary>
        /// Add allocations to the current transaction
        /// </summary>
        /// <param name="fid">
        /// 3-character FID code identifying your merchant activity.  These are assigned by Internal Control.
        /// </param>
        /// <param name="chart">
        /// 1-character chart code of the account to which you want to allocate the credit transaction.
        /// </param>
        /// <param name="account">
        /// 7-character account number to which you want to allocate the credit transaction.
        /// </param>
        /// <param name="subAccount">Optional</param>
        /// <param name="project">Optional</param>
        /// <param name="giftNotificationId">
        /// Used by gift transactions to direct the generated gift document to a particular person.  
        /// If this value is not passed (or is not valid) then the gift document will be generated 
        /// to the inbox of the person set up as the default on the server. 
        /// This value should be the UCD Login ID of the desired recipient in upper case.
        /// </param>
        /// <param name="allocationValue">
        /// The amount or percent to allocate to this allocation
        /// </param>
        /// <param name="allocationType">
        /// The type of allocation -- either percent or $ amount
        /// </param>
        public void AddAllocation(string fid, string chart, string account, string subAccount, string project, string giftNotificationId, double allocationValue, AllocationType allocationType)
        {
            var allocation = new allocRequestTransactionAllocation
                                 {
                                     fid = fid,
                                     chart = chart,
                                     account = account,
                                     subAccount = subAccount,
                                     project = project,
                                     giftNotificationId = giftNotificationId
                                 };

            switch (allocationType)
            {
                case AllocationType.Amount:
                    allocation.amount = allocationValue;
                    allocation.amountSpecified = true;
                    break;
                case AllocationType.Percent:
                    allocation.percent = allocationValue;
                    allocation.percentSpecified = true;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("allocationType");
            }

            //Now we have an allocation, add it to the allocation collection
            Allocations.Add(allocation);
        }
示例#3
0
        public void AddHolding(AllocationType allocType, string symbol, decimal price, decimal quanity)
        {
            Holding holding = new Holding(this)
                    {
                        AllocType = allocType,
                        Symbol = symbol,
                        Price = price,
                        Quantity = quanity,
                    };

            m_TotalValue += holding.Value;

            Holdings.Add(holding);
        }
        public int ReadFrom(byte[] buffer, int offset)
        {
            PriorDirectEntries = Utilities.ToUInt32LittleEndian(buffer, offset);
            StrategyType = Utilities.ToUInt16LittleEndian(buffer, offset + 4);
            StrategyParameter = Utilities.ToUInt16LittleEndian(buffer, offset + 6);
            MaxEntries = Utilities.ToUInt16LittleEndian(buffer, offset + 8);
            FileType = (FileType)buffer[offset + 11];
            ParentICBLocation = Utilities.ToStruct<LogicalBlockAddress>(buffer, offset + 12);

            ushort flagsField = Utilities.ToUInt16LittleEndian(buffer, offset + 18);
            AllocationType = (AllocationType)(flagsField & 0x3);
            Flags = (InformationControlBlockFlags)(flagsField & 0xFFFC);

            return 20;
        }
        public void AssignAllocationValue(AllocationType allocationType, int allocationId, string allocationName)
        {
            switch (allocationType)
            {
                case AllocationType.Engagement:
                    this.TimesheetEntrySummaryLineKey.EngagementId = allocationId;
                    break;
                case AllocationType.Project:
                    this.TimesheetEntrySummaryLineKey.ProjectId = allocationId;
                    break;
                case AllocationType.BillingRule:
                    this.TimesheetEntrySummaryLineKey.BillingRuleId = allocationId;
                    break;
                case AllocationType.CostCenter:
                    this.TimesheetEntrySummaryLineKey.CostCenterId = allocationId;
                    break;
                case AllocationType.GeneralLedger:
                    this.TimesheetEntrySummaryLineKey.GeneralLedgerId = allocationId;
                    break;
            }

            var allocationValue = new AllocationValue { AllocationType = allocationType, AllocationId = allocationId, AllocationName = allocationName };
            this.timesheetEntryAllocationSlots[allocationType] = allocationValue;
        }
示例#6
0
 /// <summary>
 /// Create a new Tensor from the given unmanaged memory pointer (which must be allocated, fixed or pinned by the caller)
 /// Note: the caller is responsible for freeing the memory. Calling Dispose on this object will dispose the TensorFlow tensor
 /// but not the memory itself!
 /// </summary>
 /// <param name="data_ptr">Pointer to unmanaged, fixed or pinned memory which the caller owns</param>
 /// <param name="shape">Tensor shape</param>
 /// <param name="dType">TF data type</param>
 /// <param name="num_bytes">Size of the tensor in memory</param>
 public unsafe Tensor(void *data_ptr, long[] shape, TF_DataType dType, int num_bytes)
 {
     _handle        = TF_NewTensor(dType, dims: shape, num_dims: shape.Length, data: data_ptr, len: (ulong)num_bytes);
     AllocationType = TF_TensorData(_handle).ToPointer() == data_ptr ? AllocationType.FromPointer : AllocationType.Tensorflow;
 }
示例#7
0
 static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize,
                                   AllocationType flAllocationType, MemoryProtection flProtect);
示例#8
0
 public static bool Free(IntPtr proc, IntPtr addr, uint size = 0u, AllocationType freeType = AllocationType.Release)
 {
     return(API.VirtualFreeEx(proc, addr, size, freeType));
 }
示例#9
0
文件: PInvoke.cs 项目: v2sky/d2bs
 private static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, AllocationType flAllocationType, PageAccessProtectionFlags flProtect);
示例#10
0
 internal static extern IntPtr VirtualAllocEx(SafeProcessHandle processHandle, IntPtr baseAddress, int size, AllocationType allocationType, ProtectionType protectionType);
 public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, AllocationType flAllocationType, ProtectType flProtect);
示例#12
0
 internal static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr address, UIntPtr size, AllocationType allocationType, MemoryProtect protect);
示例#13
0
 static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
示例#14
0
文件: Native.cs 项目: Scooletz/RampUp
 public static extern bool VirtualFree(UIntPtr lpAddress, UIntPtr dwSize, AllocationType dwFreeType);
示例#15
0
 public static IntPtr Alloc(IntPtr address, Int32 size, MemoryProtection protection, AllocationType allocationType)
 {
     return(Kernel32.VirtualAlloc(address, size, allocationType, protection));
 }
示例#16
0
 public static IntPtr Alloc(Int32 size, MemoryProtection protection, AllocationType allocationType)
 {
     return(Memory.Alloc(IntPtr.Zero, size, protection, allocationType));
 }
示例#17
0
 static extern nuint VirtualAlloc(IntPtr lpAddress,
                                  int dwSize,
                                  AllocationType flAllocationType,
                                  MemoryProtection flProtect);
示例#18
0
 public static extern nint VirtualAlloc(nint lpAddress,
                                        nuint dwSize,
                                        AllocationType flAllocationType,
                                        ProtectConstant flProtect);
示例#19
0
 internal static extern bool VirtualFree(IntPtr lpAddress, UInt32 dwSize,
                                         AllocationType dwFreeType);
示例#20
0
 public static extern IntPtr VirtualAlloc(IntPtr address, Int32 size, AllocationType allocationType, MemoryProtection protection);
示例#21
0
 public SafeVirtualMemoryHandle(IntPtr processHandle, Int64 address, Int64 size, AllocationType allocation, MemoryProtection protection)
     : base(true)
 {
     _processHandle = processHandle;
     _size          = size;
     handle         = Kernel32.VirtualAllocEx(processHandle, (IntPtr)address, (IntPtr)_size, allocation, protection);
     if (IsInvalid)
     {
         throw new Win32Exception();
     }
 }
示例#22
0
 public AllocationEntry(uint address, uint size, AllocationType type)
 {
     Address = address;
     Size = size;
     Type = type;
 }
示例#23
0
 private static extern IntPtr VirtualAllocEx(SafeMemoryHandle hProcess, IntPtr lpAddress,
                                             UIntPtr dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
示例#24
0
 internal static extern IntPtr VirtualAllocEx(SafeProcessHandle processHandle, IntPtr address, SizeT size, AllocationType flAllocationType,
     MemoryProtection flProtect);
示例#25
0
 public SafeVirtualMemoryHandle Allocate(Int64 size, AllocationType allocation, MemoryProtection protection)
 {
     return(new SafeVirtualMemoryHandle(handle, 0, size, allocation, protection));
 }
 private static extern IntPtr VirtualAllocEx(
     IntPtr hProcess,
     IntPtr lpAddress,
     IntPtr dwSize,
     AllocationType flAllocationType,
     uint flProtect);
示例#27
0
 public static extern byte *VirtualAlloc(byte *lpAddress, UIntPtr dwSize,
                                         AllocationType flAllocationType, MemoryProtection flProtect);
示例#28
0
 static extern Int32 VirtualAllocEx(IntPtr hProcess, Int32 lpAddress, Int32 dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
示例#29
0
        private void LoadExtents()
        {
            _extents = new List <CookedExtent>();
            byte[] activeBuffer = _fileEntry.AllocationDescriptors;

            AllocationType allocType = _fileEntry.InformationControlBlock.AllocationType;

            if (allocType == AllocationType.ShortDescriptors)
            {
                long filePos = 0;

                int i = 0;
                while (i < activeBuffer.Length)
                {
                    ShortAllocationDescriptor sad = Utilities.ToStruct <ShortAllocationDescriptor>(activeBuffer, i);
                    if (sad.ExtentLength == 0)
                    {
                        break;
                    }

                    if (sad.Flags != ShortAllocationFlags.RecordedAndAllocated)
                    {
                        throw new NotImplementedException("Extents that are not 'recorded and allocated' not implemented");
                    }

                    CookedExtent newExtent = new CookedExtent
                    {
                        FileContentOffset = filePos,
                        Partition         = int.MaxValue,
                        StartPos          = sad.ExtentLocation * (long)_blockSize,
                        Length            = sad.ExtentLength
                    };
                    _extents.Add(newExtent);

                    filePos += sad.ExtentLength;
                    i       += sad.Size;
                }
            }
            else if (allocType == AllocationType.Embedded)
            {
                // do nothing
            }
            else if (allocType == AllocationType.LongDescriptors)
            {
                long filePos = 0;

                int i = 0;
                while (i < activeBuffer.Length)
                {
                    LongAllocationDescriptor lad = Utilities.ToStruct <LongAllocationDescriptor>(activeBuffer, i);
                    if (lad.ExtentLength == 0)
                    {
                        break;
                    }

                    CookedExtent newExtent = new CookedExtent
                    {
                        FileContentOffset = filePos,
                        Partition         = lad.ExtentLocation.Partition,
                        StartPos          = lad.ExtentLocation.LogicalBlock * (long)_blockSize,
                        Length            = lad.ExtentLength
                    };
                    _extents.Add(newExtent);

                    filePos += lad.ExtentLength;
                    i       += lad.Size;
                }
            }
            else
            {
                throw new NotImplementedException("Allocation Type: " + _fileEntry.InformationControlBlock.AllocationType);
            }
        }
示例#30
0
 public static IntPtr VirtualAlloc(int size, AllocationType allocationType, MemoryProtection protection)
 {
     return(Imports.VirtualAlloc(IntPtr.Zero, size, allocationType, protection));
 }
示例#31
0
文件: WinApi.cs 项目: Lamael/tools
 public static extern int VirtualAllocEx(IntPtr hProcess, Int32 lpAddress,
    Int32 dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
示例#32
0
 public static IntPtr Allocate(IntPtr proc, IntPtr addr, uint size, AllocationType allocationType = AllocationType.Commit | AllocationType.Reserve, MemoryProtection memoryProtection = MemoryProtection.ReadWrite)
 {
     return(API.VirtualAllocEx(proc, addr, size, allocationType, memoryProtection));
 }
 internal static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr address, int size, AllocationType allocationType, MemoryProtection protect);
示例#34
0
 public static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, AllocationType dwFreeType);
 internal static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr address, IntPtr size, AllocationType freeType);
 public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress,
                                            uint dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
 public static extern IntPtr VirtualAllocEx(SafeProcessHandle processHandle, IntPtr address, UIntPtr size, AllocationType allocationType, MemoryProtection memoryProtection);
示例#38
0
 internal static extern IntPtr VirtualAllocEx(SafeProcessHandle hProcess, uint dwAddress, int nSize, AllocationType dwAllocationType, MemoryProtection dwProtect);
 public void FillAllocationSlot(AllocationType allocationType, AllocationValue allocationValue)
 {
     this.alloctionSlots[allocationType] = allocationValue;
 }
示例#40
0
 public AllocationInfo(AllocationType type, int size)
 {
     this.type = type;
     this.size = size;
 }
示例#41
0
 public static extern IntPtr VirtualAlloc(IntPtr address, Int32 size, AllocationType allocationType, MemoryProtection protection);
示例#42
0
文件: WinAPI.cs 项目: aghili/nwohack
 public static extern DWORD_PTR VirtualAllocEx( IntPtr hProcess, DWORD_PTR lpAddress, uint dwSize, AllocationType flAllocationType, MemoryProtection flProtect );
 public static extern void *VirtualAlloc(void *lpAddress, SizeT dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
示例#44
0
 /// <summary>
 /// Allocates memory of specified type on the xbox.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="size"></param>
 /// <returns>Allocated address.</returns>
 public uint AllocateMemory(AllocationType type, uint size)
 {
     switch (type)
     {
         case AllocationType.Debug:		return AllocateDebugMemory(size);
         case AllocationType.Physical:	return AllocatePhysicalMemory(size);
         case AllocationType.System:		return AllocateSystemMemory(size);
         case AllocationType.Virtual:	return AllocateVirtualMemory(size);
         default:						throw new Exception("Invalid allocation type.");
     }
 }
 public static extern bool VirtualFree(void *lpAddress, SizeT dwSize, AllocationType dwFreeType);
示例#46
0
 public static extern bool VirtualFreeEx(
     IntPtr hProcess,
     IntPtr lpAddress,
     uint dwSize,
     AllocationType dwFreeType);
示例#47
0
 private static extern IntPtr VirtualAllocEx(
     IntPtr hProcess,
     IntPtr lpAddress,
     IntPtr dwSize,
     AllocationType flAllocationType,
     uint flProtect);
示例#48
0
文件: Opcode.cs 项目: adamsp/beastmon
     public static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize,
 AllocationType flAllocationType, MemoryProtection flProtect);
示例#49
0
 public static extern UInt32 NtFreeVirtualMemory(
     IntPtr ProcessHandle,
     ref IntPtr BaseAddress,
     ref IntPtr RegionSize,
     AllocationType FreeType);
示例#50
0
 internal static extern bool VirtualFreeEx(SafeProcessHandle processHandle, IntPtr address, SizeT size, AllocationType flAllocationType);
示例#51
0
 public static extern bool VirtualFree(
     IntPtr lpAddress,
     uint dwSize,
     AllocationType dwFreeType);
示例#52
0
 internal static extern IntPtr VirtualAlloc(IntPtr startAddress, UIntPtr size, AllocationType allocationType, MemoryProtection protect);
		public static extern IntPtr VirtualAllocEx( SafeProcessHandle processHandle, IntPtr address, UIntPtr size, AllocationType allocationType, MemoryProtection memoryProtection );