本文整理汇总了C#中global.DangerousAddRef方法的典型用法代码示例。如果您正苦于以下问题:C# global.DangerousAddRef方法的具体用法?C# global.DangerousAddRef怎么用?C# global.DangerousAddRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类global
的用法示例。
在下文中一共展示了global.DangerousAddRef方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CancelThreadpoolIo
public static void CancelThreadpoolIo(global::Microsoft.Win32.SafeHandles.SafeThreadPoolIOHandle__System_Threading_Overlapped pio)
{
// Setup
bool addRefed = false;
// Marshalling
pio.DangerousAddRef(ref addRefed);
// Call to native method
global::McgInterop.api_ms_win_core_threadpool_l1_2_0_dll_PInvokes.CancelThreadpoolIo(pio.DangerousGetHandle());
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
if (addRefed)
pio.DangerousRelease();
// Return
}
示例2: GetFileInformationByHandleEx
public static bool GetFileInformationByHandleEx(
global::Microsoft.Win32.SafeHandles.SafeFileHandle__System_IO_FileSystem hFile,
global::Interop.mincore.FILE_INFO_BY_HANDLE_CLASS__System_IO_FileSystem FileInformationClass,
out global::Interop.mincore.FILE_STANDARD_INFO__System_IO_FileSystem lpFileInformation,
uint dwBufferSize)
{
// Setup
bool addRefed = false;
global::Interop.mincore.FILE_STANDARD_INFO__System_IO_FileSystem__Impl.UnsafeType unsafe_lpFileInformation = default(global::Interop.mincore.FILE_STANDARD_INFO__System_IO_FileSystem__Impl.UnsafeType);
int unsafe___value;
// Marshalling
hFile.DangerousAddRef(ref addRefed);
unsafe_lpFileInformation = default(global::Interop.mincore.FILE_STANDARD_INFO__System_IO_FileSystem__Impl.UnsafeType);
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_file_l2_1_0_dll_PInvokes.GetFileInformationByHandleEx(
hFile.DangerousGetHandle(),
FileInformationClass,
&(unsafe_lpFileInformation),
dwBufferSize
);
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
global::Interop.mincore.FILE_STANDARD_INFO__System_IO_FileSystem__Impl.Marshal__UnsafeToSafe(
ref unsafe_lpFileInformation,
out lpFileInformation
);
if (addRefed)
hFile.DangerousRelease();
// Return
return unsafe___value != 0;
}
示例3: CreateThreadpoolIo
public static global::Microsoft.Win32.SafeHandles.SafeThreadPoolIOHandle__System_Threading_Overlapped CreateThreadpoolIo(
global::System.Runtime.InteropServices.SafeHandle fl,
global::Interop.NativeIoCompletionCallback__System_Threading_Overlapped pfnio,
global::System.IntPtr context,
global::System.IntPtr pcbe)
{
// Setup
bool addRefed = false;
void* unsafe_pfnio = default(void*);
global::Microsoft.Win32.SafeHandles.SafeThreadPoolIOHandle__System_Threading_Overlapped __value;
global::System.IntPtr unsafe___value;
try
{
// Marshalling
fl.DangerousAddRef(ref addRefed);
unsafe_pfnio = (void*)global::System.Runtime.InteropServices.McgModuleManager.GetStubForPInvokeDelegate(
global::System.Runtime.InteropServices.TypeOfHelper.RuntimeTypeHandleOf("Interop+NativeIoCompletionCallback,System.Threading.Overlapped, Version=4.0.0.0, Culture=neutral, PublicKeyToken" +
"=b03f5f7f11d50a3a"),
pfnio
);
__value = new global::Microsoft.Win32.SafeHandles.SafeThreadPoolIOHandle__System_Threading_Overlapped();
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_threadpool_l1_2_0_dll_PInvokes.CreateThreadpoolIo(
fl.DangerousGetHandle(),
unsafe_pfnio,
context,
pcbe
);
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
global::System.Runtime.InteropServices.McgMarshal.InitializeHandle(
__value,
unsafe___value
);
if (addRefed)
fl.DangerousRelease();
// Return
return __value;
}
finally
{
// Cleanup
global::System.GC.KeepAlive(pfnio);
}
}
示例4: FlushFileBuffers
public static bool FlushFileBuffers(global::System.Runtime.InteropServices.SafeHandle hHandle)
{
// Setup
bool addRefed = false;
int unsafe___value;
// Marshalling
hHandle.DangerousAddRef(ref addRefed);
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_file_l1_1_0_dll_PInvokes.FlushFileBuffers(hHandle.DangerousGetHandle());
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
if (addRefed)
hHandle.DangerousRelease();
// Return
return unsafe___value != 0;
}
示例5: WriteFile__0
public static int WriteFile__0(
global::System.Runtime.InteropServices.SafeHandle handle,
byte* bytes,
int numBytesToWrite,
out int numBytesWritten,
global::System.IntPtr mustBeZero)
{
// Setup
bool addRefed = false;
int unsafe_numBytesWritten;
int unsafe___value;
// Marshalling
handle.DangerousAddRef(ref addRefed);
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_file_l1_1_0_dll_PInvokes.WriteFile__0(
handle.DangerousGetHandle(),
((byte*)bytes),
numBytesToWrite,
&(unsafe_numBytesWritten),
mustBeZero
);
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
numBytesWritten = unsafe_numBytesWritten;
if (addRefed)
handle.DangerousRelease();
// Return
return unsafe___value;
}
示例6: ReadFile
public static int ReadFile(
global::System.Runtime.InteropServices.SafeHandle handle,
byte* bytes,
int numBytesToRead,
global::System.IntPtr numBytesRead_mustBeZero,
global::System.Threading.NativeOverlapped__System_Threading_Overlapped* overlapped)
{
// Setup
bool addRefed = false;
int unsafe___value;
// Marshalling
handle.DangerousAddRef(ref addRefed);
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_file_l1_1_0_dll_PInvokes.ReadFile(
handle.DangerousGetHandle(),
((byte*)bytes),
numBytesToRead,
numBytesRead_mustBeZero,
((global::System.Threading.NativeOverlapped__System_Threading_Overlapped*)overlapped)
);
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
if (addRefed)
handle.DangerousRelease();
// Return
return unsafe___value;
}
示例7: SetFilePointerEx
public static bool SetFilePointerEx(
global::Microsoft.Win32.SafeHandles.SafeFileHandle__System_IO_FileSystem hFile,
long liDistanceToMove,
out long lpNewFilePointer,
uint dwMoveMethod)
{
// Setup
bool addRefed = false;
long unsafe_lpNewFilePointer;
int unsafe___value;
// Marshalling
hFile.DangerousAddRef(ref addRefed);
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_file_l1_1_0_dll_PInvokes.SetFilePointerEx(
hFile.DangerousGetHandle(),
liDistanceToMove,
&(unsafe_lpNewFilePointer),
dwMoveMethod
);
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
lpNewFilePointer = unsafe_lpNewFilePointer;
if (addRefed)
hFile.DangerousRelease();
// Return
return unsafe___value != 0;
}
示例8: CancelIoEx
public static bool CancelIoEx(
global::System.Runtime.InteropServices.SafeHandle handle,
global::System.Threading.NativeOverlapped__System_Threading_Overlapped* lpOverlapped)
{
// Setup
bool addRefed = false;
int unsafe___value;
// Marshalling
handle.DangerousAddRef(ref addRefed);
// Call to native method
unsafe___value = global::McgInterop.api_ms_win_core_io_l1_1_0_dll_PInvokes.CancelIoEx(
handle.DangerousGetHandle(),
((global::System.Threading.NativeOverlapped__System_Threading_Overlapped*)lpOverlapped)
);
global::System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
global::System.Runtime.InteropServices.McgMarshal.SaveLastWin32Error();
if (addRefed)
handle.DangerousRelease();
// Return
return unsafe___value != 0;
}