• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UInt32类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SNILoadHandle

        private SNILoadHandle() : base(IntPtr.Zero, true)
        {
            // From security review - SafeHandle guarantees this is only called once.
            // The reason for the safehandle is guaranteed initialization and termination of SNI to
            // ensure SNI terminates and cleans up properly.
            try { }
            finally
            {
                _sniStatus = SNINativeMethodWrapper.SNIInitialize();

                UInt32 value = 0;

                // VSDevDiv 479597: If initialize fails, don't call QueryInfo.
                if (TdsEnums.SNI_SUCCESS == _sniStatus)
                {
                    // Query OS to find out whether encryption is supported.
                    SNINativeMethodWrapper.SNIQueryInfo(SNINativeMethodWrapper.QTypes.SNI_QUERY_CLIENT_ENCRYPT_POSSIBLE, ref value);
                }

                _encryptionOption = (value == 0) ? EncryptionOptions.NOT_SUP : EncryptionOptions.OFF;

                base.handle = (IntPtr)1; // Initialize to non-zero dummy variable.
            }
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:24,代码来源:TdsParserSafeHandles.cs


示例17: DosTimeToDateTime

        /*DosTime format 32 bits
        //Year: 7 bits, 0 is ValidZipDate_YearMin, unsigned (ValidZipDate_YearMin = 1980)
        //Month: 4 bits
        //Day: 5 bits
        //Hour: 5
        //Minute: 6 bits
        //Second: 5 bits
        */

        //will silently return InvalidDateIndicator if the UInt32 is not a valid Dos DateTime
        internal static DateTime DosTimeToDateTime(UInt32 dateTime)
        {
            // do the bit shift as unsigned because the fields are unsigned, but
            // we can safely convert to Int32, because they won't be too big
            Int32 year = (Int32)(ValidZipDate_YearMin + (dateTime >> 25));
            Int32 month = (Int32)((dateTime >> 21) & 0xF);
            Int32 day = (Int32)((dateTime >> 16) & 0x1F);
            Int32 hour = (Int32)((dateTime >> 11) & 0x1F);
            Int32 minute = (Int32)((dateTime >> 5) & 0x3F);
            Int32 second = (Int32)((dateTime & 0x001F) * 2);       // only 5 bits for second, so we only have a granularity of 2 sec. 

            try
            {
                return new System.DateTime(year, month, day, hour, minute, second, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                return s_invalidDateIndicator;
            }
            catch (ArgumentException)
            {
                return s_invalidDateIndicator;
            }
        }
开发者ID:SGuyGe,项目名称:corefx,代码行数:34,代码来源:ZipHelper.cs


示例18: SSPIData

        }// tdsLogin

        private void SSPIData(byte[] receivedBuff, UInt32 receivedLength, byte[] sendBuff, ref UInt32 sendLength)
        {
            SNISSPIData(receivedBuff, receivedLength, sendBuff, ref sendLength);
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:6,代码来源:TdsParser.cs


示例19: LogAnalyticVerbose

        /// <summary>
        /// Logs remoting fragment data to verbose channel.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="opcode"></param>
        /// <param name="task"></param>
        /// <param name="keyword"></param>
        /// <param name="objectId"></param>
        /// <param name="fragmentId"></param>
        /// <param name="isStartFragment"></param>
        /// <param name="isEndFragment"></param>
        /// <param name="fragmentLength"></param>
        /// <param name="fragmentData"></param>
        internal static void LogAnalyticVerbose(PSEventId id, PSOpcode opcode, PSTask task, PSKeyword keyword,
            Int64 objectId,
            Int64 fragmentId,
            int isStartFragment,
            int isEndFragment,
            UInt32 fragmentLength,
            PSETWBinaryBlob fragmentData)
        {
            if (provider.IsEnabled(PSLevel.Verbose, keyword))
            {
                string payLoadData = BitConverter.ToString(fragmentData.blob, fragmentData.offset, fragmentData.length);
                payLoadData = string.Format(CultureInfo.InvariantCulture, "0x{0}", payLoadData.Replace("-", ""));

                provider.WriteEvent(id, PSChannel.Analytic, opcode, PSLevel.Verbose, task, keyword,
                                    objectId, fragmentId, isStartFragment, isEndFragment, fragmentLength,
                                    payLoadData);
            }
        }
开发者ID:40a,项目名称:PowerShell,代码行数:31,代码来源:PSEtwLog.cs


示例20: CheckSumAndSizeWriteStream

 /* parameters to saveCrcAndSizes are
  *  initialPosition (initialPosition in baseBaseStream),
  *  currentPosition (in this CheckSumAndSizeWriteStream),
  *  checkSum (of data passed into this CheckSumAndSizeWriteStream),
  *  baseBaseStream it's a backingStream, passed here so as to avoid closure allocation,
  *  zipArchiveEntry passed here so as to avoid closure allocation,
  *  onClose handler passed here so as to avoid closure allocation
 */
 public CheckSumAndSizeWriteStream(Stream baseStream, Stream baseBaseStream, Boolean leaveOpenOnClose,
     ZipArchiveEntry entry, EventHandler onClose,
     Action<Int64, Int64, UInt32, Stream, ZipArchiveEntry, EventHandler> saveCrcAndSizes)
 {
     _baseStream = baseStream;
     _baseBaseStream = baseBaseStream;
     _position = 0;
     _checksum = 0;
     _leaveOpenOnClose = leaveOpenOnClose;
     _canWrite = true;
     _isDisposed = false;
     _initialPosition = 0;
     _zipArchiveEntry = entry;
     _onClose = onClose;
     _saveCrcAndSizes = saveCrcAndSizes;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:24,代码来源:ZipCustomStreams.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UInt32Collection类代码示例发布时间:2022-05-24
下一篇:
C# UInt256类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap