nativemethods.cs

来自「C#高级编程第6版随书源代码 值得下载」· CS 代码 · 共 33 行

CS
33
字号
using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.Win32.SafeHandles;

namespace Wrox.ProCSharp.Transactions
{
   internal static class NativeMethods
   {
      [DllImport("Kernel32.dll", CallingConvention = CallingConvention.StdCall,
        CharSet = CharSet.Unicode)]
      internal static extern SafeFileHandle CreateFileTransacted(
          String lpFileName,
          uint dwDesiredAccess,
          uint dwShareMode,
          IntPtr lpSecurityAttributes,
          uint dwCreationDisposition,
          int dwFlagsAndAttributes,
          IntPtr hTemplateFile,
          SafeTransactionHandle txHandle,
          IntPtr miniVersion,
          IntPtr extendedParameter);

      [DllImport("Kernel32.dll", SetLastError = true)]
      [ResourceExposure(ResourceScope.Machine)]
      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
      [return: MarshalAs(UnmanagedType.Bool)]
      internal static extern bool CloseHandle(IntPtr handle);

   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?