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


C# Win32.Win32Native类代码示例

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


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

示例1: Mutex

        internal Mutex(bool initiallyOwned, String name, out bool createdNew, Win32Native.SECURITY_ATTRIBUTES secAttrs) 
        {
            if (null != name && Path.MAX_PATH < name.Length) 
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", name));
            }
            Contract.EndContractBlock();

            CreateMutexWithGuaranteedCleanup(initiallyOwned, name, out createdNew, secAttrs);
        }
开发者ID:enavro,项目名称:coreclr,代码行数:10,代码来源:Mutex.cs

示例2: CreateMutexWithGuaranteedCleanup

 internal void CreateMutexWithGuaranteedCleanup(bool initiallyOwned, String name, out bool createdNew, Win32Native.SECURITY_ATTRIBUTES secAttrs)
 {
     RuntimeHelpers.CleanupCode cleanupCode = new RuntimeHelpers.CleanupCode(MutexCleanupCode);
     MutexCleanupInfo cleanupInfo = new MutexCleanupInfo(null, false);
     MutexTryCodeHelper tryCodeHelper = new MutexTryCodeHelper(initiallyOwned, cleanupInfo, name, secAttrs, this);
     RuntimeHelpers.TryCode tryCode = new RuntimeHelpers.TryCode(tryCodeHelper.MutexTryCode);
     RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(
         tryCode,
         cleanupCode,
         cleanupInfo);             
     createdNew = tryCodeHelper.m_newMutex;
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:12,代码来源:Mutex.cs

示例3: PopulateFrom

 internal void PopulateFrom(Win32Native.WIN32_FIND_DATA findData)
 {
     this.fileAttributes = findData.dwFileAttributes;
     this.ftCreationTimeLow = findData.ftCreationTime_dwLowDateTime;
     this.ftCreationTimeHigh = findData.ftCreationTime_dwHighDateTime;
     this.ftLastAccessTimeLow = findData.ftLastAccessTime_dwLowDateTime;
     this.ftLastAccessTimeHigh = findData.ftLastAccessTime_dwHighDateTime;
     this.ftLastWriteTimeLow = findData.ftLastWriteTime_dwLowDateTime;
     this.ftLastWriteTimeHigh = findData.ftLastWriteTime_dwHighDateTime;
     this.fileSizeHigh = findData.nFileSizeHigh;
     this.fileSizeLow = findData.nFileSizeLow;
 }
开发者ID:BclEx,项目名称:BclEx-Extend,代码行数:12,代码来源:Win32Native.cs

示例4: Mutex

        internal Mutex(bool initiallyOwned, String name, out bool createdNew, Win32Native.SECURITY_ATTRIBUTES secAttrs) 
        {
            if (name == string.Empty)
            {
                // Empty name is treated as an unnamed mutex. Set to null, and we will check for null from now on.
                name = null;
            }
#if !PLATFORM_UNIX
            if (name != null && System.IO.Path.MaxPath < name.Length)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
            }
#endif
            Contract.EndContractBlock();

            CreateMutexWithGuaranteedCleanup(initiallyOwned, name, out createdNew, secAttrs);
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:17,代码来源:Mutex.cs

示例5: GetVersionEx

		internal static extern bool GetVersionEx(Win32Native.OSVERSIONINFOEX osVer);
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:1,代码来源:Environment.cs

示例6: SetConsoleCursorPosition

 internal static bool SetConsoleCursorPosition(IntPtr hConsoleOutput, Win32Native.COORD cursorPosition);
开发者ID:sebgod,项目名称:userscripts,代码行数:1,代码来源:Microsoft.Win32.cs

示例7: _GetDateNotBefore

 internal static extern void _GetDateNotBefore(SafeCertContextHandle safeCertContext, ref Win32Native.FILE_TIME fileTime);
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:1,代码来源:x509utils.cs

示例8: TimeZoneInformation

 public TimeZoneInformation(Win32Native.DynamicTimeZoneInformation dtzi) {
     Bias = dtzi.Bias;
     StandardName = dtzi.StandardName;
     StandardDate = dtzi.StandardDate;
     StandardBias = dtzi.StandardBias;
     DaylightName = dtzi.DaylightName;
     DaylightDate = dtzi.DaylightDate;
     DaylightBias = dtzi.DaylightBias;
 }
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:9,代码来源:Win32Native.cs

示例9: InitializeFrom

 internal void InitializeFrom(Win32Native.WIN32_FIND_DATA findData)
 {
     _data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
     _data.PopulateFrom(findData);
     _dataInitialised = 0;
 }
开发者ID:l1183479157,项目名称:coreclr,代码行数:6,代码来源:FileSystemInfo.cs

示例10: ColorAttributeToConsoleColor

        [System.Security.SecurityCritical]  // auto-generated
        private static ConsoleColor ColorAttributeToConsoleColor(Win32Native.Color c)
        { 
            // Turn background colors into foreground colors.
            if ((c & Win32Native.Color.BackgroundMask) != 0) 
                c = (Win32Native.Color) (((int)c) >> 4); 

            return (ConsoleColor) c; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:9,代码来源:Console.cs

示例11: CreateMutexHandle

        static int CreateMutexHandle(bool initiallyOwned, String name, Win32Native.SECURITY_ATTRIBUTES securityAttribute, out SafeWaitHandle mutexHandle) {            
            int errorCode;  
            bool fAffinity = false;
            
            while(true) {
                mutexHandle = Win32Native.CreateMutex(securityAttribute, initiallyOwned, name);
                errorCode = Marshal.GetLastWin32Error();                                
                if( !mutexHandle.IsInvalid) {
                    break;                
                }

                if( errorCode == Win32Native.ERROR_ACCESS_DENIED) {
                    // If a mutex with the name already exists, OS will try to open it with FullAccess.
                    // It might fail if we don't have enough access. In that case, we try to open the mutex will modify and synchronize access.
                    //
                    
                    RuntimeHelpers.PrepareConstrainedRegions();
                    try 
                    {
                        try 
                        {
                        } 
                        finally 
                        {
#if !FEATURE_CORECLR
                            Thread.BeginThreadAffinity();
#endif
                            fAffinity = true;
                        }
                        mutexHandle = Win32Native.OpenMutex(Win32Native.MUTEX_MODIFY_STATE | Win32Native.SYNCHRONIZE, false, name);
                        if(!mutexHandle.IsInvalid)
                        {
                            errorCode = Win32Native.ERROR_ALREADY_EXISTS;
                        }
                        else
                        {
                            errorCode = Marshal.GetLastWin32Error();
                        }
                    }
                    finally 
                    {
                        if (fAffinity) {
#if !FEATURE_CORECLR
                            Thread.EndThreadAffinity();
#endif
                        }
                    }

                    // There could be a race condition here, the other owner of the mutex can free the mutex,
                    // We need to retry creation in that case.
                    if( errorCode != Win32Native.ERROR_FILE_NOT_FOUND) {
                        if( errorCode == Win32Native.ERROR_SUCCESS) {
                            errorCode =  Win32Native.ERROR_ALREADY_EXISTS;
                        }                        
                        break;
                    }
                }
                else {
                    break;
                }
            }                        
            return errorCode;
        }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:63,代码来源:Mutex.cs

示例12: SetConsoleScreenBufferSize

 internal static bool SetConsoleScreenBufferSize(IntPtr hConsoleOutput, Win32Native.COORD size);
开发者ID:sebgod,项目名称:userscripts,代码行数:1,代码来源:Microsoft.Win32.cs

示例13: IsKeyDownEvent

 [System.Security.SecurityCritical]  // auto-generated
 private static bool IsKeyDownEvent(Win32Native.InputRecord ir) {
     return (ir.eventType == Win32Native.KEY_EVENT && ir.keyEvent.keyDown);
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:Console.cs

示例14: WriteConsoleOutput

 internal static bool WriteConsoleOutput(IntPtr hConsoleOutput, Win32Native.CHAR_INFO* buffer, Win32Native.COORD bufferSize, Win32Native.COORD bufferCoord, ref Win32Native.SMALL_RECT writeRegion);
开发者ID:sebgod,项目名称:userscripts,代码行数:1,代码来源:Microsoft.Win32.cs

示例15: VirtualQuery

 internal static UIntPtr VirtualQuery(void* address, ref Win32Native.MEMORY_BASIC_INFORMATION buffer, UIntPtr sizeOfBuffer);
开发者ID:sebgod,项目名称:userscripts,代码行数:1,代码来源:Microsoft.Win32.cs


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