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


C# UInt32类代码示例

本文整理汇总了C#中UInt32的典型用法代码示例。如果您正苦于以下问题:C# UInt32类的具体用法?C# UInt32怎么用?C# UInt32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: IsDepEnabled

            /**
             * Returns 1 if enabled, 0 if disabled, -1 if not applicable (i.e., a 64-bit process)
             */
            public static int IsDepEnabled(UInt32 pid)
            {
                UInt32 Flags = PROCESS_DEP_DISABLE;
                bool Permanent = false;

                IntPtr hProcess = IntPtr.Zero;
                hProcess = OpenProcess(ProcessAccessFlags.QueryInformation, false, (int)pid);
                if (hProcess == IntPtr.Zero) {
                throw new System.ComponentModel.Win32Exception(GetLastError());
                }

                bool is32bit = false;
                if (!IsWow64Process(hProcess, out is32bit)) {
                throw new System.ComponentModel.Win32Exception(GetLastError());
                }
                if (is32bit) {
                if (GetProcessDEPPolicy(hProcess, out Flags, out Permanent)) {
                CloseHandle(hProcess);
                if ((Flags | PROCESS_DEP_ENABLE) == PROCESS_DEP_ENABLE) {
                return 1;
                } else {
                return 0;
                }
                } else {
                CloseHandle(hProcess);
                throw new System.ComponentModel.Win32Exception(GetLastError());
                }
                } else {
                return -1;
                }
            }
开发者ID:praveeds,项目名称:jOVAL,代码行数:34,代码来源:Process58.cs

示例2: Write

		public override void Write(UInt32 val)
		{
			val = Utilities.SwapBytes(val);
			base.Write(val);

			if (AutoFlush) Flush();
		}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:7,代码来源:BinaryReverseWriter.cs

示例3: SwapBytes

		public static UInt32 SwapBytes(UInt32 x)
		{
			// swap adjacent 16-bit blocks
			x = (x >> 16) | (x << 16);
			// swap adjacent 8-bit blocks
			return ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8);
		}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:7,代码来源:Utilities.cs

示例4: BigEndian

        /// <summary>
        /// Converts a <see cref="UInt32"/> to big endian notation.
        /// </summary>
        /// <param name="input">The <see cref="UInt32"/> to convert.</param>
        /// <returns>The converted <see cref="UInt32"/>.</returns>
        public static UInt32 BigEndian(UInt32 input)
        {
            if (!BitConverter.IsLittleEndian)
                return input;

            return Swap(input);
        }
开发者ID:neokamikai,项目名称:rolib,代码行数:12,代码来源:EndianConverter.cs

示例5: ReadAsync_MemoryStream

        internal static IAsyncOperationWithProgress<IBuffer, UInt32> ReadAsync_MemoryStream(Stream stream, IBuffer buffer, UInt32 count)
        {
            Debug.Assert(stream != null);
            Debug.Assert(stream is SREMemoryStream);
            Debug.Assert(stream.CanRead);
            Debug.Assert(stream.CanSeek);
            Debug.Assert(buffer != null);
            Debug.Assert(buffer is IBufferByteAccess);
            Debug.Assert(0 <= count);
            Debug.Assert(count <= Int32.MaxValue);
            Debug.Assert(count <= buffer.Capacity);
            Contract.EndContractBlock();

            // We will return a different buffer to the user backed directly by the memory stream (avoids memory copy).
            // This is permitted by the WinRT stream contract.
            // The user specified buffer will not have any data put into it:
            buffer.Length = 0;

            SREMemoryStream memStream = stream as SREMemoryStream;
            Debug.Assert(memStream != null);

            try
            {
                IBuffer dataBuffer = memStream.GetWindowsRuntimeBuffer((Int32)memStream.Position, (Int32)count);
                if (dataBuffer.Length > 0)
                    memStream.Seek(dataBuffer.Length, SeekOrigin.Current);

                return AsyncInfo.CreateCompletedOperation<IBuffer, UInt32>(dataBuffer);
            }
            catch (Exception ex)
            {
                return AsyncInfo.CreateFaultedOperation<IBuffer, UInt32>(ex);
            }
        }  // ReadAsync_MemoryStream
开发者ID:dotnet,项目名称:corefx,代码行数:34,代码来源:StreamOperationsImplementation.cs

示例6: UInt32

        public static byte[] UInt32(UInt32 i, Endianness e = Endianness.Machine)
        {
            byte[] bytes = BitConverter.GetBytes(i);

            if (NeedsFlipping(e)) Array.Reverse(bytes);

            return bytes;
        }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:8,代码来源:Pack.cs

示例7: CreateThread

    private static extern IntPtr CreateThread(

          UInt32 lpThreadAttributes,
          UInt32 dwStackSize,
          UInt32 lpStartAddress,
          IntPtr param,
          UInt32 dwCreationFlags,
          ref UInt32 lpThreadId

          );
开发者ID:c4bbage,项目名称:pentestscripts,代码行数:10,代码来源:shellcode.cs

示例8: ToString_

 public void ToString_()
 {
     UInt32 i = new UInt32();
     foreach (var iteration in Benchmark.Iterations)
         using (iteration.StartMeasurement())
         {
             i.ToString(); i.ToString(); i.ToString();
             i.ToString(); i.ToString(); i.ToString();
             i.ToString(); i.ToString(); i.ToString();
         }
 }
开发者ID:sky7sea,项目名称:corefx,代码行数:11,代码来源:Perf.UInt32.cs

示例9: Write

 public static void Write(this BinaryWriter writer, UInt32 value, bool invertEndian = false)
 {
     if (invertEndian)
     {
         writer.WriteInvertedBytes(BitConverter.GetBytes(value));
     }
     else
     {
         writer.Write(value);
     }
 }
开发者ID:r2d2rigo,项目名称:BinaryEndiannessExtensions,代码行数:11,代码来源:BinaryWriterExtensions.cs

示例10: ToString_

 public void ToString_()
 {
     UInt32 testint = new UInt32();
     foreach (var iteration in Benchmark.Iterations)
         using (iteration.StartMeasurement())
             for (int i = 0; i < 10000; i++)
             {
                 testint.ToString(); testint.ToString(); testint.ToString();
                 testint.ToString(); testint.ToString(); testint.ToString();
                 testint.ToString(); testint.ToString(); testint.ToString();
             }
 }
开发者ID:nnyamhon,项目名称:corefx,代码行数:12,代码来源:Perf.UInt32.cs

示例11: HexNumberToUInt32

            private unsafe static Boolean HexNumberToUInt32(ref NumberBuffer number, ref UInt32 value)
            {
                Int32 i = number.scale;
                if (i > UINT32_PRECISION || i < number.precision)
                {
                    return false;
                }
                Char* p = number.digits;
                Debug.Assert(p != null, "");

                UInt32 n = 0;
                while (--i >= 0)
                {
                    if (n > ((UInt32)0xFFFFFFFF / 16))
                    {
                        return false;
                    }
                    n *= 16;
                    if (*p != '\0')
                    {
                        UInt32 newN = n;
                        if (*p != '\0')
                        {
                            if (*p >= '0' && *p <= '9')
                            {
                                newN += (UInt32)(*p - '0');
                            }
                            else
                            {
                                if (*p >= 'A' && *p <= 'F')
                                {
                                    newN += (UInt32)((*p - 'A') + 10);
                                }
                                else
                                {
                                    Debug.Assert(*p >= 'a' && *p <= 'f', "");
                                    newN += (UInt32)((*p - 'a') + 10);
                                }
                            }
                            p++;
                        }

                        // Detect an overflow here...
                        if (newN < n)
                        {
                            return false;
                        }
                        n = newN;
                    }
                }
                value = n;
                return true;
            }
开发者ID:nattress,项目名称:corert,代码行数:53,代码来源:FormatProvider.FormatAndParse.cs

示例12: calculate_master_key

		private static ulong calculate_master_key(string generator)
		{
			UInt32[] table = new UInt32[256];
			UInt32 data;
			UInt32 y;
			byte x;
			UInt64 yll;
			UInt32 yhi;

			for(int i=0; i<256; i++)
			{
				data = (UInt32)i;
				for(int j=0; j<4; j++)
				{
					if ((data & 1) != 0)
						data =  0xEDBA6320 ^ (data>>1);
					else
						data = data>>1;

					if ((data & 1) != 0)
						data = 0xEDBA6320 ^ (data>>1);
					else
						data = data>>1;
				}

				table[i] = data;
			}

			y = 0xFFFFFFFF;
			x = Convert.ToByte(generator[0]);
			for(int i=0; i<4; i++)
			{
				x = (byte)(x ^ y);
				y = table[x] ^ (y>>8);
				x = (byte)(Convert.ToByte(generator[1+i*2]) ^ y);
				y = table[x] ^ (y>>8);
				x = Convert.ToByte(generator[2+i*2]);
			}

			y ^= 0xAAAA;
			y += 0x1657;

			yll = (ulong)y;
			yll = (yll+1) * 0xA7C5AC47ULL;
			yhi = (uint)(yll>>48);
			yhi *= 0xFFFFF3CB;
			y += (uint)(yhi<<5);

			return y;
		}
开发者ID:XxDragonSlayer1,项目名称:3DsUnlock,代码行数:50,代码来源:3DsUnlockLib.cs

示例13: PlatformCreatePackages

      // TODO
      public static bool PlatformCreatePackages(UInt32 platformId) {
         Log.Trace("PlatformCreatePackages: Enter");

         var dbConn = _dbConn();

         var images = Image.GetByPlatformId(dbConn, platformId);
         if (images == null) {
            return false;
         }

         foreach (var image in images) {
            Log.Trace("Creating packages descriptor for {0}", image.ImageId.ToString());
            image.CreatePackages(dbConn);
         }

         Log.Trace("PlatformCreatePackages: OK");
         return true;
      }
开发者ID:borkaborka,项目名称:gmit,代码行数:19,代码来源:DatabaseManager.cs

示例14: MyAcquisitionEventsManagerCallbackInterface

            public static Int32 MyAcquisitionEventsManagerCallbackInterface(
                UInt32 OccurredEventCode,
                Int32 GetFrameErrorCode,
                UInt32 Eventinfo,
                IntPtr FramePtr,
                Int32 FrameSizeX,
                Int32 FrameSizeY,
                Double CurrentFrameRate,
                Double NominalFrameRate,
                UInt32 GB_Diagnostic,
                System.IntPtr UserDefinedParameters
            )
            {
                Byte[] ArrayToPass = null;
                if (FramePtr != IntPtr.Zero && FrameSizeX > 0 && FrameSizeY > 0)
                {
                    ArrayToPass = new Byte[FrameSizeX * FrameSizeY];
                    Marshal.Copy(FramePtr, ArrayToPass, 0, FrameSizeX * FrameSizeY);
                }
                else
                {
                    FrameSizeX = 0;
                    FrameSizeY = 0;
                    ArrayToPass = null;
                }

                GC.KeepAlive(GBMSAPI_AcquisitionCallbackInterface.FunctionToBeCalled);
                if (FunctionToBeCalled != null)
                {
                    return FunctionToBeCalled(OccurredEventCode,
                        GetFrameErrorCode,
                        Eventinfo,
                        ArrayToPass,
                        FrameSizeX,
                        FrameSizeY,
                        CurrentFrameRate,
                        NominalFrameRate,
                        GB_Diagnostic,
                        UserDefinedParameters
                    );
                }
                else return 1;
            }
开发者ID:radiantwf,项目名称:GreenBitTest,代码行数:43,代码来源:GBMSAPI_NET_LibraryFunctions.cs

示例15: GetProcessArchitecture

 public static int GetProcessArchitecture(UInt32 pid)
 {
     IntPtr hProcess = IntPtr.Zero;
     ProcessAccessFlags flags = ProcessAccessFlags.QueryInformation | ProcessAccessFlags.VMRead;
     hProcess = OpenProcess(flags, false, (int)pid);
     if (hProcess == IntPtr.Zero) {
     throw new System.ComponentModel.Win32Exception(GetLastError());
     }
     try {
     bool wow64;
     if (!IsWow64Process(hProcess, out wow64)) {
     return 32; // call failed means 32-bit
     }
     if (wow64) {
     return 32;
     } else {
     return 64;
     }
     } finally {
     CloseHandle(hProcess);
     }
 }
开发者ID:praveeds,项目名称:jOVAL,代码行数:22,代码来源:Environmentvariable58.cs


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