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


C# HANDLE类代码示例

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


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

示例1: AdjustTokenPrivileges

 public static extern int AdjustTokenPrivileges(
     HANDLE TokenHandle,
     int DisableAllPrivileges,
     PTOKEN_PRIVILEGES NewState,
     uint BufferLength,
     PTOKEN_PRIVILEGES PreviousState,
     out uint ReturnLength);
开发者ID:farshad-sadri,项目名称:Windows-10-Login-Background-Changer,代码行数:7,代码来源:Win32.cs

示例2: GraphicsPlus

        public GraphicsPlus(HDC hdc,
                 HANDLE hdevice)
        {
            GpGraphics Graphics = new GpGraphics();

            lastResult = NativeMethods.GdipCreateFromHDC2(hdc, hdevice, out Graphics);

            SetNativeGraphics(Graphics);
        }
开发者ID:intille,项目名称:mitessoftware,代码行数:9,代码来源:GraphicsPlus.cs

示例3: GetSecurityInfo

		public static void GetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE objectType,
			SECURITY_INFORMATION securityInfo,
			out Sid sidOwner,
			out Sid sidGroup,
			out Dacl dacl,
			out Sacl sacl,
			out SecurityDescriptor secDesc)
		{
			sidOwner = null;
			sidGroup = null;
			dacl = null;
			sacl = null;
			secDesc = null;

			IntPtr ptrOwnerSid = IntPtr.Zero;
			IntPtr ptrGroupSid = IntPtr.Zero;
			IntPtr ptrDacl = IntPtr.Zero;
			IntPtr ptrSacl = IntPtr.Zero;
			IntPtr ptrSecDesc = IntPtr.Zero;

			DWORD rc = Win32.GetSecurityInfo(handle, objectType, securityInfo,
				ref ptrOwnerSid, ref ptrGroupSid, ref ptrDacl, ref ptrSacl, ref ptrSecDesc);

			if (rc != Win32.ERROR_SUCCESS)
			{
				Win32.SetLastError(rc);
				Win32.ThrowLastError();
			}

			try
			{
				if (ptrOwnerSid != IntPtr.Zero)
					sidOwner = new Sid(ptrOwnerSid);

				if (ptrGroupSid != IntPtr.Zero)
					sidGroup = new Sid(ptrGroupSid);

				if (ptrDacl != IntPtr.Zero)
					dacl = new Dacl(ptrDacl);

				if (ptrSacl != IntPtr.Zero)
					sacl = new Sacl(ptrSacl);

				if (ptrSecDesc != IntPtr.Zero)
					secDesc = new SecurityDescriptor(ptrSecDesc, true);
			}
			catch
			{
				if (ptrSecDesc != IntPtr.Zero)
					Win32.LocalFree(ptrSecDesc);
				throw;
			}
		}
开发者ID:jmbolivar,项目名称:BetterExplorer,代码行数:55,代码来源:Win32Helpers.cs

示例4: GetSecurityInfo

		public static SecurityDescriptor GetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE objectType,
			SECURITY_INFORMATION securityInfo)
		{
			Sid sidOwner;
			Sid sidGroup;
			Dacl dacl;
			Sacl sacl;
			SecurityDescriptor secDesc;
			Win32Helpers.GetSecurityInfo(handle, objectType, securityInfo,
				out sidOwner, out sidGroup, out dacl, out sacl,	out secDesc);

			return secDesc;
		}
开发者ID:jmbolivar,项目名称:BetterExplorer,代码行数:15,代码来源:SecurityDescriptor.cs

示例5: EndDeferWindowPos

 public static extern bool EndDeferWindowPos(HANDLE hWndPosInfo);
开发者ID:peeboo,项目名称:open-media-library,代码行数:1,代码来源:ThemeManager.cs

示例6: DeferWindowPos

 public static extern bool DeferWindowPos(HANDLE hWndPosInfo, HWND hWnd, HWND hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
开发者ID:peeboo,项目名称:open-media-library,代码行数:1,代码来源:ThemeManager.cs

示例7: TerminateProcess

		public static extern BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
开发者ID:MrTrillian,项目名称:Asmuth,代码行数:1,代码来源:NativeMethods.cs

示例8: GetRawInputDeviceInfo

 internal static extern INT GetRawInputDeviceInfo(
     HANDLE Device,
     [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
     [In, Out] RawInputDeviceInfo Data,
     [In, Out] ref INT Size
 );
开发者ID:jpbruyere,项目名称:opentk,代码行数:6,代码来源:API.cs

示例9: SetProcessWorkingSetSize

 public static extern bool SetProcessWorkingSetSize(HANDLE hProcess, IntPtr min, IntPtr max);
开发者ID:peeboo,项目名称:open-media-library,代码行数:1,代码来源:ThemeManager.cs

示例10: ReleaseMutex

 public static extern bool ReleaseMutex(HANDLE hMutex);
开发者ID:peeboo,项目名称:open-media-library,代码行数:1,代码来源:ThemeManager.cs

示例11: LoadLibraryEx

 public static extern HINSTANCE LoadLibraryEx(string stModuleName, HANDLE hFile, uint dwFlags);
开发者ID:peeboo,项目名称:open-media-library,代码行数:1,代码来源:ThemeManager.cs

示例12: OpenProcessToken

		public static extern BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, [Out] out HANDLE TokenHandle);
开发者ID:MrTrillian,项目名称:Asmuth,代码行数:1,代码来源:NativeMethods.cs

示例13: AdjustTokenPrivileges

		public static extern BOOL AdjustTokenPrivileges(HANDLE TokenHandle,
			[MarshalAs(UnmanagedType.Bool)] BOOL DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, DWORD BufferLength,
			IntPtr PreviousState = default(IntPtr), IntPtr ReturnLength = default(IntPtr));
开发者ID:MrTrillian,项目名称:Asmuth,代码行数:3,代码来源:NativeMethods.cs

示例14: GetFinalPathNameByHandle

		public static string GetFinalPathNameByHandle(HANDLE handle, DWORD dwFlags)
		{
			var pathLength = GetFinalPathNameByHandle(handle, null, 0, dwFlags);
			NativeMethods.CheckWin32(pathLength > 0);
			var pathBuilder = new StringBuilder((int)pathLength);
			pathBuilder.Length = (int)pathLength;
			NativeMethods.CheckWin32(GetFinalPathNameByHandle(handle, pathBuilder, pathLength, dwFlags) > 0);
			return pathBuilder.ToString();
		}
开发者ID:MrTrillian,项目名称:Asmuth,代码行数:9,代码来源:NativeMethods.cs

示例15: WriteProcessMemory

		public static extern BOOL WriteProcessMemory(HANDLE hProcess, LPVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, out SIZE_T lpNumberOfBytesWritten);
开发者ID:MrTrillian,项目名称:Asmuth,代码行数:1,代码来源:NativeMethods.cs


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