本文整理汇总了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);
示例2: GraphicsPlus
public GraphicsPlus(HDC hdc,
HANDLE hdevice)
{
GpGraphics Graphics = new GpGraphics();
lastResult = NativeMethods.GdipCreateFromHDC2(hdc, hdevice, out Graphics);
SetNativeGraphics(Graphics);
}
示例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;
}
}
示例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;
}
示例5: EndDeferWindowPos
public static extern bool EndDeferWindowPos(HANDLE hWndPosInfo);
示例6: DeferWindowPos
public static extern bool DeferWindowPos(HANDLE hWndPosInfo, HWND hWnd, HWND hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
示例7: TerminateProcess
public static extern BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
示例8: GetRawInputDeviceInfo
internal static extern INT GetRawInputDeviceInfo(
HANDLE Device,
[MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
[In, Out] RawInputDeviceInfo Data,
[In, Out] ref INT Size
);
示例9: SetProcessWorkingSetSize
public static extern bool SetProcessWorkingSetSize(HANDLE hProcess, IntPtr min, IntPtr max);
示例10: ReleaseMutex
public static extern bool ReleaseMutex(HANDLE hMutex);
示例11: LoadLibraryEx
public static extern HINSTANCE LoadLibraryEx(string stModuleName, HANDLE hFile, uint dwFlags);
示例12: OpenProcessToken
public static extern BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, [Out] out HANDLE TokenHandle);
示例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));
示例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();
}
示例15: WriteProcessMemory
public static extern BOOL WriteProcessMemory(HANDLE hProcess, LPVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, out SIZE_T lpNumberOfBytesWritten);