当前位置: 首页>>代码示例>>C#>>正文


C# IntPtr.ToInt64方法代码示例

本文整理汇总了C#中System.IntPtr.ToInt64方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.ToInt64方法的具体用法?C# IntPtr.ToInt64怎么用?C# IntPtr.ToInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IntPtr的用法示例。


在下文中一共展示了IntPtr.ToInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Align

 private byte* Align(IntPtr buf, uint alignTo)
 {
     //This makes an aligned buffer linux needs this.
     //The buffer must originally be at least one alignment bigger!
     var diff = alignTo - (buf.ToInt64() % alignTo);
     var aligned = (IntPtr)(buf.ToInt64() + diff);
     return (byte*)aligned;
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:8,代码来源:UnbufferedFileStream.cs

示例2: SharedMemory

        public SharedMemory(string name, IntPtr size)
        {
            mmf = MemoryMappedFile.OpenExisting(name + "_CONNECT_DATA");

            mmva = mmf.CreateViewAccessor();
            if (mmf.SafeMemoryMappedFileHandle.IsInvalid)
                throw new MySqlException("Cannot open file mapping " + name);
            mmvs = mmf.CreateViewStream(0L, size.ToInt64());
            mmva = mmf.CreateViewAccessor(0L, size.ToInt64());
        }
开发者ID:noahvans,项目名称:mariadb-connector-net,代码行数:10,代码来源:SharedMemoryStream.cs

示例3: GetReadSize

 static IntPtr GetReadSize(IntPtr pointer, IntPtr endPointer, int bufferSize)
 {
     if (endPointer.ToInt64() < IntPtr.Add(pointer, bufferSize).ToInt64())
     {
         return (IntPtr)(endPointer.ToInt64() - pointer.ToInt64());
     }
     else
     {
         return new IntPtr(bufferSize);
     }
 }
开发者ID:toydev,项目名称:ExampleCSharp,代码行数:11,代码来源:Program.cs

示例4: Read

        /// <summary>
        /// Read a hardware independent dictionary of language and code page identifier tables.
        /// </summary>
        /// <param name="lpRes">Pointer to the beginning of data.</param>
        /// <returns>Pointer to the end of data.</returns>
        internal override IntPtr Read(IntPtr lpRes)
        {
            _vars.Clear();
            IntPtr pChild = base.Read(lpRes);

            while (pChild.ToInt64() < (lpRes.ToInt64() + _header.wLength))
            {
                VarTable res = new VarTable(pChild);
                _vars.Add(res.Key, res);
                pChild = ResourceUtil.Align(pChild.ToInt64() + res.Header.wLength);
            }

            return new IntPtr(lpRes.ToInt64() + _header.wLength);
        }
开发者ID:xingkongtianyu,项目名称:Apex-Crypter,代码行数:19,代码来源:VarFileInfo.cs

示例5: Read

        /// <summary>
        /// Read a table of language and code page identifier pairs.
        /// </summary>
        /// <param name="lpRes">Pointer to the beginning of the data.</param>
        /// <returns></returns>
        internal override IntPtr Read(IntPtr lpRes)
        {
            _languages.Clear();
            IntPtr pVar = base.Read(lpRes);

            while (pVar.ToInt64() < (lpRes.ToInt64() + _header.wLength))
            {
                Kernel32.VAR_HEADER var = (Kernel32.VAR_HEADER) Marshal.PtrToStructure(
                    pVar, typeof(Kernel32.VAR_HEADER));
                _languages.Add(var.wLanguageIDMS, var.wCodePageIBM);
                pVar = new IntPtr(pVar.ToInt64() + Marshal.SizeOf(var));
            }

            return new IntPtr(lpRes.ToInt64() + _header.wLength);
        }
开发者ID:GabberBaby,项目名称:DotNetObfuscator,代码行数:20,代码来源:VarTable.cs

示例6: MarshallingStream

 /// <summary> Constructs a stream that marshals bytes from unmanaged memory </summary>
 public MarshallingStream(IntPtr ptrBytes, bool readOnly, int start, int length)
 {
     _ptrBytes = start == 0 ? ptrBytes : new IntPtr(ptrBytes.ToInt64() + start);
     _readOnly = readOnly;
     _length = length;
     _position = 0;
 }
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:8,代码来源:MarshallingStream.cs

示例7: Read

        /// <summary>
        /// Read the accelerator.
        /// </summary>
        /// <param name="lpRes">Address in memory.</param>
        internal IntPtr Read(IntPtr lpRes)
        {
            _accel = (User32.ACCEL) Marshal.PtrToStructure(
                lpRes, typeof(User32.ACCEL));

            return new IntPtr(lpRes.ToInt64() + Marshal.SizeOf(_accel));
        }
开发者ID:xingkongtianyu,项目名称:Apex-Crypter,代码行数:11,代码来源:Accelerator.cs

示例8: NtWriteFile

        public static UInt32 NtWriteFile(
            IntPtr FileHandle,
            IntPtr Event,
            IntPtr ApcRoutine,
            IntPtr ApcContext,
            IntPtr IoStatusBlock,
            IntPtr Buffer,
            UInt32 Length,
            UInt32 ByteOffset,
            UInt32 Key)
        {
            if (DetourBlock.IsDetouring) {
                return OriginalFn(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock,
                    Buffer, Length, ByteOffset, Key);
            }

            using (var block = new DetourBlock())
            {
                var result = OriginalFn(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock,
                    Buffer, Length, ByteOffset, Key);

                if (result == 0 /* STATUS_SUCCESS */)
                {
                    Remoting.Scribe.DocumentFileWrite(Process.GetCurrentProcess().Id, FileHandle.ToInt64());
                }

                return result;
            }
        }
开发者ID:coapp-deprecated,项目名称:_trace_deprecated,代码行数:29,代码来源:NtWriteFile.cs

示例9: Assemble

 /// <summary>
 ///     Assemble the specified assembly code at a base address.
 /// </summary>
 /// <param name="asm">The assembly code.</param>
 /// <param name="baseAddress">The address where the code is rebased.</param>
 /// <returns>An array of bytes containing the assembly code.</returns>
 public byte[] Assemble(string asm, IntPtr baseAddress)
 {
     // Rebase the code
     asm = $"use32\norg 0x{baseAddress.ToInt64():X8}\n" + asm;
     // Assemble and return the code
     return FasmNet.Assemble(asm);
 }
开发者ID:jasteph,项目名称:MemorySharp,代码行数:13,代码来源:Fasm32Assembler.cs

示例10: WndProc

		internal static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
		{
			if (msg != CUSTOM_MESSAGE) {
				return IntPtr.Zero;
			}
			handled = true;
			long fileNumber = wParam.ToInt64();
			long openEvenIfProjectIsOpened = lParam.ToInt64();
			LoggingService.Info("Receiving custom message...");
			if (openEvenIfProjectIsOpened == 0 && ProjectService.OpenSolution != null) {
				return new IntPtr(RESULT_PROJECT_IS_OPEN);
			} else {
				try {
					WorkbenchSingleton.SafeThreadAsyncCall(
						delegate { NativeMethods.SetForegroundWindow(WorkbenchSingleton.MainWin32Window.Handle) ; }
					);
					string tempFileName = Path.Combine(Path.GetTempPath(), "sd" + fileNumber + ".tmp");
					foreach (string file in File.ReadAllLines(tempFileName)) {
						WorkbenchSingleton.SafeThreadAsyncCall(
							delegate(string openFileName) { FileService.OpenFile(openFileName); }
							, file
						);
					}
				} catch (Exception ex) {
					LoggingService.Warn(ex);
				}
				return new IntPtr(RESULT_FILES_HANDLED);
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:29,代码来源:SingleInstanceHelper.cs

示例11: Initialize

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			GFileDescriptorBasedIface native_iface = (GFileDescriptorBasedIface) Marshal.PtrToStructure (ifaceptr, typeof (GFileDescriptorBasedIface));
			native_iface.GetFd = iface.GetFd;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:7,代码来源:FileDescriptorBasedAdapter.cs

示例12: WLAN_INTERFACE_INFO_LIST

        /// <summary>
        ///     Constructor for WLAN_INTERFACE_INFO_LIST.
        ///     Constructor is needed because the InterfaceInfo member varies based on how many adapters are in the system.
        /// </summary>
        /// <param name="pointerToWlanInterfaceInfoList">the unmanaged pointer containing the list.</param>
        public WLAN_INTERFACE_INFO_LIST(IntPtr pointerToWlanInterfaceInfoList)
        {
            // The first 4 bytes are the number of WLAN_INTERFACE_INFO structures.
            this.dwNumberOfItems = Marshal.ReadInt32(pointerToWlanInterfaceInfoList, (0 * Marshal.SizeOf(typeof(int))));

            // The next 4 bytes are the index of the current item in the unmanaged API.
            this.dwIndex = Marshal.ReadInt32(pointerToWlanInterfaceInfoList, (1 * Marshal.SizeOf(typeof(int))));

            // Construct the array of WLAN_INTERFACE_INFO structures.
            this.InterfaceInfo = new WLAN_INTERFACE_INFO[this.dwNumberOfItems];

            // start pointer
            long start = pointerToWlanInterfaceInfoList.ToInt64() + (2 * Marshal.SizeOf(typeof(int))); // we skip 8 for the first and second int in the structure

            // get the size of WLAN_INTERFACE_INFO
            int sizeOfWlanInterfaceInfo = Marshal.SizeOf(typeof (WLAN_INTERFACE_INFO));

            // we know there are dwNumberOfItems in the struct
            // so we can take each of those memory pieces and marshal them to WLAN_INTERFACE_INFO

            for (int i = 0; i <= this.dwNumberOfItems - 1; i++)
            {
                var pItemList = new IntPtr(start + (i * sizeOfWlanInterfaceInfo));

                this.InterfaceInfo[i] = (WLAN_INTERFACE_INFO) Marshal.PtrToStructure(pItemList, typeof (WLAN_INTERFACE_INFO));
            }
        }
开发者ID:CSharpFan,项目名称:wireless-prio,代码行数:32,代码来源:WLAN_INTERFACE_INFO_LIST.cs

示例13: IntPtrToBytes

 private static byte[] IntPtrToBytes(IntPtr p, long offset, long length)
 {
     byte[] buffer = new byte[0x10 + IntPtr.Size];
     for (int i = 0; i < 8; i++)
     {
         buffer[i] = (byte) ((offset >> (8 * i)) & 0xffL);
     }
     for (int j = 0; j < 8; j++)
     {
         buffer[8 + j] = (byte) ((length >> (8 * j)) & 0xffL);
     }
     if (IntPtr.Size == 4)
     {
         int num3 = p.ToInt32();
         for (int m = 0; m < 4; m++)
         {
             buffer[0x10 + m] = (byte) ((num3 >> (8 * m)) & 0xff);
         }
         return buffer;
     }
     long num5 = p.ToInt64();
     for (int k = 0; k < 8; k++)
     {
         buffer[0x10 + k] = (byte) ((num5 >> (8 * k)) & 0xffL);
     }
     return buffer;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:MemoryBytes.cs

示例14: GetEveObjectType

 public static PyType? GetEveObjectType(IntPtr intptr, bool isDerived = false)
 {
     PyType? returnType;
     if (!_pythontypesLoaded)
     {
         PopulatePythonTypes();
     }
     if (intptr == IntPtr.Zero)
     {
         return PyType.Invalid;
     }
     IntPtr key = Marshal.ReadIntPtr(((IntPtr)intptr.ToInt64() + 4)); // Points to the type
     if (!_pythonTypes.TryGetValue(key, out returnType) && !isDerived)
     {
         returnType = GetEveObjectType(key, true);
         _pythonTypes.Add(key, returnType);
         return returnType;
     }
     if (isDerived)
     {
         string str = returnType.ToString();
         returnType = (PyType)Enum.Parse(typeof(PyType), "Derived" + str);
     }
     return returnType;
 }
开发者ID:Pgde,项目名称:EBot-master,代码行数:25,代码来源:PyCall.cs

示例15: Initialize

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			AtkHyperlinkImplIface native_iface = (AtkHyperlinkImplIface) Marshal.PtrToStructure (ifaceptr, typeof (AtkHyperlinkImplIface));
			native_iface.GetHyperlink = iface.GetHyperlink;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:7,代码来源:HyperlinkImplAdapter.cs


注:本文中的System.IntPtr.ToInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。